Interface Position

  • All Implemented Interfaces:
    java.io.Serializable

    
    public interface Position<P extends Position<P>>
     implements Serializable
                        

    An interface to represent a generic coordinates system.

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
    • Field Summary

      Fields 
      Modifier and Type Field Description
    • Constructor Summary

      Constructors 
      Constructor Description
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
    • Method Summary

      Modifier and Type Method Description
      abstract List<P> boundingBox(Double range) Given a range, produces N coordinates, representing the N opposite vertices of the hypercube having the current coordinate as center and circumscribing the N-sphere defined by the range.
      abstract Double getCoordinate(Integer dimension) Allows to access the value of a coordinate.
      abstract Double distanceTo(P other) Computes the distance between this position and another compatible position.
      abstract P plus(DoubleArray other) Considers both positions as vectors, and sums them.
      abstract P minus(DoubleArray other) Considers both positions as vectors, and returns the difference between this position and the passed one.
      abstract DoubleArray getCoordinates() Allows to get the position as a Number array.
      abstract Integer getDimensions()
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

    • Method Detail

      • boundingBox

         abstract List<P> boundingBox(Double range)

        Given a range, produces N coordinates, representing the N opposite vertices of the hypercube having the current coordinate as center and circumscribing the N-sphere defined by the range. In the case of two dimensional coordinates, it must return the opposite vertices of the square circumscribing the circle with center in this position and radius range.

        Parameters:
        range -
        the radius of the hypersphere
        Returns:

        the vertices of the circumscribed hypercube

      • getCoordinate

         abstract Double getCoordinate(Integer dimension)

        Allows to access the value of a coordinate.

        Parameters:
        dimension -
        the dimension. E.g., in a 2-dimensional implementation, 0
        could be the X-axis and 1 the Y-axis
        Returns:

        the coordinate value

      • distanceTo

         abstract Double distanceTo(P other)

        Computes the distance between this position and another compatible position.

        Parameters:
        other -
        the position you want to know the distance to
        Returns:

        the distance between this and p

      • plus

         abstract P plus(DoubleArray other)

        Considers both positions as vectors, and sums them.

        Parameters:
        other - the other position
        Returns:

        a new {@link Position} that is the sum of the two.

      • minus

         abstract P minus(DoubleArray other)

        Considers both positions as vectors, and returns the difference between this position and the passed one.

        Parameters:
        other - the other position
        Returns:

        a new {@link Position} that is this position minus the one passed.

      • getCoordinates

         abstract DoubleArray getCoordinates()

        Allows to get the position as a Number array.

        Returns:

        an array of size getDimensions() where each element represents a coordinate.

      • getDimensions

         abstract Integer getDimensions()
        Returns:

        the number of dimensions of this {@link Position}.