Math class

@fileoverview Math methods supplement

Constructors

Math()

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

angleDx(double degrees, double radius) double
For a given angle and radius, finds the X portion of the offset. @param {number} degrees Angle in degrees (zero points in +X direction). @param {number} radius Radius. @return {number} The x-distance for the angle and radius.
angleDy(double degrees, double radius) double
For a given angle and radius, finds the Y portion of the offset. @param {number} degrees Angle in degrees (zero points in +X direction). @param {number} radius Radius. @return {number} The y-distance for the angle and radius.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Methods

angle(double x1, double y1, double x2, double y2) double
Computes the angle between two points (x1,y1) and (x2,y2). Angle zero points in the +X direction, 90 degrees points in the +Y direction (down) and from there we grow clockwise towards 360 degrees. @param {number} x1 x of first point. @param {number} y1 y of first point. @param {number} x2 x of second point. @param {number} y2 y of second point. @return {number} Standardized angle in degrees of the vector from x1,y1 to x2,y2.
atan2(num a, num b) double
atan2
cos(num radians) double
cos
degreesToRadians(double angleDegrees) double
Converts degrees to radians. @param {number} angleDegrees Angle in degrees. @return {number} Angle in radians.
log10(num value) double
log10
max<T extends num>(T a, T b) → T
Return highest of two values
min<T extends num>(T a, T b) → T
Return lowest of two values
modulo(double a, double b) double
The % operator in JavaScript returns the remainder of a / b, but differs from some other languages in that the result will have the same sign as the dividend. For example, -1 % 8 == -1, whereas in some other languages (such as Python) the result would be 7. This function emulates the more correct modulo behavior, which is useful for certain applications such as calculating an offset index in a circular list.
pow<T extends num>(num x, num exponent) num
pow
radiansToDegrees(double angleRadians) double
Converts radians to degrees. @param {number} angleRadians Angle in radians. @return {number} Angle in degrees.
sin(num radians) double
sin
sqrt(num x) double
sqrt
standardAngle(double angle) double
Normalizes an angle to be in range [0-360). Angles outside this range will be normalized to be the equivalent angle with that range. @param {number} angle Angle in degrees. @return {number} Standardized angle.

Constants

DOUBLE_MAX_VALUE → const double
DOUBLE_MIN_VALUE → const double
INT_MAX_VALUE → const int
A constant holding the maximum value an int can have, 231-1.
INT_MIN_VALUE → const int
PI → const double
The PI constant.