Class AABB.Vec3D

java.lang.Object
studio.magemonkey.fabled.api.target.AABB.Vec3D
Direct Known Subclasses:
AABB.Ray3D
Enclosing class:
AABB

public static class AABB.Vec3D extends Object
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final AABB.Vec3D
    Point with the coordinate (1, 1, 1).
    final double
    X coordinate.
    final double
    Y coordinate.
    final double
    Z coordinate.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Vec3D(double x, double y, double z)
    Creates a new vector with the given coordinates.
    Creates a new vector with the coordinates of the given vector.
  • Method Summary

    Modifier and Type
    Method
    Description
    Add vector v and returns result as new vector.
    boolean
     
    static AABB.Vec3D
    fromLocation(org.bukkit.Location loc)
    Construct a vector from a Bukkit location.
    static AABB.Vec3D
    fromVector(org.bukkit.util.Vector v)
    Construct a copy of our immutable vector from Bukkit's mutable vector.
    int
     
    Normalizes the vector so that its magnitude = 1.
    scale(double s)
    Scales vector uniformly and returns result as new vector.
     

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Field Details

    • UNIT_MAX

      public static final AABB.Vec3D UNIT_MAX
      Point with the coordinate (1, 1, 1).
    • x

      public final double x
      X coordinate.
    • y

      public final double y
      Y coordinate.
    • z

      public final double z
      Z coordinate.
  • Constructor Details

    • Vec3D

      public Vec3D(double x, double y, double z)
      Creates a new vector with the given coordinates.
      Parameters:
      x - the x
      y - the y
      z - the z
    • Vec3D

      public Vec3D(AABB.Vec3D v)
      Creates a new vector with the coordinates of the given vector.
      Parameters:
      v - vector to copy.
  • Method Details

    • fromLocation

      public static AABB.Vec3D fromLocation(org.bukkit.Location loc)
      Construct a vector from a Bukkit location.
      Parameters:
      loc - - the Bukkit location.
    • fromVector

      public static AABB.Vec3D fromVector(org.bukkit.util.Vector v)
      Construct a copy of our immutable vector from Bukkit's mutable vector.
      Parameters:
      v - - Bukkit vector.
      Returns:
      A copy of the given vector.
    • add

      public final AABB.Vec3D add(AABB.Vec3D v)
      Add vector v and returns result as new vector.
      Parameters:
      v - vector to add
      Returns:
      result as new vector
    • scale

      public AABB.Vec3D scale(double s)
      Scales vector uniformly and returns result as new vector.
      Parameters:
      s - scale factor
      Returns:
      new vector
    • normalize

      public AABB.Vec3D normalize()
      Normalizes the vector so that its magnitude = 1.
      Returns:
      The normalized vector.
    • equals

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

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

      public String toString()
      Overrides:
      toString in class Object