goog.math.Coordinate | |
goog.math.Vec2 | goog.math.Coordinate |
x
: number
The x coordinate for the vector.
|
y
: number
The y coordinate for the vector.
|
Adds another vector to this vector in-place.
Arguments:
|
code » | ||
No description.
Returns: !goog.math.Vec2
A new vector with the same coordinates as this one.
|
code » | ||
Compares this vector with another for equality.
Arguments:
Returns: boolean
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: !goog.math.Vec2
The inverted vector.
|
code » | ||
Returns the magnitude of the vector measured from the origin.
Returns: number
The length of the vector.
|
code » | ||
Normalizes the current vector to have a magnitude of 1.
Returns: !goog.math.Vec2
The normalized vector.
|
code » | ||
Rotates this vector in-place by a given angle, specified in radians.
Arguments:
|
code » | ||
No description.
Returns: !goog.math.Vec2
This coordinate after scaling.
|
code » | ||
Returns the squared magnitude of the vector measured from the origin.
NOTE(brenneman): Leaving out the square root is not a significant
optimization in JavaScript.
Returns: number
The length of the vector, squared.
|
code » | ||
Subtracts another vector from this vector in-place.
Arguments:
|
code » |
Rounds the x and y fields to the next larger integer values.
Returns: !goog.math.Coordinate
This coordinate with ceil'd fields.
|
code » | |||
Returns a new copy of the coordinate.
Returns: !goog.math.Coordinate
A clone of this coordinate.
|
code » | |||
Rounds the x and y fields to the next smaller integer values.
Returns: !goog.math.Coordinate
This coordinate with floored fields.
|
code » | |||
![]()
Rotates this coordinate clockwise about the origin (or, optionally, the given
center) by the given angle, in degrees.
Arguments:
|
code » | |||
![]()
Rotates this coordinate clockwise about the origin (or, optionally, the given
center) by the given angle, in radians.
Arguments:
|
code » | |||
Rounds the x and y fields to the nearest integer values.
Returns: !goog.math.Coordinate
This coordinate with rounded fields.
|
code » | |||
Scales this coordinate by the given scale factors. The x and y values are
scaled by
sx and opt_sy respectively. If opt_sy
is not given, then sx is used for both x and y.
Arguments:
Returns: !goog.math.Coordinate
This coordinate after scaling.
|
code » | |||
Returns a nice string representing the coordinate.
Returns: string
In the form (50, 73).
|
code » | |||
Translates this box by the given offsets. If a
goog.math.Coordinate
is given, then the x and y values are translated by the coordinate's x and y.
Otherwise, x and y are translated by tx and opt_ty
respectively.
Arguments:
Returns: !goog.math.Coordinate
This coordinate after translating.
|
code » |
Returns the difference between two vectors as a new Vec2.
Arguments:
Returns: !goog.math.Vec2
The difference vector.
|
code » | ||||
Returns the distance between two vectors.
Arguments:
Returns: number
The distance.
|
code » | ||||
Returns the dot-product of two vectors.
Arguments:
Returns: number
The dot-product of the two vectors.
|
code » | ||||
Compares vectors for equality.
Arguments:
Returns: boolean
Whether the vectors have the same x and y coordinates.
|
code » | ||||
Returns a new Vec2 object from a given coordinate.
Arguments:
Returns: !goog.math.Vec2
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: !goog.math.Vec2
The interpolated vector.
|
code » | ||||
No description.
Returns: !goog.math.Vec2
A random vector inside the unit-disc.
|
code » | ||||
No description.
Returns: !goog.math.Vec2
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: !goog.math.Vec2
The rotated vector in a newly created instance.
|
code » | ||||
Returns the squared distance between two vectors.
Arguments:
Returns: number
The squared distance.
|
code » | ||||
Returns the sum of two vectors as a new Vec2.
Arguments:
Returns: !goog.math.Vec2
The sum vector.
|
code » |
![]()
No description.
|
Code » |