Skip to content

Commit

Permalink
refactor(zones): centroid -> coords
Browse files Browse the repository at this point in the history
While centroid is a more accurate term, coords is a little simpler when
writing it a million times.
Prefer to use a single term (sphere was using coords) to simplify API.
  • Loading branch information
thelindat committed May 7, 2022
1 parent 91f52d1 commit ce3f916
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions imports/zones/client.lua
Original file line number Diff line number Diff line change
Expand Up @@ -314,14 +314,14 @@ end

local function getBoxVertices(self)
return {
self.centroid + vec3(self.size.x, self.size.y, self.thickness) * self.rotation,
self.centroid + vec3(-self.size.x, self.size.y, self.thickness) * self.rotation,
self.centroid + vec3(-self.size.x, -self.size.y, self.thickness) * self.rotation,
self.centroid + vec3(self.size.x, -self.size.y, self.thickness) * self.rotation,
self.centroid - vec3(self.size.x, self.size.y, self.thickness) * self.rotation,
self.centroid - vec3(-self.size.x, self.size.y, self.thickness) * self.rotation,
self.centroid - vec3(-self.size.x, -self.size.y, self.thickness) * self.rotation,
self.centroid - vec3(self.size.x, -self.size.y, self.thickness) * self.rotation,
self.coords + vec3(self.size.x, self.size.y, self.thickness) * self.rotation,
self.coords + vec3(-self.size.x, self.size.y, self.thickness) * self.rotation,
self.coords + vec3(-self.size.x, -self.size.y, self.thickness) * self.rotation,
self.coords + vec3(self.size.x, -self.size.y, self.thickness) * self.rotation,
self.coords - vec3(self.size.x, self.size.y, self.thickness) * self.rotation,
self.coords - vec3(-self.size.x, self.size.y, self.thickness) * self.rotation,
self.coords - vec3(-self.size.x, -self.size.y, self.thickness) * self.rotation,
self.coords - vec3(self.size.x, -self.size.y, self.thickness) * self.rotation,
}
end

Expand All @@ -330,7 +330,7 @@ return {
data.id = #zones + 1
data.thickness = data.thickness or 2
data.polygon = glm.polygon.new(data.points)
data.centroid = data.polygon:centroid()
data.coords = data.polygon:centroid()
data.remove = removeZone
data.contains = contains

Expand All @@ -352,7 +352,7 @@ return {
vec3(-data.size.x, data.size.y, 0),
vec3(-data.size.x, -data.size.y, 0),
vec3(data.size.x, -data.size.y, 0),
}) + data.centroid)
}) + data.coords)
data.remove = removeZone
data.contains = contains

Expand Down

0 comments on commit ce3f916

Please sign in to comment.