Class vec3
3 Dimensional Vector
Defined in: glMatrix.js.
Constructor Attributes | Constructor Name and Description |
---|---|
vec3()
|
Method Attributes | Method Name and Description |
---|---|
<static> |
vec3.add(vec, vec2, dest)
Performs a vector addition
|
<static> |
vec3.create(vec)
Creates a new instance of a vec3 using the default array type
Any javascript array-like objects containing at least 3 numeric elements can serve as a vec3
|
<static> |
vec3.createFrom(x, y, z)
Creates a new instance of a vec3, initializing it with the given arguments
|
<static> |
vec3.cross(vec, vec2, dest)
Generates the cross product of two vec3s
|
<static> |
vec3.dist(vec, vec2)
Calculates the euclidian distance between two vec3
Params:
|
<static> |
vec3.dot(vec, vec2)
Caclulates the dot product of two vec3s
|
<static> |
vec3.equal(a, b)
Compares two vectors for equality within a certain margin of error
|
<static> |
vec3.length(vec)
Caclulates the length of a vec3
|
<static> |
vec3.lerp(vec, vec2, lerp, dest)
Performs a linear interpolation between two vec3
|
<static> |
vec3.multiply(vec, vec2, dest)
Performs a vector multiplication
|
<static> |
vec3.negate(vec, dest)
Negates the components of a vec3
|
<static> |
vec3.normalize(vec, dest)
Generates a unit vector of the same direction as the provided vec3
If vector length is 0, returns [0, 0, 0]
|
<static> |
vec3.scale(vec, val, dest)
Multiplies the components of a vec3 by a scalar value
|
<static> |
vec3.set(vec, dest)
Copies the values of one vec3 to another
|
<static> |
vec3.squaredLength(vec)
Caclulates the squared length of a vec3
|
<static> |
vec3.str(vec)
Returns a string representation of a vector
|
<static> |
vec3.subtract(vec, vec2, dest)
Performs a vector subtraction
|
Method Detail
<static>
{vec3}
vec3.add(vec, vec2, dest)
Performs a vector addition
- Parameters:
- {vec3} vec
- First operand
- {vec3} vec2
- Second operand
- {vec3} dest Optional
- vec3 receiving operation result. If not specified result is written to vec
- Returns:
- {vec3} dest if specified, vec otherwise
<static>
{vec3}
vec3.create(vec)
Creates a new instance of a vec3 using the default array type
Any javascript array-like objects containing at least 3 numeric elements can serve as a vec3
- Parameters:
- {vec3} vec Optional
- vec3 containing values to initialize with
- Returns:
- {vec3} New vec3
<static>
{vec3}
vec3.createFrom(x, y, z)
Creates a new instance of a vec3, initializing it with the given arguments
- Parameters:
- {number} x
- X value
- {number} y
- Y value
- {number} z
- Z value
- Returns:
- {vec3} New vec3
<static>
{vec3}
vec3.cross(vec, vec2, dest)
Generates the cross product of two vec3s
- Parameters:
- {vec3} vec
- First operand
- {vec3} vec2
- Second operand
- {vec3} dest Optional
- vec3 receiving operation result. If not specified result is written to vec
- Returns:
- {vec3} dest if specified, vec otherwise
<static>
{number}
vec3.dist(vec, vec2)
Calculates the euclidian distance between two vec3
Params:
- Returns:
- {number} Distance between vec and vec2
<static>
{number}
vec3.dot(vec, vec2)
Caclulates the dot product of two vec3s
- Returns:
- {number} Dot product of vec and vec2
<static>
{Boolean}
vec3.equal(a, b)
Compares two vectors for equality within a certain margin of error
- Returns:
- {Boolean} True if a is equivalent to b
<static>
{number}
vec3.length(vec)
Caclulates the length of a vec3
- Parameters:
- {vec3} vec
- vec3 to calculate length of
- Returns:
- {number} Length of vec
<static>
{vec3}
vec3.lerp(vec, vec2, lerp, dest)
Performs a linear interpolation between two vec3
- Parameters:
- {vec3} vec
- First vector
- {vec3} vec2
- Second vector
- {number} lerp
- Interpolation amount between the two inputs
- {vec3} dest Optional
- vec3 receiving operation result. If not specified result is written to vec
- Returns:
- {vec3} dest if specified, vec otherwise
<static>
{vec3}
vec3.multiply(vec, vec2, dest)
Performs a vector multiplication
- Parameters:
- {vec3} vec
- First operand
- {vec3} vec2
- Second operand
- {vec3} dest Optional
- vec3 receiving operation result. If not specified result is written to vec
- Returns:
- {vec3} dest if specified, vec otherwise
<static>
{vec3}
vec3.negate(vec, dest)
Negates the components of a vec3
- Parameters:
- {vec3} vec
- vec3 to negate
- {vec3} dest Optional
- vec3 receiving operation result. If not specified result is written to vec
- Returns:
- {vec3} dest if specified, vec otherwise
<static>
{vec3}
vec3.normalize(vec, dest)
Generates a unit vector of the same direction as the provided vec3
If vector length is 0, returns [0, 0, 0]
- Parameters:
- {vec3} vec
- vec3 to normalize
- {vec3} dest Optional
- vec3 receiving operation result. If not specified result is written to vec
- Returns:
- {vec3} dest if specified, vec otherwise
<static>
{vec3}
vec3.scale(vec, val, dest)
Multiplies the components of a vec3 by a scalar value
- Parameters:
- {vec3} vec
- vec3 to scale
- {number} val
- Value to scale by
- {vec3} dest Optional
- vec3 receiving operation result. If not specified result is written to vec
- Returns:
- {vec3} dest if specified, vec otherwise
<static>
{vec3}
vec3.set(vec, dest)
Copies the values of one vec3 to another
- Returns:
- {vec3} dest
<static>
{number}
vec3.squaredLength(vec)
Caclulates the squared length of a vec3
- Parameters:
- {vec3} vec
- vec3 to calculate squared length of
- Returns:
- {number} Squared Length of vec
<static>
{string}
vec3.str(vec)
Returns a string representation of a vector
- Parameters:
- {vec3} vec
- Vector to represent as a string
- Returns:
- {string} String representation of vec
<static>
{vec3}
vec3.subtract(vec, vec2, dest)
Performs a vector subtraction
- Parameters:
- {vec3} vec
- First operand
- {vec3} vec2
- Second operand
- {vec3} dest Optional
- vec3 receiving operation result. If not specified result is written to vec
- Returns:
- {vec3} dest if specified, vec otherwise