Asked • 03/18/19

Draw arc with angles ranging from -360 to 360 degrees?

I am having some trouble trying to implement drawing an arc. Basically it's supposed to be drawn exactly like how you can draw a 3 point arc in AutoCAD. I can get the arc to draw with start and end angles from from -180 degrees to 360, but if I try to go more than -180, the arc flips around to +180 degrees. My problem is that I need the arc to continue when the angle passes -180. I have everything right in the code (I think) except for calculating the start and end angles. Thanks in advance for any help. Here is my code: private void DrawArc() { //fyi linept is of type List(); Point3D currentPoint = (Point3D)GetPoints(e); double rad; Point3D center = GetCenterOfCircle(linept.ElementAt(0), linept.ElementAt(1), currentPoint, out rad); PieSliceVisual3D circle = new PieSliceVisual3D(); circle.Center = center; circle.OuterRadius = rad; circle.InnerRadius = circle.OuterRadius + 3; circle.StartAngle = (Math.Atan2(linept.ElementAt(0).Y - center.Y, linept.ElementAt(0).X - center.X) * 180 / Math.PI); circle.EndAngle = (Math.Atan2(currentPoint.Y - center.Y, currentPoint.X - center.X) * 180 / Math.PI); //I've also tried these next 4 lines to no avail double startAngle = (Math.Atan2(linept.ElementAt(0).Y - center.Y, linept.ElementAt(0).X - center.X) * 180 / Math.PI); circle.StartAngle = (startAngle > 0.0 ? startAngle : (360.0 + startAngle)); double endAngle = (Math.Atan2(currentPoint.Y - center.Y, currentPoint.X - center.X) * 180 / Math.PI); circle.EndAngle = (endAngle > 0.0 ? endAngle : (360.0 + endAngle)); }

1 Expert Answer

By:

Still looking for help? Get the right answer, fast.

Ask a question for free

Get a free answer to a quick problem.
Most questions answered within 4 hours.

OR

Find an Online Tutor Now

Choose an expert and meet online. No packages or subscriptions, pay only for the time you need.