Package com.skillw.particlelib.utils
Object LocationUtils
-
- All Implemented Interfaces:
public class LocationUtils
坐标工具类
Zoyn
-
-
Field Summary
Fields Modifier and Type Field Description public final static LocationUtils
INSTANCE
-
Method Summary
Modifier and Type Method Description final Location
rotateLocationAboutPoint(Location location, Double angle, Location point)
在二维平面上利用给定的中心点逆时针旋转一个点 final Location
rotateLocationAboutVector(Location location, Location origin, Double angle, Vector axis)
final Boolean
isPointInEntitySector(Location target, LivingEntity entity, Double radius, Double angle)
判断一个是否处在实体面向的扇形区域内通过反三角算向量夹角的算法 final Boolean
isInsideSector(Location target, LivingEntity entity, Double radius, Double angle)
判断一个是否处在实体面向的扇形区域内通过叉乘算法 -
-
Method Detail
-
rotateLocationAboutPoint
final Location rotateLocationAboutPoint(Location location, Double angle, Location point)
在二维平面上利用给定的中心点逆时针旋转一个点
- Parameters:
location
- 待旋转的点angle
- 旋转角度point
- 中心点- Returns:
Location
-
rotateLocationAboutVector
final Location rotateLocationAboutVector(Location location, Location origin, Double angle, Vector axis)
-
isPointInEntitySector
final Boolean isPointInEntitySector(Location target, LivingEntity entity, Double radius, Double angle)
判断一个是否处在实体面向的扇形区域内
通过反三角算向量夹角的算法
- Parameters:
target
- 目标坐标entity
- 实体radius
- 扇形半径angle
- 扇形角度- Returns:
如果处于扇形区域则返回 true
-
isInsideSector
final Boolean isInsideSector(Location target, LivingEntity entity, Double radius, Double angle)
判断一个是否处在实体面向的扇形区域内
通过叉乘算法
- Parameters:
target
- 目标坐标entity
- 实体radius
- 扇形半径angle
- 扇形角度- Returns:
如果处于扇形区域则返回 true
-
-
-
-