💥 名称简化

This commit is contained in:
kercylan98 2023-06-20 16:31:23 +08:00
parent 1e0c2c9926
commit 68e456fe8f
2 changed files with 3 additions and 3 deletions

View File

@ -131,7 +131,7 @@ func (slf *Moving2D) handle() {
slf.OnPosition2DDestinationEvent(entity)
continue
} else {
nx, ny := geometry.CalculateNewCoordinate(x, y, angle, moveDistance)
nx, ny := geometry.CalcNewCoordinate(x, y, angle, moveDistance)
entity.SetPosition(nx, ny)
entity.lastMoveTime = moveTime
slf.OnPosition2DChangeEvent(entity, x, y)

View File

@ -126,8 +126,8 @@ func CalcAngle[V generic.SignedNumber](x1, y1, x2, y2 V) V {
return V(math.Atan2(float64(y2-y1), float64(x2-x1)) * 180 / math.Pi)
}
// CalculateNewCoordinate 根据给定的x、y坐标、角度和距离计算新的坐标
func CalculateNewCoordinate[V generic.SignedNumber](x, y, angle, distance V) (newX, newY V) {
// CalcNewCoordinate 根据给定的x、y坐标、角度和距离计算新的坐标
func CalcNewCoordinate[V generic.SignedNumber](x, y, angle, distance V) (newX, newY V) {
// 将角度转换为弧度
var pi = math.Pi
var dividend = 180.0