Interface Point<P extends Point<P>>

  • Type Parameters:
    P - Point implementation type
    All Superinterfaces:
    Spatial
    All Known Implementing Classes:
    EuclideanVector, MultiDimensionalEuclideanVector, Point1S, Point2S, Vector1D, Vector1D.Unit, Vector2D, Vector2D.Unit, Vector3D, Vector3D.Unit

    public interface Point<P extends Point<P>>
    extends Spatial
    Interface representing a point in a mathematical space.

    Implementations of this interface are sufficient to define a space since they define both the structure of the points making up the space and the operations permitted on them. The only mathematical requirement at this level is that the represented space have a defined distance metric, meaning an operation that can compute the distance between two points (ie, the space must be a metric space).

    This interface uses self-referencing generic parameters to ensure that implementations are only used with instances of their own type. This removes the need for casting inside of methods in order to access implementation-specific data, such as coordinate values.

    See Also:
    Metric space
    • Method Detail

      • distance

        double distance​(P p)
        Compute the distance between this point and another point.
        Parameters:
        p - second point
        Returns:
        the distance between this point and p