Documentation generator: JsDoc Toolkit 2.4.0
Template: Codeview 1.2
Generated on: 2012-11-19 0:05

Namespace SpiderGL.Math.Vec2

The SpiderGL.Math.Vec2 namespace defines operations on 2-dimensional vectors.

Namespace Summary
Constructor Attributes Constructor Name and Description
 
The SpiderGL.Math.Vec2 namespace.

Method Summary

Method Attributes Method Name and Description
<static>  
SpiderGL.Math.Vec2.abs(v)
Component-wise absolute value of a 2-dimensional vector.
<static>  
SpiderGL.Math.Vec2.acos(v)
Component-wise arccosine of a 2-dimensional vector.
<static>  
SpiderGL.Math.Vec2.add(u, v)
Component-wise addition of two 2-dimensional vectors.
<static>  
SpiderGL.Math.Vec2.add$(u, v)
In-place component-wise addition of two 2-dimensional vectors.
<static>  
SpiderGL.Math.Vec2.adds(v, s)
Component-wise addition of a 2-dimensional vector and a scalar.
<static>  
SpiderGL.Math.Vec2.adds$(v, s)
In-place component-wise addition of a 2-dimensional vector and a scalar.
<static>  
SpiderGL.Math.Vec2.asin(v)
Component-wise arcsine of a 2-dimensional vector.
<static>  
SpiderGL.Math.Vec2.atan(v)
Component-wise arctangent of a 2-dimensional vector.
<static>  
SpiderGL.Math.Vec2.atan2(y, x)
Component-wise arctangent of the quotient of two 2-dimensional vectors.
<static>  
SpiderGL.Math.Vec2.ceil(v)
Component-wise ceil of a 2-dimensional vector.
<static>  
SpiderGL.Math.Vec2.clamp(v, min, max)
Component-wise clamp of a 2-dimensional vector with vector bounds.
<static>  
SpiderGL.Math.Vec2.copy$(u, v)
In-place component-wise copy of two 2-dimensional vectors.
<static>  
SpiderGL.Math.Vec2.cos(v)
Component-wise cosine of a 2-dimensional vector.
<static>  
SpiderGL.Math.Vec2.cross(u, v)
Cross product of two 2-dimensional vectors.
<static>  
SpiderGL.Math.Vec2.degToRad(v)
Component-wise conversion of a 2-dimensional vector from degrees to radians.
<static>  
SpiderGL.Math.Vec2.div(u, v)
Component-wise division of two 2-dimensional vectors.
<static>  
SpiderGL.Math.Vec2.div$(u, v)
In-place component-wise division of two 2-dimensional vectors.
<static>  
SpiderGL.Math.Vec2.divs(v, s)
Component-wise division of a 2-dimensional vector by a scalar.
<static>  
SpiderGL.Math.Vec2.divs$(v, s)
In-place component-wise division of a 2-dimensional vector by a scalar.
<static>  
SpiderGL.Math.Vec2.dot(u, v)
Dot product of two 2-dimensional vectors.
<static>  
SpiderGL.Math.Vec2.dup(v)
Duplicates the input 2-dimensional vector.
<static>  
SpiderGL.Math.Vec2.exp(v)
Component-wise exponential of a 2-dimensional vector.
<static>  
SpiderGL.Math.Vec2.floor(v)
Component-wise floor of a 2-dimensional vector.
<static>  
SpiderGL.Math.Vec2.length(v)
Length of a 2-dimensional vector.
<static>  
SpiderGL.Math.Vec2.lerp(u, v, t)
Linear interpolation between two 2-dimensional vectors.
<static>  
SpiderGL.Math.Vec2.ln(v)
Component-wise natural (base E) logarithm of a 2-dimensional vector.
<static>  
SpiderGL.Math.Vec2.log(v)
Component-wise natural (base E) logarithm of a 2-dimensional vector.
<static>  
SpiderGL.Math.Vec2.log10(v)
Component-wise base 10 logarithm of a 2-dimensional vector.
<static>  
SpiderGL.Math.Vec2.log2(v)
Component-wise base 2 logarithm of a 2-dimensional vector.
<static>  
SpiderGL.Math.Vec2.max(u, v)
Component-wise maximum of two 2-dimensional vectors.
<static>  
SpiderGL.Math.Vec2.maxNumber()
Creates a 2-dimensional vector initialized with SpiderGL.Math.MAX_NUMBER.
<static>  
SpiderGL.Math.Vec2.min(u, v)
Component-wise minimum of two 2-dimensional vectors.
<static>  
SpiderGL.Math.Vec2.minNumber()
Creates a 2-dimensional vector initialized with SpiderGL.Math.MIN_NUMBER.
<static>  
SpiderGL.Math.Vec2.mul(u, v)
Component-wise multiplication of two 2-dimensional vectors.
<static>  
SpiderGL.Math.Vec2.mul$(u, v)
In-place component-wise multiplication of two 2-dimensional vectors.
<static>  
SpiderGL.Math.Vec2.muls(v, s)
Component-wise multiplication of a 2-dimensional vector and a scalar.
<static>  
SpiderGL.Math.Vec2.muls$(v, s)
In-place component-wise multiplication of a 2-dimensional vector and a scalar.
<static>  
SpiderGL.Math.Vec2.neg(v)
Component-wise negation of a 2-dimensional vector.
<static>  
SpiderGL.Math.Vec2.neg$(v)
In-place component-wise negation of a 2-dimensional vector.
<static>  
SpiderGL.Math.Vec2.normalize(v)
Creates a normalized 2-dimensional vector.
<static>  
SpiderGL.Math.Vec2.normalize$(v)
In-place 2-dimensional vector normalization.
<static>  
SpiderGL.Math.Vec2.one()
Creates a 2-dimensional vector initialized with one.
<static>  
SpiderGL.Math.Vec2.perp(v)
Perp operation.
<static>  
SpiderGL.Math.Vec2.perp$(v)
In-place perp operation.
<static>  
SpiderGL.Math.Vec2.pow(u, v)
Component-wise power of two 2-dimensional vectors.
<static>  
SpiderGL.Math.Vec2.radToDeg(v)
Component-wise conversion of a 2-dimensional vector from radians to degrees.
<static>  
SpiderGL.Math.Vec2.random()
Creates a random 2-dimensional vector between 0 and 1.
<static>  
SpiderGL.Math.Vec2.random01()
Creates a random 2-dimensional vector between 0 and 1.
<static>  
SpiderGL.Math.Vec2.random11()
Creates a random 2-dimensional vector between -1 and 1.
<static>  
SpiderGL.Math.Vec2.randomRange(min, max)
Creates a random 2-dimensional vector inside a range.
<static>  
SpiderGL.Math.Vec2.rcp(v)
Component-wise reciprocal of a 2-dimensional vector.
<static>  
SpiderGL.Math.Vec2.round(v)
Component-wise round of a 2-dimensional vector.
<static>  
SpiderGL.Math.Vec2.scalar(s)
Creates a 2-dimensional vector initialized with a scalar.
<static>  
SpiderGL.Math.Vec2.sdiv(s, v)
Component-wise division of a scalar by a 2-dimensional vector.
<static>  
SpiderGL.Math.Vec2.sdiv$(s, v)
In-place component-wise division of a scalar by a 2-dimensional.
<static>  
SpiderGL.Math.Vec2.sin(v)
Component-wise sine of a 2-dimensional vector.
<static>  
SpiderGL.Math.Vec2.sqLength(v)
Squared length of a 2-dimensional vector.
<static>  
SpiderGL.Math.Vec2.sqrt(v)
Component-wise square root of a 2-dimensional vector.
<static>  
SpiderGL.Math.Vec2.ssub(s, v)
Component-wise subtraction of a scalar and a 2-dimensional.
<static>  
SpiderGL.Math.Vec2.ssub$(s, v)
In-place component-wise subtraction of a scalar and a 2-dimensional vector.
<static>  
SpiderGL.Math.Vec2.sub(u, v)
Component-wise subtraction of two 2-dimensional vectors.
<static>  
SpiderGL.Math.Vec2.sub$(u, v)
In-place component-wise subtraction of two 2-dimensional vectors.
<static>  
SpiderGL.Math.Vec2.subs(v, s)
Component-wise subtraction of a 2-dimensional vector and a scalar.
<static>  
SpiderGL.Math.Vec2.subs$(v, s)
In-place component-wise subtraction of a 2-dimensional vector and a scalar.
<static>  
SpiderGL.Math.Vec2.tan(v)
Component-wise tangent root of a 2-dimensional vector.
<static>  
SpiderGL.Math.Vec2.to3(v, z)
Creates a 3-dimensional vector from a 2-dimensional vector.
<static>  
SpiderGL.Math.Vec2.to4(v, z, w)
Creates a 4-dimensional vector from a 2-dimensional vector.
<static>  
SpiderGL.Math.Vec2.zero()
Creates a 2-dimensional vector initialized with zero.

