Point
Represents a 2D point with x and y coordinates. Extends the Kendo Drawing geometry Point class with additional utility methods.
Definition
Package:@progress/kendo-angular-diagrams
Methods
Adds an observer to be notified for changes.
Creates a Point instance with the specified coordinates.
The X coordinate of the point
ynumberThe Y coordinate of the point.
Returns:- The new Point instance.
Creates a Point instance with the specified coordinates.
Calculates the distance to another point.
The point to calculate the distance to.
Returns:number
- The straight-line distance to the given point.
Compares this point with another instance.
The point to compare with.
Returns:boolean
true if the point coordinates match. Otherwise, returns false.
Gets the x coordinate value.
number
- The current X-coordinate value.
Gets the Y-coordinate value.
number
- The current Y-coordinate value.
Determines if this point lies on the line segment between two other points.
The starting point of the line segment
toanyThe 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.
number
The distance from origin to this point
Calculates the squared length of this point vector. More efficient than length() when only comparing distances.
number
The squared distance from origin to this point
Returns a Point with the largest representable coordinates.
- A new Point instance with maximum coordinates.
Calculates the midpoint between two points.
The first point
qanyThe second point
Returns:A new Point representing the midpoint between p and q
Returns a Point with the smallest representable coordinates.
- A new Point instance with minimum coordinates.
Subtracts another point from this point.
Moves the point to the specified X and Y coordinates.
The new X coordinate.
ynumberThe new Y coordinate.
Returns:- The current point instance.
Returns a normalized version of this point (unit vector).
A new Point with length 1 in the same direction, or origin if length is 0
Returns the list of observers.
GeometryObserver[]
- The current observers.
Creates a new point offset by the specified value in both x and y directions.
The offset value to subtract from both coordinates
Returns:A new Point offset by the specified amount
Parses a point from a string representation.
The string to parse, expected format: "(x,y)"
Returns:A new Point if parsing succeeds, undefined otherwise
Adds another point to this point.
Stops notifying the specified observer for changes.
Resumes the notification to all observers for changes.
- The current Arc instance.
Rotates the point around the given center.
The angle in decimal degrees. Measured in a clockwise direction with 0 (zero) pointing "right". Negative values or values greater than 360 are normalized.
centerPoint | number[]The rotation center. Can be a Point instance or an [x, y] array.
- The current Point instance.
Rounds the point coordinates to the specified number of fractional digits.
Scales the point coordinates along the X and Y axis.
The X scale multiplier.
scaleYnumberThe Y scale multiplier.
Returns:- The current Point instance.
Scales the point coordinates on a copy of the current point. The callee coordinates will remain unchanged.
The X scale multiplier.
scaleYnumberThe Y scale multiplier.
Returns:- The current Point instance.
Sets the X coordinate to a new value.
Sets the Y coordinate to a new value.
Multiplies this point by a scalar value.
The scalar multiplier
Returns:A new Point with coordinates multiplied by the scalar
Returns the point coordinates as an [X, Y] array.
The number of fractional digits.
Returns:number[]
- An array representation of the point. For example,
[10, 20].
Converts this point to polar coordinates.
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.
string
A string in the format "(x,y)"
Applies a transformation to the point coordinates. The current coordinates will be overridden.
The transformation to apply.
Returns:- The current Point instance.
Applies a transformation on a copy of the current point. The callee coordinates will remain unchanged.
The transformation to apply.
Returns:- The new Point instance.
Translates the point along the X and Y axis.
The distance to move along the X axis.
dynumberThe distance to move along the Y axis.
Returns:- The current Point instance.