New to Kendo UI for Angular? Start a free 30-day trial
Represents a 2D point with x and y coordinates.
Extends the Kendo Drawing geometry Point class with additional utility methods.
Name | Type | Default | Description |
---|
|
number
|
|
|
number
|
|
(x?: number, y?: number)
Creates a new Point instance.
number
The x-coordinate of the point (defaults to 0)
number
The y-coordinate of the point (defaults to 0)
|
---|
Adds an observer to be notified for changes.
|
Parameters | | |
---|
observer
|
GeometryObserver
|
The observer to add.
|
|
Returns | |
---|
Point
|
- The current Arc instance.
|
|
|
---|
Creates a copy of this point.
|
Returns | |
---|
Point
|
A new Point instance with the same coordinates
|
|
|
---|
Creates a Point instance with the specified coordinates.
|
Parameters | | |
---|
x
|
number
|
The X coordinate of the point
|
y
|
number
|
The Y coordinate of the point.
|
|
|
|
---|
Creates a Point instance with the specified coordinates.
|
Parameters | | |
---|
coords
|
number[]
|
An array of X and Y coordinates.
|
|
|
|
---|
Returns the supplied Point instance.
|
Parameters | | |
---|
point
|
Point
|
An existing Point instance.
|
|
Returns | |
---|
Point
|
- The supplied Point instance.
|
|
|
---|
Calculates the distance to another point.
|
Parameters | | |
---|
point
|
Point
|
The point to calculate the distance to.
|
|
Returns | |
---|
number
|
- The straight-line distance to the given point.
|
|
|
---|
Compares this point with another instance.
|
Parameters | | |
---|
other
|
Point
|
The point to compare with.
|
|
Returns | |
---|
boolean
|
true if the point coordinates match. Otherwise, returns false .
|
|
|
---|
Gets the x coordinate value.
|
Returns | |
---|
number
|
- The current X-coordinate value.
|
|
|
---|
Gets the Y-coordinate value.
|
Returns | |
---|
number
|
- The current Y-coordinate value.
|
|
|
---|
Determines if this point lies on the line segment between two other points.
|
Parameters | | |
---|
from
|
any
|
The starting point of the line segment
|
to
|
any
|
The ending point of the line segment
|
|
Returns | |
---|
boolean
|
True if this point is on the line segment, false otherwise
|
|
|
---|
Calculates the length (magnitude) of this point vector.
|
Returns | |
---|
number
|
The distance from origin to this point
|
|
|
---|
Calculates the squared length of this point vector.
More efficient than length() when only comparing distances.
|
Returns | |
---|
number
|
The squared distance from origin to this point
|
|
|
---|
Returns the Point with maximum X and Y coordinates.
|
Parameters | | |
---|
points
|
Point[]
|
The points to evaluate.
|
|
Returns | |
---|
Point
|
- The Point with maximum X and Y coordinates.
|
|
|
---|
Returns a Point with the largest representable coordinates.
|
Returns | |
---|
Point
|
- A new Point instance with maximum coordinates.
|
|
|
---|
Calculates the midpoint between two points.
|
Parameters | | |
---|
p
|
any
|
The first point
|
q
|
any
|
The second point
|
|
Returns | |
---|
Point
|
A new Point representing the midpoint between p and q
|
|
|
---|
Returns the Point with minimum X and Y coordinates.
|
Parameters | | |
---|
points
|
Point[]
|
The points to evaluate.
|
|
Returns | |
---|
Point
|
- The Point with minimum X and Y coordinates.
|
|
|
---|
Returns a Point with the smallest representable coordinates.
|
Returns | |
---|
Point
|
- A new Point instance with minimum coordinates.
|
|
|
---|
Subtracts another point from this point.
|
Parameters | | |
---|
p
|
any
|
The point to subtract
|
|
Returns | |
---|
Point
|
A new Point representing the difference
|
|
|
---|
Moves the point to the specified X and Y coordinates.
|
Parameters | | |
---|
x
|
number
|
The new X coordinate.
|
y
|
number
|
The new Y coordinate.
|
|
Returns | |
---|
Point
|
- The current point instance.
|
|
|
---|
Returns a normalized version of this point (unit vector).
|
Returns | |
---|
Point
|
A new Point with length 1 in the same direction, or origin if length is 0
|
|
|
---|
Returns the list of observers.
|
Returns | |
---|
GeometryObserver[]
|
|
|
|
---|
Creates a new point offset by the specified value in both x and y directions.
|
Parameters | | |
---|
value
|
any
|
The offset value to subtract from both coordinates
|
|
Returns | |
---|
Point
|
A new Point offset by the specified amount
|
|
|
---|
Parses a point from a string representation.
|
Parameters | | |
---|
str
|
any
|
The string to parse, expected format: "(x,y)"
|
|
Returns | |
---|
Point
|
A new Point if parsing succeeds, undefined otherwise
|
|
|
---|
Adds another point to this point.
|
Parameters | | |
---|
p
|
any
|
The point to add
|
|
Returns | |
---|
Point
|
A new Point representing the sum of the two points
|
|
|
---|
Stops notifying the specified observer for changes.
|
Parameters | | |
---|
observer
|
GeometryObserver
|
The observer to remove.
|
|
Returns | |
---|
Point
|
- The current Arc instance.
|
|
|
---|
Resumes the notification to all observers for changes.
|
Returns | |
---|
Point
|
- The current Arc instance.
|
|
|
---|
Rotates the point around the given center.
|
Parameters | | |
---|
angle
|
number
|
The angle in decimal degrees. Measured in a clockwise direction with 0 (zero) pointing "right". Negative values or values greater than 360 are normalized.
|
center
|
Point | number[]
|
The rotation center. Can be a Point instance or an [x, y] array.
|
|
Returns | |
---|
Point
|
- The current Point instance.
|
|
|
---|
Rounds the point coordinates to the specified number of fractional digits.
|
Parameters | | |
---|
digits
|
number
|
The number of fractional digits.
|
|
Returns | |
---|
Point
|
- The current Point instance.
|
|
|
---|
Scales the point coordinates along the X and Y axis.
|
Parameters | | |
---|
scaleX
|
number
|
The X scale multiplier.
|
scaleY
|
number
|
The Y scale multiplier.
|
|
Returns | |
---|
Point
|
- The current Point instance.
|
|
|
---|
Scales the point coordinates on a copy of the current point. The callee coordinates will remain unchanged.
|
Parameters | | |
---|
scaleX
|
number
|
The X scale multiplier.
|
scaleY
|
number
|
The Y scale multiplier.
|
|
Returns | |
---|
Point
|
- The current Point instance.
|
|
|
---|
Sets the X coordinate to a new value.
|
Parameters | | |
---|
value
|
number
|
The new X coordinate value.
|
|
Returns | |
---|
Point
|
- The current Point instance.
|
|
|
---|
Sets the Y coordinate to a new value.
|
Parameters | | |
---|
value
|
number
|
The new Y coordinate value.
|
|
Returns | |
---|
Point
|
- The current Point instance.
|
|
|
---|
Suspends the change notifications to all observers.
|
Returns | |
---|
Point
|
- The current Arc instance.
|
|
|
---|
Multiplies this point by a scalar value.
|
Parameters | | |
---|
s
|
any
|
The scalar multiplier
|
|
Returns | |
---|
Point
|
A new Point with coordinates multiplied by the scalar
|
|
|
---|
Returns the point coordinates as an [X, Y] array.
|
Parameters | | |
---|
digits?
|
number
|
The number of fractional digits.
|
|
Returns | |
---|
number[]
|
- An array representation of the point. For example,
[10, 20] .
|
|
|
---|
Converts this point to polar coordinates.
|
Parameters | | |
---|
useDegrees
|
any
|
Whether to return angle in degrees (true) or radians (false)
|
|
Returns | |
---|
Polar
|
A Polar object with radius and angle
|
|
|
---|
Returns a string representation of this point.
|
Returns | |
---|
string
|
A string in the format "(x,y)"
|
|
|
---|
Applies a transformation to the point coordinates. The current coordinates will be overridden.
|
Parameters | | |
---|
tansformation
|
Transformation
|
The transformation to apply.
|
|
Returns | |
---|
Point
|
- The current Point instance.
|
|
|
---|
Applies a transformation on a copy of the current point. The callee coordinates will remain unchanged.
|
Parameters | | |
---|
tansformation
|
Transformation
|
The transformation to apply.
|
|
|
|
---|
Translates the point along the X and Y axis.
|
Parameters | | |
---|
dx
|
number
|
The distance to move along the X axis.
|
dy
|
number
|
The distance to move along the Y axis.
|
|
Returns | |
---|
Point
|
- The current Point instance.
|
|
|
---|
Translates the point by using a Point instance as a vector of translation.
|
Parameters | | |
---|
vector
|
Point | number[]
|
The vector of translation. Can be either a Point instance or an [x, y] array.
|
|
Returns | |
---|
Point
|
- The current point instance.
|
|