Class Vector3f

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

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

    • ZERO

      public static final Vector3f ZERO
    • UNIT_X

      public static final Vector3f UNIT_X
    • UNIT_Y

      public static final Vector3f UNIT_Y
    • UNIT_Z

      public static final Vector3f UNIT_Z
    • ONE

      public static final Vector3f ONE
    • UP

      public static final Vector3f UP
    • FORWARD

      public static final Vector3f FORWARD
  • Constructor Details

    • Vector3f

      public Vector3f(Vector2f v)
    • Vector3f

      public Vector3f(Vector2f v, double z)
    • Vector3f

      public Vector3f(Vector2f v, float z)
    • Vector3f

      public Vector3f(Vector4f v)
    • Vector3f

      public Vector3f(VectorNf v)
    • Vector3f

      public Vector3f(double x, double y, double z)
    • Vector3f

      public Vector3f(float x, float y, float z)
  • Method Details

    • x

      public float x()
    • y

      public float y()
    • z

      public float z()
    • floorX

      public int floorX()
    • floorY

      public int floorY()
    • floorZ

      public int floorZ()
    • add

      public Vector3f add(Vector3f v)
    • add

      public Vector3f add(double x, double y, double z)
    • add

      public Vector3f add(float x, float y, float z)
    • sub

      public Vector3f sub(Vector3f v)
    • sub

      public Vector3f sub(double x, double y, double z)
    • sub

      public Vector3f sub(float x, float y, float z)
    • mul

      public Vector3f mul(double a)
    • mul

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

      public Vector3f mul(Vector3f v)
    • mul

      public Vector3f mul(double x, double y, double z)
    • mul

      public Vector3f mul(float x, float y, float z)
    • div

      public Vector3f div(double a)
    • div

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

      public Vector3f div(Vector3f v)
    • div

      public Vector3f div(double x, double y, double z)
    • div

      public Vector3f div(float x, float y, float z)
    • dot

      public float dot(Vector3f v)
    • dot

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

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

      public Vector3f project(Vector3f v)
    • project

      public Vector3f project(double x, double y, double z)
    • project

      public Vector3f project(float x, float y, float z)
    • cross

      public Vector3f cross(Vector3f v)
    • cross

      public Vector3f cross(double x, double y, double z)
    • cross

      public Vector3f cross(float x, float y, float z)
    • pow

      public Vector3f pow(double pow)
    • pow

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

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

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

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

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

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

      public Vector3f min(Vector3f v)
    • min

      public Vector3f min(double x, double y, double z)
    • min

      public Vector3f min(float x, float y, float z)
    • max

      public Vector3f max(Vector3f v)
    • max

      public Vector3f max(double x, double y, double z)
    • max

      public Vector3f max(float x, float y, float z)
    • distanceSquared

      public float distanceSquared(Vector3f v)
    • distanceSquared

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

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

      public float distance(Vector3f v)
    • distance

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

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

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

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

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

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

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

      public Vector2f toVector2()
    • toVector2

      public Vector2f toVector2(boolean useZ)
    • toVector4

      public Vector4f toVector4()
    • toVector4

      public Vector4f toVector4(double w)
    • toVector4

      public Vector4f toVector4(float w)
    • toVectorN

      public VectorNf toVectorN()
    • toArray

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

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

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

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

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

      public int compareTo(Vector3f v)
      Specified by:
      compareTo in interface Comparable<Vector3f>
    • 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 Vector3f from(float n)
    • from

      public static Vector3f from(float x, float y, float z)
    • createRandomDirection

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

      public static Vector3f createDirectionDeg(double theta, double phi)
      Gets the direction vector of a certain theta and phi in degrees. This uses the standard math spherical coordinate system.
      Parameters:
      theta - in degrees
      phi - in degrees
      Returns:
      the direction vector
    • createDirectionDeg

      public static Vector3f createDirectionDeg(float theta, float phi)
      Gets the direction vector of a certain theta and phi in degrees. This uses the standard math spherical coordinate system.
      Parameters:
      theta - in degrees
      phi - in degrees
      Returns:
      the direction vector
    • createDirectionRad

      public static Vector3f createDirectionRad(double theta, double phi)
      Gets the direction vector of a certain theta and phi in radians. This uses the standard math spherical coordinate system.
      Parameters:
      theta - in radians
      phi - in radians
      Returns:
      the direction vector
    • createDirectionRad

      public static Vector3f createDirectionRad(float theta, float phi)
      Gets the direction vector of a certain theta and phi in radians. This uses the standard math spherical coordinate system.
      Parameters:
      theta - in radians
      phi - in radians
      Returns:
      the direction vector