/** * 弧度转角度 */ public static function R2A(r:Number):int { return int(r*180/Math.PI); }
public static void test(Point a, Point b) { Point c = new Point(b.x, a.y); int ac = Math.abs(a.x - c.x); int bc = Math.abs(b.y - c.y); double ab = Math.sqrt(ac * ac + bc * bc); System.out.println(Math.asin(bc / ab) * 180 / Math.PI); } 没考虑钝角的情况,自己判断
Point c = new Point(b.x, a.y); int ac = Math.abs(a.x - c.x); int bc = Math.abs(b.y - c.y); System.out.println(Math.atan(bc / ac) * 180 / Math.PI); 刚才多算了一步, 唉 智商又下降了
* 弧度转角度
*/
public static function R2A(r:Number):int
{
return int(r*180/Math.PI);
}
public static void test(Point a, Point b) {
Point c = new Point(b.x, a.y);
int ac = Math.abs(a.x - c.x);
int bc = Math.abs(b.y - c.y);
double ab = Math.sqrt(ac * ac + bc * bc);
System.out.println(Math.asin(bc / ab) * 180 / Math.PI);
}
没考虑钝角的情况,自己判断
Point c = new Point(b.x, a.y);
int ac = Math.abs(a.x - c.x);
int bc = Math.abs(b.y - c.y);
System.out.println(Math.atan(bc / ac) * 180 / Math.PI);
刚才多算了一步,
唉 智商又下降了
脚本语言 ActionScript3.0
又发一遍csdn啊