Maps API for JavaScript Developer's Guide

H.math.Point

Class Summary

Implements: H.math.IPoint

Class represents a 2-dimensional point, defined by x and y coordinates.

[ For full details, see the Class Details ]

Property Summary

Table 1. Properties
Properties

x : {number}

The point's coordinate on X-axis.

y : {number}

The point's coordinate on Y-axis.

Method Summary

Table 2. Methods
Methods

set (x, y)

Sets the x and y coordinate of this point

clone (opt_out) : {H.math.Point}

This method creates a copy of the current point.

add (other) : {H.math.Point}

This method adds given point coordinates to the current one.

sub (other) : {H.math.Point}

This method substract given point coordinates from the current point.

scale (factor, opt_factorY) : {H.math.Point}

This method scales the current point coordinates by the given factor(s).

round () : {H.math.Point}

This method rounds the x and y coordinates of the point.

floor () : {H.math.Point}

Rounds the x and y coordinates to the next smaller integer values.

ceil () : {H.math.Point}

Rounds the x and y coordinates to the next greater integer values.

equals (other) : {boolean}

This method compares current point coordinates with the supplied point coordinates.

getNearest (start, end) : {H.math.IPoint}

Calculates the closest point on a given line

distance (other) : {number}

This method calculates the distance to a point supplied by the caller.

static fromIPoint (iPoint) : {H.math.Point}

This method creates a Point instance from a given IPoint object.

Class Description

Class represents a 2-dimensional point, defined by x and y coordinates.

Constructor Details

H.math.Point(x, y)

Parameters:
 
x:
{number}
 
coordinate on x-axis
y:
{number}
 
coordinate on y-axis

Property Details

x: {number}

The point's coordinate on X-axis.

y: {number}

The point's coordinate on Y-axis.

Method Details

set (x, y)

Sets the x and y coordinate of this point

Parameters:
 
x:
{number}
 
coordinate on x-axis
y:
{number}
 
coordinate on y-axis

clone (opt_out) : {H.math.Point}

This method creates a copy of the current point.

Parameters:
 
opt_out:
{H.math.Point=} [optional]
 
An optional point to store the copied values
Returns:
 
{H.math.Point}
The clone of the point

add (other) : {H.math.Point}

This method adds given point coordinates to the current one.

Parameters:
 
other:
{H.math.IPoint}
 
The point to add
Returns:
 
{H.math.Point}
the point itself after adding

sub (other) : {H.math.Point}

This method substract given point coordinates from the current point.

Parameters:
 
other:
{H.math.IPoint}
 
The point to subtract
Returns:
 
{H.math.Point}
the point itself after substracting

scale (factor, opt_factorY) : {H.math.Point}

This method scales the current point coordinates by the given factor(s).

Parameters:
 
factor:
{number}
 
multiplication factor
opt_factorY:
{number=} [optional]
 
If omitted, the factor argument is used
Returns:
 
{H.math.Point}
the point itself after scaling

round () : {H.math.Point}

This method rounds the x and y coordinates of the point.

Returns:
 
{H.math.Point}
the point itself after rounding

floor () : {H.math.Point}

Rounds the x and y coordinates to the next smaller integer values.

Returns:
 
{H.math.Point}
the point itself after flooring

ceil () : {H.math.Point}

Rounds the x and y coordinates to the next greater integer values.

Returns:
 
{H.math.Point}
the point itself after ceiling

equals (other) : {boolean}

This method compares current point coordinates with the supplied point coordinates.

Parameters:
 
other:
{H.math.IPoint}
 
The point to compare to.
Returns:
 
{boolean}
True if the points are equal

getNearest (start, end) : {H.math.IPoint}

Calculates the closest point on a given line

Parameters:
 
start:
{H.math.IPoint}
 
The start point of the line
end:
{H.math.IPoint}
 
The end point of the line
Returns:
 
{H.math.IPoint}
the closest point

distance (other) : {number}

This method calculates the distance to a point supplied by the caller.

Parameters:
 
other:
{H.math.IPoint}
 
Returns:
 
{number}

static fromIPoint (iPoint) : {H.math.Point}

This method creates a Point instance from a given IPoint object.

Parameters:
 
iPoint:
{H.math.IPoint}
 
The IPoint object to use
Returns:
 
{H.math.Point}
the created Point instance

You cannot use this account to purchase a commercial plan on Developer Portal, as it is already associated to plans with different payment methods.

To purchase a commercial plan on Developer Portal, please register for or sign in with a different HERE Account.

Something took longer than expected.

The project should be available soon under your projects page.

Sorry, our services are not available in this region.

Something seems to have gone wrong. Please try again later.

We've detected that your account is set to Australian Dollars (AUD).
Unfortunately, we do not offer checkouts in AUD anymore.
You can continue using your current plan as normal, but to subscribe to one of our new plans,
please register for a new HERE account or contact us for billing questions on selfservesupport@here.com.