|
发表于 2011-4-3 21:17:52
|
显示全部楼层
[jass]
// x1(基点坐标X轴) y1(基点坐标Y轴) x2(目标坐标X轴) y2(目标坐标Y轴)
//返回基点到目标角度
function PointToPointAngle takes real x1,real y1,real x2,real y2 returns real
    return Atan2(y2-y1,x2-x1)/3.14159*180
endfunction
// x1(基点坐标X轴) y1(基点坐标Y轴) angle(角度:单位度) distance(距离:基点到目标点的距离)
//返回目标点
function PointAngleToPoint takes real x1,real y1,real angle,real distance returns location
local real radangle=angle/180*3.14159
    return Location(x1+Cos(radangle)*distance,y1+Sin(radangle)*distance)
endfunction
// u(单位) angle(角度:单位度) distance(距离:基点到目标点的距离)
//通过单位,角度,距离算出目标点
//返回目标点
function UnitAngleToPoint takes unit u,real angle,real distance returns location
local real x1=GetUnitX(u)
local real y1=GetUnitY(u)
local real radangle=angle/180*3.14159
return Location(x1+Cos(radangle)*distance,y1+Sin(radangle)*distance)
endfunction
[/jass] |
|