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 -
Method Summary
Modifier and TypeMethodDescriptionabstract V
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
Get the projection of the instance onto the given base vector.abstract V
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
-
Constructor Details
-
MultiDimensionalEuclideanVector
public MultiDimensionalEuclideanVector()
-
-
Method Details
-
project
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:
IllegalArgumentException
- if the norm of the base vector is zero, NaN, or infinite- See Also:
-
reject
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:
IllegalArgumentException
- if the norm of the base vector is zero, NaN, or infinite- See Also:
-
orthogonal
Get a unit vector orthogonal to the instance.- Returns:
- a unit vector orthogonal to the current instance
- Throws:
IllegalArgumentException
- if the norm of the current instance is zero, NaN, or infinite
-
orthogonal
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:
IllegalArgumentException
- if either vector norm is zero, NaN or infinite, or the given vector is collinear with this vector.
-