Interface Point<P extends Point<P>>

All Superinterfaces:
Serializable
All Known Implementing Classes:
HomogeneousPoint2D, HomogeneousPoint3D, InhomogeneousPoint2D, InhomogeneousPoint3D, Point2D, Point3D

public interface Point<P extends Point<P>> extends Serializable
Interface defining a point (either in 2D or 3D, or any other further dimensions that might be defined).
  • Method Summary

    Modifier and Type
    Method
    Description
    double
    distanceTo(P point)
    Returns Euclidean distance between this point and provided point.
    int
    Returns number of dimensions of this point implementation.
    double
    Gets value of inhomogeneous coordinate for provided dimension.
    void
    setInhomogeneousCoordinate(int dim, double value)
    Sets value of inhomogeneous coordinate for provided dimension.
    double
    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

      double distanceTo(P point)
      Returns Euclidean distance between this point and provided point.
      Parameters:
      point - point to compare.
      Returns:
      Euclidean distance between this point and provided point.
    • sqrDistanceTo

      double sqrDistanceTo(P point)
      Returns squared Euclidean distance between this point and provided point.
      Parameters:
      point - point to compare.
      Returns:
      Euclidean distance between this point and provided point.