Class: Coordinate

jsts.geom.Coordinate

Source:

Methods

clone() → {Coordinate}

Clones this instance.
Source:
Returns:
A point instance cloned from this.
Type
Coordinate

compareTo(other) → {number}

Compares this Coordinate with the specified Coordinate for order. This method ignores the z value when making the comparison. Returns:
• -1 : this.x < other.x || ((this.x == other.x) && (this.y < other.y))
• 0 : this.x == other.x && this.y = other.y
• 1 : this.x > other.x || ((this.x == other.x) && (this.y > other.y))
Note: This method assumes that ordinate values are valid numbers. NaN values are not handled correctly.
Parameters:
Name Type Description
`other` Coordinate the `Coordinate` with which this `Coordinate` is being compared.
Source:
Returns:
-1, zero, or 1 as explained above.
Type
number

distance(p) → {number}

Computes the 2-dimensional Euclidean distance to another location. The Z-ordinate is ignored.
Parameters:
Name Type Description
`p` Coordinate a point.
Source:
Returns:
the 2-dimensional Euclidean distance between the locations.
Type
number

equals(other) → {boolean}

Returns `true` if `other` has the same values for the x and y ordinates. Since Coordinates are 2.5D, this routine ignores the z value when making the comparison.
Parameters:
Name Type Description
`other` Coordinate a `Coordinate` with which to do the comparison.
Source:
Returns:
`true` if `other` is a `Coordinate` with the same values for the x and y ordinates.
Type
boolean

equals2D(other) → {boolean}

Returns whether the planar projections of the two `Coordinate`s are equal.
Parameters:
Name Type Description
`other` Coordinate a `Coordinate` with which to do the 2D comparison.
Source:
Returns:
`true` if the x- and y-coordinates are equal; the z-coordinates do not have to be equal.
Type
boolean

setCoordinate(other)

Sets this `Coordinate`s (x,y,z) values to that of `other`.
Parameters:
Name Type Description
`other` Coordinate the `Coordinate` to copy.
Source: