Coordinate class

Class for representing coordinates and positions. @param {number=} opt_x Left, defaults to 0. @param {number=} opt_y Top, defaults to 0. @struct @constructor

Implemented types

Constructors

Coordinate([double x = 0, double y = 0])

Properties

hashCode int
The hash code for this object.
no setteroverride
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
x double
getter/setter pair
y double
getter/setter pair

Methods

ceil() Coordinate
Rounds the x and y fields to the next larger integer values. @return {!goog.math.Coordinate} This coordinate with ceil'd fields.
clamp(Coordinate maxCoor, Coordinate minCoor) Coordinate
@param maxCoor -- Beginning of range @param minCoor -- End of range
copy() Coordinate
@return {!goog.math.Coordinate} A new copy of this Coordinate.
difference(Coordinate b) Coordinate
distanceTo(Coordinate other) double
Returns the distance between this and other.
floor() Coordinate
Rounds the x and y fields to the next smaller integer values. @return {!goog.math.Coordinate} This coordinate with floored fields.
getAxis(Axis axis) double
Get an axis value. For OO patterns.
graphPointToPositionPercent() Coordinate
Computes position percent coordinate from graph coordinate, where (0,0) is centre.
marshal(MarshalledObject marshalled) → void
Marshal method must operate by mutating empty object passed.
override
max(Coordinate maxCoor) Coordinate
min(Coordinate minCoor) Coordinate
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
reverseSign() Coordinate
Multiplies each axis by -1
round() Coordinate
Rounds the x and y fields to the nearest integer values. @return {!goog.math.Coordinate} This coordinate with rounded fields.
squaredDistance(Coordinate b) double
toSize() Size
@return {!goog.math.Size} A new copy of this Coordinate as Size.
toString() String
Returns a nice string representing the coordinate. @return {string} In the form (50, 73). @override
override
translate(Coordinate tc) Coordinate
Translates this coordinate by the given offsets. If a {@code 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 {@code tx} and {@code opt_ty} respectively. @return {!goog.math.Coordinate} This coordinate after translating.

Operators

operator ==(Object other) bool
Compares coordinates for equality.
override

Static Properties

naught Coordinate
Constant for coordinate at (0, 0).
final

Static Methods

differenceFrom(Coordinate a, Coordinate b) Coordinate
Returns the difference between two coordinates as a new goog.math.Coordinate. @param {!goog.math.Coordinate} a A Coordinate. @param {!goog.math.Coordinate} b A Coordinate. @return {!goog.math.Coordinate} A Coordinate representing the difference between {@code a} and {@code b}.
graphPointAxisToPositionPercent(double coordinateValue) double
Zero is centre on each axis, so must translate to x/y.
squaredDistanceFrom(Coordinate a, Coordinate b) double
Returns the squared distance between two coordinates. Squared distances can be used for comparisons when the actual value is not required.
unmarshal(MarshalledObject marshalled) Coordinate
Encoded object parameter is encoded depending on format.