vec.Vec2

Classes


Public Protected Private

Global Functions

goog.vec.Vec2.abs(vec0resultVec) !goog.vec.Vec2.AnyType
Takes the absolute value of each component of vec0 storing the result in resultVec.
Arguments:
vec0 : goog.vec.Vec2.AnyType
The source vector.
resultVec : goog.vec.Vec2.AnyType
The vector to receive the result. May be vec0.
Returns: !goog.vec.Vec2.AnyType  Return resultVec so that operations can be chained together.
code »
goog.vec.Vec2.add(vec0vec1resultVec) !goog.vec.Vec2.AnyType
Performs a component-wise addition of vec0 and vec1 together storing the result into resultVec.
Arguments:
vec0 : goog.vec.Vec2.AnyType
The first addend.
vec1 : goog.vec.Vec2.AnyType
The second addend.
resultVec : goog.vec.Vec2.AnyType
The vector to receive the result. May be vec0 or vec1.
Returns: !goog.vec.Vec2.AnyType  Return resultVec so that operations can be chained together.
code »
goog.vec.Vec2.cloneFloat32(vec) !goog.vec.Vec2.Float32
Creates a clone of the given 2 element Float32 vector.
Arguments:
vec : goog.vec.Vec2.Float32
The source 2 element vector.
Returns: !goog.vec.Vec2.Float32  The new cloned vector.
code »
goog.vec.Vec2.cloneFloat64(vec) !goog.vec.Vec2.Float64
Creates a clone of the given 2 element vector.
Arguments:
vec : goog.vec.Vec2.Float64
The source 2 element vector.
Returns: !goog.vec.Vec2.Float64  The new cloned vector.
code »
goog.vec.Vec2.createFloat32() !goog.vec.Vec2.Float32
Creates a 2 element vector of Float32. The array is initialized to zero.
Returns: !goog.vec.Vec2.Float32  The new 2 element array.
code »
goog.vec.Vec2.createFloat32FromArray(vec) !goog.vec.Vec2.Float32
Creates a new 2 element FLoat32 vector initialized with the value from the given array.
Arguments:
vec : goog.vec.Vec2.AnyType
The source 2 element array.
Returns: !goog.vec.Vec2.Float32  The new 2 element array.
code »
goog.vec.Vec2.createFloat32FromValues(vec0vec1) !goog.vec.Vec2.Float32
Creates a new 2 element Float32 vector initialized with the supplied values.
Arguments:
vec0 : number
The value for element at index 0.
vec1 : number
The value for element at index 1.
Returns: !goog.vec.Vec2.Float32  The new vector.
code »
goog.vec.Vec2.createFloat64() !goog.vec.Vec2.Float64
Creates a 2 element vector of Float64. The array is initialized to zero.
Returns: !goog.vec.Vec2.Float64  The new 2 element array.
code »
goog.vec.Vec2.createFloat64FromArray(vec) !goog.vec.Vec2.Float64
Creates a new 2 element Float64 vector initialized with the value from the given array.
Arguments:
vec : goog.vec.Vec2.AnyType
The source 2 element array.
Returns: !goog.vec.Vec2.Float64  The new 2 element array.
code »
goog.vec.Vec2.createFloat64FromValues(vec0vec1) !goog.vec.Vec2.Float64
Creates a new 2 element Float64 vector initialized with the supplied values.
Arguments:
vec0 : number
The value for element at index 0.
vec1 : number
The value for element at index 1.
Returns: !goog.vec.Vec2.Float64  The new vector.
code »
goog.vec.Vec2.createNumber() !goog.vec.Vec2.Number
Creates a 2 element vector of Number. The array is initialized to zero.
Returns: !goog.vec.Vec2.Number  The new 2 element array.
code »
goog.vec.Vec2.direction(vec0vec1resultVec) !goog.vec.Vec2.AnyType
Returns a unit vector pointing from one point to another. If the input points are equal then the result will be all zeros.
Arguments:
vec0 : goog.vec.Vec2.AnyType
Origin point.
vec1 : goog.vec.Vec2.AnyType
Target point.
resultVec : goog.vec.Vec2.AnyType
The vector to receive the results (may be vec0 or vec1).
Returns: !goog.vec.Vec2.AnyType  Return resultVec so that operations can be chained together.
code »
goog.vec.Vec2.distance(vec0vec1) number
Returns the distance between two points.
Arguments:
vec0 : goog.vec.Vec2.AnyType
First point.
vec1 : goog.vec.Vec2.AnyType
Second point.
Returns: number  The distance between the points.
code »
goog.vec.Vec2.distanceSquared(vec0vec1) number
Returns the squared distance between two points.
Arguments:
vec0 : goog.vec.Vec2.AnyType
First point.
vec1 : goog.vec.Vec2.AnyType
Second point.
Returns: number  The squared distance between the points.
code »
goog.vec.Vec2.dot(vec0vec1) number
Returns the scalar product of vectors vec0 and vec1.
Arguments:
vec0 : goog.vec.Vec2.AnyType
The first vector.
vec1 : goog.vec.Vec2.AnyType
The second vector.
Returns: number  The scalar product.
code »
goog.vec.Vec2.equals(vec0vec1) boolean
Returns true if the components of vec0 are equal to the components of vec1.
Arguments:
vec0 : goog.vec.Vec2.AnyType
The first vector.
vec1 : goog.vec.Vec2.AnyType
The second vector.
Returns: boolean  True if the vectors are equal, false otherwise.
code »
goog.vec.Vec2.lerp(vec0vec1fresultVec) !goog.vec.Vec2.AnyType
Linearly interpolate from vec0 to vec1 according to f. The value of f should be in the range [0..1] otherwise the results are undefined.
Arguments:
vec0 : goog.vec.Vec2.AnyType
The first vector.
vec1 : goog.vec.Vec2.AnyType
The second vector.
f : number
The interpolation factor.
resultVec : goog.vec.Vec2.AnyType
The vector to receive the results (may be vec0 or vec1).
Returns: !goog.vec.Vec2.AnyType  Return resultVec so that operations can be chained together.
code »
goog.vec.Vec2.magnitude(vec0) number
Returns the magnitude of the given vector.
Arguments:
vec0 : goog.vec.Vec2.AnyType
The vector.
Returns: number  The magnitude of the vector.
code »
goog.vec.Vec2.magnitudeSquared(vec0) number
Returns the magnitudeSquared of the given vector.
Arguments:
vec0 : goog.vec.Vec2.AnyType
The vector.
Returns: number  The magnitude of the vector.
code »
goog.vec.Vec2.max(vec0limitresultVec) !goog.vec.Vec2.AnyType
Compares the components of vec0 with the components of another vector or scalar, storing the larger values in resultVec.
Arguments:
vec0 : goog.vec.Vec2.AnyType
The source vector.
limit : goog.vec.Vec2.AnyType | number
The limit vector or scalar.
resultVec : goog.vec.Vec2.AnyType
The vector to receive the results (may be vec0 or limit).
Returns: !goog.vec.Vec2.AnyType  Return resultVec so that operations can be chained together.
code »
goog.vec.Vec2.min(vec0limitresultVec) !goog.vec.Vec2.AnyType
Compares the components of vec0 with the components of another vector or scalar, storing the smaller values in resultVec.
Arguments:
vec0 : goog.vec.Vec2.AnyType
The source vector.
limit : goog.vec.Vec2.AnyType | number
The limit vector or scalar.
resultVec : goog.vec.Vec2.AnyType
The vector to receive the results (may be vec0 or limit).
Returns: !goog.vec.Vec2.AnyType  Return resultVec so that operations can be chained together.
code »
goog.vec.Vec2.negate(vec0resultVec) !goog.vec.Vec2.AnyType
Negates vec0, storing the result into resultVec.
Arguments:
vec0 : goog.vec.Vec2.AnyType
The vector to negate.
resultVec : goog.vec.Vec2.AnyType
The vector to receive the result. May be vec0.
Returns: !goog.vec.Vec2.AnyType  Return resultVec so that operations can be chained together.
code »
goog.vec.Vec2.normalize(vec0resultVec) !goog.vec.Vec2.AnyType
Normalizes the given vector storing the result into resultVec.
Arguments:
vec0 : goog.vec.Vec2.AnyType
The vector to normalize.
resultVec : goog.vec.Vec2.AnyType
The vector to receive the result. May be vec0.
Returns: !goog.vec.Vec2.AnyType  Return resultVec so that operations can be chained together.
code »
goog.vec.Vec2.scale(vec0scalarresultVec) !goog.vec.Vec2.AnyType
Multiplies each component of vec0 with scalar storing the product into resultVec.
Arguments:
vec0 : goog.vec.Vec2.AnyType
The source vector.
scalar : number
The value to multiply with each component of vec0.
resultVec : goog.vec.Vec2.AnyType
The vector to receive the result. May be vec0.
Returns: !goog.vec.Vec2.AnyType  Return resultVec so that operations can be chained together.
code »
goog.vec.Vec2.setFromArray(vecvalues) !goog.vec.Vec2.AnyType
Initializes the vector with the given array of values.
Arguments:
vec : goog.vec.Vec2.AnyType
The vector to receive the values.
values : goog.vec.Vec2.AnyType
The array of values.
Returns: !goog.vec.Vec2.AnyType  Return vec so that operations can be chained together.
code »
goog.vec.Vec2.setFromValues(vecvec0vec1) !goog.vec.Vec2.AnyType
Initializes the vector with the given values.
Arguments:
vec : goog.vec.Vec2.AnyType
The vector to receive the values.
vec0 : number
The value for element at index 0.
vec1 : number
The value for element at index 1.
Returns: !goog.vec.Vec2.AnyType  Return vec so that operations can be chained together.
code »
goog.vec.Vec2.subtract(vec0vec1resultVec) !goog.vec.Vec2.AnyType
Performs a component-wise subtraction of vec1 from vec0 storing the result into resultVec.
Arguments:
vec0 : goog.vec.Vec2.AnyType
The minuend.
vec1 : goog.vec.Vec2.AnyType
The subtrahend.
resultVec : goog.vec.Vec2.AnyType
The vector to receive the result. May be vec0 or vec1.
Returns: !goog.vec.Vec2.AnyType  Return resultVec so that operations can be chained together.
code »

Global Properties

goog.vec.Vec2.AnyType :
No description.
Code »
goog.vec.Vec2.Float32 :
No description.
Code »
goog.vec.Vec2.Float64 :
No description.
Code »
goog.vec.Vec2.Number :
No description.
Code »

Package vec

Package Reference