MathUtils

THREE.MathUtils
object MathUtils extends Object

A collection of math utility functions.

Attributes

Graph
Supertypes
class Object
trait Any
class Object
trait Matchable
class Any
Self type
MathUtils.type

Members list

Value members

Concrete methods

def ceilPowerOfTwo(value: Double): Double

Returns the smallest power of two that is greater than or equal to the given number.

Returns the smallest power of two that is greater than or equal to the given number.

Attributes

def clamp(value: Double, min: Double, max: Double): Double

Clamps the given value between min and max.

Clamps the given value between min and max.

Attributes

def damp(x: Double, y: Double, lambda: Double, dt: Double): Double

Smoothly interpolate a number from x to y in a spring-like manner.

Smoothly interpolate a number from x to y in a spring-like manner.

Attributes

def degToRad(degrees: Double): Double

Converts degrees to radians.

Converts degrees to radians.

Attributes

def denormalize(value: Double, array: TypedArray[_, _]): Double

Denormalizes the given value according to the given typed array.

Denormalizes the given value according to the given typed array.

Attributes

def euclideanModulo(n: Double, m: Double): Double

Computes the Euclidean modulo of the given parameters: ((n % m) + m) % m

Computes the Euclidean modulo of the given parameters: ((n % m) + m) % m

Attributes

def floorPowerOfTwo(value: Double): Double

Returns the largest power of two that is less than or equal to the given number.

Returns the largest power of two that is less than or equal to the given number.

Attributes

def generateUUID(): String

Generate a UUID (universally unique identifier).

Generate a UUID (universally unique identifier).

Attributes

def inverseLerp(x: Double, y: Double, value: Double): Double

Returns the percentage in the closed interval [0, 1] of the given value between the start and end point.

Returns the percentage in the closed interval [0, 1] of the given value between the start and end point.

Attributes

def isPowerOfTwo(value: Double): Boolean

Returns true if the given number is a power of two.

Returns true if the given number is a power of two.

Attributes

def lerp(x: Double, y: Double, t: Double): Double

Returns a value linearly interpolated from two known points. t = 0 returns x and t = 1 returns y.

Returns a value linearly interpolated from two known points. t = 0 returns x and t = 1 returns y.

Attributes

def mapLinear(x: Double, a1: Double, a2: Double, b1: Double, b2: Double): Double

Performs a linear mapping from range <a1, a2> to range <b1, b2> for the given value.

Performs a linear mapping from range <a1, a2> to range <b1, b2> for the given value.

Attributes

def normalize(value: Double, array: TypedArray[_, _]): Double

Normalizes the given value according to the given typed array.

Normalizes the given value according to the given typed array.

Attributes

def pingpong(x: Double, length: Double): Double

Returns a value that alternates between 0 and the given length parameter.

Returns a value that alternates between 0 and the given length parameter.

Attributes

def radToDeg(radians: Double): Double

Converts radians to degrees.

Converts radians to degrees.

Attributes

def randFloat(low: Double, high: Double): Double

Returns a random float from <low, high> interval.

Returns a random float from <low, high> interval.

Attributes

def randFloatSpread(range: Double): Double

Returns a random float from <-range/2, range/2> interval.

Returns a random float from <-range/2, range/2> interval.

Attributes

def randInt(low: Double, high: Double): Double

Returns a random integer from <low, high> interval.

Returns a random integer from <low, high> interval.

Attributes

def seededRandom(s: UndefOr[Double]): Double

Returns a deterministic pseudo-random float in the interval [0, 1].

Returns a deterministic pseudo-random float in the interval [0, 1].

Attributes

def setQuaternionFromProperEuler(q: Quaternion, a: Double, b: Double, c: Double, order: String): Unit

Sets the given quaternion from the Intrinsic Proper Euler Angles.

Sets the given quaternion from the Intrinsic Proper Euler Angles.

Attributes

def smootherstep(x: Double, min: Double, max: Double): Double

A variation on smoothstep that has zero 1st and 2nd order derivatives at x=0 and x=1.

A variation on smoothstep that has zero 1st and 2nd order derivatives at x=0 and x=1.

Attributes

def smoothstep(x: Double, min: Double, max: Double): Double

Returns a value in the range [0,1] that represents the percentage that x has moved between min and max, but smoothed or slowed down the closer x is to the min and max.

Returns a value in the range [0,1] that represents the percentage that x has moved between min and max, but smoothed or slowed down the closer x is to the min and max.

Attributes

Inherited methods

def hasOwnProperty(v: String): Boolean

Attributes

Inherited from:
Object
def isPrototypeOf(v: Object): Boolean

Attributes

Inherited from:
Object
def propertyIsEnumerable(v: String): Boolean

Attributes

Inherited from:
Object
def toLocaleString(): String

Attributes

Inherited from:
Object
def valueOf(): Any

Attributes

Inherited from:
Object

Concrete fields

val DEG2RAD: Double

Constant to convert degrees to radians

Constant to convert degrees to radians

Attributes

val RAD2DEG: Double

Constant to convert radians to degrees

Constant to convert radians to degrees

Attributes