Package 

Interface Vector

  • All Implemented Interfaces:

    
    public interface Vector<S extends Vector<S>>
    
                        

    A generic vector in a multidimensional space.

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
    • Field Summary

      Fields 
      Modifier and Type Field Description
    • Constructor Summary

      Constructors 
      Constructor Description
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
    • 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()
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

    • 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
      • plus

         abstract S plus(S other)

        Support for sum. Note: the dimensions must coincide.

      • minus

         abstract S minus(S other)

        Support for subtraction. Note: the dimensions must coincide.

      • times

         abstract S times(Double other)

        Multiplication by a Double.

      • dot

         Double dot(S other)

        Computes the dot product between two vectors.

      • 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.

      • coerceIn

         S coerceIn(Double minimumMagnitude, Double maximumMagnitude)

        Performs a coercion at least and at most.

      • normal

         abstract S normal()

        Find the normal of a vector.

      • 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.