Add C wrapper for Clipper2 - #60
Open
gpeairs wants to merge 1 commit into
Open
Conversation
Member
|
This seems generally reasonable, but would be interested to see a finished version based on local testing |
Author
|
I was just thinking the same thing, so I opened #61 which adds the Julia side for local testing. |
Author
|
@SimonDanisch, just pinging if you want to take a look at this/#61 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR is intended as the first step towards updating Clipper.jl to wrap Clipper2. As discussed in #50, I wrote a custom C wrapper to do this. The plan is that Yggdrasil#14270 will add this wrapper as a third library product of
Clipper2_jll,libcclipper2. The wrapper was originally bundled in the recipe in that PR (as was done with Clipper1), but the maintainers prefer files of this size be hosted elsewhere. At their suggestion this PR adds the two wrapper source files here, with the C ABI implementation indeps/cwrapper/cclipper2.cppand headerdeps/cwrapper/clipper2.h.This doesn't change anything for Clipper.jl users at this point; these are just build inputs for
Clipper2_jll. Yggdrasil#14270 (which also updates the Clipper2 version to 2.0.1) is gated on this, since it currently points at my personal fork as a placeholder. Following that, a separate PR will add a Julia wrapper for the new C ABI and bump the version number for a breaking release.Some notes on the wrapper:
JoinType::Bevelin v1.2.3.try/catch.-DUSINGZbuild, linked againstlibClipper2Z. Internally, points then carry azinteger tag. The Clipper engine stamps intersection-created vertices with a sentinel valueZ_INTERSECTION = INT64_MIN. There are narrow (x,y) entry points that construct a point with z=0, so callers pay 8 bytes per vertex for z tags they never see. I've found this to be negligible overhead compared to engine operations, but a second library product could be added later if a need justifies it. The equivalent*_zentry points expose the z tag. The file also compiles withoutUSINGZ, minus the*_zsymbols. (For context, Z tagging is the feature motivating the upgrade on my side at Upgrade to Clipper2 aws-cqc/DeviceLayout.jl#199 (comment).)