标签:div blog sqrt ber ace 自带 数学 number int
普通做法:
var pA:Point=new Point(100,100); var pB:Point=new Point(300,200); var dx:Number=pA.x-pB.x; var dy:Number=pA.y-pB.y; var dist:Number=Math.sqrt(dx*dx+dy*dy); //勾股定理 trace(dist);
as3自带API
var p1:Point=new Point(50,50); var p2:Point=new Point(275,200); trace(Point.distance(p1,p2));
标签:div blog sqrt ber ace 自带 数学 number int
原文地址:http://www.cnblogs.com/dt1991/p/7497304.html