Tangent fix (#43)

* Fixed tangent mis calculation

* fixed possible error null reference
This commit is contained in:
2025-05-26 14:48:14 +02:00
committed by GitHub
parent cae2c7edb3
commit 74e7d1ca7a
2 changed files with 9 additions and 0 deletions
+8
View File
@@ -315,6 +315,10 @@ do -- INIT UTIL
---@param points Array<Vec2>
function UTIL.enlargeConvexHull(points, meters)
if points == nil or #points == 0 then
return {}
end
---@type Array<Vec2>
local allpoints = {}
@@ -383,6 +387,10 @@ end
---@return Array<Vec2>
function UTIL.GetTangentHullPointsFromOrigin(hull, origin)
if hull == nil or #hull <= 0 then
return {}
end
local function orientation(a, b, c)
-- Returns >0 if c is to the left of ab, <0 if to the right, 0 if colinear
return (b.x - a.x) * (c.y - a.y) - (b.y - a.y) * (c.x - a.x)