Home

Library goog.vec.Vec2

Function Summary
add(?goog.vec.Vec2.AnyType vec0, ?goog.vec.Vec2.AnyType vec1, ?goog.vec.Vec2.AnyType resultVec) ⇒ !goog.vec.Vec2.AnyType

Performs a component-wise addition of vec0 and vec1 together storing the result into resultVec.

createFloat32() ⇒ !goog.vec.Vec2.Float32

Creates a 2 element vector of Float32. The array is initialized to zero.

createFloat32FromArray(?goog.vec.Vec2.AnyType vec) ⇒ !goog.vec.Vec2.Float32

Creates a new 2 element FLoat32 vector initialized with the value from the given array.

createFloat32FromValues(number vec0, number vec1) ⇒ !goog.vec.Vec2.Float32

Creates a new 2 element Float32 vector initialized with the supplied values.

createFloat64() ⇒ !goog.vec.Vec2.Float64

Creates a 2 element vector of Float64. The array is initialized to zero.

createFloat64FromArray(?goog.vec.Vec2.AnyType vec) ⇒ !goog.vec.Vec2.Float64

Creates a new 2 element Float64 vector initialized with the value from the given array.

createFloat64FromValues(number vec0, number vec1) ⇒ !goog.vec.Vec2.Float64

Creates a new 2 element Float64 vector initialized with the supplied values.

createNumber() ⇒ !goog.vec.Vec2.Number

Creates a 2 element vector of Number. The array is initialized to zero.

direction(?goog.vec.Vec2.AnyType vec0, ?goog.vec.Vec2.AnyType vec1, ?goog.vec.Vec2.AnyType resultVec) ⇒ !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.

distance(?goog.vec.Vec2.AnyType vec0, ?goog.vec.Vec2.AnyType vec1) ⇒ number

Returns the distance between two points.

distanceSquared(?goog.vec.Vec2.AnyType vec0, ?goog.vec.Vec2.AnyType vec1) ⇒ number

Returns the squared distance between two points.

dot(?goog.vec.Vec2.AnyType vec0, ?goog.vec.Vec2.AnyType vec1) ⇒ number

Returns the scalar product of vectors vec0 and vec1.

equals(?goog.vec.Vec2.AnyType vec0, ?goog.vec.Vec2.AnyType vec1) ⇒ boolean

Returns true if the components of vec0 are equal to the components of vec1.

lerp(?goog.vec.Vec2.AnyType vec0, ?goog.vec.Vec2.AnyType vec1, number f, ?goog.vec.Vec2.AnyType resultVec) ⇒ !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.

magnitude(?goog.vec.Vec2.AnyType vec0) ⇒ number

Returns the magnitude of the given vector.

magnitudeSquared(?goog.vec.Vec2.AnyType vec0) ⇒ number

Returns the magnitudeSquared of the given vector.

negate(?goog.vec.Vec2.AnyType vec0, ?goog.vec.Vec2.AnyType resultVec) ⇒ !goog.vec.Vec2.AnyType

Negates vec0, storing the result into resultVec.

normalize(?goog.vec.Vec2.AnyType vec0, ?goog.vec.Vec2.AnyType resultVec) ⇒ !goog.vec.Vec2.AnyType

Normalizes the given vector storing the result into resultVec.

scale(?goog.vec.Vec2.AnyType vec0, number scalar, ?goog.vec.Vec2.AnyType resultVec) ⇒ !goog.vec.Vec2.AnyType

Multiplies each component of vec0 with scalar storing the product into resultVec.

setFromArray(?goog.vec.Vec2.AnyType vec, ?goog.vec.Vec2.AnyType values) ⇒ !goog.vec.Vec2.AnyType

Initializes the vector with the given array of values.

setFromValues(?goog.vec.Vec2.AnyType vec, number vec0, number vec1) ⇒ !goog.vec.Vec2.AnyType

Initializes the vector with the given values.

subtract(?goog.vec.Vec2.AnyType vec0, ?goog.vec.Vec2.AnyType vec1, ?goog.vec.Vec2.AnyType resultVec) ⇒ !goog.vec.Vec2.AnyType

Performs a component-wise subtraction of vec1 from vec0 storing the result into resultVec.