Hi,
I want to find the direction of the arc drawn from three points for programming purpose.
Depending on Point2 I have to decide whether to draw clock wise or counterclock wise arc from Point1 to Point3 through point2.
My Logic is working in most cases except one case, as shown in figure.
Point1= P1 =(P1X,P1Y)
Point2= P2 =(P2X,P2Y)
Point3= P3 =(P3X,P3Y)
CenterPoint of Arc C(CX,CY) - I am calculating center from three points
P1P3angle = Angle from Point1 to Point3
P1P2angle = Angle from Point1 to Point2
diff = p1p3angle - p1p2angle;
by Default: Direction = CounterClockwise
if (diff < 0 || diff > 180)
{
Direction = Clockwise
}
if (p1p3angle == 0)
{
if (AngleDifference < -180)
Direction = CounterClockwise
else
Direction = Clockwise
}
if (p1p3angle == 90)
{
if (diff< -180)
Direction = CounterClockwise
}


LinkBack URL
About LinkBacks