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.
-
-
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()
-
-
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}.
-
-
-
-