Add vector.reflect

This commit is contained in:
Lars Mueller 2022-09-09 14:34:42 +02:00
parent 9d29f42b4c
commit b938ef85e0

@ -187,6 +187,10 @@ function dot(v, w)
return sum return sum
end end
function reflect(v, normal --[[**normalized** plane normal vector]])
return subtract(v, multiply_scalar(normal, 2 * dot(v, normal))) -- reflection of v at the plane
end
--+ Angle between two vectors --+ Angle between two vectors
--> Signed angle in radians --> Signed angle in radians
function angle(v, w) function angle(v, w)