H.math.Point
Class Summary
Implements: H.math.IPoint
This class represents a two-dimensional point, defined by its x and y coordinates.
[ For full details, see the Class Details ]
Property Summary
Method Summary
Methods |
---|
This method sets the x and y coordinate of the point. |
This method this creates a copy of the current point. |
This method adds the coordinates of the point supplied by the caller to the coordinates of the given point. |
This method subtract the coordinates of the point supplied by the caller from the coordinates from the given point. |
This method scales the coordinates of the given point by the factor(s) provided by the caller. |
This method rounds the x and y coordinates of the given point. |
This method rounds the x and y coordinates of the given point down to the next smaller integer values. |
This method rounds the x and y coordinates of the given point up to the next greater integer values. |
This method compares two points by checking if their coordinates are equal. |
This method calculates the closest point on the line specified by the caller to the given point. |
This method calculates the distance to a point supplied by the caller. |
This method creates a |
Class Description
This class represents a two-dimensional point, defined by its x and y coordinates.
Constructor Details
H.math.Point(x, y)
- Parameters:
-
x
: -
{number}
- coordinate of the point
-
y
: -
{number}
- coordinate of the point
Property Details
x: {number}
This property represents the x-coordinate of the point.
y: {number}
This property represents the y-coordinate of the point.
Method Details
set (x, y)
This method sets the x and y coordinate of the point.
- Parameters:
-
x
: -
{number}
- A value indicating the x-coordinate
-
y
: -
{number}
- A value indicating the y-coordinate
clone (opt_out) : {H.math.Point}
This method this creates a copy of the current point.
- Parameters:
-
opt_out
: -
{H.math.Point=} [optional]
- An optional point object to store the copied values
- Returns:
-
{H.math.Point}
- An object representing a clone of the given point
add (other) : {H.math.Point}
This method adds the coordinates of the point supplied by the caller to the coordinates of the given point.
- Parameters:
-
other
: -
{H.math.IPoint}
- An object whose coordinates are to be added to those of the given point
- Returns:
-
{H.math.Point}
- An object representing the given point after its coordinates have been modified
sub (other) : {H.math.Point}
This method subtract the coordinates of the point supplied by the caller from the coordinates from the given point.
- Parameters:
-
other
: -
{H.math.IPoint}
- An object representing the point whose coordinates are to be subtracted from those of the given point
- Returns:
-
{H.math.Point}
- An object representing the given point after its coordinates have been modified
scale (factor, opt_factorY) : {H.math.Point}
This method scales the coordinates of the given point by the factor(s) provided by the caller.
- Parameters:
-
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 used
- Returns:
-
{H.math.Point}
- An object representing the given point after its coordinates have been scaled
round () : {H.math.Point}
This method rounds the x and y coordinates of the given point.
- Returns:
-
{H.math.Point}
- An object representing the given point after its coordinates have been rounded
floor () : {H.math.Point}
This method rounds the x and y coordinates of the given point down to the next smaller integer values.
- Returns:
-
{H.math.Point}
- An object representing the given point after its coordinates have been rounded down to the nearest integer
ceil () : {H.math.Point}
This method rounds the x and y coordinates of the given point up to the next greater integer values.
- Returns:
-
{H.math.Point}
- An object representing the given point after its coordinates have been rounded up to the nearest integer
equals (other) : {boolean}
This method compares two points by checking if their coordinates are equal.
- Parameters:
-
other
: -
{H.math.IPoint}
- An object representing the point to which to compare the given point
- Returns:
-
{boolean}
-
true
if the points are equal, otherwisefalse
getNearest (start, end) : {H.math.IPoint}
This method calculates the closest point on the line specified by the caller to the given point.
- Parameters:
-
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:
-
{H.math.IPoint}
- An object representing the closest point on the line to the given point
distance (other) : {number}
This method calculates the distance to a point supplied by the caller.
- Parameters:
-
other
: -
{H.math.IPoint}
- An object representing the point to which the distance is to be calculated
- Returns:
-
{number}
- A value indicating the distance to the point supplied by the caller
static fromIPoint (iPoint) : {H.math.Point}
This method creates a Point
instance from the IPoint
object provided by the caller.
- Parameters:
-
iPoint
: -
{H.math.IPoint}
- An object implementing
IPoint
- Returns:
-
{H.math.Point}
- An object representing the newly created
Point
instance