Class PathVector

java.lang.Object
de.metaphoriker.pathetic.api.wrapper.PathVector
All Implemented Interfaces:
Cloneable

public class PathVector extends Object implements Cloneable
  • Constructor Details

    • PathVector

      public PathVector()
  • Method Details

    • computeDistance

      public static double computeDistance(PathVector A, PathVector B, PathVector C)
      Finds the distance between the line BC and the point A
      Parameters:
      A - The point
      B - The first point of the line
      C - The second point of the line
      Returns:
      The distance
    • dot

      public double dot(PathVector otherVector)
      Calculates the dot product of two vectors
      Parameters:
      otherVector - The other vector
      Returns:
      The dot product
    • length

      public double length()
      Gets the length of the PathVector
      Returns:
      The length
    • distance

      public double distance(PathVector otherVector)
      Gets the distance between this vector and another vector
      Parameters:
      otherVector - The other vector
      Returns:
      The distance
    • setX

      public PathVector setX(double x)
      Sets the x component of the vector
      Parameters:
      x - The x component
      Returns:
      A new PathVector
    • setY

      public PathVector setY(double y)
      Sets the y component of the vector
      Parameters:
      y - The y component
      Returns:
      A new PathVector
    • setZ

      public PathVector setZ(double z)
      Sets the z component of the vector
      Parameters:
      z - The z component
      Returns:
      A new PathVector
    • subtract

      @NonNull public @NonNull PathVector subtract(PathVector otherVector)
      Subtracts one vector from another
      Parameters:
      otherVector - PathVector to vector to subtract from the current Vector
      Returns:
      A new PathVector
    • multiply

      @NonNull public @NonNull PathVector multiply(double value)
      Multiplies itself by a scalar constant
      Parameters:
      value - The constant to multiply by
      Returns:
      A new PathVector
    • normalize

      @NonNull public @NonNull PathVector normalize()
      Normalises the PathVector (Divides the components by its magnitude)
      Returns:
      A new PathVector
    • divide

      public PathVector divide(double value)
      Divide the vector by a scalar constant
      Parameters:
      value - The constant to divide by
      Returns:
      A new PathVector
    • add

      public PathVector add(PathVector otherVector)
      Adds two vectors together
      Parameters:
      otherVector - The other vector
      Returns:
      A new PathVector
    • getCrossProduct

      public PathVector getCrossProduct(PathVector o)
      Calculates the cross product of two vectors
      Parameters:
      o - The other vector
      Returns:
      The cross product vector
    • clone

      public PathVector clone()
      Overrides:
      clone in class Object