[name]

Math utility functions

Properties

Methods

[method:Float clamp]( [page:Float value], [page:Float min], [page:Float max] )

value — Value to be clamped.
min — Minimum value
max — Maximum value.
Clamps the *value* to be between *min* and *max*.

[method:Float mapLinear]( [page:Float x], [page:Float a1], [page:Float a2], [page:Float b1], [page:Float b2] )

x — Value to be mapped.
a1 — Minimum value for range A.
a2 — Maximum value for range A.
b1 — Minimum value for range B.
b2 — Maximum value for range B.
Linear mapping of *x* from range [*a1*, *a2*] to range [*b1*, *b2*].

[method:Float random16]()

Random float from 0 to 1 with 16 bits of randomness.
Standard Math.random() creates repetitive patterns when applied over larger space.

[method:Integer randInt]( [page:Integer low], [page:Integer high] )

Random integer from *low* to *high* interval.

[method:Float randFloat]( [page:Float low], [page:Float high] )

Random float from *low* to *high* interval.

[method:Float randFloatSpread]( [page:Float range] )

Random float from *- range / 2* to *range / 2* interval.

[method:Float degToRad]( [page:Float degrees] )

degrees -- [page:Float]
Converts degrees to radians.

[method:Float radToDeg]( [page:Float radians] )

radians -- [page:Float]
Converts radians to degrees

[method:Float smoothstep]( [page:Float x], [page:Float min], [page:Float max] )

x -- The value to evaluate based on its position between min and max.
min -- Any x value below min will be 0
max -- Any x value above max will be 1
Returns a value between 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.

[link:http://en.wikipedia.org/wiki/Smoothstep Wikipedia]

[method:Float smootherstep]( [page:Float x], [page:Float min], [page:Float max] )

x -- The value to evaluate based on its position between min and max.
min -- Any x value below min will be 0
max -- Any x value above max will be 1
Returns a value between 0-1. It works the same as smoothstep, but more smooth.

Source

[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]