Point
A point representing a location (x, y) in two-dimensional coordinate space.
Name | Type | Default | Description |
---|---|---|---|
x |
|
The X coordinate of the point. | |
y |
|
The Y coordinate of the point. |
Constructors
Point
(x?: number, y?: number)
Creates a point with the specified coordinates.
Parameters
x?
number
The X coordinate of the point.
y?
number
The Y coordinate of the point.
Methods
addObserver | ||||||
---|---|---|---|---|---|---|
Adds an observer to be notified for changes. | ||||||
| ||||||
|
clone | ||||
---|---|---|---|---|
Creates a new instance with the same coordinates. | ||||
|
create | |||||||||
---|---|---|---|---|---|---|---|---|---|
Creates a Point instance with the specified coordinates. | |||||||||
| |||||||||
|
create | ||||||
---|---|---|---|---|---|---|
Creates a Point instance with the specified coordinates. | ||||||
| ||||||
|
create | ||||||
---|---|---|---|---|---|---|
Returns the supplied Point instance. | ||||||
| ||||||
|
distanceTo | ||||||
---|---|---|---|---|---|---|
Calculates the distance to another point. | ||||||
| ||||||
|
equals | ||||||
---|---|---|---|---|---|---|
Compares this point with another instance. | ||||||
| ||||||
|
getX | ||||
---|---|---|---|---|
Gets the x coordinate value. | ||||
|
getY | ||||
---|---|---|---|---|
Gets the Y-coordinate value. | ||||
|
max | ||||||
---|---|---|---|---|---|---|
Returns the Point with maximum X and Y coordinates. | ||||||
| ||||||
|
maxPoint | ||||
---|---|---|---|---|
Returns a Point with the largest representable coordinates. | ||||
|
min | ||||||
---|---|---|---|---|---|---|
Returns the Point with minimum X and Y coordinates. | ||||||
| ||||||
|
minPoint | ||||
---|---|---|---|---|
Returns a Point with the smallest representable coordinates. | ||||
|
move | |||||||||
---|---|---|---|---|---|---|---|---|---|
Moves the point to the specified X and Y coordinates. | |||||||||
| |||||||||
|
observers | ||||
---|---|---|---|---|
Returns the list of observers. | ||||
|
removeObserver | ||||||
---|---|---|---|---|---|---|
Stops notifying the specified observer for changes. | ||||||
| ||||||
|
resume | ||||
---|---|---|---|---|
Resumes the notification to all observers for changes. | ||||
|
rotate | |||||||||
---|---|---|---|---|---|---|---|---|---|
Rotates the point around the given center. | |||||||||
| |||||||||
|
round | ||||||
---|---|---|---|---|---|---|
Rounds the point coordinates to the specified number of fractional digits. | ||||||
| ||||||
|
scale | |||||||||
---|---|---|---|---|---|---|---|---|---|
Scales the point coordinates along the X and Y axis. | |||||||||
| |||||||||
|
scaleCopy | |||||||||
---|---|---|---|---|---|---|---|---|---|
Scales the point coordinates on a copy of the current point. The callee coordinates will remain unchanged. | |||||||||
| |||||||||
|
setX | ||||||
---|---|---|---|---|---|---|
Sets the X coordinate to a new value. | ||||||
| ||||||
|
setY | ||||||
---|---|---|---|---|---|---|
Sets the Y coordinate to a new value. | ||||||
| ||||||
|
suspend | ||||
---|---|---|---|---|
Suspends the change notifications to all observers. | ||||
|
toArray | ||||||
---|---|---|---|---|---|---|
Returns the point coordinates as an | ||||||
| ||||||
|
toString | |||||||||
---|---|---|---|---|---|---|---|---|---|
Formats the point value to a string. | |||||||||
| |||||||||
|
transform | ||||||
---|---|---|---|---|---|---|
Applies a transformation to the point coordinates. The current coordinates will be overridden. | ||||||
| ||||||
|
transformCopy | ||||||
---|---|---|---|---|---|---|
Applies a transformation on a copy of the current point. The callee coordinates will remain unchanged. | ||||||
| ||||||
|
translate | |||||||||
---|---|---|---|---|---|---|---|---|---|
Translates the point along the X and Y axis. | |||||||||
| |||||||||
|
translateWith | ||||||
---|---|---|---|---|---|---|
Translates the point by using a Point instance as a vector of translation. | ||||||
| ||||||
|