Public Member Functions
Xapian::GreatCircleMetric Class Reference

Calculate the great-circle distance between two coordinates on a sphere. More...

+ Inheritance diagram for Xapian::GreatCircleMetric:

List of all members.

Public Member Functions

 GreatCircleMetric ()
 Construct a GreatCircleMetric.
 GreatCircleMetric (double radius_)
 Construct a GreatCircleMetric using a specified radius.
double pointwise_distance (const LatLongCoord &a, const LatLongCoord &b) const
 Return the great-circle distance between points on the sphere.
LatLongMetricclone () const
 Clone the metric.
std::string name () const
 Return the full name of the metric.
std::string serialise () const
 Serialise object parameters into a string.
LatLongMetricunserialise (const std::string &s) const
 Create object given string serialisation returned by serialise().

Detailed Description

Calculate the great-circle distance between two coordinates on a sphere.

Experimental - see http://xapian.org/docs/deprecation#experimental-features

This uses the haversine formula to calculate the distance. Note that this formula is subject to inaccuracy due to numerical errors for coordinates on the opposite side of the sphere.

See http://en.wikipedia.org/wiki/Haversine_formula


Constructor & Destructor Documentation

Construct a GreatCircleMetric.

The (quadratic mean) radius of the Earth will be used by this calculator.

Xapian::GreatCircleMetric::GreatCircleMetric ( double  radius_) [explicit]

Construct a GreatCircleMetric using a specified radius.

This is useful for data sets in which the points are not on Earth (eg, a database of features on Mars).

Parameters:
radius_The radius of the sphere to use, in metres.

Member Function Documentation

Clone the metric.

Implements Xapian::LatLongMetric.

std::string Xapian::GreatCircleMetric::name ( ) const [virtual]

Return the full name of the metric.

This is used when serialising and unserialising metrics; for example, for performing remote searches.

If the subclass is in a C++ namespace, the namespace should be included in the name, using "::" as a separator. For example, for a LatLongMetric subclass called "FooLatLongMetric" in the "Xapian" namespace the result of this call should be "Xapian::FooLatLongMetric".

Implements Xapian::LatLongMetric.

std::string Xapian::GreatCircleMetric::serialise ( ) const [virtual]

Serialise object parameters into a string.

The serialised parameters should represent the configuration of the metric.

Implements Xapian::LatLongMetric.

LatLongMetric* Xapian::GreatCircleMetric::unserialise ( const std::string &  s) const [virtual]

Create object given string serialisation returned by serialise().

Parameters:
sA serialised instance of this LatLongMetric subclass.

Implements Xapian::LatLongMetric.


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

Documentation for Xapian (version 1.3.1).
Generated on Fri May 3 2013 by Doxygen 1.7.6.1.