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

Issue when taking unions #51

Open
AndrewGibbs opened this issue Oct 22, 2024 · 1 comment
Open

Issue when taking unions #51

AndrewGibbs opened this issue Oct 22, 2024 · 1 comment

Comments

@AndrewGibbs
Copy link

Hi,

I run the following code with two overlapping quadrilaterals:

using Clipper
path1 = Vector{IntPoint}()
mag = 2
pres = 8
push!(path1, IntPoint(0.0, 0.0, mag, pres))
push!(path1, IntPoint(0.0, 1.0, mag, pres))
push!(path1, IntPoint(1.0, 1.0, mag, pres))
push!(path1, IntPoint(1.3, 0.1, mag, pres))

path2 = Vector{IntPoint}()
push!(path2, IntPoint(1.0, 0.0, mag, pres))
push!(path2, IntPoint(1.0, 1.0, mag, pres))
push!(path2, IntPoint(2.0, 1.0, mag, pres))
push!(path2, IntPoint(2.0, 0.0, mag, pres))

c = Clip()
add_path!(c, path1, PolyTypeSubject, true)
add_path!(c, path2, PolyTypeSubject, true)

result, polys = execute(c, ClipTypeUnion, PolyFillTypeEvenOdd, PolyFillTypeEvenOdd)

The output variable polys consists of two polygons. I would expect this to be a single polygon, the union of the original two.

Perhaps I am misunderstanding how to take a union, that seems more likely than a bug. Either way, any help would be very much appreciated.

Thanks,

Andrew

@AndrewGibbs
Copy link
Author

Update - this can be fixed by changing either one of the PolyTypeSubject to PolyTypeClip. I don't get why though...

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

No branches or pull requests

1 participant