/// 离心率 /// 返回两点间的角度
private
double PointToAngle(Point AOrigin, Point APoint, double
AEccentricity)
{
if
(APoint.X == AOrigin.X)
if (APoint.Y > AOrigin.Y)
return
Math.PI * 0.5;
else
return Math.PI * 1.5;
else
if (APoint.Y == AOrigin.Y)
if
(APoint.X > AOrigin.X)
return
0;
else
return Math.PI;
else
{
double
Result = Math.Atan((AOrigin.Y - APoint.Y) /
(AOrigin.X - APoint.X) * AEccentricity);
if
((APoint.X <</SPAN> AOrigin.X) && (APoint.Y > AOrigin.Y))
return
Result + Math.PI;
else
if ((APoint.X <</SPAN> AOrigin.X) && (APoint.Y <</SPAN> AOrigin.Y))
return
Result + Math.PI;
else
if ((APoint.X > AOrigin.X) && (APoint.Y <</SPAN> AOrigin.Y))
return
Result + 2 * Math.PI;
else
return Result;
}
}
|