Geometry-related utilities.

Static methods

staticpointInTriangle(x:Float, y:Float, ax:Float, ay:Float, bx:Float, by:Float, cx:Float, cy:Float):Bool

Returns true if the point (x,y) is inside the given (a,b,c) triangle

staticpointInRectangle(x:Float, y:Float, rectX:Float, rectY:Float, rectWidth:Float, rectHeight:Float):Bool

Returns true if the point (x,y) is inside the given (rectX, rectY, rectWidth, rectHeight) rectangle

staticinlinepointInCircle(x:Float, y:Float, cx:Float, cy:Float, radius:Float):Bool

Returns true if the point (x,y) is inside the given (cx, cy, radius) circle

staticinlinedistance(x1:Float, y1:Float, x2:Float, y2:Float):Float

Returns the distance between point (x1, y1) and point (x2, y2)

staticinlinesquareDistance(x1:Float, y1:Float, x2:Float, y2:Float):Float

Returns the square of the distance between point (x1, y1) and point (x2, y2) It is expected to be used to simply compare two different distances when you don't need the actual distance value (that needs sqrt call).

staticangleTo(x0:Float, y0:Float, x1:Float, y1:Float):Float

Returns the angle between (x0, y0) and (x1, y1) in degrees.

staticangleDelta(angle0:Float, angle1:Float):Float

Returns the delta between angle0 and angle1, all values being angles in degrees.

staticclampDegrees(deg:Float):Float

Clamp an degrees (angle) value between 0 (included) and 360 (excluded)

staticangleDirection(angle:Float, result:Point):Point

Set the given result's x and y values so that it's a vector representing a direction matching the angle (in degrees)

Parameters:

angle

The angle to compute the direction from

result

The vector (a Point object) receiving the result