FORGE. Math

Math helper
Source:

Members

(static, constant) DEG2RAD :number

FORGE.Math.DEG2RAD
Type:
  • number
Source:

(static, constant) DEGREES :string

Type:
  • string
Source:

(static, constant) RAD2DEG :number

FORGE.Math.RAD2DEG
Type:
  • number
Source:

(static, constant) RADIANS :string

Type:
  • string
Source:

(static, constant) TWOPI :number

FORGE.Math.TWOPI
Type:
  • number
Source:

Methods

(static) cartesianToSpherical(x, y, z, unitopt) → {SphericalCoordinates}

Converts cartesian coordinates to spherical, respecting the FORGE coordinates system.
Parameters:
Name Type Attributes Default Description
x number x
y number y
z number z
unit string <optional>
radian The unit used to return spherical
Source:
Returns:
Type
SphericalCoordinates

(static) clamp(value, minopt, nullable, maxopt, nullable) → {number}

Clamp a value between a min and a max value
Parameters:
Name Type Attributes Description
value number Value to clamp
min number <optional>
<nullable>
The min value
max number <optional>
<nullable>
The max value
Source:
Returns:
Return the clamped value
Type
number

(static) degToRad(deg) → {number}

Converts angle unit degrees to radians
Parameters:
Name Type Description
deg number angle in degrees
Source:
Returns:
Return the angle in radians
Type
number

(static) eulerToRotationMatrix(yaw, pitch, roll, orderYPRopt) → {THREE.Matrix4}

Get rotation matrix from euler angles
Parameters:
Name Type Attributes Description
yaw number yaw angle [rad]
pitch number pitch angle [rad]
roll number roll angle [rad]
orderYPR boolean <optional>
Source:
Returns:
rotation matrix
Type
THREE.Matrix4

(static) isPowerOfTwo(value)

Check if a value is a power of two
Parameters:
Name Type Description
value number value to check
Source:

(static) mix(a, b, mix) → {number}

Linear mix function
Parameters:
Name Type Description
a number first value
b number second value
mix number factor
Source:
Returns:
linear mix of a and b
Type
number

(static) radToDeg(rad) → {number}

Converts angle unit radians to degrees
Parameters:
Name Type Description
rad number angle in radians
Source:
Returns:
Return the angle in degrees
Type
number

(static) rotationMatrixToEuler(mat) → {TEuler}

Get euler angles from rotation matrix
Parameters:
Name Type Description
mat THREE.Matrix4 rotation matrix
Source:
Returns:
object with keys {yaw, pitch, roll} and euler angles as values [radians]
Type
TEuler

(static) round10(value) → {number}

Returns the value of a number rounded to the nearest decimal value
Parameters:
Name Type Description
value number Value to round
Source:
Returns:
Return the rounded value
Type
number

(static) smoothStep(value, edge0, edge1) → {number}

Smoothstep function
Parameters:
Name Type Description
value number Value to smooth
edge0 number low edge
edge1 number high edge
Source:
Returns:
smooth step result
Type
number

(static) sphericalToCartesian(radius, theta, phi, unitopt) → {CartesianCoordinates}

Converts spherical coordinates to cartesian, respecting the FORGE coordinates system.
Parameters:
Name Type Attributes Default Description
radius number radius
theta number theta angle
phi number phi angle
unit string <optional>
radian The unit used for theta and phi arguments
Source:
Returns:
the resulting cartesian coordinates
Type
CartesianCoordinates

(static) wrap(value, min, max) → {number}

Wrap a value between a min and a max value
Parameters:
Name Type Description
value number Value to wrap
min number The min value
max number The max value
Source:
Returns:
Return the wrapped value
Type
number

FORGE. Math

Members
Methods