Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed #704 (DXF reader: rational splines not supported) #705

Merged
merged 3 commits into from Jan 21, 2021

Conversation

klayoutmatthias
Copy link
Collaborator

No description provided.

@lukasc-ubc
Copy link

lukasc-ubc commented Jan 21, 2021 via email

@klayoutmatthias klayoutmatthias merged commit 41094ab into master Jan 21, 2021
@klayoutmatthias klayoutmatthias deleted the issue-704 branch January 21, 2021 06:48
@klayoutmatthias
Copy link
Collaborator Author

@lukasc-ubc Excellent idea! And done (awaits merge): #706 :)

klayoutmatthias added a commit that referenced this pull request Jan 27, 2021
* Fixed issue #704. TODO: replace algorithm by De Boor, check if accuracy is still maintained.

* Switch spline interpolation algorithm to De Boor for better numerical stability.

* Updated tests with DXF accuracy test, provide a warning for unsupported SPLINE types.
@victorliu
Copy link

This does not appear to be fixed. Using KLayout version 0.27.11, and opening the DXF generated with the following script:

import math
import ezdxf

dwg = ezdxf.new(dxfversion='AC1015')
ms = dwg.modelspace()

ms.add_circle((0,0), 0.9)
ms.add_circle((0,0), 1.1)

r2 = math.sqrt(0.5)
spline = ms.add_rational_spline([(1, 0), (1, 1), (0, 1)], [1, r2, 1], 2)
spline.dxf.flags = 12

dwg.saveas('klayout_rational_spline_test.dxf')

This should produce a quarter circle between the two full circles. Instead, what I see is a non-rational Bezier with all weights 1:
image

@klayoutmatthias
Copy link
Collaborator Author

klayoutmatthias commented Oct 26, 2022

Please create a new issue. This one isn't an issue, but a pull request and it is closed.

BTW: rational splines are supported. The problem is the order of records that ezdxf produces. The test file I got for developing that feature has a record sequence of

10 20 30 41  (x y z w) first point
10 20 30 41  (x y z w) second point
...

while ezdxf produces:

41 41 41 ... (w vector)
10 20 30  (x y z) first point
10 20 30  (x y z) second point
...

KLayout does not digest this order properly. When I manually change it, the circle looks at it is supposed to.

Matthias

@klayoutmatthias
Copy link
Collaborator Author

Never mind. I created an issue for this: #1173

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants