Class Vector3d

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

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

    • ZERO

      public static final Vector3d ZERO
    • UNIT_X

      public static final Vector3d UNIT_X
    • UNIT_Y

      public static final Vector3d UNIT_Y
    • UNIT_Z

      public static final Vector3d UNIT_Z
    • ONE

      public static final Vector3d ONE
    • UP

      public static final Vector3d UP
    • FORWARD

      public static final Vector3d FORWARD
  • Constructor Details

    • Vector3d

      public Vector3d(Vector2d v)
    • Vector3d

      public Vector3d(Vector2d v, float z)
    • Vector3d

      public Vector3d(Vector2d v, double z)
    • Vector3d

      public Vector3d(Vector4d v)
    • Vector3d

      public Vector3d(VectorNd v)
    • Vector3d

      public Vector3d(float x, float y, float z)
    • Vector3d

      public Vector3d(double x, double y, double z)
  • Method Details

    • x

      public double x()
    • y

      public double y()
    • z

      public double z()
    • floorX

      public int floorX()
    • floorY

      public int floorY()
    • floorZ

      public int floorZ()
    • add

      public Vector3d add(Vector3d v)
    • add

      public Vector3d add(float x, float y, float z)
    • add

      public Vector3d add(double x, double y, double z)
    • sub

      public Vector3d sub(Vector3d v)
    • sub

      public Vector3d sub(float x, float y, float z)
    • sub

      public Vector3d sub(double x, double y, double z)
    • mul

      public Vector3d mul(float a)
    • mul

      public Vector3d mul(double a)
      Specified by:
      mul in interface Vectord
    • mul

      public Vector3d mul(Vector3d v)
    • mul

      public Vector3d mul(float x, float y, float z)
    • mul

      public Vector3d mul(double x, double y, double z)
    • div

      public Vector3d div(float a)
    • div

      public Vector3d div(double a)
      Specified by:
      div in interface Vectord
    • div

      public Vector3d div(Vector3d v)
    • div

      public Vector3d div(float x, float y, float z)
    • div

      public Vector3d div(double x, double y, double z)
    • dot

      public double dot(Vector3d v)
    • dot

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

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

      public Vector3d project(Vector3d v)
    • project

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

      public Vector3d project(double x, double y, double z)
    • cross

      public Vector3d cross(Vector3d v)
    • cross

      public Vector3d cross(float x, float y, float z)
    • cross

      public Vector3d cross(double x, double y, double z)
    • pow

      public Vector3d pow(float pow)
    • pow

      public Vector3d pow(double power)
      Specified by:
      pow in interface Vectord
    • ceil

      public Vector3d ceil()
      Specified by:
      ceil in interface Vectord
    • floor

      public Vector3d floor()
      Specified by:
      floor in interface Vectord
    • round

      public Vector3d round()
      Specified by:
      round in interface Vectord
    • abs

      public Vector3d abs()
      Specified by:
      abs in interface Vectord
    • negate

      public Vector3d negate()
      Specified by:
      negate in interface Vectord
    • min

      public Vector3d min(Vector3d v)
    • min

      public Vector3d min(float x, float y, float z)
    • min

      public Vector3d min(double x, double y, double z)
    • max

      public Vector3d max(Vector3d v)
    • max

      public Vector3d max(float x, float y, float z)
    • max

      public Vector3d max(double x, double y, double z)
    • distanceSquared

      public double distanceSquared(Vector3d v)
    • distanceSquared

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

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

      public double distance(Vector3d v)
    • distance

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

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

      public double lengthSquared()
      Specified by:
      lengthSquared in interface Vectord
    • length

      public double length()
      Specified by:
      length in interface Vectord
    • normalize

      public Vector3d normalize()
      Specified by:
      normalize in interface Vectord
    • minAxis

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

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

      public Vector2d toVector2()
    • toVector2

      public Vector2d toVector2(boolean useZ)
    • toVector4

      public Vector4d toVector4()
    • toVector4

      public Vector4d toVector4(float w)
    • toVector4

      public Vector4d toVector4(double w)
    • toVectorN

      public VectorNd toVectorN()
    • toArray

      public double[] toArray()
      Specified by:
      toArray in interface Vectord
    • toInt

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

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

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

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

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

      public static Vector3d from(double x, double y, double z)
    • createRandomDirection

      public static Vector3d 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 Vector3d 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
    • createDirectionDeg

      public static Vector3d 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
    • createDirectionRad

      public static Vector3d 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
    • createDirectionRad

      public static Vector3d 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