[vec] Add cross product between vectors.

This commit is contained in:
Lorenzo Cogotti 2022-09-15 09:18:25 +02:00
parent ac68fce474
commit c7849901cf
1 changed files with 7 additions and 0 deletions

View File

@ -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)