haplokuon / netDxf

.net dxf Reader-Writer
MIT License
986 stars 400 forks source link

Wrong Ellipse.ToPolylines for ellipses with negative normals #278

Open albanmdb3d opened 3 years ago

albanmdb3d commented 3 years ago

Hello,

Thanks' for the library, it's pretty awesome. I believe I encountered an error when drawing ellipses using the .ToPolyline() method. It is my understanding that this method samples points along the ellipse and takes care of the rotation, start angle, end angle, etc. for us. I have noticed some unwanted behavior for ellipses with negative normals. The x axis of the sample points becomes negative what it should be.

I am trying to draw this .dxf in my app: image

And get something like this: image

I have attahed the .dxf so you can check it out. houseplan.zip

Thanks'

haplokuon commented 3 years ago

Since you didn't show the code where you manipulate the resulting polyline, I guess that you are interpreting its vertices as in world coordinate system but they are in local/object coordinate system. They must be transformed by its normal and elevation to convert them to world coordinates.