Module ncine.vec4
The table containing 4-components vector related functions
Functions
ncine.vec4.create (x, y, z, w) | Creates a vec4 table from its components |
ncine.vec4.add (vec0, vec1) | Adds two vectors together, component-wise |
ncine.vec4.add (vec0, scalar) | Adds a scalar to the vector components |
ncine.vec4.sub (vec0, vec1) | Subtracts the second vector from the first one, component-wise |
ncine.vec4.sub (vec, scalar) | Subtracts the scalar from the vector components |
ncine.vec4.mul (vec0, vec1) | Multiplies two vectors together, component-wise |
ncine.vec4.mul (vec, scalar) | Multiplies the vector components by the scalar |
ncine.vec4.div (vec0, vec1) | Divides the first vector by the second one, component-wise |
ncine.vec4.div (vec, scalar) | Divides the vector components by the scalar |
ncine.vec4.length (vec) | Returns the length of the vector |
ncine.vec4.sqrlength (vec) | Returns the squared length of the vector |
ncine.vec4.normalized (vec) | Returns a normalized version of the vector |
ncine.vec4.dot (vec0, vec1) | Returns the dot product between the two vectors |
Tables
ncine.vec4 | A three component vector |
Functions
- ncine.vec4.create (x, y, z, w)
-
Creates a vec4 table from its components
Parameters:
- x number The X component
- y number The Y component
- z number The Z component
- w number The W component
Returns:
- ncine.vec4.add (vec0, vec1)
-
Adds two vectors together, component-wise
Parameters:
- vec0 ncine.vec4
- vec1 ncine.vec4
Returns:
- ncine.vec4.add (vec0, scalar)
-
Adds a scalar to the vector components
Parameters:
- vec0 ncine.vec4
- scalar number
Returns:
- ncine.vec4.sub (vec0, vec1)
-
Subtracts the second vector from the first one, component-wise
Parameters:
- vec0 ncine.vec4
- vec1 ncine.vec4
Returns:
- ncine.vec4.sub (vec, scalar)
-
Subtracts the scalar from the vector components
Parameters:
- vec ncine.vec4
- scalar number
Returns:
- ncine.vec4.mul (vec0, vec1)
-
Multiplies two vectors together, component-wise
Parameters:
- vec0 ncine.vec4
- vec1 ncine.vec4
Returns:
- ncine.vec4.mul (vec, scalar)
-
Multiplies the vector components by the scalar
Parameters:
- vec ncine.vec4
- scalar number
Returns:
- ncine.vec4.div (vec0, vec1)
-
Divides the first vector by the second one, component-wise
Parameters:
- vec0 ncine.vec4
- vec1 ncine.vec4
Returns:
- ncine.vec4.div (vec, scalar)
-
Divides the vector components by the scalar
Parameters:
- vec ncine.vec4
- scalar number
Returns:
- ncine.vec4.length (vec)
-
Returns the length of the vector
Parameters:
- vec ncine.vec4
Returns:
-
number
- ncine.vec4.sqrlength (vec)
-
Returns the squared length of the vector
Parameters:
- vec ncine.vec4
Returns:
-
number
- ncine.vec4.normalized (vec)
-
Returns a normalized version of the vector
Parameters:
- vec ncine.vec4
Returns:
- ncine.vec4.dot (vec0, vec1)
-
Returns the dot product between the two vectors
Parameters:
- vec0 ncine.vec4
- vec1 ncine.vec4
Returns:
-
number