2点間の角度を調べる
1月 22, 2007 · Posted in Flash
概要
2点間の角度を調べる
Action Script
function getAngle(x1,y1,x2,y2){
// p1(x1,y1)とp2(x2,y2)の差を計算
xDis = x2-x1;
yDis = y2-y1;
// そこから角度(ラジアン表記)を計算
radian = Math.atan2(yDis, xDis);
// ラジアンを角度に変換
angle = radian/(Math.PI/180);
return angle;
}

