diff options
-rw-r--r-- | cactus.lua | 7 |
1 files changed, 4 insertions, 3 deletions
@@ -36,10 +36,11 @@ end local function rotatev(v,nq) -- rotates v by n quarters nq = nq%4 - for i = 1,nq do - v.x,v.z = -v.z,v.x + if nq == 0 then return vector.new( v.x, v.y, v.z) + elseif nq == 1 then return vector.new(-v.z, v.y, v.x) + elseif nq == 2 then return vector.new(-v.x, v.y, -v.z) + elseif nq == 3 then return vector.new( v.z, v.y, -v.x) end - return v end local v = vector.new(1,0,0) |