[vec] Add cross product between vectors.
This commit is contained in:
parent
ac68fce474
commit
c7849901cf
7
vec.lua
7
vec.lua
|
@ -25,6 +25,13 @@ function vec.dot3(x1,y1,z1, x2,y2,z2)
|
|||
return x1*x2 + y1*y2 + z1*z2
|
||||
end
|
||||
|
||||
--- Vector cross product.
|
||||
function vec.cross(x1,y1,z1, x2,y2,z2)
|
||||
return y1*z2 - z1*y2,
|
||||
z1*x2 - x1*z2,
|
||||
x1*y2 - y1*x2
|
||||
end
|
||||
|
||||
--- Vector squared length.
|
||||
function vec.sqrlen(x,y)
|
||||
return x*x + y*y -- vec.dot(x,y, x,y)
|
||||
|
|
Loading…
Reference in New Issue