Provides convenience methods for calculations often carried out in graphics. Some of the methods are returning approximations.

Static Methods

atan2(double y, double x) double

Returns the angle of two vector components. The result is less acurate than the standard atan2 function in the math package.

distanceBetweenPoints(Point a, Point b) double

Approximates the distance between two points. The returned value can be up to 6% wrong in the worst case.

filter(double a, double b, double filterFactor) double

Interpolates a double between a and b according to the filterFactor, which should be in the range of 0.0 to 1.0.

filterPoint(Point a, Point b, double filterFactor) Point

Interpolates a Point between a and b according to the filterFactor, which should be in the range of 0.0 to 1.0.

lineIntersection(Point p0, Point p1, Point q0, Point q1) Point

Returns the intersection between two line segmentss defined by p0, p1 and q0, q1. If the lines are not intersecting null is returned.

Constructors

GameMath()

Properties

hashCode int

Get a hash code for this object.

read-only, inherited
runtimeType Type

A representation of the runtime type of the object.

read-only, inherited

Operators

operator ==(other) bool

The equality operator.

inherited

Methods

noSuchMethod(Invocation invocation) → dynamic

Invoked when a non-existent method or property is accessed.

inherited
toString() String

Returns a string representation of this object.

inherited