Package com.skillw.particlelib.utils
Object VectorUtils
-
- All Implemented Interfaces:
public class VectorUtils
向量工具类
Zoyn
-
-
Field Summary
Fields Modifier and Type Field Description public final static VectorUtils
INSTANCE
-
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. -
-
Method Detail
-
createVector
final Vector createVector(Location start, Location end)
只通过数字本身相减得到向量, 减少额外克隆的损耗
- Parameters:
start
- 起点end
- 终点- Returns:
Vector
-
getLeftDirection
final Vector getLeftDirection(Location location)
-
getRightDirection
final Vector getRightDirection(Location location)
-
getUpVector
final Vector getUpVector()
得到一个单位为 1 的向上的向量
- Returns:
Vector
-
getUpVector
final Vector getUpVector(Double multiply)
-
rotateAroundAxisX
final Vector rotateAroundAxisX(Vector vec, Double angleValue)
-
rotateAroundAxisY
final Vector rotateAroundAxisY(Vector vec, Double angleValue)
-
rotateAroundAxisZ
final Vector rotateAroundAxisZ(Vector vec, Double angleValue)
-
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
-
-
-
-