Package com.irurueta.geometry
Interface Point<P extends Point<P>>
- All Superinterfaces:
Serializable
- All Known Implementing Classes:
HomogeneousPoint2D,HomogeneousPoint3D,InhomogeneousPoint2D,InhomogeneousPoint3D,Point2D,Point3D
Interface defining a point (either in 2D or 3D, or any other further dimensions that might be defined).
-
Method Summary
Modifier and TypeMethodDescriptiondoubledistanceTo(P point) Returns Euclidean distance between this point and provided point.intReturns number of dimensions of this point implementation.doublegetInhomogeneousCoordinate(int dim) Gets value of inhomogeneous coordinate for provided dimension.voidsetInhomogeneousCoordinate(int dim, double value) Sets value of inhomogeneous coordinate for provided dimension.doublesqrDistanceTo(P point) Returns squared Euclidean distance between this point and provided point.
-
Method Details
-
getDimensions
int getDimensions()Returns number of dimensions of this point implementation.- Returns:
- number of dimensions.
-
getInhomogeneousCoordinate
double getInhomogeneousCoordinate(int dim) Gets value of inhomogeneous coordinate for provided dimension.- Parameters:
dim- dimension to retrieve coordinate for (i.e. 0 means x, 1 means y, 2 means z, etc).- Returns:
- value of inhomogeneous coordinate.
- Throws:
IllegalArgumentException- if provided dimension value is negative or exceeds number of dimensions.
-
setInhomogeneousCoordinate
void setInhomogeneousCoordinate(int dim, double value) Sets value of inhomogeneous coordinate for provided dimension.- Parameters:
dim- dimension to set coordinate for (i.e. 0 means x, 1 means y, 2 means z, etc.).value- value to be set.- Throws:
IllegalArgumentException- if provided dimension value is negative or exceeds number of dimensions.
-
distanceTo
Returns Euclidean distance between this point and provided point.- Parameters:
point- point to compare.- Returns:
- Euclidean distance between this point and provided point.
-
sqrDistanceTo
Returns squared Euclidean distance between this point and provided point.- Parameters:
point- point to compare.- Returns:
- Euclidean distance between this point and provided point.
-