MathUtils class

A collection of static utility methods for mathematical operations.

Constructors

MathUtils()
Factory constructor to ensure exception. Throws an exception if an attempt is made to instantiate this class.
factory

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

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

getNextPowerOfTwo(num value) int
Calculates the next power of two for the given value. If value is already a power of two, it is returned. If value is not a power of two, the smallest power of two greater than value is returned.
isEquivalent(double a, double b, [double epsilon = .0001]) bool
Determines if two floating-point numbers are equivalent within a given epsilon value.
isPointInTriangle(GPoint point, GPoint a, GPoint b, GPoint c) bool
Determines whether a given point is inside a triangle defined by three other points (a, b, c).
normalizeAngle(double angle) double
Normalizes the given angle (in radians) to the range of -pi to pi.
shortRotation(double rotation) double
Shortens the given rotation angle to the range of -pi to pi.

Constants

halfPi → const double
Half of the value of pi.
pi2 → const double
The value of 2 times pi.