Class Haversine
The Haversine distance metric for geospatial points in meters.
Inheritance
System.Object
Haversine
Implements
IMetric<System.Double[]>
IDistance<System.Double[]>
IMetric<System.Int32[]>
IDistance<System.Int32[]>
System.ICloneable
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace: Mars.Numerics.Distances
Assembly: Mars.Numerics.dll
Syntax
[Serializable]
public class Haversine : IMetric<double[]>, IDistance<double[]>, IDistance<double[], double[]>, IMetric<int[]>, IDistance<int[]>, IDistance<int[], int[]>, IMetric<Tuple<double, double>>, IDistance<Tuple<double, double>>, IDistance<Tuple<double, double>, Tuple<double, double>>, ICloneable
Methods
| Improve this Doc View SourceClone()
Creates a new object that is a copy of the current instance.
Declaration
public object Clone()
Returns
Type | Description |
---|---|
System.Object | A new object that is a copy of this instance. |
Distance(Double, Double, Double, Double)
Gets the Haversine distance approximation between two geospatial points.
Declaration
public double Distance(double lon1, double lat1, double lon2, double lat2)
Parameters
Type | Name | Description |
---|---|---|
System.Double | lon1 | The first coordinate of first point in space. |
System.Double | lat1 | The second coordinate of first point in space. |
System.Double | lon2 | The first coordinate of second point in space. |
System.Double | lat2 | The second coordinate of second point in space. |
Returns
Type | Description |
---|---|
System.Double | The meter distance between x and y in. |
Distance(Double[], Double[])
Computes the distance
d(x,y)
between points
x
and y
.
Declaration
public double Distance(double[] x, double[] y)
Parameters
Type | Name | Description |
---|---|---|
System.Double[] | x | The first point x . |
System.Double[] | y | The second point y . |
Returns
Type | Description |
---|---|
System.Double |
A double-precision value representing the distance d(x,y)
between x and y according
to the distance function implemented by this class.
|
Distance(Int32[], Int32[])
Computes the distance
d(x,y)
between points
x
and y
.
Declaration
public double Distance(int[] x, int[] y)
Parameters
Type | Name | Description |
---|---|---|
System.Int32[] | x | The first point x . |
System.Int32[] | y | The second point y . |
Returns
Type | Description |
---|---|
System.Double |
A double-precision value representing the distance d(x,y)
between x and y according
to the distance function implemented by this class.
|
Distance(Tuple<Double, Double>, Tuple<Double, Double>)
Gets the Euclidean distance between two points.
Declaration
public double Distance(Tuple<double, double> x, Tuple<double, double> y)
Parameters
Type | Name | Description |
---|---|---|
System.Tuple<System.Double, System.Double> | x | The first point in space. |
System.Tuple<System.Double, System.Double> | y | The second point in space. |
Returns
Type | Description |
---|---|
System.Double | The Euclidean distance between x and y. |
Implements
System.ICloneable