Skip to content

Commit

Permalink
optimize point_in_circle
Browse files Browse the repository at this point in the history
  • Loading branch information
AustinEast committed May 8, 2021
1 parent 96cf9bd commit e458a93
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion echo/util/SAT.hx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class SAT {
}

public static inline function point_in_circle(p:Vector2, c:Circle):Bool {
return p.distanceTo(c.get_position()) < c.radius;
return (p - c.get_position()).lengthSq < c.radius * c.radius;
}

public static inline function point_in_polygon(point:Vector2, polygon:Polygon):Bool {
Expand Down

0 comments on commit e458a93

Please sign in to comment.