com.vividsolutions.jump.geom
Class CoordUtil

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

public class CoordUtil
extends java.lang.Object

Utility functions for working with Coordinates.


Constructor Summary
CoordUtil()
           
 
Method Summary
static com.vividsolutions.jts.geom.Coordinate add(com.vividsolutions.jts.geom.Coordinate c1, com.vividsolutions.jts.geom.Coordinate c2)
          Adds two coordinates.
static java.awt.geom.Point2D add(java.awt.geom.Point2D a, java.awt.geom.Point2D b)
           
static com.vividsolutions.jts.geom.Coordinate average(java.util.Collection coordinates)
           
static com.vividsolutions.jts.geom.Coordinate average(com.vividsolutions.jts.geom.Coordinate c1, com.vividsolutions.jts.geom.Coordinate c2)
          Returns the average of two Coordinates.
static com.vividsolutions.jts.geom.Coordinate closest(java.util.Collection coordinates, com.vividsolutions.jts.geom.Coordinate p)
           
static com.vividsolutions.jts.geom.Coordinate divide(com.vividsolutions.jts.geom.Coordinate c, double d)
          Divides a coordinate by a scalar.
static com.vividsolutions.jts.geom.Coordinate multiply(double d, com.vividsolutions.jts.geom.Coordinate c)
          Multiplies a scalar and a coordinate.
static com.vividsolutions.jts.geom.Coordinate subtract(com.vividsolutions.jts.geom.Coordinate c1, com.vividsolutions.jts.geom.Coordinate c2)
          Subtracts two coordinates.
static java.awt.geom.Point2D subtract(java.awt.geom.Point2D a, java.awt.geom.Point2D b)
           
static com.vividsolutions.jts.geom.Coordinate toCoordinate(java.awt.geom.Point2D point)
           
static java.awt.geom.Point2D toPoint2D(com.vividsolutions.jts.geom.Coordinate coordinate)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CoordUtil

public CoordUtil()
Method Detail

average

public static com.vividsolutions.jts.geom.Coordinate average(com.vividsolutions.jts.geom.Coordinate c1,
                                                             com.vividsolutions.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 com.vividsolutions.jts.geom.Coordinate average(java.util.Collection coordinates)
Parameters:
coordinates - not empty

closest

public static com.vividsolutions.jts.geom.Coordinate closest(java.util.Collection coordinates,
                                                             com.vividsolutions.jts.geom.Coordinate p)
Parameters:
coordinates - not empty

add

public static com.vividsolutions.jts.geom.Coordinate add(com.vividsolutions.jts.geom.Coordinate c1,
                                                         com.vividsolutions.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 com.vividsolutions.jts.geom.Coordinate subtract(com.vividsolutions.jts.geom.Coordinate c1,
                                                              com.vividsolutions.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 com.vividsolutions.jts.geom.Coordinate multiply(double d,
                                                              com.vividsolutions.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 com.vividsolutions.jts.geom.Coordinate divide(com.vividsolutions.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 com.vividsolutions.jts.geom.Coordinate toCoordinate(java.awt.geom.Point2D point)

toPoint2D

public static java.awt.geom.Point2D toPoint2D(com.vividsolutions.jts.geom.Coordinate coordinate)

add

public static java.awt.geom.Point2D add(java.awt.geom.Point2D a,
                                        java.awt.geom.Point2D b)

subtract

public static java.awt.geom.Point2D subtract(java.awt.geom.Point2D a,
                                             java.awt.geom.Point2D b)