Class CoordUtil

java.lang.Object
com.vividsolutions.jump.geom.CoordUtil

public class CoordUtil extends Object
Utility functions for working with Coordinates.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static Point2D
     
    static org.locationtech.jts.geom.Coordinate
    add(org.locationtech.jts.geom.Coordinate c1, org.locationtech.jts.geom.Coordinate c2)
    Adds two coordinates.
    static org.locationtech.jts.geom.Coordinate
    average(Collection<org.locationtech.jts.geom.Coordinate> coordinates)
     
    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.
    static org.locationtech.jts.geom.Coordinate
    closest(Collection<org.locationtech.jts.geom.Coordinate> coordinates, org.locationtech.jts.geom.Coordinate p)
     
    static org.locationtech.jts.geom.Coordinate
    divide(org.locationtech.jts.geom.Coordinate c, double d)
    Divides a coordinate by a scalar.
    static org.locationtech.jts.geom.Coordinate
    multiply(double d, org.locationtech.jts.geom.Coordinate c)
    Multiplies a scalar and a coordinate.
    static Point2D
     
    static org.locationtech.jts.geom.Coordinate
    subtract(org.locationtech.jts.geom.Coordinate c1, org.locationtech.jts.geom.Coordinate c2)
    Subtracts two coordinates.
    static org.locationtech.jts.geom.Coordinate
     
    static Point2D
    toPoint2D(org.locationtech.jts.geom.Coordinate coordinate)
     

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 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 coordinate
      c2 - 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 empty
      p - 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 coordinate
      c2 - 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 coordinate
      c2 - 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 scalar
      c - 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 coordinate
      d - the scalar *
      Returns:
      a new coordinate: c / d
    • toCoordinate

      public static org.locationtech.jts.geom.Coordinate toCoordinate(Point2D point)
    • toPoint2D

      public static Point2D toPoint2D(org.locationtech.jts.geom.Coordinate coordinate)
    • add

      public static Point2D add(Point2D a, Point2D b)
    • subtract

      public static Point2D subtract(Point2D a, Point2D b)