arcgis api for flex三個點求夾角

眼鏡333發表於2018-01-12
private function Angle(pointO:MapPoint,pointS:MapPoint,pointM:MapPoint):Number
			{
				var molecule:Number=0;
				var denominator:Number=0;
                
				var angle:Number=0;

			  var vSx:Number=pointS.x-pointO.x;
			  var vSy:Number=pointS.y-pointO.y;
			  
			  var vMx:Number=pointM.x-pointO.x;
			  var vMy:Number=pointM.y-pointO.y;
			  
			  molecule=vSx*vMx+vSy*vMy;
			  denominator=(vSx*vSx+vSy*vSy)*(vMx*vMx+vMy*vMy);
			  
			  molecule/=Math.sqrt(denominator);
			  angle=Math.acos(molecule);
			  return angle;
			}

相關文章