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

staticintersectCircles(x0:Float, y0:Float, r0:Float, x1:Float, y1:Float, r1:Float):Bool

Returns true if the circle at point (x0,y0) with a radius r0 interects with the other circle at point (x1,y1) with a radius r1

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

staticisClockwise(vertices:Array<Float>, offset:Int, count:Int):Bool

Returns whether the polygon vertices are ordered clockwise or counterclockwise.

Parameters:

vertices

Array of polygon vertices as [x,y,x,y,...]

offset

Starting index in the array

count

Number of array indices to use

Returns:

true if clockwise, false if counterclockwise