summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cactus.lua7
1 files changed, 4 insertions, 3 deletions
diff --git a/cactus.lua b/cactus.lua
index b5624d9..7a43da8 100644
--- a/cactus.lua
+++ b/cactus.lua
@@ -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)