Class AstarMath

Public

Utility functions for working with numbers and strings.

Public Static Methods

CubicBezier (p0, p1, p2, p3, t)

Returns a point on a cubic bezier curve.

Public Static
DistancePointSegment (a, b, p)

Returns the approximate shortest squared distance between x,z and the line p-q.

Public Static
DistancePointSegment (x, z, px, pz, qx, qz)

Returns the approximate shortest squared distance between x,z and the line p-q.

Public Static
DistancePointSegmentStrict (a, b, p)

Returns the squared distance between c and the line a-b.

Public Static
FormatBytesBinary (bytes)

Returns a nicely formatted string for the number of bytes (KiB, MiB, GiB etc).

Public Static
HSVToRGB (h, s, v)

Converts an HSV color to an RGB color.

Public Static
IntToColor (i, a)

Returns a nice color from int i with alpha a.

Public Static
MapTo (startMin, startMax, value)

Maps a value between startMin and startMax to be between 0 and 1.

Public Static
MapTo (startMin, startMax, targetMin, targetMax, value)

Maps a value between startMin and startMax to be between targetMin and targetMax.

Public Static
NearestPoint (lineStart, lineEnd, point)

Returns the closest point on the line.

Public Static
NearestPointFactor (lineStart, lineEnd, point)
Public Static
NearestPointFactor (lineStart, lineEnd, point)

Factor of the nearest point on the segment.

Public Static
NearestPointFactor (lineStart, lineEnd, point)

Factor of the nearest point on the segment.

Public Static
NearestPointStrict (lineStart, lineEnd, point)

Returns the closest point on the line segment.

Public Static
NearestPointStrictXZ (lineStart, lineEnd, point)

Returns the closest point on the line segment on the XZ plane.

Public Static
SqrMagnitudeXZ (a, b)

Squared distance between two points on the XZ plane.

Public Static

Private/Protected Members

Bit (a, b)

Returns bit number b from int a.

Private Static

Deprecated Members

Abs (a)
Public Static
Abs (a)
Public Static
Clamp (a, b, c)
Public Static
Clamp (a, b, c)
Public Static
Clamp01 (a)
Public Static
Clamp01 (a)
Public Static
ComputeVertexHash (x, y, z)
Public Static
DistancePointSegment2 (a, b, p)
Public Static
DistancePointSegment2 (x, z, px, pz, qx, qz)
Public Static
FormatBytes (bytes)
Public Static
Hermite (start, end, value)
Public Static
Lerp (a, b, t)
Public Static
MagnitudeXZ (a, b)
Public Static
MapToRange (targetMin, targetMax, value)
Public Static
Max (a, b)
Public Static
Max (a, b)
Public Static
Max (a, b)
Public Static
Max (a, b)
Public Static
Min (a, b)
Public Static
Min (a, b)
Public Static
Min (a, b)
Public Static
Repeat (i, n)
Public Static
RoundToInt (v)
Public Static
RoundToInt (v)
Public Static
Sign (a)
Public Static
Sign (a)
Public Static