From ec6a391cb9cf0c0feac0fe3615a59cc7cb6db2d5 Mon Sep 17 00:00:00 2001 From: ubq323 Date: Fri, 3 Feb 2023 01:32:09 +0000 Subject: drawing changes, world generation, perlin noise --- common/coords.lua | 2 ++ 1 file changed, 2 insertions(+) (limited to 'common/coords.lua') diff --git a/common/coords.lua b/common/coords.lua index 1bb9154..2399e43 100644 --- a/common/coords.lua +++ b/common/coords.lua @@ -76,6 +76,8 @@ function Pos.__div(a,b) end function Pos.lensq(self) return self.x^2 + self.y^2 end function Pos.len(self) return math.sqrt(self:lensq()) end +function Pos.norm(self) return self/self:len() end +function Pos.dot(self,other) return self.x*other.x + self.y*other.y end function Pos.to_hex(self) local q = self.x*(SR3/3) - self.y*(1/3) local r = (2/3)*self.y -- cgit v1.2.3