coordinate.js
A utility class for representing two-dimensional positions.

File Location

math/coordinate.js

Classes

goog.math.Coordinate
Class for representing coordinates and positions.

Public Protected Private

Global Functions

goog.math.Coordinate.difference(ab)
Returns the difference between two coordinates as a new goog.math.Coordinate.
Arguments:
a :
A Coordinate.
b :
A Coordinate.
Returns:   A Coordinate representing the difference between {@code a} and {@code b}.
code »
goog.math.Coordinate.distance(ab)
Returns the distance between two coordinates.
Arguments:
a :
A Coordinate.
b :
A Coordinate.
Returns:   The distance between {@code a} and {@code b}.
code »
goog.math.Coordinate.equals(ab)
Compares coordinates for equality.
Arguments:
a :
A Coordinate.
b :
A Coordinate.
Returns:   True iff the coordinates are equal, or if both are null.
code »
goog.math.Coordinate.squaredDistance(ab)
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.)
Arguments:
a :
A Coordinate.
b :
A Coordinate.
Returns:   The squared distance between {@code a} and {@code b}.
code »
goog.math.Coordinate.sum(ab)
Returns the sum of two coordinates as a new goog.math.Coordinate.
Arguments:
a :
A Coordinate.
b :
A Coordinate.
Returns:   A Coordinate representing the sum of the two coordinates.
code »

Directory math

File Reference