Skip to content

GMath

GMath provides a bunch of convenience methods you can use when working with graphics.

Methods

static function GMath.round(x)
Rounds x to the nearest integer.
Returns: The rounded integer.
static function GMath.sinDegrees(angle)
Returns: The sine of the given angle (where angle is in degrees).
static function GMath.cosDegrees(angle)
Returns: The cosine of the given angle (where angle is in degrees).
static function GMath.tanDegrees(angle)
Returns: The tangent of the given angle (where angle is in degrees).
static function GMath.toDegrees(angle)
Converts an angle expressed in radians to degrees.
Returns: The degree representation of angle.
static function GMath.distance(x, y)
Returns: The distance from the origin to the point (x, y)
static function GMath.distance(x0, y0, x1, y1)
Returns: The length of the line from the point (x0, y0) to (x1, y1).
static function GMath.angle(x, y)
Returns: The angle (in degrees) from the origin to the point (x, y)
static function GMath.angle(x0, y0, x1, y1)
Returns: The angle (in degrees) from the point (x0, y0) to the point (x1, y1).