This class represents a point in the plane with double coordinates.
Remarks
Type Details
- yfiles module
- algorithms
- yfiles-umd modules
- All layout modules, view-layout-bridge
- Legacy UMD name
- yfiles.algorithms.YPoint
See Also
Constructors
Creates a new YPoint at location (0,0)
Creates a new YPoint object for a given position.
Parameters
A map of options to pass to the method.
- x - number
- the x coordinate of the point.
- y - number
- the y coordinate of the point.
Properties
Methods
Comparable implementation.
Remarks
Parameters
A map of options to pass to the method.
- o - Object
- The object to compare this to.
Returns
- ↪number
- -1: this is less than
obj
- 0: this is equal to
obj
- 1: this is greater than
obj
- -1: this is less than
Implements
Returns the euclidean distance between this point and a given point.
Parameters
A map of options to pass to the method.
- x - number
- the x coordinate of an arbitrary point
- y - number
- the y coordinate of an arbitrary point
Returns
- ↪number
- the Euclidean distance between this point and the point (x,y).
Tests a point to equality to another point.
Remarks
o
is also an instance of YPoint and has the same coordinates as the instance on which equals is invoked.Parameters
A map of options to pass to the method.
- o - Object
- an arbitrary instance.
Returns a hash code for this object.
Remarks
The hash code is a numeric value that can be used to treat this object as a key in a hash table or similar data structure.
Two objects that are considered equal must have the same hash code. However, the reverse does not hold and two objects having the same hash code don't have to be equal. Ideally, the hash code should be roughly uniformly-distributed to prevent hash tables from performing poorly. Calculating the hash code is also a potentially frequent operation and should therefore be fast.
Returns
- ↪number
- the hash code for this object
Returns the point, got by moving this point to another position.
Parameters
A map of options to pass to the method.
- x - number
- the value which is added on the x-coordinate of the point.
- y - number
- the value which is added on the y-coordinate of the point.
Returns
- ↪YPoint
- a new instance of YPoint which is the result of the moving operation.
Static Methods
Returns the euclidean distance between two points.
Parameters
A map of options to pass to the method.
- x1 - number
- x-coordinate of first point
- y1 - number
- y-coordinate of first point
- x2 - number
- x-coordinate of second point
- y2 - number
- y-coordinate of second point
Returns
- ↪number
- the euclidean distance between first and second point