Represents a two-dimensional point located at (x, y)
.
Type Details
- yfiles module
- algorithms
- yfiles-umd modules
- All layout modules, view-layout-bridge
- Legacy UMD name
- yfiles.algorithms.Point2D
Constructors
Properties
Sets the location of this point to the same values as for the given point.
Methods
Creates a new instance of this class that has the same values as this objects.
Calculates the distance between this points and another one, given as its coordinates.
Parameters
A map of options to pass to the method.
- px - number
- The x coordinate of the second point.
- py - number
- The y coordinate of the second point.
Returns
- ↪number
- the distance between this points and another one, given as its coordinates.
Calculates the squared distance between this points and another one, given as its coordinates.
Parameters
A map of options to pass to the method.
- px - number
- The x coordinate of the second point.
- py - number
- The y coordinate of the second point.
Returns
- ↪number
- the squared distance between this points and another one, given as its coordinates.
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
Static Methods
Calculates the distance between two points, given as their coordinates.
Parameters
A map of options to pass to the method.
- x1 - number
- The x coordinate of the first point.
- y1 - number
- The y coordinate of the first point.
- x2 - number
- The x coordinate of the second point.
- y2 - number
- The y coordinate of the second point.
Returns
- ↪number
- the distance between two points, given as their coordinates.
Calculates the squared distance between two points, given as their coordinates.
Parameters
A map of options to pass to the method.
- x1 - number
- The x coordinate of the first point.
- y1 - number
- The y coordinate of the first point.
- x2 - number
- The x coordinate of the second point.
- y2 - number
- The y coordinate of the second point.
Returns
- ↪number
- the squared distance between two points, given as their coordinates.