Class MultiDimensionalEuclideanVector<V extends MultiDimensionalEuclideanVector<V>>
- java.lang.Object
-
- org.apache.commons.geometry.euclidean.EuclideanVector<V>
-
- org.apache.commons.geometry.euclidean.MultiDimensionalEuclideanVector<V>
-
- Type Parameters:
V
- Vector implementation type
public abstract class MultiDimensionalEuclideanVector<V extends MultiDimensionalEuclideanVector<V>> extends EuclideanVector<V>
Abstract base class for Euclidean vectors with two or more dimensions.
-
-
Constructor Summary
Constructors Constructor Description MultiDimensionalEuclideanVector()
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description abstract V
orthogonal()
Get a unit vector orthogonal to the instance.abstract V
orthogonal(V dir)
Get a unit vector orthogonal to the current vector and pointing in the direction ofdir
.abstract V
project(V base)
Get the projection of the instance onto the given base vector.abstract V
reject(V base)
Get the rejection of the instance from the given base vector.-
Methods inherited from class org.apache.commons.geometry.euclidean.EuclideanVector
directionTo, eq, getCheckedNorm, isZero, lerp, vectorTo
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.commons.geometry.core.Spatial
getDimension, isFinite, isInfinite, isNaN
-
-
-
-
Method Detail
-
project
public abstract V project(V base)
Get the projection of the instance onto the given base vector. The returned vector is parallel tobase
. Vector projection and rejection onto a given base are related by the equationv = vprojection + vrejection
- Parameters:
base
- base vector- Returns:
- the vector projection of the instance onto
base
- Throws:
java.lang.IllegalArgumentException
- if the norm of the base vector is zero, NaN, or infinite- See Also:
reject(MultiDimensionalEuclideanVector)
-
reject
public abstract V reject(V base)
Get the rejection of the instance from the given base vector. The returned vector is orthogonal tobase
. This operation can be interpreted as returning the orthogonal projection of the instance onto the hyperplane orthogonal tobase
. Vector projection and rejection onto a given base are related by the equationv = vprojection + vrejection
- Parameters:
base
- base vector- Returns:
- the vector rejection of the instance from
base
- Throws:
java.lang.IllegalArgumentException
- if the norm of the base vector is zero, NaN, or infinite- See Also:
project(MultiDimensionalEuclideanVector)
-
orthogonal
public abstract V orthogonal()
Get a unit vector orthogonal to the instance.- Returns:
- a unit vector orthogonal to the current instance
- Throws:
java.lang.IllegalArgumentException
- if the norm of the current instance is zero, NaN, or infinite
-
orthogonal
public abstract V orthogonal(V dir)
Get a unit vector orthogonal to the current vector and pointing in the direction ofdir
. This method is equivalent to callingdir.reject(vec).normalize()
except that no intermediate vector object is produced.- Parameters:
dir
- the direction to use for generating the orthogonal vector- Returns:
- unit vector orthogonal to the current vector and pointing in the direction of
dir
that does not lie along the current vector - Throws:
java.lang.IllegalArgumentException
- if either vector norm is zero, NaN or infinite, or the given vector is collinear with this vector.
-
-