Package org.apache.lucene.spatial3d.geom

# Interface DistanceStyle

All Known Implementing Classes:
  `ArcDistance`, `LinearDistance`, `LinearSquaredDistance`, `NormalDistance`, `NormalSquaredDistance`

public interface DistanceStyle
Distance computation styles, supporting various ways of computing distance to shapes.

WARNING: This API is experimental and might change in incompatible ways in the next release.

## Field Summary

Fields
Modifier and Type
Field
Description
`static final ArcDistance`
`ARC`
Arc distance calculator
`static final LinearDistance`
`LINEAR`
Linear distance calculator
`static final LinearSquaredDistance`
`LINEAR_SQUARED`
Linear distance squared calculator
`static final NormalDistance`
`NORMAL`
Normal distance calculator
`static final NormalSquaredDistance`
`NORMAL_SQUARED`
Normal distance squared calculator

## Method Summary

Modifier and Type
Method
Description
`default double`
`aggregateDistances(double... distances)`
Aggregate two distances together to produce a "sum".
`double`
`computeDistance(GeoPoint point1, double x2, double y2, double z2)`
Compute the distance from a point to another point.
`default double`
`computeDistance(GeoPoint point1, GeoPoint point2)`
Compute the distance from a point to another point.
`double`
`computeDistance(PlanetModel planetModel, Plane plane, double x, double y, double z, Membership... bounds)`
Compute the distance from a plane to a point.
`default double`
`computeDistance(PlanetModel planetModel, Plane plane, GeoPoint point, Membership... bounds)`
Compute the distance from a plane to a point.
`GeoPoint[]`
`findDistancePoints(PlanetModel planetModel, double distanceValue, GeoPoint startPoint, Plane plane, Membership... bounds)`
Find a GeoPoint, at a specified distance from a starting point, within the specified bounds.
`double`
`findMaximumArcDistance(PlanetModel planetModel, double distanceValue)`
Given a distance metric, find the maximum arc distance represented by the distance metric.
`double`
`findMinimumArcDistance(PlanetModel planetModel, double distanceValue)`
Given a distance metric, find the minimum arc distance represented by that distance metric.
`default double`
`fromAggregationForm(double aggregateDistance)`
Convert an aggregation form distance value back to an actual distance.
`default double`
`toAggregationForm(double distance)`
Convert a distance to a form meant for aggregation.

## Field Details

### ARC

static final ArcDistance ARC
Arc distance calculator

### LINEAR

static final LinearDistance LINEAR
Linear distance calculator

### LINEAR_SQUARED

static final LinearSquaredDistance LINEAR_SQUARED
Linear distance squared calculator

### NORMAL

static final NormalDistance NORMAL
Normal distance calculator

### NORMAL_SQUARED

static final NormalSquaredDistance NORMAL_SQUARED
Normal distance squared calculator

## Method Details

### computeDistance

default double computeDistance(GeoPoint point1, GeoPoint point2)
Compute the distance from a point to another point.

Parameters:
  `point1` - Starting point
  `point2` - Final point
Returns:
  the distance

### computeDistance

double computeDistance(GeoPoint point1, double x2, double y2, double z2)
Compute the distance from a point to another point.

Parameters:
  `point1` - Starting point
  `x2` - Final point x
  `y2` - Final point y
  `z2` - Final point z
Returns:
  the distance

### computeDistance

default double computeDistance(PlanetModel planetModel, Plane plane, GeoPoint point, Membership... bounds)
Compute the distance from a plane to a point.

Parameters:
  `planetModel` - The planet model
  `plane` - The plane
  `point` - The point
  `bounds` - are the plane bounds
Returns:
  the distance

### computeDistance

double computeDistance(PlanetModel planetModel, Plane plane, double x, double y, double z, Membership... bounds)
Compute the distance from a plane to a point.

Parameters:
  `planetModel` - The planet model
  `plane` - The plane
  `x` - The point x
  `y` - The point y
  `z` - The point z
  `bounds` - are the plane bounds
Returns:
  the distance

### toAggregationForm

default double toAggregationForm(double distance)
Convert a distance to a form meant for aggregation. This is meant to be used in conjunction with aggregateDistances() and fromAggregationForm(). Distances should be converted to aggregation form before aggregation is attempted, and they should be converted back from aggregation form to yield a final result.

Parameters:
  `distance` - is an output of computeDistance().
Returns:
  the distance, converted to aggregation form.

### aggregateDistances

default double aggregateDistances(double... distances)
Aggregate two distances together to produce a "sum". This is usually just an addition operation, but in the case of squared distances it is more complex. Distances should be converted to aggregation form before aggregation is attempted, and they should be converted back from aggregation form to yield a final result.

Parameters:
  `distances` - are the distances to aggregate.
Returns:
  the combined aggregation form distance.

### fromAggregationForm

default double fromAggregationForm(double aggregateDistance)
Convert an aggregation form distance value back to an actual distance. This is meant to be used in conjunction with toAggregationForm() and aggregateDistances(). Distances should be converted to aggregation form before aggregation is attempted, and they should be converted back from aggregation form to yield a final result.

Parameters:
  `aggregateDistance` - is the aggregate form of the distance.
Returns:
  the combined distance.

### findDistancePoints

GeoPoint[] findDistancePoints(PlanetModel planetModel, double distanceValue, GeoPoint startPoint, Plane plane, Membership... bounds)
Find a GeoPoint, at a specified distance from a starting point, within the specified bounds. The GeoPoint must be in the specified plane.

Parameters:
  `planetModel` - is the planet model.
  `distanceValue` - is the distance to set the new point at, measured from point1 and on the way to point2.
  `startPoint` - is the starting point.
  `plane` - is the plane that the point must be in.
  `bounds` - are the constraints on where the point can be found.
Returns:
  zero, one, or two points at the proper distance from startPoint.

### findMinimumArcDistance

double findMinimumArcDistance(PlanetModel planetModel, double distanceValue)
Given a distance metric, find the minimum arc distance represented by that distance metric.

Parameters:
  `planetModel` - is the planet model.
  `distanceValue` - is the distance metric.
Returns:
  the minimum arc distance that that distance value can represent given the planet model.

### findMaximumArcDistance

double findMaximumArcDistance(PlanetModel planetModel, double distanceValue)
Given a distance metric, find the maximum arc distance represented by the distance metric.

Parameters:
  `planetModel` - is the planet model.
  `distanceValue` - is the distance metric.
Returns:
  the maximum arc distance that that distance value can represent given the planet model.