Package org.naviqore.utils.spatial
Interface Coordinate
- All Known Implementing Classes:
CartesianCoordinate,GeoCoordinate
public interface Coordinate
This interface represents a generic 2D coordinate. Implementations of this interface should provide methods to get
the two components of the coordinate and calculate distances.
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic enumThe axes of a 2D coordinate system. -
Method Summary
Modifier and TypeMethodDescriptiondoubledistanceTo(double firstComponent, double secondComponent) Calculates the distance to another point specified by its components.doubledistanceTo(Coordinate other) Calculates the distance to anotherCoordinateobject.default doublegetComponent(Coordinate.Axis axis) Gets the coordinate component based on the specifiedAxis.doubleExamples for the first component are latitude or X coordinate.doubleExamples for the first component are longitude or Y coordinate.
-
Method Details
-
getFirstComponent
double getFirstComponent()Examples for the first component are latitude or X coordinate.- Returns:
- the first component of the 2D-coordinate
-
getSecondComponent
double getSecondComponent()Examples for the first component are longitude or Y coordinate.- Returns:
- the second component of the 2D-coordinate
-
distanceTo
double distanceTo(double firstComponent, double secondComponent) Calculates the distance to another point specified by its components.
-