-
-
Method Summary
Modifier and Type Method Description abstract Double
get(Integer dim)
The coordinate of this vector in the specified dimension relatively to the basis its space is described with. abstract S
plus(S other)
Support for sum. abstract S
minus(S other)
Support for subtraction. abstract S
times(Double other)
Multiplication by a Double. S
div(Double other)
Division by a Double. Double
dot(S other)
Computes the dot product between two vectors. Double
angleBetween(S other)
Computes the angle in radians between two vectors. abstract Double
distanceTo(S other)
Computes the distance between two vectors, interpreted as points in an Euclidean space. S
resized(Double newLen)
abstract S
normalized()
S
coerceAtMost(Double maximumMagnitude)
S
coerceAtLeast(Double minimumMagnitude)
S
coerceIn(Double minimumMagnitude, Double maximumMagnitude)
Performs a coercion at least and at most. abstract S
normal()
Find the normal of a vector. abstract Integer
getDimensions()
The dimensions of the space this vector belongs to. abstract DoubleArray
getCoordinates()
Coordinates for a Cartesian space. Double
getMagnitude()
-
-
Method Detail
-
get
abstract Double get(Integer dim)
The coordinate of this vector in the specified dimension relatively to the basis its space is described with.
- Parameters:
dim
-the dimension. E.g., in a 2-dimensional implementation, 0 could be the X-axis and 1 the Y-axis
-
angleBetween
Double angleBetween(S other)
Computes the angle in radians between two vectors.
-
distanceTo
abstract Double distanceTo(S other)
Computes the distance between two vectors, interpreted as points in an Euclidean space. Throws IllegalArgumentException if vectors have different dimensions.
-
normalized
abstract S normalized()
-
coerceAtMost
S coerceAtMost(Double maximumMagnitude)
-
coerceAtLeast
S coerceAtLeast(Double minimumMagnitude)
-
coerceIn
S coerceIn(Double minimumMagnitude, Double maximumMagnitude)
Performs a coercion at least and at most.
-
getDimensions
abstract Integer getDimensions()
The dimensions of the space this vector belongs to.
-
getCoordinates
abstract DoubleArray getCoordinates()
Coordinates for a Cartesian space. Implementors must guarantee that internal state is not exposed.
-
getMagnitude
Double getMagnitude()
-
-
-
-