- Main Page
- Namespaces
- Classes
- Files
- Related Pages

- Class List
- Class Hierarchy
- Class Members

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

Computes the distance and closest points between two Geometrys. More...

`#include <DistanceOp.h>`

List of all members.

## Public Member Functions
| DistanceOp (const geom::Geometry *g0, const geom::Geometry *g1)
double | distance ()
geom::CoordinateSequence * | closestPoints ()
std::vector< GeometryLocation * > * | closestLocations ()
## Static Public Member Functions
static double | distance (const geom::Geometry *g0, const geom::Geometry *g1)
static geom::CoordinateSequence * | closestPoints (geom::Geometry *g0, geom::Geometry *g1)

## Detailed Description

Computes the distance and closest points between two Geometrys.

The distance computation finds a pair of points in the input geometries which have minimum distance between them. These points may not be vertices of the geometries, but may lie in the interior of a line segment. In this case 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.

## Constructor & Destructor Documentation

geos::operation::distance::DistanceOp::DistanceOp | ( | const geom::Geometry * | g0,
|  | const geom::Geometry * | g1 |
| ) |  |  |

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

## Member Function Documentation

static double geos::operation::distance::DistanceOp::distance | ( | const geom::Geometry * | g0,
|  | const geom::Geometry * | g1 |
| ) |  |  | `[static]`

Compute the distance between the closest points of two geometries.

Parameters:

  | g0 | a Geometry
  | g1 | another Geometry

Returns:
  the distance between the geometries

static geom::CoordinateSequence* geos::operation::distance::DistanceOp::closestPoints | ( | geom::Geometry * | g0,
|  | 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

double geos::operation::distance::DistanceOp::distance | ( |  | ) |

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

Returns:
  the distance between the geometries

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)

std::vector<GeometryLocation*>* geos::operation::distance::DistanceOp::closestLocations | ( |  | ) |

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

Returns:
  a pair of GeometryLocations for the closest points. Ownership of returned object is left to this instance and it's reference will be invalidated by next call to distance()

The documentation for this class was generated from the following file:

- DistanceOp.h