Object VectorUtils

  • All Implemented Interfaces:

    
    public class VectorUtils
    
                        

    向量工具类

    Author:

    Zoyn

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
    • Field Summary

      Fields 
      Modifier and Type Field Description
      public final static VectorUtils INSTANCE
    • Constructor Summary

      Constructors 
      Constructor Description
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
    • Method Summary

      Modifier and Type Method Description
      final Vector createVector(Location start, Location end) 只通过数字本身相减得到向量, 减少额外克隆的损耗
      final Vector getLeftDirection(Location location)
      final Vector getRightDirection(Location location)
      final Vector getUpVector() 得到一个单位为 1 的向上的向量
      final Vector getUpVector(Double multiply)
      final Vector rotateAroundAxisX(Vector vec, Double angleValue)
      final Vector rotateAroundAxisY(Vector vec, Double angleValue)
      final Vector rotateAroundAxisZ(Vector vec, Double angleValue)
      final Vector rotateVector(Vector v, Float yawDegrees, Float pitchDegrees) This handles non-unit vectors, with yaw and pitch instead of X,Y,Z angles.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

    • Method Detail

      • createVector

         final Vector createVector(Location start, Location end)

        只通过数字本身相减得到向量, 减少额外克隆的损耗

        Parameters:
        start - 起点
        end - 终点
        Returns:

        Vector

      • getUpVector

         final Vector getUpVector()

        得到一个单位为 1 的向上的向量

        Returns:

        Vector

      • rotateVector

         final Vector rotateVector(Vector v, Float yawDegrees, Float pitchDegrees)

        This handles non-unit vectors, with yaw and pitch instead of X,Y,Z angles.

        Thanks to SexyToad!

        将一个非单位向量使用yaw和pitch来代替X, Y, Z的角旋转方式

        Parameters:
        v - 向量
        yawDegrees - yaw的角度
        pitchDegrees - pitch的角度
        Returns:

        Vector