| goog.math.Coordinate | |
| goog.math.Vec2 | goog.math.Coordinate |
|
x
:
The x coordinate for the vector.
|
|
y
:
The y coordinate for the vector.
|
|
Adds another vector to this vector in-place. Uses goog.math.Vec2.sum(a, b) to
return a new vector.
Arguments:
Returns:
This vector with
b added.
|
code » | ||
|
No description.
Returns:
A new vector with the same coordinates as this one.
|
code » | ||
|
Compares this vector with another for equality.
Arguments:
Returns:
Whether this vector has the same x and y as the given vector.
|
code » | ||
|
Reverses the sign of the vector. Equivalent to scaling the vector by -1.
Returns:
The inverted vector.
|
code » | ||
|
Returns the magnitude of the vector measured from the origin.
Returns:
The length of the vector.
|
code » | ||
|
Normalizes the current vector to have a magnitude of 1.
Returns:
The normalized vector.
|
code » | ||
|
Rotates this vector in-place by a given angle, specified in radians.
Arguments:
Returns:
This vector rotated
angle radians.
|
code » | ||
|
Scales the current vector by a constant.
Arguments:
Returns:
The scaled vector.
|
code » | ||
|
Returns the squared magnitude of the vector measured from the origin.
NOTE(user): Leaving out the square root is not a significant
optimization in JavaScript.
Returns:
The length of the vector, squared.
|
code » | ||
|
Subtracts another vector from this vector in-place. Uses
goog.math.Vec2.difference(a, b) to return a new vector.
Arguments:
Returns:
This vector with
b subtracted.
|
code » |
|
Returns the difference between two vectors as a new Vec2.
Arguments:
Returns:
The difference vector.
|
code » | ||||
|
Returns the distance between two vectors.
Arguments:
Returns:
The distance.
|
code » | ||||
|
Returns the dot-product of two vectors.
Arguments:
Returns:
The dot-product of the two vectors.
|
code » | ||||
|
Compares vectors for equality.
Arguments:
Returns:
Whether the vectors have the same x and y coordinates.
|
code » | ||||
|
Returns a new Vec2 object from a given coordinate.
Arguments:
Returns:
A new vector object.
|
code » | ||||
|
Returns a new Vec2 that is the linear interpolant between vectors a and b at
scale-value x.
Arguments:
Returns:
The interpolated vector.
|
code » | ||||
|
No description.
Returns:
A random vector inside the unit-disc.
|
code » | ||||
|
No description.
Returns:
A random unit-length vector.
|
code » | ||||
|
Rotates a vector by a given angle, specified in radians, relative to a given
axis rotation point. The returned vector is a newly created instance - no
in-place changes are done.
Arguments:
Returns:
The rotated vector in a newly created instance.
|
code » | ||||
|
Returns the squared distance between two vectors.
Arguments:
Returns:
The squared distance.
|
code » | ||||
|
Returns the sum of two vectors as a new Vec2.
Arguments:
Returns:
The sum vector.
|
code » |