Main Page | Namespace List | Class Hierarchy | Class List | File List | Namespace Members | Class Members | Related Pages

geos::operation::distance::DistanceOp Class Reference

Find two points on two Geometrys which lie within a given distance, or else are the nearest points on the geometries (in which case this also provides the distance between the geometries). More...

#include <DistanceOp.h>

List of all members.

Public Member Functions

 DistanceOp (const geom::Geometry *g0, const geom::Geometry *g1)
 DistanceOp (const geom::Geometry &g0, const geom::Geometry &g1)
 Constructs a DistanceOp that computes the distance and nearest points between the two specified geometries.
 DistanceOp (const geom::Geometry &g0, const geom::Geometry &g1, double terminateDistance)
 Constructs a DistanceOp that computes the distance and nearest points between the two specified geometries.
double distance ()
geom::CoordinateSequenceclosestPoints ()
geom::CoordinateSequencenearestPoints ()

Static Public Member Functions

double distance (const geom::Geometry &g0, const geom::Geometry &g1)
 Compute the distance between the nearest points of two geometries.
double distance (const geom::Geometry *g0, const geom::Geometry *g1)
bool isWithinDistance (const geom::Geometry &g0, const geom::Geometry &g1, double distance)
 Test whether two geometries lie within a given distance of each other.
geom::CoordinateSequencenearestPoints (const geom::Geometry *g0, const geom::Geometry *g1)
geom::CoordinateSequenceclosestPoints (const geom::Geometry *g0, const geom::Geometry *g1)


Detailed Description

Find two points on two Geometrys which lie within a given distance, or else are the nearest points on the geometries (in which case this also provides the distance between the geometries).

The distance computation also finds a pair of points in the input geometries which have the minimum distance between them. If a point lies in the interior of a line segment, the coordinate computed is a close approximation to the exact point.

The algorithms used are straightforward O(n^2) comparisons. This worst-case performance could be improved on by using Voronoi techniques or spatial indexes.


Constructor & Destructor Documentation

geos::operation::distance::DistanceOp::DistanceOp const geom::Geometry g0,
const geom::Geometry g1
 

Deprecated:
use the one taking references

geos::operation::distance::DistanceOp::DistanceOp const geom::Geometry g0,
const geom::Geometry g1
 

Constructs a DistanceOp that computes the distance and nearest points between the two specified geometries.

Parameters:
g0 a Geometry
g1 a Geometry

geos::operation::distance::DistanceOp::DistanceOp const geom::Geometry g0,
const geom::Geometry g1,
double  terminateDistance
 

Constructs a DistanceOp that computes the distance and nearest points between the two specified geometries.

Parameters:
g0 a Geometry
g1 a Geometry
terminateDistance the distance on which to terminate the search


Member Function Documentation

geom::CoordinateSequence* geos::operation::distance::DistanceOp::closestPoints  ) 
 

Report the coordinates of the closest points in the input geometries. The points are presented in the same order as the input Geometries.

Returns:
a pair of Coordinates of the closest points as a newly allocated object (ownership to caller)

Deprecated:
renamed to nearestPoints

geom::CoordinateSequence* geos::operation::distance::DistanceOp::closestPoints const geom::Geometry g0,
const geom::Geometry g1
[static]
 

Compute the the closest points of two geometries.

The points are presented in the same order as the input Geometries.

Parameters:
g0 a Geometry
g1 another Geometry
Returns:
the closest points in the geometries, ownership to caller. A NULL return means one of the geometries is empty.

Deprecated:
renamed to nearestPoints

double geos::operation::distance::DistanceOp::distance  ) 
 

Report the distance between the closest points on the input geometries.

Returns:
the distance between the geometries

double geos::operation::distance::DistanceOp::distance const geom::Geometry g0,
const geom::Geometry g1
[static]
 

Deprecated:
, use the version taking references

double geos::operation::distance::DistanceOp::distance const geom::Geometry g0,
const geom::Geometry g1
[static]
 

Compute the distance between the nearest points of two geometries.

Parameters:
g0 a Geometry
g1 another Geometry
Returns:
the distance between the geometries

0 if either input geometry is empty

Exceptions:
IllegalArgumentException if either input geometry is null

bool geos::operation::distance::DistanceOp::isWithinDistance const geom::Geometry g0,
const geom::Geometry g1,
double  distance
[static]
 

Test whether two geometries lie within a given distance of each other.

Parameters:
g0 a Geometry
g1 another Geometry
distance the distance to test
Returns:
true if g0.distance(g1) <= distance

geom::CoordinateSequence* geos::operation::distance::DistanceOp::nearestPoints  ) 
 

Report the coordinates of the nearest points in the input geometries. The points are presented in the same order as the input Geometries.

Returns:
a pair of Coordinates of the nearest points as a newly allocated object (ownership to caller)

geom::CoordinateSequence* geos::operation::distance::DistanceOp::nearestPoints const geom::Geometry g0,
const geom::Geometry g1
[static]
 

Compute the the nearest points of two geometries.

The points are presented in the same order as the input Geometries.

Parameters:
g0 a Geometry
g1 another Geometry
Returns:
the nearest points in the geometries, ownership to caller. A NULL return means one of the geometries is empty.


The documentation for this class was generated from the following file:
Generated on Tue Jun 5 14:58:52 2012 for GEOS by  doxygen 1.3.9.1