Class: Point
- Last UpdatedMay 21, 2025
- 3 minute read
This class represents a two-dimensional point, defined by its x and y coordinates.
Name | Type | Description |
---|---|---|
x |
number |
coordinate of the point |
y |
number |
coordinate of the point |
Implements
Members
-
This property represents the x-coordinate of the point.
-
This property represents the y-coordinate of the point.
Methods
-
H.math.Point.fromIPoint (iPoint)H.math.Point static
-
This method creates a
Point
instance from theIPoint
object provided by the caller.Name Type Description iPoint
H.math.IPoint An object implementing
IPoint
Returns:
Type Description H.math.Point An object representing the newly created Point
instance -
add (other)H.math.Point
-
This method adds the coordinates of the point supplied by the caller to the coordinates of the given point.
Name Type Description other
H.math.IPoint An object whose coordinates are to be added to those of the given point
Returns:
Type Description H.math.Point An object representing the given point after its coordinates have been modified -
ceil ()H.math.Point
-
This method rounds the x and y coordinates of the given point up to the next greater integer values.
Returns:
Type Description H.math.Point An object representing the given point after its coordinates have been rounded up to the nearest integer -
clone (opt_out)H.math.Point
-
This method this creates a copy of the current point.
Name Type Description opt_out
H.math.Point optional An optional point object to store the copied values
Returns:
Type Description H.math.Point An object representing a clone of the given point -
This method calculates the distance to a point supplied by the caller.
Name Type Description other
H.math.IPoint An object representing the point to which the distance is to be calculated
Returns:
Type Description number A value indicating the distance to the point supplied by the caller -
This method compares two points by checking if their coordinates are equal.
Name Type Description other
H.math.IPoint An object representing the point to which to compare the given point
Returns:
Type Description boolean true
if the points are equal, otherwisefalse
-
floor ()H.math.Point
-
This method rounds the x and y coordinates of the given point down to the next smaller integer values.
Returns:
Type Description H.math.Point An object representing the given point after its coordinates have been rounded down to the nearest integer -
getNearest (start, end)H.math.IPoint
-
This method calculates the closest point on the line specified by the caller to the given point.
Name Type Description start
H.math.IPoint A an object representing the start point of the line
end
H.math.IPoint A an object representing the end point of the line
Returns:
Type Description H.math.IPoint An object representing the closest point on the line to the given point -
round ()H.math.Point
-
This method rounds the x and y coordinates of the given point.
Returns:
Type Description H.math.Point An object representing the given point after its coordinates have been rounded -
scale (factor, opt_factorY)H.math.Point
-
This method scales the coordinates of the given point by the factor(s) provided by the caller.
Name Type Description factor
number A value indicating the multiplication factor
opt_factorY
number optional An optional value indicating the multiplication factor for the y-coordinate; if omitted, only
factor
is usedReturns:
Type Description H.math.Point An object representing the given point after its coordinates have been scaled -
This method sets the x and y coordinate of the point.
Name Type Description x
number A value indicating the x-coordinate
y
number A value indicating the y-coordinate
-
sub (other)H.math.Point
-
This method subtract the coordinates of the point supplied by the caller from the coordinates from the given point.
Name Type Description other
H.math.IPoint An object representing the point whose coordinates are to be subtracted from those of the given point
Returns:
Type Description H.math.Point An object representing the given point after its coordinates have been modified