Point
Class representing a point in 2 dimension cartesian space
Static Method Summary
Static Public Methods | ||
public static |
get a new Point that is a copy (clone) of the otherPoint passed has parameter |
|
public static |
creates a new Point in cartesian space from polar coordinates |
Constructor Summary
Public Constructor | ||
public |
constructor(x: number, y: number) Creates a point |
Member Summary
Public Members | ||
public |
|
|
public |
|
|
public get |
Get the x value. |
|
public set |
Set the x value |
|
public get |
Get the y value. |
|
public set |
Set the y value |
Private Members | ||
private |
_x: * |
|
private |
_y: * |
Method Summary
Public Methods | ||
public |
copy this Point relative to its position by the deltaX, deltaY displacement in cartesian space |
|
public |
copyRelArray(arrVector: Array): Point copy this Point relative to its position by the arrVector displacement in cartesian space |
|
public |
copyRelPolar(radius: number, theta: number, angleSystem: Object): Point copy this Point relative to its position by the polar displacement in cartesian space |
|
public |
get the distance from this point to otherPoint |
|
public |
allows to compare equality with otherPoint, they should have the same values for x and y Math.sqrt(2) Math.sqrt(2) should give 2 but gives instead 2.0000000000000004 Math.sqrt(3) Math.sqrt(3) should give 2 but gives instead 2.9999999999999996 i found So the Point Class equality should take this fact account to test near equality with EPSILON=0.0000000001 feel free to adapt EPSILON value to your needs in utils.js |
|
public |
move this Point relative to its position by the deltaX, deltaY displacement in cartesian space |
|
public |
moveRelArray(arrVector: Array): Point move this Point relative to its position by the arrVector displacement in cartesian space |
|
public |
moveRelPolar(radius: number, theta: number, angleSystem: Object): Point move this Point relative to its position by the polar displacement in cartesian space |
|
public |
will move this Point to the new position in cartesian space given by the newX and newY values |
|
public |
moveToArray(arrCoordinates: Array): Point will move this Point to the new position in cartesian space given by the arrCoordinates |
|
public |
give an array representation of this Point class instance [x, y] |
|
public |
give an Postgis Extended Well-known text (EWKT) representation of this class instance https://postgis.net/docs/using_postgis_dbmanagement.html#EWKB_EWKT |
|
public |
give a GeoJSON (http://geojson.org/) representation of this class instance geometry |
|
public |
give a string representation of this class instance |
|
public |
give an OGC Well-known text (WKT) representation of this class instance https://en.wikipedia.org/wiki/Well-known_text |
Static Public Methods
public static fromPoint(otherPoint: Point): Point source
get a new Point that is a copy (clone) of the otherPoint passed has parameter
Params:
Name | Type | Attribute | Description |
otherPoint | Point | is the Point you want to copy |
Public Constructors
Public Methods
public copyRel(deltaX: number, deltaY: number): Point source
copy this Point relative to its position by the deltaX, deltaY displacement in cartesian space
public copyRelArray(arrVector: Array): Point source
copy this Point relative to its position by the arrVector displacement in cartesian space
Params:
Name | Type | Attribute | Description |
arrVector | Array | is an array representing the vector displacement to apply to actual coordinates [deltaX, deltaY] |
public copyRelPolar(radius: number, theta: number, angleSystem: Object): Point source
copy this Point relative to its position by the polar displacement in cartesian space
public distance(otherPoint: Point): Number source
get the distance from this point to otherPoint
Params:
Name | Type | Attribute | Description |
otherPoint | Point |
public equal(otherPoint: Point): boolean source
allows to compare equality with otherPoint, they should have the same values for x and y Math.sqrt(2) Math.sqrt(2) should give 2 but gives instead 2.0000000000000004 Math.sqrt(3) Math.sqrt(3) should give 2 but gives instead 2.9999999999999996 i found So the Point Class equality should take this fact account to test near equality with EPSILON=0.0000000001 feel free to adapt EPSILON value to your needs in utils.js
Params:
Name | Type | Attribute | Description |
otherPoint | Point |
public moveRel(deltaX: number, deltaY: number): Point source
move this Point relative to its position by the deltaX, deltaY displacement in cartesian space
public moveRelArray(arrVector: Array): Point source
move this Point relative to its position by the arrVector displacement in cartesian space
Params:
Name | Type | Attribute | Description |
arrVector | Array | is an array representing the vector displacement to apply to actual coordinates [deltaX, deltaY] |
public moveRelPolar(radius: number, theta: number, angleSystem: Object): Point source
move this Point relative to its position by the polar displacement in cartesian space
public moveTo(newX: number, newY: number): Point source
will move this Point to the new position in cartesian space given by the newX and newY values
public moveToArray(arrCoordinates: Array): Point source
will move this Point to the new position in cartesian space given by the arrCoordinates
Params:
Name | Type | Attribute | Description |
arrCoordinates | Array | is an array with the 2 cartesian coordinates [x, y] |
public toEWKT(srid: number): string source
give an Postgis Extended Well-known text (EWKT) representation of this class instance https://postgis.net/docs/using_postgis_dbmanagement.html#EWKB_EWKT
Params:
Name | Type | Attribute | Description |
srid | number | is the Spatial reference systems identifier EPSG code default is 21781 for Switzerland MN03 |
public toGeoJSON(): string source
give a GeoJSON (http://geojson.org/) representation of this class instance geometry
public toString(separator: string, surroundingParenthesis: boolean, precision: number): string source
give a string representation of this class instance
Params:
Name | Type | Attribute | Description |
separator | string | placed between x and y values ', ' by default |
|
surroundingParenthesis | boolean | allow to tell if result string should be surrounded with parenthesis (True by default) |
|
precision | number | defines the number of decimals for the coordinates (2 by default) |
public toWKT(): string source
give an OGC Well-known text (WKT) representation of this class instance https://en.wikipedia.org/wiki/Well-known_text