Class CoordUtil
java.lang.Object
com.vividsolutions.jump.geom.CoordUtil
Utility functions for working with Coordinates.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic Point2Dstatic org.locationtech.jts.geom.Coordinateadd(org.locationtech.jts.geom.Coordinate c1, org.locationtech.jts.geom.Coordinate c2) Adds two coordinates.static org.locationtech.jts.geom.Coordinateaverage(Collection<org.locationtech.jts.geom.Coordinate> coordinates) static org.locationtech.jts.geom.Coordinateaverage(org.locationtech.jts.geom.Coordinate c1, org.locationtech.jts.geom.Coordinate c2) Returns the average of two Coordinates.static org.locationtech.jts.geom.Coordinateclosest(Collection<org.locationtech.jts.geom.Coordinate> coordinates, org.locationtech.jts.geom.Coordinate p) static org.locationtech.jts.geom.Coordinatedivide(org.locationtech.jts.geom.Coordinate c, double d) Divides a coordinate by a scalar.static org.locationtech.jts.geom.Coordinatemultiply(double d, org.locationtech.jts.geom.Coordinate c) Multiplies a scalar and a coordinate.static Point2Dstatic org.locationtech.jts.geom.Coordinatesubtract(org.locationtech.jts.geom.Coordinate c1, org.locationtech.jts.geom.Coordinate c2) Subtracts two coordinates.static org.locationtech.jts.geom.CoordinatetoCoordinate(Point2D point) static Point2DtoPoint2D(org.locationtech.jts.geom.Coordinate coordinate)
-
Constructor Details
-
CoordUtil
public CoordUtil()
-
-
Method Details
-
average
public static org.locationtech.jts.geom.Coordinate average(org.locationtech.jts.geom.Coordinate c1, org.locationtech.jts.geom.Coordinate c2) Returns the average of two Coordinates.- Parameters:
c1- one coordinatec2- another coordinate- Returns:
- a new Coordinate with the average x and average y
-
average
public static org.locationtech.jts.geom.Coordinate average(Collection<org.locationtech.jts.geom.Coordinate> coordinates) - Parameters:
coordinates- not empty- Returns:
- the average position of all input coordinates
-
closest
public static org.locationtech.jts.geom.Coordinate closest(Collection<org.locationtech.jts.geom.Coordinate> coordinates, org.locationtech.jts.geom.Coordinate p) - Parameters:
coordinates- not emptyp- the point to measure distance to- Returns:
- the closest coordinate to p
-
add
public static org.locationtech.jts.geom.Coordinate add(org.locationtech.jts.geom.Coordinate c1, org.locationtech.jts.geom.Coordinate c2) Adds two coordinates.- Parameters:
c1- the first coordinatec2- the second coordinate- Returns:
- a new coordinate: c1 + c2
-
subtract
public static org.locationtech.jts.geom.Coordinate subtract(org.locationtech.jts.geom.Coordinate c1, org.locationtech.jts.geom.Coordinate c2) Subtracts two coordinates.- Parameters:
c1- the first coordinatec2- the second coordinate- Returns:
- a new coordinate: c1 - c2
-
multiply
public static org.locationtech.jts.geom.Coordinate multiply(double d, org.locationtech.jts.geom.Coordinate c) Multiplies a scalar and a coordinate.- Parameters:
d- the scalarc- the coordinate- Returns:
- a new coordinate: d * c
-
divide
public static org.locationtech.jts.geom.Coordinate divide(org.locationtech.jts.geom.Coordinate c, double d) Divides a coordinate by a scalar.- Parameters:
c- the coordinated- the scalar *- Returns:
- a new coordinate: c / d
-
toCoordinate
-
toPoint2D
-
add
-
subtract
-