3

I need to draw an arc for the given three points, I have calculated center point like below ,

float ab = (p1.Y - p2.Y) / (p1.X - p2.X); float bc = (p3.Y - p2.Y) / (p3.X - p2.X);

                float xctr = (ab * bc * (p3.Y - p1.Y) + ab * (p2.X + p3.X) - bc * (p1.X + p2.X)) / (2 * (ab - bc));

                float yctr = -(1 / ab) * (xctr - ((p1.X + p2.X) / 2)) + ((p1.Y + p2.Y) / 2);

                float rad = (nfloat)Math.Sqrt(Math.Pow(p1.X - xctr, 2) + Math.Pow(p1.Y - yctr, 2));

Now i need to draw an arc based on these points.

Any suggestion on this would be appreciated !

Smile
  • 31
  • 5
  • I mean you need to draw a circle is that right? – gymni f Jul 07 '17 at 06:52
  • Nope ! to draw an arc , we need rect , start and sweep angle. I have found the rect like below, RectF rc = new RectF(); rc.Left =( xctr - rad); rc.Top = yctr - rad; rc.Right = xctr + rad; rc.Bottom = yctr + rad; So my question is how to draw an arc based on the start angle and sweep angle – Smile Jul 07 '17 at 06:56
  • how to find start angle and sweep angle . Any other possibilities is there to draw an arc with these values?? – Smile Jul 07 '17 at 06:59
  • Maybe this can help you understand https://stackoverflow.com/questions/11131954/how-to-draw-arc-between-two-points-on-the-canvas – gymni f Jul 07 '17 at 07:02
  • Thanks for ur suggestion. I will try it out n get back ! – Smile Jul 07 '17 at 07:21

0 Answers0