Class VectorUtils

java.lang.Object
dev.esophose.playerparticles.util.VectorUtils

public final class VectorUtils
extends java.lang.Object
  • Method Summary

    Modifier and Type Method Description
    static double angleToXAxis​(org.bukkit.util.Vector vector)
    Gets the angle toward the X axis
    static org.bukkit.util.Vector rotateAroundAxisX​(org.bukkit.util.Vector v, double angle)
    Rotates a vector around the X axis at an angle
    static org.bukkit.util.Vector rotateAroundAxisY​(org.bukkit.util.Vector v, double angle)
    Rotates a vector around the Y axis at an angle
    static org.bukkit.util.Vector rotateAroundAxisZ​(org.bukkit.util.Vector v, double angle)
    Rotates a vector around the Z axis at an angle
    static org.bukkit.util.Vector rotateVector​(org.bukkit.util.Vector v, double angleX, double angleY, double angleZ)
    Rotates a vector around the X, Y, and Z axes
    static org.bukkit.util.Vector rotateVector​(org.bukkit.util.Vector v, float yawDegrees, float pitchDegrees)
    This handles non-unit vectors, with yaw and pitch instead of X,Y,Z angles.
    static org.bukkit.util.Vector rotateVector​(org.bukkit.util.Vector v, org.bukkit.Location location)
    Rotate a vector about a location using that location's direction

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • rotateAroundAxisX

      public static org.bukkit.util.Vector rotateAroundAxisX​(org.bukkit.util.Vector v, double angle)
      Rotates a vector around the X axis at an angle
      Parameters:
      v - Starting vector
      angle - How much to rotate
      Returns:
      The starting vector rotated
    • rotateAroundAxisY

      public static org.bukkit.util.Vector rotateAroundAxisY​(org.bukkit.util.Vector v, double angle)
      Rotates a vector around the Y axis at an angle
      Parameters:
      v - Starting vector
      angle - How much to rotate
      Returns:
      The starting vector rotated
    • rotateAroundAxisZ

      public static org.bukkit.util.Vector rotateAroundAxisZ​(org.bukkit.util.Vector v, double angle)
      Rotates a vector around the Z axis at an angle
      Parameters:
      v - Starting vector
      angle - How much to rotate
      Returns:
      The starting vector rotated
    • rotateVector

      public static org.bukkit.util.Vector rotateVector​(org.bukkit.util.Vector v, double angleX, double angleY, double angleZ)
      Rotates a vector around the X, Y, and Z axes
      Parameters:
      v - The starting vector
      angleX - The change angle on X
      angleY - The change angle on Y
      angleZ - The change angle on Z
      Returns:
      The starting vector rotated
    • rotateVector

      public static org.bukkit.util.Vector rotateVector​(org.bukkit.util.Vector v, org.bukkit.Location location)
      Rotate a vector about a location using that location's direction
      Parameters:
      v - The starting vector
      location - The location to rotate around
      Returns:
      The starting vector rotated
    • rotateVector

      public static org.bukkit.util.Vector rotateVector​(org.bukkit.util.Vector v, float yawDegrees, float pitchDegrees)
      This handles non-unit vectors, with yaw and pitch instead of X,Y,Z angles. Thanks to SexyToad!
      Parameters:
      v - The starting vector
      yawDegrees - The yaw offset in degrees
      pitchDegrees - The pitch offset in degrees
      Returns:
      The starting vector rotated
    • angleToXAxis

      public static double angleToXAxis​(org.bukkit.util.Vector vector)
      Gets the angle toward the X axis
      Parameters:
      vector - The vector to check
      Returns:
      The angle toward the X axis