Interface for a point in 2D coordinate space with double precision coordinates.
Inheritance Hierarchy

Remarks

This interface provides read access to the coordinates only. However, this does not mean that an instance that implements IPoint will always return the same values for the coordinate properties. Often times the instance provides a dynamic read access to the current state of a point. It depends on the context whether it is allowed to or even necessary to copy the state of the properties or whether the reference to the instance should always be used to query the values.

This is a convertible type that can be used with the following notation(s) in parameter lists, parameter objects or setters.

It is possible to specify an Array or plain Object to define the IPoint:

[5, 5] // x, y
{ x: 5, y: 5 }

See Also

Developer's Guide

API

IMutablePoint, MutablePoint

Members

No filters for this type

Properties

Gets the current x-coordinate of this point.
Depending on context, the values returned may change over time.
readonlyabstract

Implemented in

IMutablePoint.x, Point.x
Gets the current y-coordinate of this point.
Depending on context, the values returned may change over time.
readonlyabstract

Implemented in

IMutablePoint.y, Point.y

Methods

Calculates the Euclidean distance between two points.

Parameters

point2: IPoint
The second point.

Return Value

number
The distance between the two points.
Returns the euclidean distance between this point and a given point.

Parameters

x: number
the x coordinate of the second point
y: number
the y coordinate of the second point

Return Value

number
the Euclidean distance between this point and the point (x,y).
Creates a new Point instance with the same coordinates as this point.
This method is useful to obtain a copy of the state and for making use of the various utility methods that are provided by Point.

Return Value

Point
The current values of the coordinates of the point.

See Also

API
toMutablePoint

Static Methods

Creates a Point instance from the given point-like object by performing automatic type conversion.
static

Parameters

pointLike: Point
The object to convert to a Point.

Return Value

Point
The given pointLike if it is already a Point, or a new instance initialized to the values found in pointLike.