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
All Implemented Interfaces:
Point<V>, Spatial, Vector<V>
Direct Known Subclasses:
Vector2D, Vector3D

public abstract class MultiDimensionalEuclideanVector<V extends MultiDimensionalEuclideanVector<V>> extends EuclideanVector<V>
Abstract base class for Euclidean vectors with two or more dimensions.
  • Constructor Details

    • MultiDimensionalEuclideanVector

      public MultiDimensionalEuclideanVector()
  • Method Details

    • project

      public abstract V project(V base)
      Get the projection of the instance onto the given base vector. The returned vector is parallel to base. Vector projection and rejection onto a given base are related by the equation v = 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

      public abstract V reject(V base)
      Get the rejection of the instance from the given base vector. The returned vector is orthogonal to base. This operation can be interpreted as returning the orthogonal projection of the instance onto the hyperplane orthogonal to base. Vector projection and rejection onto a given base are related by the equation v = 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

      public abstract V 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

      public abstract V orthogonal(V dir)
      Get a unit vector orthogonal to the current vector and pointing in the direction of dir. This method is equivalent to calling dir.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.