goog.vec.Vec2
Namespace.AnyType
.Float32
.Float64
.Number
.add(vec0, vec1, resultVec)
Performs a component-wise addition of vec0 and vec1 together storing the result into resultVec.
vec0
{goog.vec.Vec2.AnyType
}
vec1
{goog.vec.Vec2.AnyType
}
resultVec
{goog.vec.Vec2.AnyType
}
goog.vec.Vec2.AnyType
}
.cloneFloat32
Creates a clone of the given 2 element Float32 vector.
vec
{goog.vec.Vec2.Float32
}
goog.vec.Vec2.Float32
}
.cloneFloat64
Creates a clone of the given 2 element vector.
vec
{goog.vec.Vec2.Float64
}
goog.vec.Vec2.Float64
}
.createFloat32()
Creates a 2 element vector of Float32. The array is initialized to zero.
goog.vec.Vec2.Float32
}
.createFloat32FromArray(vec)
Creates a new 2 element FLoat32 vector initialized with the value from the given array.
vec
{goog.vec.Vec2.AnyType
}
goog.vec.Vec2.Float32
}
.createFloat32FromValues(vec0, vec1)
Creates a new 2 element Float32 vector initialized with the supplied values.
vec0
{number
}
vec1
{number
}
goog.vec.Vec2.Float32
}
.createFloat64()
Creates a 2 element vector of Float64. The array is initialized to zero.
goog.vec.Vec2.Float64
}
.createFloat64FromArray(vec)
Creates a new 2 element Float64 vector initialized with the value from the given array.
vec
{goog.vec.Vec2.AnyType
}
goog.vec.Vec2.Float64
}
.createFloat64FromValues(vec0, vec1)
Creates a new 2 element Float64 vector initialized with the supplied values.
vec0
{number
}
vec1
{number
}
goog.vec.Vec2.Float64
}
.createNumber()
Creates a 2 element vector of Number. The array is initialized to zero.
goog.vec.Vec2.Number
}
.direction(vec0, vec1, resultVec)
Returns a unit vector pointing from one point to another. If the input points are equal then the result will be all zeros.
vec0
{goog.vec.Vec2.AnyType
}
vec1
{goog.vec.Vec2.AnyType
}
resultVec
{goog.vec.Vec2.AnyType
}
goog.vec.Vec2.AnyType
}
.distance(vec0, vec1)
Returns the distance between two points.
vec0
{goog.vec.Vec2.AnyType
}
vec1
{goog.vec.Vec2.AnyType
}
number
}
.distanceSquared(vec0, vec1)
Returns the squared distance between two points.
vec0
{goog.vec.Vec2.AnyType
}
vec1
{goog.vec.Vec2.AnyType
}
number
}
.dot(vec0, vec1)
Returns the scalar product of vectors vec0 and vec1.
vec0
{goog.vec.Vec2.AnyType
}
vec1
{goog.vec.Vec2.AnyType
}
number
}
.equals(vec0, vec1)
Returns true if the components of vec0 are equal to the components of vec1.
vec0
{goog.vec.Vec2.AnyType
}
vec1
{goog.vec.Vec2.AnyType
}
boolean
}
.lerp(vec0, vec1, f, resultVec)
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.
vec0
{goog.vec.Vec2.AnyType
}
vec1
{goog.vec.Vec2.AnyType
}
f
{number
}
resultVec
{goog.vec.Vec2.AnyType
}
goog.vec.Vec2.AnyType
}
.magnitude(vec0)
Returns the magnitude of the given vector.
vec0
{goog.vec.Vec2.AnyType
}
number
}
.magnitudeSquared(vec0)
Returns the magnitudeSquared of the given vector.
vec0
{goog.vec.Vec2.AnyType
}
number
}
.negate(vec0, resultVec)
Negates vec0, storing the result into resultVec.
vec0
{goog.vec.Vec2.AnyType
}
resultVec
{goog.vec.Vec2.AnyType
}
goog.vec.Vec2.AnyType
}
.normalize(vec0, resultVec)
Normalizes the given vector storing the result into resultVec.
vec0
{goog.vec.Vec2.AnyType
}
resultVec
{goog.vec.Vec2.AnyType
}
goog.vec.Vec2.AnyType
}
.scale(vec0, scalar, resultVec)
Multiplies each component of vec0 with scalar storing the product into resultVec.
vec0
{goog.vec.Vec2.AnyType
}
scalar
{number
}
resultVec
{goog.vec.Vec2.AnyType
}
goog.vec.Vec2.AnyType
}
.setFromArray(vec, values)
Initializes the vector with the given array of values.
vec
{goog.vec.Vec2.AnyType
}
values
{goog.vec.Vec2.AnyType
}
goog.vec.Vec2.AnyType
}
.setFromValues(vec, vec0, vec1)
Initializes the vector with the given values.
vec
{goog.vec.Vec2.AnyType
}
vec0
{number
}
vec1
{number
}
goog.vec.Vec2.AnyType
}
.subtract(vec0, vec1, resultVec)
Performs a component-wise subtraction of vec1 from vec0 storing the result into resultVec.
vec0
{goog.vec.Vec2.AnyType
}
vec1
{goog.vec.Vec2.AnyType
}
resultVec
{goog.vec.Vec2.AnyType
}
goog.vec.Vec2.AnyType
}