-
inneradd$4(out, a, b) → vec3
-
Adds two vec3's
Name |
Type |
Description |
out |
vec3
|
the receiving vector |
a |
vec3
|
the first operand |
b |
vec3
|
the second operand |
Returns:
out
-
innerangle(a, b) → Number
-
Get the angle between two 3D vectors
Name |
Type |
Description |
a |
vec3
|
The first operand |
b |
vec3
|
The second operand |
Returns:
The angle in radians
-
innerbezier(out, a, b, c, d, t) → vec3
-
Performs a bezier interpolation with two control points
Name |
Type |
Description |
out |
vec3
|
the receiving vector |
a |
vec3
|
the first operand |
b |
vec3
|
the second operand |
c |
vec3
|
the third operand |
d |
vec3
|
the fourth operand |
t |
Number
|
interpolation amount, in the range [0-1], between the two inputs |
Returns:
out
-
-
Math.ceil the components of a vec3
Name |
Type |
Description |
out |
vec3
|
the receiving vector |
a |
vec3
|
vector to ceil |
Returns:
out
-
-
Creates a new vec3 initialized with values from an existing vector
Name |
Type |
Description |
a |
vec3
|
vector to clone |
Returns:
a new 3D vector
-
innercopy$4(out, a) → vec3
-
Copy the values from one vec3 to another
Name |
Type |
Description |
out |
vec3
|
the receiving vector |
a |
vec3
|
the source vector |
Returns:
out
-
-
Creates a new, empty vec3
Returns:
a new 3D vector
-
innercross(out, a, b) → vec3
-
Computes the cross product of two vec3's
Name |
Type |
Description |
out |
vec3
|
the receiving vector |
a |
vec3
|
the first operand |
b |
vec3
|
the second operand |
Returns:
out
-
-
Alias for vec3.distance
-
innerdistance(a, b) → Number
-
Calculates the euclidian distance between two vec3's
Name |
Type |
Description |
a |
vec3
|
the first operand |
b |
vec3
|
the second operand |
Returns:
distance between a and b
-
-
Alias for vec3.divide
-
innerdivide(out, a, b) → vec3
-
Divides two vec3's
Name |
Type |
Description |
out |
vec3
|
the receiving vector |
a |
vec3
|
the first operand |
b |
vec3
|
the second operand |
Returns:
out
-
-
Calculates the dot product of two vec3's
Name |
Type |
Description |
a |
vec3
|
the first operand |
b |
vec3
|
the second operand |
Returns:
dot product of a and b
-
innerequals$5(a, b) → Boolean
-
Returns whether or not the vectors have approximately the same elements in the same position.
Name |
Type |
Description |
a |
vec3
|
The first vector. |
b |
vec3
|
The second vector. |
Returns:
True if the vectors are equal, false otherwise.
-
innerexactEquals$4(a, b) → Boolean
-
Returns whether or not the vectors have exactly the same elements in the same position (when compared with ===)
Name |
Type |
Description |
a |
vec3
|
The first vector. |
b |
vec3
|
The second vector. |
Returns:
True if the vectors are equal, false otherwise.
-
innerfloor(out, a) → vec3
-
Math.floor the components of a vec3
Name |
Type |
Description |
out |
vec3
|
the receiving vector |
a |
vec3
|
vector to floor |
Returns:
out
-
innerforEach(a, stride, offset, count, fn, arg) → Array
-
Perform some operation over an array of vec3s.
Name |
Type |
Description |
a |
Array
|
the array of vectors to iterate over |
stride |
Number
|
Number of elements between the start of each vec3. If 0 assumes tightly packed |
offset |
Number
|
Number of elements to skip at the beginning of the array |
count |
Number
|
Number of vec3s to iterate over. If 0 iterates over entire array |
fn |
function
|
Function to call for each vector in the array |
arg |
Object
|
optional
additional argument to pass to fn |
Returns:
a
-
innerfromValues$4(x, y, z) → vec3
-
Creates a new vec3 initialized with the given values
Name |
Type |
Description |
x |
Number
|
X component |
y |
Number
|
Y component |
z |
Number
|
Z component |
Returns:
a new 3D vector
-
innerhermite(out, a, b, c, d, t) → vec3
-
Performs a hermite interpolation with two control points
Name |
Type |
Description |
out |
vec3
|
the receiving vector |
a |
vec3
|
the first operand |
b |
vec3
|
the second operand |
c |
vec3
|
the third operand |
d |
vec3
|
the fourth operand |
t |
Number
|
interpolation amount, in the range [0-1], between the two inputs |
Returns:
out
-
innerinverse(out, a) → vec3
-
Returns the inverse of the components of a vec3
Name |
Type |
Description |
out |
vec3
|
the receiving vector |
a |
vec3
|
vector to invert |
Returns:
out
-
-
Alias for vec3.length
-
-
Calculates the length of a vec3
Name |
Type |
Description |
a |
vec3
|
vector to calculate length of |
Returns:
length of a
-
innerlerp(out, a, b, t) → vec3
-
Performs a linear interpolation between two vec3's
Name |
Type |
Description |
out |
vec3
|
the receiving vector |
a |
vec3
|
the first operand |
b |
vec3
|
the second operand |
t |
Number
|
interpolation amount, in the range [0-1], between the two inputs |
Returns:
out
-
innermax(out, a, b) → vec3
-
Returns the maximum of two vec3's
Name |
Type |
Description |
out |
vec3
|
the receiving vector |
a |
vec3
|
the first operand |
b |
vec3
|
the second operand |
Returns:
out
-
innermin(out, a, b) → vec3
-
Returns the minimum of two vec3's
Name |
Type |
Description |
out |
vec3
|
the receiving vector |
a |
vec3
|
the first operand |
b |
vec3
|
the second operand |
Returns:
out
-
-
Alias for vec3.multiply
-
innermultiply$4(out, a, b) → vec3
-
Multiplies two vec3's
Name |
Type |
Description |
out |
vec3
|
the receiving vector |
a |
vec3
|
the first operand |
b |
vec3
|
the second operand |
Returns:
out
-
innernegate(out, a) → vec3
-
Negates the components of a vec3
Name |
Type |
Description |
out |
vec3
|
the receiving vector |
a |
vec3
|
vector to negate |
Returns:
out
-
innernormalize(out, a) → vec3
-
Normalize a vec3
Name |
Type |
Description |
out |
vec3
|
the receiving vector |
a |
vec3
|
vector to normalize |
Returns:
out
-
innerrandom(out, scale) → vec3
-
Generates a random vector with the given scale
Name |
Type |
Description |
out |
vec3
|
the receiving vector |
scale |
Number
|
optional
Length of the resulting vector. If ommitted, a unit vector will be returned |
Returns:
out
-
innerrotateX$1(out, a, b, c) → vec3
-
Rotate a 3D vector around the x-axis
Name |
Type |
Description |
out |
vec3
|
The receiving vec3 |
a |
vec3
|
The vec3 point to rotate |
b |
vec3
|
The origin of the rotation |
c |
Number
|
The angle of rotation |
Returns:
out
-
innerrotateY$1(out, a, b, c) → vec3
-
Rotate a 3D vector around the y-axis
Name |
Type |
Description |
out |
vec3
|
The receiving vec3 |
a |
vec3
|
The vec3 point to rotate |
b |
vec3
|
The origin of the rotation |
c |
Number
|
The angle of rotation |
Returns:
out
-
innerrotateZ$1(out, a, b, c) → vec3
-
Rotate a 3D vector around the z-axis
Name |
Type |
Description |
out |
vec3
|
The receiving vec3 |
a |
vec3
|
The vec3 point to rotate |
b |
vec3
|
The origin of the rotation |
c |
Number
|
The angle of rotation |
Returns:
out
-
innerround(out, a) → vec3
-
Math.round the components of a vec3
Name |
Type |
Description |
out |
vec3
|
the receiving vector |
a |
vec3
|
vector to round |
Returns:
out
-
innerscale$4(out, a, b) → vec3
-
Scales a vec3 by a scalar number
Name |
Type |
Description |
out |
vec3
|
the receiving vector |
a |
vec3
|
the vector to scale |
b |
Number
|
amount to scale the vector by |
Returns:
out
-
innerscaleAndAdd(out, a, b, scale) → vec3
-
Adds two vec3's after scaling the second operand by a scalar value
Name |
Type |
Description |
out |
vec3
|
the receiving vector |
a |
vec3
|
the first operand |
b |
vec3
|
the second operand |
scale |
Number
|
the amount to scale b by before adding |
Returns:
out
-
innerset$4(out, x, y, z) → vec3
-
Set the components of a vec3 to the given values
Name |
Type |
Description |
out |
vec3
|
the receiving vector |
x |
Number
|
X component |
y |
Number
|
Y component |
z |
Number
|
Z component |
Returns:
out
-
-
Alias for vec3.squaredDistance
-
-
Alias for vec3.squaredLength
-
innersquaredDistance(a, b) → Number
-
Calculates the squared euclidian distance between two vec3's
Name |
Type |
Description |
a |
vec3
|
the first operand |
b |
vec3
|
the second operand |
Returns:
squared distance between a and b
-
innersquaredLength(a) → Number
-
Calculates the squared length of a vec3
Name |
Type |
Description |
a |
vec3
|
vector to calculate squared length of |
Returns:
squared length of a
-
-
Returns a string representation of a vector
Name |
Type |
Description |
a |
vec3
|
vector to represent as a string |
Returns:
string representation of the vector
-
-
Alias for vec3.subtract
-
innersubtract$4(out, a, b) → vec3
-
Subtracts vector b from vector a
Name |
Type |
Description |
out |
vec3
|
the receiving vector |
a |
vec3
|
the first operand |
b |
vec3
|
the second operand |
Returns:
out
-
-
Transforms the vec3 with a mat3.
Name |
Type |
Description |
out |
vec3
|
the receiving vector |
a |
vec3
|
the vector to transform |
m |
mat3
|
the 3x3 matrix to transform with |
Returns:
out
-
-
Transforms the vec3 with a mat4.
4th vector component is implicitly '1'
Name |
Type |
Description |
out |
vec3
|
the receiving vector |
a |
vec3
|
the vector to transform |
m |
mat4
|
matrix to transform with |
Returns:
out
-
-
Transforms the vec3 with a quat
Can also be used for dual quaternions. (Multiply it with the real part)
Name |
Type |
Description |
out |
vec3
|
the receiving vector |
a |
vec3
|
the vector to transform |
q |
quat
|
quaternion to transform with |
Returns:
out
-
-
Set the components of a vec3 to zero
Name |
Type |
Description |
out |
vec3
|
the receiving vector |
Returns:
out