Package org.esa.snap.core.util.math
Class CosineDistance
java.lang.Object
org.esa.snap.core.util.math.CosineDistance
- All Implemented Interfaces:
DistanceMeasure
This class uses the negative cosine of the spherical distance as a distance
measure between two (lon, lat) points.
This distance measure is computationally much less expensive than the spherical distance, because it is not necessary to evaluate the inverse of the cosine.
-
Constructor Summary
ConstructorsConstructorDescriptionCosineDistance(double lon, double lat) Creates a new instance of this class. -
Method Summary
Modifier and TypeMethodDescriptiondoubledistance(double lon, double lat) Returns the distance of a given (lon, lat) point to the reference (lon, lat) point.
-
Constructor Details
-
CosineDistance
public CosineDistance(double lon, double lat) Creates a new instance of this class.- Parameters:
lon- The reference longitude of this distance calculator.lat- The reference latitude of this distance calculator.
-
-
Method Details
-
distance
public double distance(double lon, double lat) Returns the distance of a given (lon, lat) point to the reference (lon, lat) point.- Specified by:
distancein interfaceDistanceMeasure- Parameters:
lon- The longitude.lat- The latitude.- Returns:
- the distance of the given (lon, lat) point to the reference (lon, lat) point.
-