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
    • 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
        Returns:

        the coordinate value

      • plus

         abstract S plus(S other)

        Support for sum. Note: the dimensions must coincide.

        Returns:

        a vector containing the result

      • minus

         abstract S minus(S other)

        Support for subtraction. Note: the dimensions must coincide.

        Returns:

        a vector containing the result

      • times

         abstract S times(Double other)

        Multiplication by a Double.

        Returns:

        the resulting vector, the operation is not performed in-place.

      • div

         S div(Double other)

        Division by a Double.

        Returns:

        the resulting vector, the operation is not performed in-place.

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

      • resized

         S resized(Double newLen)
        Returns:

        a resized version of the vector, whose magnitude is equal to newLen. Direction and verse of the original vector are preserved.

      • normalized

         abstract S normalized()
        Returns:

        a normalized version of the vector (i.e. of unitary magnitude).

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