Namespace SpiderGL.Math.Vec4
The SpiderGL.Math.Vec4 namespace defines operations on 4-dimensional vectors.
- Defined in: math.js
Constructor Attributes | Constructor Name and Description |
---|---|
The SpiderGL.Math.Vec4 namespace.
|
Method Summary
Method Attributes | Method Name and Description |
---|---|
<static> |
SpiderGL.Math.Vec4.abs(v)
Component-wise absolute value of a 4-dimensional vector.
|
<static> |
SpiderGL.Math.Vec4.acos(v)
Component-wise arccosine of a 4-dimensional vector.
|
<static> |
SpiderGL.Math.Vec4.add(u, v)
Component-wise addition of two 4-dimensional vectors.
|
<static> |
SpiderGL.Math.Vec4.add$(u, v)
In-place component-wise addition of two 4-dimensional vectors.
|
<static> |
SpiderGL.Math.Vec4.adds(v, s)
Component-wise addition of a 4-dimensional vector and a scalar.
|
<static> |
SpiderGL.Math.Vec4.adds$(v, s)
In-place component-wise addition of a 4-dimensional vector and a scalar.
|
<static> |
SpiderGL.Math.Vec4.asin(v)
Component-wise arcsine of a 4-dimensional vector.
|
<static> |
SpiderGL.Math.Vec4.atan(v)
Component-wise arctangent of a 4-dimensional vector.
|
<static> |
SpiderGL.Math.Vec4.atan2(y, x)
Component-wise arctangent of the quotient of two 4-dimensional vectors.
|
<static> |
SpiderGL.Math.Vec4.ceil(v)
Component-wise ceil of a 4-dimensional vector.
|
<static> |
SpiderGL.Math.Vec4.clamp(v, min, max)
Component-wise clamp of a 4-dimensional vector with vector bounds.
|
<static> |
SpiderGL.Math.Vec4.copy$(u, v)
In-place component-wise copy of two 4-dimensional vectors.
|
<static> |
SpiderGL.Math.Vec4.cos(v)
Component-wise cosine of a 4-dimensional vector.
|
<static> |
SpiderGL.Math.Vec4.cross(u, v, w)
Cross product of three 4-dimensional vectors.
|
<static> |
SpiderGL.Math.Vec4.degToRad(v)
Component-wise conversion of a 4-dimensional vector from degrees to radians.
|
<static> |
SpiderGL.Math.Vec4.div(u, v)
Component-wise division of two 4-dimensional vectors.
|
<static> |
SpiderGL.Math.Vec4.div$(u, v)
In-place component-wise division of two 4-dimensional vectors.
|
<static> |
SpiderGL.Math.Vec4.divs(v, s)
Component-wise division of a 4-dimensional vector by a scalar.
|
<static> |
SpiderGL.Math.Vec4.divs$(v, s)
In-place component-wise division of a 4-dimensional vector by a scalar.
|
<static> |
SpiderGL.Math.Vec4.dot(u, v)
Dot product of two 4-dimensional vectors.
|
<static> |
SpiderGL.Math.Vec4.dup(v)
Duplicates the input 4-dimensional vector.
|
<static> |
SpiderGL.Math.Vec4.exp(v)
Component-wise exponential of a 4-dimensional vector.
|
<static> |
SpiderGL.Math.Vec4.floor(v)
Component-wise floor of a 4-dimensional vector.
|
<static> |
SpiderGL.Math.Vec4.length(v)
Length of a 4-dimensional vector.
|
<static> |
SpiderGL.Math.Vec4.lerp(u, v, t)
Linear interpolation between two 4-dimensional vectors.
|
<static> |
SpiderGL.Math.Vec4.ln(v)
Component-wise natural (base E) logarithm of a 4-dimensional vector.
|
<static> |
SpiderGL.Math.Vec4.log(v)
Component-wise natural (base E) logarithm of a 4-dimensional vector.
|
<static> |
SpiderGL.Math.Vec4.log10(v)
Component-wise base 10 logarithm of a 4-dimensional vector.
|
<static> |
SpiderGL.Math.Vec4.log2(v)
Component-wise base 2 logarithm of a 4-dimensional vector.
|
<static> |
SpiderGL.Math.Vec4.max(u, v)
Component-wise maximum of two 4-dimensional vectors.
|
<static> |
SpiderGL.Math.Vec4.maxNumber()
Creates a 4-dimensional vector initialized with SpiderGL.Math.MAX_NUMBER.
|
<static> |
SpiderGL.Math.Vec4.min(u, v)
Component-wise minimum of two 4-dimensional vectors.
|
<static> |
SpiderGL.Math.Vec4.minNumber()
Creates a 4-dimensional vector initialized with SpiderGL.Math.MIN_NUMBER.
|
<static> |
SpiderGL.Math.Vec4.mul(u, v)
Component-wise multiplication of two 4-dimensional vectors.
|
<static> |
SpiderGL.Math.Vec4.mul$(u, v)
In-place component-wise multiplication of two 4-dimensional vectors.
|
<static> |
SpiderGL.Math.Vec4.muls(v, s)
Component-wise multiplication of a 4-dimensional vector and a scalar.
|
<static> |
SpiderGL.Math.Vec4.muls$(v, s)
In-place component-wise multiplication of a 4-dimensional vector and a scalar.
|
<static> |
SpiderGL.Math.Vec4.neg(v)
Component-wise negation of a 4-dimensional vector.
|
<static> |
SpiderGL.Math.Vec4.neg$(v)
In-place component-wise negation of a 4-dimensional vector.
|
<static> |
SpiderGL.Math.Vec4.normalize(v)
Creates a normalized 4-dimensional vector.
|
<static> |
SpiderGL.Math.Vec4.normalize$(v)
In-place 4-dimensional vector normalization.
|
<static> |
SpiderGL.Math.Vec4.one()
Creates a 4-dimensional vector initialized with one.
|
<static> |
SpiderGL.Math.Vec4.pow(u, v)
Component-wise power of two 4-dimensional vectors.
|
<static> |
SpiderGL.Math.Vec4.project(v)
Projects a homogeneous 4-dimensional vector.
|
<static> |
SpiderGL.Math.Vec4.radToDeg(v)
Component-wise conversion of a 4-dimensional vector from radians to degrees.
|
<static> |
SpiderGL.Math.Vec4.random()
Creates a random 4-dimensional vector between 0 and 1.
|
<static> |
SpiderGL.Math.Vec4.random01()
Creates a random 4-dimensional vector between 0 and 1.
|
<static> |
SpiderGL.Math.Vec4.random11()
Creates a random 4-dimensional vector between -1 and 1.
|
<static> |
SpiderGL.Math.Vec4.randomRange(min, max)
Creates a random 4-dimensional vector inside a range.
|
<static> |
SpiderGL.Math.Vec4.rcp(v)
Component-wise reciprocal of a 4-dimensional vector.
|
<static> |
SpiderGL.Math.Vec4.round(v)
Component-wise round of a 4-dimensional vector.
|
<static> |
SpiderGL.Math.Vec4.scalar(s)
Creates a 4-dimensional vector initialized with a scalar.
|
<static> |
SpiderGL.Math.Vec4.sdiv(s, v)
Component-wise division of a scalar by a 4-dimensional vector.
|
<static> |
SpiderGL.Math.Vec4.sdiv$(s, v)
In-place component-wise division of a scalar by a 4-dimensional.
|
<static> |
SpiderGL.Math.Vec4.sin(v)
Component-wise sine of a 4-dimensional vector.
|
<static> |
SpiderGL.Math.Vec4.sqLength(v)
Squared length of a 4-dimensional vector.
|
<static> |
SpiderGL.Math.Vec4.sqrt(v)
Component-wise square root of a 4-dimensional vector.
|
<static> |
SpiderGL.Math.Vec4.ssub(s, v)
Component-wise subtraction of a scalar and a 4-dimensional.
|
<static> |
SpiderGL.Math.Vec4.ssub$(s, v)
In-place component-wise subtraction of a scalar and a 4-dimensional vector.
|
<static> |
SpiderGL.Math.Vec4.sub(u, v)
Component-wise subtraction of two 4-dimensional vectors.
|
<static> |
SpiderGL.Math.Vec4.sub$(u, v)
In-place component-wise subtraction of two 4-dimensional vectors.
|
<static> |
SpiderGL.Math.Vec4.subs(v, s)
Component-wise subtraction of a 4-dimensional vector and a scalar.
|
<static> |
SpiderGL.Math.Vec4.subs$(v, s)
In-place component-wise subtraction of a 4-dimensional vector and a scalar.
|
<static> |
SpiderGL.Math.Vec4.tan(v)
Component-wise tangent root of a 4-dimensional vector.
|
<static> |
SpiderGL.Math.Vec4.to2(v)
Creates a 2-dimensional vector from a 4-dimensional vector.
|
<static> |
SpiderGL.Math.Vec4.to3(v)
Creates a 3-dimensional vector from a 4-dimensional vector.
|
<static> |
SpiderGL.Math.Vec4.zero()
Creates a 4-dimensional vector initialized with zero.
|
Namespace Detail
SpiderGL.Math.Vec4
The SpiderGL.Math.Vec4 namespace.
The provided functions operate on 4-dimensional vectors, represented as standard JavaScript arrays of length 4.
In general, vectors are considered as column vectors.
Method Detail
-
<static> {array} SpiderGL.Math.Vec4.abs(v)Component-wise absolute value of a 4-dimensional vector.
- Parameters:
- {array} v
- The input vector.
- Returns:
- {array} A new 4-dimensional array r, where r[i] = SpiderGL.Math.abs(v[i]).
-
<static> {array} SpiderGL.Math.Vec4.acos(v)Component-wise arccosine of a 4-dimensional vector.
- Parameters:
- {array} v
- The input vector.
- Returns:
- {array} A new 4-dimensional array r, where r[i] = SpiderGL.Math.acos(v[i]), in radians.
-
<static> {array} SpiderGL.Math.Vec4.add(u, v)Component-wise addition of two 4-dimensional vectors.
- Parameters:
- {array} u
- The first addition operand.
- {array} v
- The second addition operand.
- Returns:
- {array} A new 4-dimensionals vector r, where r[i] = u[i] + v[i].
-
<static> {array} SpiderGL.Math.Vec4.add$(u, v)In-place component-wise addition of two 4-dimensional vectors.
- Parameters:
- {array} u
- The first addition operand.
- {array} v
- The second addition operand
- Returns:
- {array} The input vector u, where u[i] = u[i] + v[i].
-
<static> {array} SpiderGL.Math.Vec4.adds(v, s)Component-wise addition of a 4-dimensional vector and a scalar.
- Parameters:
- {array} v
- The vector addition operand.
- {number} s
- The scalar addition operand.
- Returns:
- {array} A new 4-dimensionals vector r, where r[i] = v[i] + s.
-
<static> {array} SpiderGL.Math.Vec4.adds$(v, s)In-place component-wise addition of a 4-dimensional vector and a scalar.
- Parameters:
- {array} v
- The vector addition operand.
- {number} s
- The scalar addition operand
- Returns:
- {array} The input vector v, where v[i] = v[i] + s.
-
<static> {array} SpiderGL.Math.Vec4.asin(v)Component-wise arcsine of a 4-dimensional vector.
- Parameters:
- {array} v
- The input vector.
- Returns:
- {array} A new 4-dimensional array r, where r[i] = SpiderGL.Math.asin(v[i]), in radians.
-
<static> {array} SpiderGL.Math.Vec4.atan(v)Component-wise arctangent of a 4-dimensional vector.
- Parameters:
- {array} v
- The input vector.
- Returns:
- {array} A new 4-dimensional array r, where r[i] = SpiderGL.Math.atan(v[i]), between -PI/2 and PI/2 radians.
-
<static> {array} SpiderGL.Math.Vec4.atan2(y, x)Component-wise arctangent of the quotient of two 4-dimensional vectors.
- Parameters:
- {array} y
- The numerator vector.
- {array} x
- The denominator vector.
- Returns:
- {array} A new 4-dimensional array r, where r[i] = SpiderGL.Math.atan2(y[i], x[i]), between PI and -PI radians.
-
<static> {array} SpiderGL.Math.Vec4.ceil(v)Component-wise ceil of a 4-dimensional vector.
- Parameters:
- {array} v
- The input vector.
- Returns:
- {array} A new 4-dimensional array r, where r[i] = SpiderGL.Math.ceil(v[i]).
-
<static> {array} SpiderGL.Math.Vec4.clamp(v, min, max)Component-wise clamp of a 4-dimensional vector with vector bounds.
- Parameters:
- {array} v
- The input vector.
- {array} min
- The lower 4-dimensional bound.
- {array} max
- The upper 4-dimensional bound.
- Returns:
- {array} A new 4-dimensional array r, where r[i] = SpiderGL.Math.clamp(v[i], min[i], max[i]).
-
<static> {array} SpiderGL.Math.Vec4.copy$(u, v)In-place component-wise copy of two 4-dimensional vectors.
- Parameters:
- {array} u
- The destination vector.
- {array} v
- The source vector.
- Returns:
- {array} The destination vector u, where u[i] = v[i].
-
<static> {array} SpiderGL.Math.Vec4.cos(v)Component-wise cosine of a 4-dimensional vector.
- Parameters:
- {array} v
- The input vector, in radians.
- Returns:
- {array} A new 4-dimensional array r, where r[i] = SpiderGL.Math.cos(v[i]).
-
<static> {array} SpiderGL.Math.Vec4.cross(u, v, w)Cross product of three 4-dimensional vectors.
- Parameters:
- {array} u
- The first vector operand.
- {array} v
- The second vector operand.
- {array} w
- The third vector operand.
- Returns:
- {array} A new 4-dimensional array equal to the cross product of u, v and w.
-
<static> {array} SpiderGL.Math.Vec4.degToRad(v)Component-wise conversion of a 4-dimensional vector from degrees to radians.
- Parameters:
- {array} v
- The input vector, in radians.
- Returns:
- {array} A new 4-dimensional array r, where r[i] = SpiderGL.Math.degToRad(v[i]).
-
<static> {array} SpiderGL.Math.Vec4.div(u, v)Component-wise division of two 4-dimensional vectors.
- Parameters:
- {array} u
- The numerator vector.
- {array} v
- The denominator vector.
- Returns:
- {array} A new 4-dimensionals vector r, where r[i] = u[i] / v[i].
-
<static> {array} SpiderGL.Math.Vec4.div$(u, v)In-place component-wise division of two 4-dimensional vectors.
- Parameters:
- {array} u
- The numerator vector.
- {array} v
- The denominator vector.
- Returns:
- {array} The input vector u, where u[i] = u[i] / v[i].
-
<static> {array} SpiderGL.Math.Vec4.divs(v, s)Component-wise division of a 4-dimensional vector by a scalar.
- Parameters:
- {array} v
- The numerator vector.
- {number} s
- The scalar denominator.
- Returns:
- {array} A new 4-dimensionals vector r, where r[i] = v[i] / s.
-
<static> {array} SpiderGL.Math.Vec4.divs$(v, s)In-place component-wise division of a 4-dimensional vector by a scalar.
- Parameters:
- {array} v
- The numerator vector.
- {number} s
- The scalar denominator.
- Returns:
- {array} The input vector v, where v[i] = v[i] / s.
-
<static> {number} SpiderGL.Math.Vec4.dot(u, v)Dot product of two 4-dimensional vectors.
- Parameters:
- {array} u
- The first vector operand.
- {array} v
- The second vector operand.
- Returns:
- {number} The dot product of u and v.
-
<static> {array} SpiderGL.Math.Vec4.dup(v)Duplicates the input 4-dimensional vector.
- Parameters:
- {array} v
- The input vector.
- Returns:
- {array} A new 4-dimensional array r, where r[i] = v[i] (same as v.slice(0, 4)).
-
<static> {array} SpiderGL.Math.Vec4.exp(v)Component-wise exponential of a 4-dimensional vector.
- Parameters:
- {array} v
- The input vector.
- Returns:
- {array} A new 4-dimensional array r, where r[i] = SpiderGL.Math.exp(v[i]).
-
<static> {array} SpiderGL.Math.Vec4.floor(v)Component-wise floor of a 4-dimensional vector.
- Parameters:
- {array} v
- The input vector.
- Returns:
- {array} A new 4-dimensional array r, where r[i] = SpiderGL.Math.floor(v[i]).
-
<static> {number} SpiderGL.Math.Vec4.length(v)Length of a 4-dimensional vector.
- Parameters:
- {array} v
- The input vector.
- Returns:
- {number} The length of v.
-
<static> {array} SpiderGL.Math.Vec4.lerp(u, v, t)Linear interpolation between two 4-dimensional vectors.
- Parameters:
- {array} u
- The start interpolation bound.
- {array} v
- The stop interpolation bound.
- {number} t
- The interpolation factor, between 0 and 1.
- Returns:
- {array} A new 4-dimensional array r, where r[i] = (1-t)*u[i] + t*v[i].
-
<static> {array} SpiderGL.Math.Vec4.ln(v)Component-wise natural (base E) logarithm of a 4-dimensional vector. Same as SpiderGL.Math.Vec4.log.
- Parameters:
- {array} v
- The input vector.
- Returns:
- {array} A new 4-dimensional array r, where r[i] = SpiderGL.Math.ln(v[i]).
-
<static> {array} SpiderGL.Math.Vec4.log(v)Component-wise natural (base E) logarithm of a 4-dimensional vector.
- Parameters:
- {array} v
- The input vector.
- Returns:
- {array} A new 4-dimensional array r, where r[i] = SpiderGL.Math.log(v[i]).
-
<static> {array} SpiderGL.Math.Vec4.log10(v)Component-wise base 10 logarithm of a 4-dimensional vector.
- Parameters:
- {array} v
- The input vector.
- Returns:
- {array} A new 4-dimensional array r, where r[i] = SpiderGL.Math.log10(v[i]).
-
<static> {array} SpiderGL.Math.Vec4.log2(v)Component-wise base 2 logarithm of a 4-dimensional vector.
- Parameters:
- {array} v
- The input vector.
- Returns:
- {array} A new 4-dimensional array r, where r[i] = SpiderGL.Math.log2(v[i]).
-
<static> {array} SpiderGL.Math.Vec4.max(u, v)Component-wise maximum of two 4-dimensional vectors.
- Parameters:
- {array} u
- The first vector.
- {array} v
- The second vector.
- Returns:
- {array} A new 4-dimensional array r, where r[i] = SpiderGL.Math.max(u[i], v[i]).
-
<static> {array} SpiderGL.Math.Vec4.maxNumber()Creates a 4-dimensional vector initialized with SpiderGL.Math.MAX_NUMBER.
- Returns:
- {array} A new 4-dimensional array r, where r[i] = SpiderGL.Math.MAX_NUMBER.
-
<static> {array} SpiderGL.Math.Vec4.min(u, v)Component-wise minimum of two 4-dimensional vectors.
- Parameters:
- {array} u
- The first vector.
- {array} v
- The second vector.
- Returns:
- {array} A new 4-dimensional array r, where r[i] = SpiderGL.Math.min(u[i], v[i]).
-
<static> {array} SpiderGL.Math.Vec4.minNumber()Creates a 4-dimensional vector initialized with SpiderGL.Math.MIN_NUMBER.
- Returns:
- {array} A new 4-dimensional array r, where r[i] = SpiderGL.Math.MIN_NUMBER.
-
<static> {array} SpiderGL.Math.Vec4.mul(u, v)Component-wise multiplication of two 4-dimensional vectors.
- Parameters:
- {array} u
- The first multiplication operand.
- {array} v
- The second multiplication operand.
- Returns:
- {array} A new 4-dimensionals vector r, where r[i] = u[i] * v[i].
-
<static> {array} SpiderGL.Math.Vec4.mul$(u, v)In-place component-wise multiplication of two 4-dimensional vectors.
- Parameters:
- {array} u
- The first multiplication operand.
- {array} v
- The second multiplication operand
- Returns:
- {array} The input vector u, where u[i] = u[i] * v[i].
-
<static> {array} SpiderGL.Math.Vec4.muls(v, s)Component-wise multiplication of a 4-dimensional vector and a scalar.
- Parameters:
- {array} v
- The vector multiplication operand.
- {number} s
- The scalar multiplication operand.
- Returns:
- {array} A new 4-dimensionals vector r, where r[i] = v[i] * s.
-
<static> {array} SpiderGL.Math.Vec4.muls$(v, s)In-place component-wise multiplication of a 4-dimensional vector and a scalar.
- Parameters:
- {array} v
- The first multiplication operand.
- {number} s
- The second multiplication operand
- Returns:
- {array} The input vector v, where v[i] = v[i] * s.
-
<static> {array} SpiderGL.Math.Vec4.neg(v)Component-wise negation of a 4-dimensional vector.
- Parameters:
- {array} v
- The input vector.
- Returns:
- {array} A new 4-dimensionals vector r, where r[i] = -v[i].
-
<static> {array} SpiderGL.Math.Vec4.neg$(v)In-place component-wise negation of a 4-dimensional vector.
- Parameters:
- {array} v
- The input vector.
- Returns:
- {array} The input vector v, where v[i] = -v[i].
-
<static> {array} SpiderGL.Math.Vec4.normalize(v)Creates a normalized 4-dimensional vector.
- Parameters:
- {array} v
- The input vector.
- Returns:
- {array} A new 4-dimensional array r representing the normalized v, where r[i] = v[i] / SpiderGL.Math.Vec4.length(v).
-
<static> {array} SpiderGL.Math.Vec4.normalize$(v)In-place 4-dimensional vector normalization.
- Parameters:
- {array} v
- The input vector.
- Returns:
- {array} The input vector v, where v[i] = v[i] / SpiderGL.Math.Vec4.length(v)
-
<static> {array} SpiderGL.Math.Vec4.one()Creates a 4-dimensional vector initialized with one.
- Returns:
- {array} A new 4-dimensional array r, where r[i] = 1.0.
-
<static> {array} SpiderGL.Math.Vec4.pow(u, v)Component-wise power of two 4-dimensional vectors.
- Parameters:
- {array} u
- The base vector.
- {array} v
- The exponent vector.
- Returns:
- {array} A new 4-dimensional array r, where r[i] = SpiderGL.Math.pow(u[i], v[i]).
-
<static> {array} SpiderGL.Math.Vec4.project(v)Projects a homogeneous 4-dimensional vector.
- Parameters:
- {array} v
- The input vector.
- Returns:
- {array} A new 4-dimensional array r, where r[i] = v[i] / v[3].
-
<static> {array} SpiderGL.Math.Vec4.radToDeg(v)Component-wise conversion of a 4-dimensional vector from radians to degrees.
- Parameters:
- {array} v
- The input vector, in degrees.
- Returns:
- {array} A new 4-dimensional array r, where r[i] = SpiderGL.Math.pow(v[i]).
-
<static> {array} SpiderGL.Math.Vec4.random()Creates a random 4-dimensional vector between 0 and 1.
- Returns:
- {array} A new 4-dimensional array r, where r[i] = SpiderGL.Math.random().
-
<static> {array} SpiderGL.Math.Vec4.random01()Creates a random 4-dimensional vector between 0 and 1. Same as SpiderGL.Math.Vec4.random.
- Returns:
- {array} A new 4-dimensional array r, where r[i] = SpiderGL.Math.random01().
-
<static> {array} SpiderGL.Math.Vec4.random11()Creates a random 4-dimensional vector between -1 and 1.
- Returns:
- {array} A new 4-dimensional array r, where r[i] = SpiderGL.Math.random11().
-
<static> {array} SpiderGL.Math.Vec4.randomRange(min, max)Creates a random 4-dimensional vector inside a range.
- Parameters:
- {array} min
- The range vector lower bound.
- {array} max
- The range vector upper bound.
- Returns:
- {array} A new 4-dimensional array r, where r[i] = SpiderGL.Math.randomRange(min[i], max[i]).
-
<static> {array} SpiderGL.Math.Vec4.rcp(v)Component-wise reciprocal of a 4-dimensional vector.
- Parameters:
- {array} v
- The input (denominator) vector.
- Returns:
- {array} A new 4-dimensionals vector r, where r[i] = 1.0 / v[i].
-
<static> {array} SpiderGL.Math.Vec4.round(v)Component-wise round of a 4-dimensional vector.
- Parameters:
- {array} v
- The input vector.
- Returns:
- {array} A new 4-dimensional array r, where r[i] = SpiderGL.Math.round(v[i]).
-
<static> {array} SpiderGL.Math.Vec4.scalar(s)Creates a 4-dimensional vector initialized with a scalar.
- Parameters:
- {number} s
- The input scalar.
- Returns:
- {array} A new 4-dimensional array r, where r[i] = s.
-
<static> {array} SpiderGL.Math.Vec4.sdiv(s, v)Component-wise division of a scalar by a 4-dimensional vector.
- Parameters:
- {number} s
- The denominator scalar.
- {array} v
- The numerator vector.
- Returns:
- {array} A new 4-dimensionals vector r, where r[i] = s / v[i].
-
<static> {array} SpiderGL.Math.Vec4.sdiv$(s, v)In-place component-wise division of a scalar by a 4-dimensional.
- Parameters:
- {number} s
- The scalar numerator.
- {array} v
- The denominator vector.
- Returns:
- {array} The input vector v, where v[i] = s / v[i].
-
<static> {array} SpiderGL.Math.Vec4.sin(v)Component-wise sine of a 4-dimensional vector.
- Parameters:
- {array} v
- The input vector, in radians.
- Returns:
- {array} A new 4-dimensional array r, where r[i] = SpiderGL.Math.sin(v[i]).
-
<static> {number} SpiderGL.Math.Vec4.sqLength(v)Squared length of a 4-dimensional vector.
- Parameters:
- {array} v
- The input vector.
- Returns:
- {number} The squared length of v, same as the dot product of v with itself.
-
<static> {array} SpiderGL.Math.Vec4.sqrt(v)Component-wise square root of a 4-dimensional vector.
- Parameters:
- {array} v
- The input vector.
- Returns:
- {array} A new 4-dimensional array r, where r[i] = SpiderGL.Math.sqrt(v[i]).
-
<static> {array} SpiderGL.Math.Vec4.ssub(s, v)Component-wise subtraction of a scalar and a 4-dimensional.
- Parameters:
- {number} s
- The scalar subtraction operand.
- {array} v
- The vector subtraction operand.
- Returns:
- {array} A new 4-dimensionals vector r, where r[i] = s - v[i].
-
<static> {array} SpiderGL.Math.Vec4.ssub$(s, v)In-place component-wise subtraction of a scalar and a 4-dimensional vector.
- Parameters:
- {number} s
- The scalar subtraction operand
- {array} v
- The vector subtraction operand.
- Returns:
- {array} The input vector v, where v[i] = s - v[i].
-
<static> {array} SpiderGL.Math.Vec4.sub(u, v)Component-wise subtraction of two 4-dimensional vectors.
- Parameters:
- {array} u
- The first subtraction operand.
- {array} v
- The second subtraction operand.
- Returns:
- {array} A new 4-dimensionals vector r, where r[i] = u[i] - v[i].
-
<static> {array} SpiderGL.Math.Vec4.sub$(u, v)In-place component-wise subtraction of two 4-dimensional vectors.
- Parameters:
- {array} u
- The first addition operand.
- {array} v
- The second addition operand
- Returns:
- {array} The input vector u, where u[i] = u[i] - v[i].
-
<static> {array} SpiderGL.Math.Vec4.subs(v, s)Component-wise subtraction of a 4-dimensional vector and a scalar.
- Parameters:
- {array} v
- The vector subtraction operand.
- {number} s
- The scalar subtraction operand.
- Returns:
- {array} A new 4-dimensionals vector r, where r[i] = v[i] - s.
-
<static> {array} SpiderGL.Math.Vec4.subs$(v, s)In-place component-wise subtraction of a 4-dimensional vector and a scalar.
- Parameters:
- {array} v
- The vector subtraction operand.
- {number} s
- The scalar subtraction operand
- Returns:
- {array} The input vector v, where v[i] = v[i] - s.
-
<static> {array} SpiderGL.Math.Vec4.tan(v)Component-wise tangent root of a 4-dimensional vector.
- Parameters:
- {array} v
- The input vector, in radians.
- Returns:
- {array} A new 4-dimensional array r, where r[i] = SpiderGL.Math.tan(v[i]).
-
<static> {array} SpiderGL.Math.Vec4.to2(v)Creates a 2-dimensional vector from a 4-dimensional vector.
- Parameters:
- {array} v
- The input vector.
- Returns:
- {array} A new 2-dimensional array r equal to v with the 3rd and 4th components dropped.
-
<static> {array} SpiderGL.Math.Vec4.to3(v)Creates a 3-dimensional vector from a 4-dimensional vector.
- Parameters:
- {array} v
- The input vector.
- Returns:
- {array} A new 3-dimensional array r equal to v with the 4th component dropped.
-
<static> {array} SpiderGL.Math.Vec4.zero()Creates a 4-dimensional vector initialized with zero.
- Returns:
- {array} A new 4-dimensional array r, where r[i] = 0.