-
-
Method Summary
Modifier and Type Method Description abstract Doubleget(Integer dim)The coordinate of this vector in the specified dimension relatively to the basis its space is described with. abstract Splus(S other)Support for sum. abstract Sminus(S other)Support for subtraction. abstract Stimes(Double other)Multiplication by a Double. Sdiv(Double other)Division by a Double. Doubledot(S other)Computes the dot product between two vectors. DoubleangleBetween(S other)Computes the angle in radians between two vectors. abstract DoubledistanceTo(S other)Computes the distance between two vectors, interpreted as points in an Euclidean space. Sresized(Double newLen)abstract Snormalized()ScoerceAtMost(Double maximumMagnitude)ScoerceAtLeast(Double minimumMagnitude)ScoerceIn(Double minimumMagnitude, Double maximumMagnitude)Performs a coercion at least and at most. abstract Snormal()Find the normal of a vector. abstract IntegergetDimensions()The dimensions of the space this vector belongs to. abstract DoubleArraygetCoordinates()Coordinates for a Cartesian space. DoublegetMagnitude()-
-
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()
-
-
-
-