MathUtil class
Provide some core math functions used by this library
Constructors
- MathUtil()
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
-
getRadians(
{required Offset center, required Offset point}) → double - getRadians will calculate the radians of the Theta (angle) between the {(0,0),(0,1)} vector the {center, point} vector
-
randDouble(
double max) → double -
Generates a non-negative random floating point value uniformly distributed
in the range from 0.0, inclusive
to
max
exclusive -
randInt(
int max) → int -
Not used, comment out for now
TODO: double check this function and see if it can be used
static double getRadiansSwipe({required Offset center, required Offset point1, required point2}) {
return acos(
((point1.dx - center.dx) * (point2.dy - center.dy) + (point1.dy - center.dy) * (point2.dx - center.dx))
/
(sqrt(pow(point1.dx - center.dx, 2) + pow(point1.dy - center.dy, 2))
+sqrt(pow(point2.dx - center.dx, 2) + pow(point2.dy - center.dy, 2))
)
);
}
Generates a non-negative random integer uniformly distributed in the range
from 0, inclusive,
to
max
, exclusive. Implementation note: The default implementation supportsmax
values between 1 and (1<<32) inclusive. A wrapper around the Random.nextInt