goog.math.Coordinate
Instance Methods
this.ceil() → goog.math.Coordinate
goog.math.Coordinate
Rounds the x and y fields to the next larger integer values.
Parameters | None. | ||
---|---|---|---|
Returns |
|
this.clone() → goog.math.Coordinate
goog.math.Coordinate
Returns a new copy of the coordinate.
Parameters | None. | ||
---|---|---|---|
Returns |
|
this.equals( other ) → boolean
boolean
Returns whether the specified value is equal to this coordinate.
Parameters |
| ||||
---|---|---|---|---|---|
Returns |
|
this.floor() → goog.math.Coordinate
goog.math.Coordinate
Rounds the x and y fields to the next smaller integer values.
Parameters | None. | ||
---|---|---|---|
Returns |
|
this.rotateDegrees( degrees, opt_center ) → void
void
Rotates this coordinate clockwise about the origin (or, optionally, the given center) by the given angle, in degrees.
Parameters |
|
---|
this.rotateRadians( radians, opt_center ) → void
void
Rotates this coordinate clockwise about the origin (or, optionally, the given center) by the given angle, in radians.
Parameters |
|
---|
this.round() → goog.math.Coordinate
goog.math.Coordinate
Rounds the x and y fields to the nearest integer values.
Parameters | None. | ||
---|---|---|---|
Returns |
|
this.scale( sx, opt_sy ) → goog.math.Coordinate
goog.math.Coordinate
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.
Parameters |
| ||||||||
---|---|---|---|---|---|---|---|---|---|
Returns |
|
this.toString() → string
string
Returns a nice string representing the coordinate.
Parameters | None. | ||
---|---|---|---|
Returns |
|
this.translate( tx, opt_ty ) → goog.math.Coordinate
goog.math.Coordinate
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.
Parameters |
| ||||||||
---|---|---|---|---|---|---|---|---|---|
Returns |
|
Instance Properties
this.x → number
number
X-value
this.y → number
number
Y-value
Static Functions
Coordinate.azimuth( a ) → number
number
Returns the angle from the origin to a coordinate.
Parameters |
| ||||
---|---|---|---|---|---|
Returns |
|
Coordinate.difference( a, b ) → goog.math.Coordinate
goog.math.Coordinate
Returns the difference between two coordinates as a new goog.math.Coordinate.
Parameters |
| ||||||||
---|---|---|---|---|---|---|---|---|---|
Returns |
|
Coordinate.distance( a, b ) → number
number
Returns the distance between two coordinates.
Parameters |
| ||||||||
---|---|---|---|---|---|---|---|---|---|
Returns |
|
Coordinate.equals( a, b ) → boolean
boolean
Compares coordinates for equality.
Parameters |
| ||||||||
---|---|---|---|---|---|---|---|---|---|
Returns |
|
Coordinate.magnitude( a ) → number
number
Returns the magnitude of a coordinate.
Parameters |
| ||||
---|---|---|---|---|---|
Returns |
|
Coordinate.squaredDistance( a, b ) → number
number
Returns the squared distance between two coordinates. Squared distances can be used for comparisons when the actual value is not required.
Performance note: eliminating the square root is an optimization often used in lower-level languages, but the speed difference is not nearly as pronounced in JavaScript (only a few percent.)
Parameters |
| ||||||||
---|---|---|---|---|---|---|---|---|---|
Returns |
|
Coordinate.sum( a, b ) → goog.math.Coordinate
goog.math.Coordinate
Returns the sum of two coordinates as a new goog.math.Coordinate.
Parameters |
| ||||||||
---|---|---|---|---|---|---|---|---|---|
Returns |
|