Properties
Axis direction
Axis.X: 0
Axis.Y: 1
Axis.Z: 2
enum
ClipTest
number
Plane or frustum clip test result type.
ClipTest.Inside: 0 // The object is completely inside the frustum or in front of the plane.
ClipTest.Outside: 1 // The object is completely outside the frustum or behind the plane.
ClipTest.Overlap: 2 // The object overlaps the plane or frustum.
Conversion value for degrees to radians.
General value to consider as an epsilon for float comparisons.
General value to consider as a maximum float value.
3.1415...
PI multiplied by 2
PI divided by 2
Conversion value for radians to degrees.
Order in which to apply euler rotations for a transformation.
RotationOrder.Default: RotationOrder.ZYX
RotationOrder.ZYX: 0
RotationOrder.XYZ: 1,
RotationOrder.XZY: 2,
RotationOrder.YZX: 3,
RotationOrder.YXZ: 4,
RotationOrder.ZXY: 5,
Methods
static clamp(x, min, max) → number
Clamp the value x to the range [min, max].
x |
number | |
min |
number | |
max |
number |
- number
static copysign(a, b) → number
Apply the sign of b to a.
a |
number | |
b |
number |
- number
static equals(a, b, epsilon) → bool
Compare two floating-point numbers, testing if the two numbers closer than the given epsilon.
a |
number | |
b |
number | |
epsilon |
number |
- bool
static isPowerOfTwo(v) → bool
Is the given number a power of 2?
v |
number |
- bool
static ldexp(mantissa, exponent)
Implementation of the C ldexp function, which combines a mantessa and exponent into a floating-point number. http://croquetweak.blogspot.com/2014/08/deconstructing-floats-frexp-and-ldexp.html
mantissa |
number | |
exponent |
number |
static length3(x, y, z) → number
The length of a 3-dimensional vector, given by its components.
x |
number | |
y |
number | |
z |
number |
- number
static lerp(x, min, max) → number
Linear interpolate between [min, max] using x. If x is outside of the range [min, max], the interpolated value will be a linear extrapolation.
x |
number | The interpolation amount, in the range [0, 1]. |
min |
number | The start of the range to interpolate. |
max |
number | The end of the range to interpolate. |
- number
The interpolated value.
static nearestPowerOfTwo(v) → number
Return the closest power-of-2 of the given number.
v |
number |
- number
static pingpong(x, min, max) → number
If x is outside of the range [min, max], the interval will be ping-ponged.
x |
number | |
min |
number | |
max |
number |
- number
static radiansToDegrees(a) → number
Convert radians to degrees.
a |
number |
- number
static repeat(x, min, max) → number
If x is outside of the range [min, max], the interval will be repeated.
x |
number | |
min |
number | |
max |
number |
- number
static solveCubic(a, b, c, d, roots) → number
Solves the cubic equation: a + bx + cx^2 + d*x^3 = 0
a |
number | |
b |
number | |
c |
number | |
d |
number | |
roots |
Array.<number> | The resulting roots |
- number
The number of roots found
static solveQuadratic(a, b, c, roots) → number
Solves the quadratic equation: a + bx + cx^2 = 0
a |
number | |
b |
number | |
c |
number | |
roots |
Array.<number> | The resulting roots |
- number
The number of roots found
static solveQuartic(a, b, c, d, e, roots) → number
Solve the quartic equation: a + bx + cx^2 + dx^3 + ex^4 = 0
a |
number | |
b |
number | |
c |
number | |
d |
number | |
e |
number | |
roots |
Array.<number> | The resulting roots |
- number
The number of roots found
static toFloat16(value) → number
Convert a float32 number to a float16.
ref: http://stackoverflow.com/questions/32633585/how-do-you-convert-to-half-floats-in-javascript This method is faster than the OpenEXR implementation, with the additional benefit of rounding, inspired by James Tursa?s half-precision code
value |
number | The number to convert |
- number
The float16 value
inner abs(x)
Returns the absolute value of x.
x |
number |
inner acos(x) → number
Returns the arccosine of x.
x |
number |
- number
inner asin(x) → number
Returns the arcsine of x.
x |
number |
- number
inner ceil(x) → number
Returns the smallest integer greater than or equal to x.
x |
number |
- number
inner cos(x) → number
Returns the cosine of x.
x |
number |
- number
inner floor(x) → number
Returns the largest integer less than or equal to x.
x |
number |
- number
inner log(x) → number
Returns the natural logarithm of x.
x |
number |
- number
inner sign(x) → number
Returns the sign of x, indicating whether x is positive, negative, or zero.
x |
number |
- number
inner sin(x) → number
Returns the sine of x.
x |
number |
- number
inner sqrt(x) → number
Returns the square root of x.
x |
number |
- number
inner sqrt(x) → number
Returns the arctangent of x.
x |
number |
- number
inner tan(x) → number
Returns the tangent of x.
x |
number |
- number