Liking cljdoc? Tell your friends :D

mathree.math-utils


ceil-power-of-twocljs

(ceil-power-of-two n)

.ceilPowerOfTwo ( n : Number ) : Integer Returns the smallest power of 2 that is greater than or equal to n.

.ceilPowerOfTwo ( n : Number ) : Integer
Returns the smallest power of 2 that is greater than or equal to n.
sourceraw docstring

clampcljs

(clamp value min max)

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

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

dampcljs

(damp x y lambda dt)

.damp ( x : Float, y : Float, lambda : Float, dt : Float ) : Float x - Current point. y - Target point. lambda - A higher lambda value will make the movement more sudden, and a lower value will make the movement more gradual. dt - Delta time in seconds.

Smoothly interpolate a number from x toward y in a spring-like manner using the dt to maintain frame rate independent movement. For details, see Frame rate independent damping using lerp.

.damp ( x : Float, y : Float, lambda : Float, dt : Float ) : Float
x - Current point.
y - Target point.
lambda - A higher lambda value will make the movement more sudden, and a lower value will make the movement more gradual.
dt - Delta time in seconds.

Smoothly interpolate a number from x toward y in a spring-like manner using the dt to maintain frame rate independent movement. For details, see Frame rate independent damping using lerp.
sourceraw docstring

deg-to-radcljs

(deg-to-rad degree)

.degToRad ( degrees : Float ) : Float Converts degrees to radians.

.degToRad ( degrees : Float ) : Float
Converts degrees to radians.
sourceraw docstring

euclidean-modulocljs

(euclidean-modulo n m)

.euclideanModulo ( n : Integer, m : Integer ) : Integer n, m - Integers Computes the Euclidean modulo of m % n, that is: ( ( n % m ) + m ) % m

.euclideanModulo ( n : Integer, m : Integer ) : Integer
n, m - Integers
Computes the Euclidean modulo of m % n, that is:
( ( n % m ) + m ) % m 
sourceraw docstring

floor-power-of-twocljs

(floor-power-of-two n)

.floorPowerOfTwo ( n : Number ) : Integer Returns the largest power of 2 that is less than or equal to n.

.floorPowerOfTwo ( n : Number ) : Integer
Returns the largest power of 2 that is less than or equal to n.
sourceraw docstring

generate-UUIDcljs

(generate-UUID)

.generateUUID ( ) : UUID Generate a UUID (universally unique identifier).

.generateUUID ( ) : UUID
Generate a UUID (universally unique identifier).
sourceraw docstring

inverse-lerpcljs

(inverse-lerp x y value)

.inverseLerp ( x : Float, y : Float, value : Float ) : Float x - Start point. y - End point. value - A value between start and end. Returns the percentage in the closed interval [0, 1] of the given value between the start and end point.

.inverseLerp ( x : Float, y : Float, value : Float ) : Float
x - Start point.
y - End point.
value - A value between start and end.
Returns the percentage in the closed interval [0, 1] of the given value between the start and end point.
sourceraw docstring

is-power-of-twocljs

(is-power-of-two n)

.isPowerOfTwo ( n : Number ) : Boolean Return true if n is a power of 2.

.isPowerOfTwo ( n : Number ) : Boolean
Return true if n is a power of 2.
sourceraw docstring

lerpcljs

(lerp x y t)

.lerp ( x : Float, y : Float, t : Float ) : Float x - Start point. y - End point. t - interpolation factor in the closed interval [0, 1].

Returns a value linearly interpolated from two known points based on the given interval - t = 0 will return x and t = 1 will return y.

.lerp ( x : Float, y : Float, t : Float ) : Float
x - Start point.
y - End point.
t - interpolation factor in the closed interval [0, 1].

Returns a value linearly interpolated from two known points based on the given interval - t = 0 will return x and t = 1 will return y.
sourceraw docstring

map-linearcljs

(map-linear x a1 a2 b1 b2)

.mapLinear ( x : Float, a1 : Float, a2 : Float, b1 : Float, b2 : Float ) : Float 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].

.mapLinear ( x : Float, a1 : Float, a2 : Float, b1 : Float, b2 : Float ) : Float
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].
sourceraw docstring

math-utilscljs

source

pingpongcljs

(pingpong x length)

.pingpong ( x : Float, length : Float ) : Float x — The value to pingpong. length — The positive value the function will pingpong to. Default is 1.

Returns a value that alternates between 0 and length : Float.

.pingpong ( x : Float, length : Float ) : Float
x — The value to pingpong.
length — The positive value the function will pingpong to. Default is 1.

Returns a value that alternates between 0 and length : Float.
sourceraw docstring

rad-to-degcljs

(rad-to-deg radians)

.radToDeg ( radians : Float ) : Float Converts radians to degrees.

.radToDeg ( radians : Float ) : Float
Converts radians to degrees.
sourceraw docstring

rand-floatcljs

(rand-float low high)

.randFloat ( low : Float, high : Float ) : Float Random float in the interval [low, high].

.randFloat ( low : Float, high : Float ) : Float
Random float in the interval [low, high].
sourceraw docstring

rand-float-spreadcljs

(rand-float-spread range)

.randFloatSpread ( range : Float ) : Float Random float in the interval [- range / 2, range / 2].

.randFloatSpread ( range : Float ) : Float
Random float in the interval [- range / 2, range / 2].
sourceraw docstring

rand-integercljs

(rand-integer low high)

.randInt ( low : Integer, high : Integer ) : Integer Random integer in the interval [low, high].

.randInt ( low : Integer, high : Integer ) : Integer
Random integer in the interval [low, high].
sourceraw docstring

seeded-randomcljs

(seeded-random)
(seeded-random seed)

.seededRandom ( seed : Integer ) : Float Deterministic pseudo-random float in the interval [0, 1]. The integer seed is optional.

.seededRandom ( seed : Integer ) : Float
Deterministic pseudo-random float in the interval [0, 1]. The integer seed is optional.
sourceraw docstring

smooth-stepcljs

(smooth-step x min max)

.smoothstep ( x : Float, min : Float, max : Float ) : Float 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. See Smoothstep for details.

.smoothstep ( x : Float, min : Float, max : Float ) : Float
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.
See Smoothstep for details.
sourceraw docstring

smoother-stepcljs

(smoother-step x min max)

.smootherstep ( x : Float, min : Float, max : Float ) : Float 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. A variation on smoothstep that has zero 1st and 2nd order derivatives at x=0 and x=1.

.smootherstep ( x : Float, min : Float, max : Float ) : Float
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. A variation on smoothstep that has zero 1st and 2nd order derivatives at x=0 and x=1.
sourceraw docstring

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close