haplokuon / netDxf

.net dxf Reader-Writer
MIT License
966 stars 393 forks source link

Ellipse: StartAnlge and EndAngle are wrong (perhaps) #434

Closed Take3A closed 1 year ago

Take3A commented 1 year ago

I think the following thing. Is it wrong?

The following codes in "private static void SetEllipseParameters(Ellipse ellipse, double[] param)" in "DxfReader.cs." ellipse.StartAngle = Vector2.Angle(startPoint) MathHelper.RadToDeg; ellipse.EndAngle = Vector2.Angle(endPoint) MathHelper.RadToDeg; are wrong. They should be the following. ellipse.StartAngle = param[0] MathHelper.RadToDeg; ellipse.EndAngle = param[1] MathHelper.RadToDeg;

haplokuon commented 1 year ago

The way it is works. Do you have sample where the start and/or end angle of an ellipse arc is not properly read or written?

Take3A commented 1 year ago

I now understood.

Maybe, this is a matter of definition. Your StartAngle and EndAngle are values in the ellipse. How can I reconstruct param[0] and param[1] from them?

In the following, start angle and end angle are defined before transforming a circle into an ellipse. https://github.com/codingdna2/WPF-DXF-Viewer I firs took it is true.

Now I found "GetEllipseParameters()" in "DxfWriter.cs."