Class Vector2f

java.lang.Object
org.spongepowered.math.vector.Vector2f
All Implemented Interfaces:
Serializable, Comparable<Vector2f>, Vectorf

@Immutable public final class Vector2f extends Object implements Vectorf, Comparable<Vector2f>, Serializable
See Also:
  • Field Details

    • ZERO

      public static final Vector2f ZERO
    • UNIT_X

      public static final Vector2f UNIT_X
    • UNIT_Y

      public static final Vector2f UNIT_Y
    • ONE

      public static final Vector2f ONE
  • Constructor Details

    • Vector2f

      public Vector2f(Vector3f v)
    • Vector2f

      public Vector2f(Vector4f v)
    • Vector2f

      public Vector2f(VectorNf v)
    • Vector2f

      public Vector2f(double x, double y)
    • Vector2f

      public Vector2f(float x, float y)
  • Method Details

    • x

      public float x()
    • withX

      public Vector2f withX(float x)
    • withX

      public Vector2f withX(double x)
    • y

      public float y()
    • withY

      public Vector2f withY(float y)
    • withY

      public Vector2f withY(double y)
    • floorX

      public int floorX()
    • floorY

      public int floorY()
    • add

      public Vector2f add(Vector2f v)
    • add

      public Vector2f add(double x, double y)
    • add

      public Vector2f add(float x, float y)
    • sub

      public Vector2f sub(Vector2f v)
    • sub

      public Vector2f sub(double x, double y)
    • sub

      public Vector2f sub(float x, float y)
    • mul

      public Vector2f mul(double a)
    • mul

      public Vector2f mul(float a)
      Specified by:
      mul in interface Vectorf
    • mul

      public Vector2f mul(Vector2f v)
    • mul

      public Vector2f mul(double x, double y)
    • mul

      public Vector2f mul(float x, float y)
    • div

      public Vector2f div(double a)
    • div

      public Vector2f div(float a)
      Specified by:
      div in interface Vectorf
    • div

      public Vector2f div(Vector2f v)
    • div

      public Vector2f div(double x, double y)
    • div

      public Vector2f div(float x, float y)
    • dot

      public float dot(Vector2f v)
    • dot

      public float dot(double x, double y)
    • dot

      public float dot(float x, float y)
    • project

      public Vector2f project(Vector2f v)
    • project

      public Vector2f project(double x, double y)
    • project

      public Vector2f project(float x, float y)
    • pow

      public Vector2f pow(double pow)
    • pow

      public Vector2f pow(float power)
      Specified by:
      pow in interface Vectorf
    • ceil

      public Vector2f ceil()
      Specified by:
      ceil in interface Vectorf
    • floor

      public Vector2f floor()
      Specified by:
      floor in interface Vectorf
    • round

      public Vector2f round()
      Specified by:
      round in interface Vectorf
    • abs

      public Vector2f abs()
      Specified by:
      abs in interface Vectorf
    • negate

      public Vector2f negate()
      Specified by:
      negate in interface Vectorf
    • min

      public Vector2f min(Vector2f v)
    • min

      public Vector2f min(double x, double y)
    • min

      public Vector2f min(float x, float y)
    • max

      public Vector2f max(Vector2f v)
    • max

      public Vector2f max(double x, double y)
    • max

      public Vector2f max(float x, float y)
    • distanceSquared

      public float distanceSquared(Vector2f v)
    • distanceSquared

      public float distanceSquared(double x, double y)
    • distanceSquared

      public float distanceSquared(float x, float y)
    • distance

      public float distance(Vector2f v)
    • distance

      public float distance(double x, double y)
    • distance

      public float distance(float x, float y)
    • lengthSquared

      public float lengthSquared()
      Specified by:
      lengthSquared in interface Vectorf
    • length

      public float length()
      Specified by:
      length in interface Vectorf
    • normalize

      public Vector2f normalize()
      Specified by:
      normalize in interface Vectorf
    • minAxis

      public int minAxis()
      Return the axis with the minimal value.
      Specified by:
      minAxis in interface Vectorf
      Returns:
      int axis with minimal value
    • maxAxis

      public int maxAxis()
      Return the axis with the maximum value.
      Specified by:
      maxAxis in interface Vectorf
      Returns:
      int axis with maximum value
    • toVector3

      public Vector3f toVector3()
    • toVector3

      public Vector3f toVector3(double z)
    • toVector3

      public Vector3f toVector3(float z)
    • toVector4

      public Vector4f toVector4()
    • toVector4

      public Vector4f toVector4(double z, double w)
    • toVector4

      public Vector4f toVector4(float z, float w)
    • toVectorN

      public VectorNf toVectorN()
    • toArray

      public float[] toArray()
      Specified by:
      toArray in interface Vectorf
    • toInt

      public Vector2i toInt()
      Specified by:
      toInt in interface Vectorf
    • toLong

      public Vector2l toLong()
      Specified by:
      toLong in interface Vectorf
    • toFloat

      public Vector2f toFloat()
      Specified by:
      toFloat in interface Vectorf
    • toDouble

      public Vector2d toDouble()
      Specified by:
      toDouble in interface Vectorf
    • compareTo

      public int compareTo(Vector2f v)
      Specified by:
      compareTo in interface Comparable<Vector2f>
    • equals

      public boolean equals(Object other)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • from

      public static Vector2f from(float n)
    • from

      public static Vector2f from(float x, float y)
    • createRandomDirection

      public static Vector2f createRandomDirection(Random random)
      Gets the direction vector of a random angle using the random specified.
      Parameters:
      random - to use
      Returns:
      the random direction vector
    • createDirectionDeg

      public static Vector2f createDirectionDeg(double angle)
      Gets the direction vector of a certain angle in degrees.
      Parameters:
      angle - in degrees
      Returns:
      the direction vector
    • createDirectionDeg

      public static Vector2f createDirectionDeg(float angle)
      Gets the direction vector of a certain angle in degrees.
      Parameters:
      angle - in degrees
      Returns:
      the direction vector
    • createDirectionRad

      public static Vector2f createDirectionRad(double angle)
      Gets the direction vector of a certain angle in radians.
      Parameters:
      angle - in radians
      Returns:
      the direction vector
    • createDirectionRad

      public static Vector2f createDirectionRad(float angle)
      Gets the direction vector of a certain angle in radians.
      Parameters:
      angle - in radians
      Returns:
      the direction vector