Skip to content package
gl-vec4 v1.0.0 gl-matrix's vec4, split into smaller pieces
node any 0 deps cjs open source
overview readme
license Zlib
deps 0
unpacked Unknown
files Unknown
node any $ npm install gl-vec4@1.0.0n npmREADME GitHub-flavored package documentation.
downloads Across all versions.
Download trend unavailable.
compatibility Runtime metadata.
keywords Tagged topics.
ecosystem:stackgl gl-matrix matrix math gl mat4 mat4x4 4x4 vectors vec4 color mat
versions Latest published May 14, 2015
maintainers Registry package owners.
contents Usage vec4 = require('gl-vec4') API add(out:vec4, a:vec4, b:vec4) clone(a:vec4) copy(out:vec4, a:vec4) create() distance(a:vec4, b:vec4) divide(out:vec4, a:vec4, b:vec4) dot(a:vec4, b:vec4) fromValues(x:Number, y:Number, z:Number, w:Number) inverse(out:vec4, a:vec4) length(a:vec4) lerp(out:vec4, a:vec4, b:vec4, t:Number) max(out:vec4, a:vec4, b:vec4) min(out:vec4, a:vec4, b:vec4) multiply(out:vec4, a:vec4, b:vec4) negate(out:vec4, a:vec4) normalize(out:vec4, a:vec4) random(out:vec4, [scale]:Number) scale(out:vec4, a:vec4, b:Number) scaleAndAdd(out:vec4, a:vec4, b:vec4, scale:Number) set(out:vec4, x:Number, y:Number, z:Number, w:Number) squaredDistance(a:vec4, b:vec4) squaredLength(a:vec4) subtract(out:vec4, a:vec4, b:vec4) transformMat4(out:vec4, a:vec4, m:mat4) transformQuat(out:vec4, a:vec4, q:quat) License gl-vec4
Part of a fork of @toji 's
gl-matrix split into smaller pieces: this
package contains glMatrix.vec4.
Usage
vec4 = require('gl-vec4')Will load all of the module's functionality and expose it on a single
object. Note that any of the methods may also be required directly
from their files.
For example, the following are equivalent:
var scale = require ( 'gl-vec4' ).scale
var scale = require ( 'gl-vec4/scale' ) copy
API
add(out:vec4, a:vec4, b:vec4)
clone(a:vec4) Creates a new vec4 initialized with values from an existing vector
copy(out:vec4, a:vec4) Copy the values from one vec4 to another
create() Creates a new, empty vec4
distance(a:vec4, b:vec4) Calculates the euclidian distance between two vec4's
divide(out:vec4, a:vec4, b:vec4)
dot(a:vec4, b:vec4) Calculates the dot product of two vec4's
fromValues(x:Number, y:Number, z:Number, w:Number) Creates a new vec4 initialized with the given values
inverse(out:vec4, a:vec4) Returns the inverse of the components of a vec4
length(a:vec4) Calculates the length of a vec4
lerp(out:vec4, a:vec4, b:vec4, t:Number) Performs a linear interpolation between two vec4's
max(out:vec4, a:vec4, b:vec4) Returns the maximum of two vec4's
min(out:vec4, a:vec4, b:vec4) Returns the minimum of two vec4's
multiply(out:vec4, a:vec4, b:vec4)
negate(out:vec4, a:vec4) Negates the components of a vec4
normalize(out:vec4, a:vec4)
random(out:vec4, [scale]:Number) Generates a random vector with the given scale
scale(out:vec4, a:vec4, b:Number) Scales a vec4 by a scalar number
scaleAndAdd(out:vec4, a:vec4, b:vec4, scale:Number) Adds two vec4's after scaling the second operand by a scalar value
set(out:vec4, x:Number, y:Number, z:Number, w:Number) Set the components of a vec4 to the given values
squaredDistance(a:vec4, b:vec4) Calculates the squared euclidian distance between two vec4's
squaredLength(a:vec4) Calculates the squared length of a vec4
subtract(out:vec4, a:vec4, b:vec4) Subtracts vector b from vector a
Transforms the vec4 with a mat4.
Transforms the vec4 with a quat
License