mirror of
https://github.com/CommunityOx/ox_lib.git
synced 2026-08-16 22:46:03 +01:00
refactor(zones): centroid -> coords
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.
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user