math.Coordinate Extends Object
Class for representing coordinates and positions.

Inheritance

Object
     goog.math.Coordinate

Constructor

goog.math.Coordinate(opt_xopt_y)

Parameters

opt_x :
Left, defaults to 0.
opt_y :
Top, defaults to 0.

Instance Methods

Public Protected Private
clone()
Returns a new copy of the coordinate.
Returns:   A clone of this coordinate.
code »
toString()
Returns a nice string representing the coordinate.
Returns:   In the form (50, 73).
code »

Static Methods

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 »

Package math

Package Reference