Class Vector3f

java.lang.Object
cn.nukkit.math.Vector3f
All Implemented Interfaces:
Cloneable

public class Vector3f extends Object implements Cloneable
  • Field Details

  • Constructor Details

    • Vector3f

      public Vector3f()
    • Vector3f

      public Vector3f(float x)
    • Vector3f

      public Vector3f(float x, float y)
    • Vector3f

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

    • getX

      public float getX()
    • getY

      public float getY()
    • getZ

      public float getZ()
    • setX

      @Since("FUTURE") public Vector3f setX(float x)
    • setY

      @Since("FUTURE") public Vector3f setY(float y)
    • setZ

      @Since("FUTURE") public Vector3f setZ(float z)
    • getFloorX

      public int getFloorX()
    • getFloorY

      public int getFloorY()
    • getFloorZ

      public int getFloorZ()
    • getRight

      public float getRight()
    • getUp

      public float getUp()
    • getForward

      public float getForward()
    • getSouth

      public float getSouth()
    • getWest

      public float getWest()
    • add

      public Vector3f add(float x)
    • add

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

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

      public Vector3f add(Vector3f x)
    • subtract

      public Vector3f subtract()
    • subtract

      public Vector3f subtract(float x)
    • subtract

      public Vector3f subtract(float x, float y)
    • subtract

      public Vector3f subtract(float x, float y, float z)
    • subtract

      public Vector3f subtract(Vector3f x)
    • multiply

      public Vector3f multiply(float number)
    • divide

      public Vector3f divide(float number)
    • ceil

      public Vector3f ceil()
    • floor

      public Vector3f floor()
    • round

      public Vector3f round()
    • abs

      public Vector3f abs()
    • getSide

      public Vector3f getSide(int side)
    • getSide

      public Vector3f getSide(int side, int step)
    • getOppositeSide

      public static int getOppositeSide(int side)
    • distance

      public double distance(Vector3f pos)
    • distanceSquared

      public double distanceSquared(Vector3f pos)
    • maxPlainDistance

      public float maxPlainDistance()
    • maxPlainDistance

      public float maxPlainDistance(float x)
    • maxPlainDistance

      public float maxPlainDistance(float x, float z)
    • maxPlainDistance

      public float maxPlainDistance(Vector2f vector)
    • maxPlainDistance

      public float maxPlainDistance(Vector3f x)
    • length

      public double length()
      Calculates the Length of this Vector
      Returns:
      The Length of this Vector.
    • lengthSquared

      public float lengthSquared()
    • normalize

      public Vector3f normalize()
    • dot

      public float dot(Vector3f v)
      Scalar Product of this Vector and the Vector supplied.
      Parameters:
      v - Vector to calculate the scalar product to.
      Returns:
      Scalar Product
    • cross

      public Vector3f cross(Vector3f v)
      Calculates the cross product of this Vector and the given Vector
      Parameters:
      v - the vector to calculate the cross product with.
      Returns:
      a Vector at right angle to this and other
    • getIntermediateWithXValue

      public Vector3f getIntermediateWithXValue(Vector3f v, float x)
      Returns a new vector with x value equal to the second parameter, along the line between this vector and the passed in vector, or null if not possible.
      Parameters:
      v - vector
      x - x value
      Returns:
      intermediate vector
    • getIntermediateWithYValue

      public Vector3f getIntermediateWithYValue(Vector3f v, float y)
      Returns a new vector with y value equal to the second parameter, along the line between this vector and the passed in vector, or null if not possible.
      Parameters:
      v - vector
      y - y value
      Returns:
      intermediate vector
    • getIntermediateWithZValue

      public Vector3f getIntermediateWithZValue(Vector3f v, float z)
      Returns a new vector with z value equal to the second parameter, along the line between this vector and the passed in vector, or null if not possible.
      Parameters:
      v - vector
      z - z value
      Returns:
      intermediate vector
    • setComponents

      public Vector3f setComponents(float x, float y, float z)
    • getAxis

      @PowerNukkitOnly @Since("1.4.0.0-PN") public float getAxis(BlockFace.Axis axis)
    • toString

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

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • rawHashCode

      public int rawHashCode()
    • clone

      public Vector3f clone()
      Overrides:
      clone in class Object
    • asVector3

      public Vector3 asVector3()
    • asBlockVector3

      public BlockVector3 asBlockVector3()