Namespace Detail

SpiderGL.Math.Vec2
The SpiderGL.Math.Vec2 namespace. The provided functions operate on 2-dimensional vectors, represented as standard JavaScript arrays of length 2. In general, vectors are considered as column vectors.

Method Detail

  • <static> {array} SpiderGL.Math.Vec2.abs(v)
    Component-wise absolute value of a 2-dimensional vector.
    Parameters:
    {array} v
    The input vector.
    Returns:
    {array} A new 2-dimensional array r, where r[i] = SpiderGL.Math.abs(v[i]).
  • <static> {array} SpiderGL.Math.Vec2.acos(v)
    Component-wise arccosine of a 2-dimensional vector.
    Parameters:
    {array} v
    The input vector.
    Returns:
    {array} A new 2-dimensional array r, where r[i] = SpiderGL.Math.acos(v[i]), in radians.
  • <static> {array} SpiderGL.Math.Vec2.add(u, v)
    Component-wise addition of two 2-dimensional vectors.
    Parameters:
    {array} u
    The first addition operand.
    {array} v
    The second addition operand.
    Returns:
    {array} A new 2-dimensionals vector r, where r[i] = u[i] + v[i].
  • <static> {array} SpiderGL.Math.Vec2.add$(u, v)
    In-place component-wise addition of two 2-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.Vec2.adds(v, s)
    Component-wise addition of a 2-dimensional vector and a scalar.
    Parameters:
    {array} v
    The vector addition operand.
    {number} s
    The scalar addition operand.
    Returns:
    {array} A new 2-dimensionals vector r, where r[i] = v[i] + s.
  • <static> {array} SpiderGL.Math.Vec2.adds$(v, s)
    In-place component-wise addition of a 2-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.Vec2.asin(v)
    Component-wise arcsine of a 2-dimensional vector.
    Parameters:
    {array} v
    The input vector.
    Returns:
    {array} A new 2-dimensional array r, where r[i] = SpiderGL.Math.asin(v[i]), in radians.
  • <static> {array} SpiderGL.Math.Vec2.atan(v)
    Component-wise arctangent of a 2-dimensional vector.
    Parameters:
    {array} v
    The input vector.
    Returns:
    {array} A new 2-dimensional array r, where r[i] = SpiderGL.Math.atan(v[i]), between -PI/2 and PI/2 radians.
  • <static> {array} SpiderGL.Math.Vec2.atan2(y, x)
    Component-wise arctangent of the quotient of two 2-dimensional vectors.
    Parameters:
    {array} y
    The numerator vector.
    {array} x
    The denominator vector.
    Returns:
    {array} A new 2-dimensional array r, where r[i] = SpiderGL.Math.atan2(y[i], x[i]), between PI and -PI radians.
  • <static> {array} SpiderGL.Math.Vec2.ceil(v)
    Component-wise ceil of a 2-dimensional vector.
    Parameters:
    {array} v
    The input vector.
    Returns:
    {array} A new 2-dimensional array r, where r[i] = SpiderGL.Math.ceil(v[i]).
  • <static> {array} SpiderGL.Math.Vec2.clamp(v, min, max)
    Component-wise clamp of a 2-dimensional vector with vector bounds.
    Parameters:
    {array} v
    The input vector.
    {array} min
    The lower 2-dimensional bound.
    {array} max
    The upper 2-dimensional bound.
    Returns:
    {array} A new 2-dimensional array r, where r[i] = SpiderGL.Math.clamp(v[i], min[i], max[i]).
  • <static> {array} SpiderGL.Math.Vec2.copy$(u, v)
    In-place component-wise copy of two 2-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.Vec2.cos(v)
    Component-wise cosine of a 2-dimensional vector.
    Parameters:
    {array} v
    The input vector, in radians.
    Returns:
    {array} A new 2-dimensional array r, where r[i] = SpiderGL.Math.cos(v[i]).
  • <static> {array} SpiderGL.Math.Vec2.cross(u, v)
    Cross product of two 2-dimensional vectors.
    Parameters:
    {array} u
    The first vector operand.
    {array} v
    The second vector operand.
    Returns:
    {array} A new 2-dimensional array equal to the cross product of u and v.
  • <static> {array} SpiderGL.Math.Vec2.degToRad(v)
    Component-wise conversion of a 2-dimensional vector from degrees to radians.
    Parameters:
    {array} v
    The input vector, in radians.
    Returns:
    {array} A new 2-dimensional array r, where r[i] = SpiderGL.Math.degToRad(v[i]).
  • <static> {array} SpiderGL.Math.Vec2.div(u, v)
    Component-wise division of two 2-dimensional vectors.
    Parameters:
    {array} u
    The numerator vector.
    {array} v
    The denominator vector.
    Returns:
    {array} A new 2-dimensionals vector r, where r[i] = u[i] / v[i].
  • <static> {array} SpiderGL.Math.Vec2.div$(u, v)
    In-place component-wise division of two 2-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.Vec2.divs(v, s)
    Component-wise division of a 2-dimensional vector by a scalar.
    Parameters:
    {array} v
    The numerator vector.
    {number} s
    The scalar denominator.
    Returns:
    {array} A new 2-dimensionals vector r, where r[i] = v[i] / s.
  • <static> {array} SpiderGL.Math.Vec2.divs$(v, s)
    In-place component-wise division of a 2-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.Vec2.dot(u, v)
    Dot product of two 2-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.Vec2.dup(v)
    Duplicates the input 2-dimensional vector.
    Parameters:
    {array} v
    The input vector.
    Returns:
    {array} A new 2-dimensional array r, where r[i] = v[i] (same as v.slice(0, 2)).
  • <static> {array} SpiderGL.Math.Vec2.exp(v)
    Component-wise exponential of a 2-dimensional vector.
    Parameters:
    {array} v
    The input vector.
    Returns:
    {array} A new 2-dimensional array r, where r[i] = SpiderGL.Math.exp(v[i]).
  • <static> {array} SpiderGL.Math.Vec2.floor(v)
    Component-wise floor of a 2-dimensional vector.
    Parameters:
    {array} v
    The input vector.
    Returns:
    {array} A new 2-dimensional array r, where r[i] = SpiderGL.Math.floor(v[i]).
  • <static> {number} SpiderGL.Math.Vec2.length(v)
    Length of a 2-dimensional vector.
    Parameters:
    {array} v
    The input vector.
    Returns:
    {number} The length of v.
  • <static> {array} SpiderGL.Math.Vec2.lerp(u, v, t)
    Linear interpolation between two 2-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 2-dimensional array r, where r[i] = (1-t)*u[i] + t*v[i].
  • <static> {array} SpiderGL.Math.Vec2.ln(v)
    Component-wise natural (base E) logarithm of a 2-dimensional vector. Same as SpiderGL.Math.Vec2.log.
    Parameters:
    {array} v
    The input vector.
    Returns:
    {array} A new 2-dimensional array r, where r[i] = SpiderGL.Math.ln(v[i]).
  • <static> {array} SpiderGL.Math.Vec2.log(v)
    Component-wise natural (base E) logarithm of a 2-dimensional vector.
    Parameters:
    {array} v
    The input vector.
    Returns:
    {array} A new 2-dimensional array r, where r[i] = SpiderGL.Math.log(v[i]).
  • <static> {array} SpiderGL.Math.Vec2.log10(v)
    Component-wise base 10 logarithm of a 2-dimensional vector.
    Parameters:
    {array} v
    The input vector.
    Returns:
    {array} A new 2-dimensional array r, where r[i] = SpiderGL.Math.log10(v[i]).
  • <static> {array} SpiderGL.Math.Vec2.log2(v)
    Component-wise base 2 logarithm of a 2-dimensional vector.
    Parameters:
    {array} v
    The input vector.
    Returns:
    {array} A new 2-dimensional array r, where r[i] = SpiderGL.Math.log2(v[i]).
  • <static> {array} SpiderGL.Math.Vec2.max(u, v)
    Component-wise maximum of two 2-dimensional vectors.
    Parameters:
    {array} u
    The first vector.
    {array} v
    The second vector.
    Returns:
    {array} A new 2-dimensional array r, where r[i] = SpiderGL.Math.max(u[i], v[i]).
  • <static> {array} SpiderGL.Math.Vec2.maxNumber()
    Creates a 2-dimensional vector initialized with SpiderGL.Math.MAX_NUMBER.
    Returns:
    {array} A new 2-dimensional array r, where r[i] = SpiderGL.Math.MAX_NUMBER.
  • <static> {array} SpiderGL.Math.Vec2.min(u, v)
    Component-wise minimum of two 2-dimensional vectors.
    Parameters:
    {array} u
    The first vector.
    {array} v
    The second vector.
    Returns:
    {array} A new 2-dimensional array r, where r[i] = SpiderGL.Math.min(u[i], v[i]).
  • <static> {array} SpiderGL.Math.Vec2.minNumber()
    Creates a 2-dimensional vector initialized with SpiderGL.Math.MIN_NUMBER.
    Returns:
    {array} A new 2-dimensional array r, where r[i] = SpiderGL.Math.MIN_NUMBER.
  • <static> {array} SpiderGL.Math.Vec2.mul(u, v)
    Component-wise multiplication of two 2-dimensional vectors.
    Parameters:
    {array} u
    The first multiplication operand.
    {array} v
    The second multiplication operand.
    Returns:
    {array} A new 2-dimensionals vector r, where r[i] = u[i] * v[i].
  • <static> {array} SpiderGL.Math.Vec2.mul$(u, v)
    In-place component-wise multiplication of two 2-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.Vec2.muls(v, s)
    Component-wise multiplication of a 2-dimensional vector and a scalar.
    Parameters:
    {array} v
    The vector multiplication operand.
    {number} s
    The scalar multiplication operand.
    Returns:
    {array} A new 2-dimensionals vector r, where r[i] = v[i] * s.
  • <static> {array} SpiderGL.Math.Vec2.muls$(v, s)
    In-place component-wise multiplication of a 2-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.Vec2.neg(v)
    Component-wise negation of a 2-dimensional vector.
    Parameters:
    {array} v
    The input vector.
    Returns:
    {array} A new 2-dimensionals vector r, where r[i] = -v[i].
  • <static> {array} SpiderGL.Math.Vec2.neg$(v)
    In-place component-wise negation of a 2-dimensional vector.
    Parameters:
    {array} v
    The input vector.
    Returns:
    {array} The input vector v, where v[i] = -v[i].
  • <static> {array} SpiderGL.Math.Vec2.normalize(v)
    Creates a normalized 2-dimensional vector.
    Parameters:
    {array} v
    The input vector.
    Returns:
    {array} A new 2-dimensional array r representing the normalized v, where r[i] = v[i] / SpiderGL.Math.Vec2.length(v).
  • <static> {array} SpiderGL.Math.Vec2.normalize$(v)
    In-place 2-dimensional vector normalization.
    Parameters:
    {array} v
    The input vector.
    Returns:
    {array} The input vector v, where v[i] = v[i] / SpiderGL.Math.Vec2.length(v).
  • <static> {array} SpiderGL.Math.Vec2.one()
    Creates a 2-dimensional vector initialized with one.
    Returns:
    {array} A new 2-dimensional array r, where r[i] = 1.0.
  • <static> {array} SpiderGL.Math.Vec2.perp(v)
    Perp operation. Returns a 2-dimensional vector which is orthogonal to the input vector and lies in the right halfspace.
    Parameters:
    {array} v
    The input vector.
    Returns:
    {array} A new 2-dimensional array r, where r = [v[1], -v[0]].
  • <static> {array} SpiderGL.Math.Vec2.perp$(v)
    In-place perp operation. Returns a 2-dimensional vector which is orthogonal to the input vector and lies in the right halfspace.
    Parameters:
    {array} v
    The input vector.
    Returns:
    {array} The input vector v, where v = [v[1], -v[0]].
  • <static> {array} SpiderGL.Math.Vec2.pow(u, v)
    Component-wise power of two 2-dimensional vectors.
    Parameters:
    {array} u
    The base vector.
    {array} v
    The exponent vector.
    Returns:
    {array} A new 2-dimensional array r, where r[i] = SpiderGL.Math.pow(u[i], v[i]).
  • <static> {array} SpiderGL.Math.Vec2.radToDeg(v)
    Component-wise conversion of a 2-dimensional vector from radians to degrees.
    Parameters:
    {array} v
    The input vector, in degrees.
    Returns:
    {array} A new 2-dimensional array r, where r[i] = SpiderGL.Math.pow(v[i]).
  • <static> {array} SpiderGL.Math.Vec2.random()
    Creates a random 2-dimensional vector between 0 and 1.
    Returns:
    {array} A new 2-dimensional array r, where r[i] = SpiderGL.Math.random().
  • <static> {array} SpiderGL.Math.Vec2.random01()
    Creates a random 2-dimensional vector between 0 and 1. Same as SpiderGL.Math.Vec2.random.
    Returns:
    {array} A new 2-dimensional array r, where r[i] = SpiderGL.Math.random01().
  • <static> {array} SpiderGL.Math.Vec2.random11()
    Creates a random 2-dimensional vector between -1 and 1.
    Returns:
    {array} A new 2-dimensional array r, where r[i] = SpiderGL.Math.random11().
  • <static> {array} SpiderGL.Math.Vec2.randomRange(min, max)
    Creates a random 2-dimensional vector inside a range.
    Parameters:
    {array} min
    The range vector lower bound.
    {array} max
    The range vector upper bound.
    Returns:
    {array} A new 2-dimensional array r, where r[i] = SpiderGL.Math.randomRange(min[i], max[i]).
  • <static> {array} SpiderGL.Math.Vec2.rcp(v)
    Component-wise reciprocal of a 2-dimensional vector.
    Parameters:
    {array} v
    The input (denominator) vector.
    Returns:
    {array} A new 2-dimensionals vector r, where r[i] = 1.0 / v[i].
  • <static> {array} SpiderGL.Math.Vec2.round(v)
    Component-wise round of a 2-dimensional vector.
    Parameters:
    {array} v
    The input vector.
    Returns:
    {array} A new 2-dimensional array r, where r[i] = SpiderGL.Math.round(v[i]).
  • <static> {array} SpiderGL.Math.Vec2.scalar(s)
    Creates a 2-dimensional vector initialized with a scalar.
    Parameters:
    {number} s
    The input scalar.
    Returns:
    {array} A new 2-dimensional array r, where r[i] = s.
  • <static> {array} SpiderGL.Math.Vec2.sdiv(s, v)
    Component-wise division of a scalar by a 2-dimensional vector.
    Parameters:
    {number} s
    The denominator scalar.
    {array} v
    The numerator vector.
    Returns:
    {array} A new 2-dimensionals vector r, where r[i] = s / v[i].
  • <static> {array} SpiderGL.Math.Vec2.sdiv$(s, v)
    In-place component-wise division of a scalar by a 2-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.Vec2.sin(v)
    Component-wise sine of a 2-dimensional vector.
    Parameters:
    {array} v
    The input vector, in radians.
    Returns:
    {array} A new 2-dimensional array r, where r[i] = SpiderGL.Math.sin(v[i]).
  • <static> {number} SpiderGL.Math.Vec2.sqLength(v)
    Squared length of a 2-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.Vec2.sqrt(v)
    Component-wise square root of a 2-dimensional vector.
    Parameters:
    {array} v
    The input vector.
    Returns:
    {array} A new 2-dimensional array r, where r[i] = SpiderGL.Math.sqrt(v[i]).
  • <static> {array} SpiderGL.Math.Vec2.ssub(s, v)
    Component-wise subtraction of a scalar and a 2-dimensional.
    Parameters:
    {number} s
    The scalar subtraction operand.
    {array} v
    The vector subtraction operand.
    Returns:
    {array} A new 2-dimensionals vector r, where r[i] = s - v[i].
  • <static> {array} SpiderGL.Math.Vec2.ssub$(s, v)
    In-place component-wise subtraction of a scalar and a 2-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.Vec2.sub(u, v)
    Component-wise subtraction of two 2-dimensional vectors.
    Parameters:
    {array} u
    The first subtraction operand.
    {array} v
    The second subtraction operand.
    Returns:
    {array} A new 2-dimensionals vector r, where r[i] = u[i] - v[i].
  • <static> {array} SpiderGL.Math.Vec2.sub$(u, v)
    In-place component-wise subtraction of two 2-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.Vec2.subs(v, s)
    Component-wise subtraction of a 2-dimensional vector and a scalar.
    Parameters:
    {array} v
    The vector subtraction operand.
    {number} s
    The scalar subtraction operand.
    Returns:
    {array} A new 2-dimensionals vector r, where r[i] = v[i] - s.
  • <static> {array} SpiderGL.Math.Vec2.subs$(v, s)
    In-place component-wise subtraction of a 2-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.Vec2.tan(v)
    Component-wise tangent root of a 2-dimensional vector.
    Parameters:
    {array} v
    The input vector, in radians.
    Returns:
    {array} A new 2-dimensional array r, where r[i] = SpiderGL.Math.tan(v[i]).
  • <static> {array} SpiderGL.Math.Vec2.to3(v, z)
    Creates a 3-dimensional vector from a 2-dimensional vector.
    Parameters:
    {array} v
    The input vector.
    {number} z Optional, Default: 0.0
    The 3th component.
    Returns:
    {array} A new 3-dimensional array r equal to v extended with z as 3rd component.
  • <static> {array} SpiderGL.Math.Vec2.to4(v, z, w)
    Creates a 4-dimensional vector from a 2-dimensional vector.
    Parameters:
    {array} v
    The input vector.
    {number} z Optional, Default: 0.0
    The 3th component.
    {number} w Optional, Default: 1.0
    The 4th component.
    Returns:
    {array} A new 4-dimensional array r equal to v extended with z as 3rd component and w as 4th component.
  • <static> {array} SpiderGL.Math.Vec2.zero()
    Creates a 2-dimensional vector initialized with zero.
    Returns:
    {array} A new 2-dimensional array r, where r[i] = 0.