API / geotoolkit / util / Point / Point
This class is a 2D Point implementation. It holds the xy values that define a point coordinates in two dimensions.
It also provides some utility functions to manipulate Points, compare points or calculate distance between points.
Constructors
| [new Point()](/solutions/geotoolkit/apis/classes/geotoolkit.util.point.point.md#new point()) | [new Point(point)](/solutions/geotoolkit/apis/classes/geotoolkit.util.point.point.md#new point(point)) | [new Point(x, y)](/solutions/geotoolkit/apis/classes/geotoolkit.util.point.point.md#new point(x, y)) |
|---|
Methods
Css Properties
| Name | Type | Description |
|---|---|---|
x | number | X coordinate |
y | number | Y coordinate |
Constructors
• new Point()
• new Point(point)
| Name | Type | Description |
|---|---|---|
point | number[] | Point | Options | Point or an object with 'x' and 'y' properties or [x,y] array |
• new Point(x?, y?)
| Name | Type | Description |
|---|---|---|
Optional x | number | x coordinate |
Optional y | number | y coordinate |
Accessors
• get x(): number
X position
Name
module:geotoolkit/util/Point~Point#x
number
• set x(value): void
X position
Name
module:geotoolkit/util/Point~Point#x
| Name | Type |
|---|---|
value | number |
void
• get y(): number
Y position
Name
module:geotoolkit/util/Point~Point#y
number
• set y(value): void
Y position
Name
module:geotoolkit/util/Point~Point#y
| Name | Type |
|---|---|
value | number |
void
Methods
▸ clone(): Point
return clone object
clone
▸ equalsPoint(point, epsilon?): boolean
compares a point against this one, if equal returns true
| Name | Type | Description |
|---|---|---|
point | Point | point to compare to |
Optional epsilon | number | acceptance criteria |
boolean
if these two points are equal
▸ getClassName(): string
string
▸ getClosest(x1, y1, x2, y2, dst?): Point
Finds closest point from current to the segment provided (represented by two points)
| Name | Type | Description |
|---|---|---|
x1 | number | first segment point x-ordinate |
y1 | number | first segment point y-ordinate |
x2 | number | second segment point x-ordinate |
y2 | number | second segment point y-ordinate |
Optional dst | Point | destination point |
point
▸ getProperties(): Required<Options>
Gets all the properties pertaining to this object
Required<Options>
▸ getX(): number
Return x value
number
x value
▸ getY(): number
Return x value
number
x value
▸ round(): Point
round point coordinates
▸ setPoint(point): Point
set Point coordinates
| Name | Type | Description |
|---|---|---|
point | Point | point |
▸ setPoint(x, y): Point
set Point coordinates
| Name | Type | Description |
|---|---|---|
x | number | x coordinate or the point |
y | number | y coordinate |
▸ setProperties(properties?): Point
Sets all the properties pertaining to this object
| Name | Type | Description |
|---|---|---|
Optional properties | Options | object containing the properties to set |
this
▸ setX(x): Point
set X Point coordinate
| Name | Type | Description |
|---|---|---|
x | number | x coordinate |
▸ setY(y): Point
set Y Point coordinates
| Name | Type | Description |
|---|---|---|
y | number | y coordinate |
▸ toString(): string
Returns a string that represents the current point.
string
A string that represents the current point.
▸ translate(dx, dy): Point
translate point of dx, dy.
| Name | Type | Description |
|---|---|---|
dx | number | dx |
dy | number | dy |
▸ Static fromObject(point?): Point
Create or get point from object
| Name | Type | Description |
|---|---|---|
Optional point | number | Point | Options | [number, number] | can be in format of constructor of Point |
point
▸ Static getClassName(): string
string
▸ Static getDistance(x1, y1, x2, y2): number
Calculates distance between two points
| Name | Type | Description |
|---|---|---|
x1 | number | first point x-ordinate |
y1 | number | first point y-ordinate |
x2 | number | second point x-ordinate |
y2 | number | second point y-ordinate |
number
distance between points
▸ Static getDistance(p1, p2): number
Calculates distance between two points
number
distance between points
▸ Static getSquaredDistance(p1, p2): number
Returns squared distance between two points
number
squared distance
▸ Static getSquaredDistance(x1, y1, x2, y2): number
Returns squared distance between two points{x1, y1} and {x2, y2}
| Name | Type | Description |
|---|---|---|
x1 | number | first point x-ordinate |
y1 | number | first point y-ordinate |
x2 | number | second point x-ordinate |
y2 | number | second point y-ordinate |
number
squared distance