An utility type definition to use along with notifyObservers.
[ -1, -1, 1, -1, -1, 1, 1, 1 ]
[ -1, -1, 0, 1, -1, 0, -1, 1, 0, 1, 1, 0 ]
[ 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1 ]
[ 0, 0, 1, 0, 0, 1, 1, 1 ]
Retry given function for n times.
See also: retry
Look for an index from a sorted list using binary search.
If you don't provide a compare function, it will look for the first same value it can find. If it cannot find an exactly matching value, it can return N where the length of given array is N.
A sorted array
An index found
Test if given point is contained in given box or not.
A box
A point
clamp
Convert a color from HSV to RGB. Each component of the HSV must be given in [0 - 1] range.
Generate a turbo gradient.
Create a 52-card deck. You might want to use shuffleArray to shuffle the deck.
Parse a polyphonic tinyseq buffer.
Returns [ time, offTime, note, reserved, time, offTime, note, reserved, ... ]
Parse a polyphonic tinyseq buffer.
Returns [ time, offTime, note, reserved, time, offTime, note, reserved, ... ]
Parse a tinyseq buffer.
Returns [ time, offTime, note, reserved, time, offTime, note, reserved, ... ]
Parse a tinyseq buffer.
Returns [ time, offTime, note, reserved, time, offTime, note, reserved, ... ]
Return all ancestor sources the specified destination has.
An array of dag edge
The target destination
See also: dagEdgesChildren
Return all children destinations the specified source has.
An array of dag edge
The target source
See also: {@link dagEdgesDescendant}
Return all descendant destinations the specified source has.
An array of dag edge
The target source
See also: dagEdgesChildren
Return first parent source the specified destination has.
If it can't find a parent, it will return null
instead.
An array of dag edge
The target destination
See also: dagEdgesParents
Return all parent sources the specified destination has.
An array of dag edge
The target destination
See also: dagEdgesChildren
Resolve dag dependency relationship and give you a correct order.
An array of dag edges
An array of dag nodes
Make the given function a debounced one.
Make the given function a debounced one.
Compute a one dimensional edt from the source data. Returning distance will be squared. Intended to be used internally in edt2d.
Data of the source
Offset of the source from beginning
Stride of the source
Length of the source
Compute a two dimensional edt from the source data. Returning distance will be squared.
Data of the source.
Width of the source.
Height of the source.
Return a euler angles out of a matrix3. Make sure the input matrix is normalized.
An input rotation matrix
An order of output euler angles. Assume as XYZ
if not specified
Return a euler angles out of a matrix4. Make sure the input matrix is normalized.
An input rotation matrix
An order of output euler angles. Assume as XYZ
if not specified
Return a euler angles out of a quaternion.
An input quaternion
An order of output euler angles. Assume as XYZ
if not specified
The input text
The value between 0.0 and 1.0
The nerd value
lerp
, or mix
Apply given matrix4 to given line.
A line
A matrix4 which will be applied to the line
Return a vector that represents a certain point of given line. Same as start at t = 0, same as end at t = 1.
A line
A parameter t
Return a point that is on the given line which is closest to the given point.
If segment
is true, it will treat the line as a segment which has start and end.
Otherwise it will treat the line is infinite.
A line
A point
Is the line a segment?
Return a vector that represents delta of given line.
A line
Return a distance from the given line to the given point.
If segment
is true, it will treat the line as a segment which has start and end.
Otherwise it will treat the line is infinite.
A line
A point
Is the line a segment?
smoothstep
but not smooth
Return an inverse of given matrix.
Return a multiplication result of matrices.
Transpose a mat2.
Create a normal matrix out of a matrix4.
Create a matrix3 from matrix4.
Who needs this?
Intended to be used by mat3CreateNormalMatrix.
Convert a quaternion into a matrix3.
Yoinked from Three.js.
See: https://threejs.org/docs/#api/en/math/Matrix4.makeRotationFromQuaternion
Return an inverse of given mat3.
Yoinked from Three.js
Return a multiplication result of matrices.
Transpose a mat3.
Compose a matrix out of position, scale, and rotation. Yoinked from Three.js.
Decompose a matrix into a position, a scale, and a rotation. Yoinked from Three.js.
Return a determinant of given mat4.
Create a matrix4 from matrix3.
Convert a quaternion into a matrix4.
Yoinked from Three.js.
See: https://threejs.org/docs/#api/en/math/Matrix4.makeRotationFromQuaternion
an inverse of given mat4.
Generate a "LookAt" matrix.
See also: mat4LookAtInverse
Generate an inverse of "LookAt" matrix. Good for creating a view matrix.
See also: mat4LookAt
Return a multiplication result of matrices.
Generate a "Perspective" projection matrix.
Field of View Y, IN DEGREES
Near clip plane
Far clip plane
Aspect ratio. 1.0
BY DEFAULT
Generate a 3d rotation matrix, rotates around x axis.
Generate a 3d rotation matrix, rotates around y axis.
Generate a 3d rotation matrix, rotates around z axis.
Generate a 3d scaling matrix.
Generate a 3d scaling matrix by a scalar.
Generate a translation matrix.
Transpose a mat4.
matrix2d( 3, 2 )
-> [ 0, 0, 0, 1, 0, 2, 1, 0, 1, 1, 1, 2 ]
See also: matrix2d
GLSL Style mod
function.
"compute value of one parameter modulo another"
A bare function to notify observers. The incredibly cheap implementation of the observer pattern.
Use along with the utility type definition Observer.
The iterator of observers
The input ST-NICCC data
Apply given matrix4 to given plane.
A plane
A matrix4 which will be applied to the plane
A normalMatrix made out of {@link matrix}
Return a signed distance from given plane to the given point.
Make sure the normal
is normalized.
Test if given point is contained in given planes or not.
A list of planes
A point
Create frustum planes out of given projection matrix.
A projection matrix
Test if given sphere intersects with planes or not.
It does not do strict intersection test but still should work well with frustum cull use cases. See the test case for more details.
A list of planes
A sphere3
Generate a Quaternion out of axis and angle.
Generate a Quaternion out of euler angles.
Generate a Quaternion out of a rotation matrix. Yoinked from Three.js.
Generate a Quaternion out of a rotation matrix.
Return an inverse of a quaternion.
Return a quaternion which looks at the direction of look
.
Return a multiplication result of quaternions.
Normalize given quaternion.
It's almost identical as vecNormalize, but it will return an identity quaternion instead when it recieves a quaternion which length is zero.
Generate a quaternion rotates around x axis.
An angle around x axis, in degree
Generate a quaternion rotates around y axis.
An angle around y axis, in degree
Generate a quaternion rotates around z axis.
An angle around z axis, in degree
Interpolate between two quaternions.
"from" quaternion
"to" quaternion
How much do we want to rotate the a to b
Transform a value from input range to output range.
Return distances from given ray to sphere.
The returning distance can be negative.
The first returning value will be the distance of the incident point.
If the ray does not intersect with sphere, it will return null
.
A ray
A target sphere
Retry given function for n times.
See also: asyncRetry
Enclose arbitrary angle (in radian) into [-π, π)
clamp( x, 0.0, 1.0 )
Shuffle given array
using given dice
RNG. Destructive.
smoothstep
but more smooth
smoothstep
but WAY more smooth
world famous smoothstep
function
Sort given array of cards in place by rank (and suit).
Test if given point is contained in given sphere or not.
A sphere
A point
Make the given function a throttled one.
Make the given function a throttled one.
Convert the parsed midi result to a tinyseq binary.
See: midiParse
The parsed midi result
A tinyseq binary
Generic traverse function.
It performs Depth-First Search.
The traverser
function will be executed for each descendants.
You need to return their "children" in an array.
If you want to stop the traversal, return false
instead.
The "root" node
The traverse function. If the node has "children" return them in an array.
I like wireframe
triIndexToLineIndex( [ 0, 1, 2, 5, 6, 7 ] )
-> [ 0, 1, 1, 2, 2, 0, 5, 6, 6, 7, 7, 5 ]
Apply a vec3 a mat3.
Apply a vec3 (with an implicit 1 in the 4th dimension) a mat4.
Apply a vec3 (with an implicit 1 in the 4th dimension) a quaternion.
Return a cross product of two vec3s.
Return a tangent which is orthogonal to normal. If binormal is specified, it is also returned and it's orthogonal to both normal and tangent.
Apply a vec4 a mat3 (with an implicit 1 on m44).
Multiply a vec4 by a mat4.
Return a vector with the absolute of each component of the given vector.
Return a sum of vectors.
Divide a vector by a vector.
Return a dot product of given two vectors.
Return an euclidean length of given vector.
Return an squared euclidean length of given vector.
Return a manhattan length of given vector.
Return a product of vectors.
Negate a vector.
Normalize given vector. If the length of given vector is 0.0, it will return a zero vector instead.
Scale the given vector by a scalar.
Subtract a vector from a vector.
Generated using TypeDoc
Note that this is extrinsic rotations (which is same as Blender, Maya, and Unity). Three.js uses intrinsic rotations so you have to reverse the order if you want to match the behavior with Three.js.