goog.math.Coordinate
Classgoog.math.Coordinate(opt_x, opt_y)
Class for representing coordinates and positions.
opt_x
{number
=}
opt_y
{number
=}
.azimuth(a)
Returns the angle from the origin to a coordinate.
a
{!goog.math.Coordinate
}
number
}
.clone()
Returns a new copy of the coordinate.
goog.math.Coordinate
}
.difference(a, b)
Returns the difference between two coordinates as a new goog.math.Coordinate.
a
{!goog.math.Coordinate
}
b
{!goog.math.Coordinate
}
goog.math.Coordinate
}
.distance(a, b)
Returns the distance between two coordinates.
a
{!goog.math.Coordinate
}
b
{!goog.math.Coordinate
}
number
}
.equals(a, b)
Compares coordinates for equality.
a
{goog.math.Coordinate
}
b
{goog.math.Coordinate
}
boolean
}
.magnitude(a)
Returns the magnitude of a coordinate.
a
{!goog.math.Coordinate
}
number
}
.squaredDistance(a, b)
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.)
a
{!goog.math.Coordinate
}
b
{!goog.math.Coordinate
}
number
}
.sum(a, b)
Returns the sum of two coordinates as a new goog.math.Coordinate.
a
{!goog.math.Coordinate
}
b
{!goog.math.Coordinate
}
goog.math.Coordinate
}
.toString()
Returns a nice string representing the coordinate.
string
}
.x
{number
}X-value
.y
{number
}Y-value