Implement some math utilities functions.
Kind: global class
Number
Number
Number
Number
Number
Number
Number
Number
Number
Number
Number
Number
Number
Vector3
PI * 2 value.
Kind: static property of MathHelper
Number
Perform linear interpolation between start and end values.
Kind: static method of MathHelper
Returns: Number
- interpolated value between start and end.
Param | Type | Description |
---|---|---|
start | Number |
Starting value. |
end | Number |
Ending value. |
amount | Number |
How much to interpolate from start to end. |
Number
Calculate 2d dot product.
Kind: static method of MathHelper
Returns: Number
- dot product result.
Param | Type | Description |
---|---|---|
x1 | Number |
First vector x. |
y1 | Number |
First vector y. |
x2 | Number |
Second vector x. |
y2 | Number |
Second vector y. |
Number
Make a number a multiply of another number by rounding it up.
Kind: static method of MathHelper
Returns: Number
- Result number.
Param | Type | Description |
---|---|---|
numToRound | Number |
Number to round up. |
multiple | Number |
Number to make ‘numToRound’ a multiply of. |
Number
Convert degrees to radians.
Kind: static method of MathHelper
Returns: Number
- Value as radians.
Param | Type | Description |
---|---|---|
degrees | Number |
Degrees value to convert to radians. |
Number
Convert radians to degrees.
Kind: static method of MathHelper
Returns: Number
- Value as degrees.
Param | Type | Description |
---|---|---|
radians | Number |
Radians value to convert to degrees. |
Number
Find shortest distance between two radians, with sign (ie distance can be negative).
Kind: static method of MathHelper
Returns: Number
- Shortest distance between radians.
Param | Type | Description |
---|---|---|
a1 | Number |
First radian. |
a2 | Number |
Second radian. |
Number
Find shortest distance between two radians.
Kind: static method of MathHelper
Returns: Number
- Shortest distance between radians.
Param | Type | Description |
---|---|---|
a1 | Number |
First radian. |
a2 | Number |
Second radian. |
Number
Find shortest distance between two angles in degrees, with sign (ie distance can be negative).
Kind: static method of MathHelper
Returns: Number
- Shortest distance between angles.
Param | Type | Description |
---|---|---|
a1 | Number |
First angle. |
a2 | Number |
Second angle. |
Number
Find shortest distance between two angles in degrees.
Kind: static method of MathHelper
Returns: Number
- Shortest distance between angles.
Param | Type | Description |
---|---|---|
a1 | Number |
First angle. |
a2 | Number |
Second angle. |
Number
Perform linear interpolation between radian values. Unlike the regular lerp method, this method will take wrapping into consideration, and will always lerp via the shortest distance.
Kind: static method of MathHelper
Returns: Number
- interpolated radians between start and end.
Param | Type | Description |
---|---|---|
a1 | Number |
Starting value. |
a2 | Number |
Ending value. |
alpha | Number |
How much to interpolate from start to end. |
Number
Perform linear interpolation between degrees. Unlike the regular lerp method, this method will take wrapping into consideration, and will always lerp via the shortest distance.
Kind: static method of MathHelper
Returns: Number
- interpolated degrees between start and end.
Param | Type | Description |
---|---|---|
a1 | Number |
Starting value. |
a2 | Number |
Ending value. |
alpha | Number |
How much to interpolate from start to end. |
Number
Round numbers from 10’th digit. This is useful for calculations that should return round or almost round numbers, but have a long tail of 0’s and 1 due to floating points accuracy.
Kind: static method of MathHelper
Returns: Number
- Rounded number.
Param | Type | Description |
---|---|---|
num | Number |
Number to round. |
Number
Wrap degrees value to be between 0 to 360.
Kind: static method of MathHelper
Returns: Number
- degrees wrapped to be 0-360 values.
Param | Type | Description |
---|---|---|
degrees | Number |
Degrees to wrap. |
Vector3
Calculate the normal vector of a polygon using 3 points on it.
Kind: static method of MathHelper
Returns: Vector3
- Normal vector, normalized.
Param | Type | Description |
---|---|---|
v1 | Vector3 |
Vector on the polygon. |
v2 | Vector3 |
Vector on the polygon. |
v3 | Vector3 |
Vector on the polygon. |