-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmathheader.lua
More file actions
19 lines (13 loc) · 794 Bytes
/
Copy pathmathheader.lua
File metadata and controls
19 lines (13 loc) · 794 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
-- Extra math things that nor lua or the math module have
vector = require("libs.vector.vector")
_G.ROOT2 = math.sqrt(2) -- The square root of 2. It will be used fairly often and calculating it is expensive, so i just did this.
-- I dont actually know how hard it is for a computer to calculate sin but whatever here it is so it doesnt have to do it a ton of times every frame
_G.SIN45 = math.sin(45) -- The sin of 45. I made it a constant because it is unchanging and so it doesn't have to be calculated every time.
_G.ZERO_VECTOR = vector.new(0,0) -- A vector of 0,0
function xor(num1,num2) -- Takes two bools and
return (num1 or num2) and not (num1 and num2)
end
function pythagorean(givenvector)
local num1,num2 = givenvector:unpack()
return math.sqrt(num1^2+num2^2)
end