haplokuon / netDxf

.net dxf Reader-Writer
MIT License
1.01k stars 411 forks source link

fix Polyline2D explode to arc start/end angles #398

Closed devel0 closed 2 years ago

devel0 commented 2 years ago

this PR fix problem explained with the other PR #397 that introduce unit tests.

more test should added to verify if proposed changes still valid.

devel0 commented 2 years ago

I investigated better, this PR not work; your actual implementation is ok. comparing two dxf, one with arc exploded by netDxf and arc exploded through qcad there is no difference apart a custom data "Reversed" that is not part of the dxf standard.

image

In other words there isn't possibility to put the arc with that orientation like the original coming from Polyline2D.

One could do a post-decoration of arcs for "reverse" by checking if StartAngle correspond to the effective initial vertex of the polyline arc and set the reverse to false otherwise ; this way it can state the sense of the edge.

For example I used in netcore-sci library the Sense for geometric entities here called by ToGeometries that pass the lwp vertex here and unit test results as this