Interface MVector2d

All Superinterfaces:
Vector2d

public interface MVector2d extends Vector2d
Interface for handling vectors in the XY-plane. Allows modification of the vector.
Since:
9.10.2
  • Method Details

    • create

      static MVector2d create()
      Returns a 2-dimensional vector with the X and Y values set to 0.
      Returns:
      a vector with all components set to 0.
      Since:
      9.10.2
    • create

      static MVector2d create(double x, double y)
      Returns a 2-dimensional vector with the given component values.
      Parameters:
      x - the value of the X component
      y - the value of the Y component
      Returns:
      a 2-dimensional vector with the given component values
      Since:
      9.10.2
    • create

      static MVector2d create(Vector2d vec)
      Returns a 2-dimensional vector with the X and Y values set to those of the given vector.
      Parameters:
      vec - the vector used for setting the values of the created vector
      Returns:
      a 2-dimensional vector with the values set to those of the given vector
      Since:
      9.10.2
    • to2dVectors

      static List<MVector2d> to2dVectors(List<? extends Vector3d> vectors)
      Returns the vectors in the given list projected to the XY-plane. The order of the vectors is preserved.
      Parameters:
      vectors - vectors that are projected to the XY-plane
      Returns:
      the vectors in the given list projected to the XY-plane
      Since:
      9.10.2
    • addInPlace

      void addInPlace(Vector2d vec)
      Adds the given vector to this vector in place.
      Parameters:
      vec - vector that is added to this vector
      Since:
      9.10.2
    • interpolateInPlace

      void interpolateInPlace(Vector2d vector, double alpha)
      Sets this vector to be the interpolation between this vector and the given vector so that the weight of the given vector is alpha (this = (1 - alpha) * this + alpha * vector). Values smaller than 0 default to 0 and value greater than 1 default to 1.
      Parameters:
      vector - the vector with which this is interpolated
      alpha - the interpolation factor
      Since:
      9.10.2
    • negateInPlace

      void negateInPlace()
      Negates this vector in place.
      Since:
      9.10.2
    • normalizeInPlace

      void normalizeInPlace()
      Normalizes this vector in place to be of length 1. If this vector is a zero vector, then all components of this vector are set to NaN.
      Since:
      9.10.2
    • scaleInPlace

      void scaleInPlace(double scalar)
      Multiplies this vector in place by the given scalar.
      Parameters:
      scalar - the scalar used in the multiplication
      Since:
      9.10.2
    • set

      void set(double x, double y)
      Sets the X and Y components of this vector to the given values.
      Parameters:
      x - the value of the X component
      y - the value of the Y component
      Since:
      9.10.2
    • set

      void set(Vector2d vec)
      Sets the X and Y components of this vector to the values of the given vector.
      Parameters:
      vec - the vector used for setting the values of this vector
      Since:
      9.10.2
    • setX

      void setX(double x)
      Sets the X component of this vector.
      Parameters:
      x - the value for the X component
      Since:
      9.10.2
    • setY

      void setY(double y)
      Sets the Y component of this vector.
      Parameters:
      y - the value for the Y component
      Since:
      9.10.2
    • subtractInPlace

      void subtractInPlace(Vector2d other)
      Subtracts in place the given vector from this vector.
      Parameters:
      other - the vector that is subtracted from this vector
      Since:
      9.10.2