Part of a fork of @toji's
gl-matrix split into smaller pieces: this
package contains glMatrix.vec2
.
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-vec2').scale
var scale = require('gl-vec2/scale')
- add()
- clone()
- copy()
- create()
- cross()
- distance()
- divide()
- dot()
- forEach()
- fromValues()
- length()
- lerp()
- max()
- min()
- multiply()
- negate()
- normalize()
- random()
- scale()
- scaleAndAdd()
- set()
- squaredDistance()
- squaredLength()
- subtract()
- transformMat2()
- transformMat2d()
- transformMat3()
- transformMat4()
Adds two vec2's
Creates a new vec2 initialized with values from an existing vector
Copy the values from one vec2 to another
Creates a new, empty vec2
Computes the cross product of two vec2's Note that the cross product must by definition produce a 3D vector
Calculates the euclidian distance between two vec2's
Divides two vec2's
Calculates the dot product of two vec2's
Perform some operation over an array of vec2s.
Creates a new vec2 initialized with the given values
Calculates the length of a vec2
Performs a linear interpolation between two vec2's
Returns the maximum of two vec2's
Returns the minimum of two vec2's
Multiplies two vec2's
Negates the components of a vec2
Normalize a vec2
Generates a random vector with the given scale
Scales a vec2 by a scalar number
Adds two vec2's after scaling the second operand by a scalar value
Set the components of a vec2 to the given values
Calculates the squared euclidian distance between two vec2's
Calculates the squared length of a vec2
Subtracts vector b from vector a
Transforms the vec2 with a mat2
Transforms the vec2 with a mat2d
Transforms the vec2 with a mat3 3rd vector component is implicitly '1'
Transforms the vec2 with a mat4 3rd vector component is implicitly '0' 4th vector component is implicitly '1'
zlib. See LICENSE.md for details.