From 661156ce988131eb4896a7af4d00a42b520305e7 Mon Sep 17 00:00:00 2001 From: Elizabeth Hunt Date: Sun, 17 May 2026 11:53:35 -0700 Subject: This is REAL Artificial Intelligence and definitely REALLY COMPLICATED --- math.lua | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'math.lua') diff --git a/math.lua b/math.lua index 429e1ab..ddc6644 100644 --- a/math.lua +++ b/math.lua @@ -25,7 +25,14 @@ end function Vec2:normal() local m = self:magnitude() if m == 0 then return vec2(self.x, self.y) end - return self / m + return vec2(self / m) +end + +-- 1 picorad == 2pi +function Vec2:clockwise_rotate(picorads) + local m = self:magnitude() + local a = atan2(self.x, self.y) + picorads + return vec2(m * cos(a), m * sin(a)) end function Vec2:apply(f) -- cgit v1.3