as3 get radians between three point

2014年7月29日 星期二 by Hu, Ching-Hsiang

// Center point is p1; angle returned in radians function findAngle(p0:Point,p1:Point,p2:Point) { var a = Math.pow(p1.x-p0.x,2) + Math.pow(p1.y-p0.y,2), b = Math.pow(p1.x-p2.x,2) + Math.pow(p1.y-p2.y,2), c = Math.pow(p2.x-p0.x,2) + Math.pow(p2.y-p0.y,2); return Math.acos( (a+b-c) / Math.sqrt(4*a*b) ); }

Filed under having 0 意見  

as3 radians to degrees

by Hu, Ching-Hsiang

var degrees:Number = radians*180/Math.PI ;

Filed under having 0 意見