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

Multipolygon difference error #2

Open
pachopepe opened this issue Jul 19, 2018 · 7 comments · May be fixed by #3
Open

Multipolygon difference error #2

pachopepe opened this issue Jul 19, 2018 · 7 comments · May be fixed by #3

Comments

@pachopepe
Copy link

The following difference of mp1 and mp2 multipolygons gives the empty polygon, but the difference is not empty:

mp1 := geom.MultiPolygon{geom.Polygon{geom.Path{geom.Point{X: 99, Y: 164}, geom.Point{X: 99, Y: 108}, geom.Point{X: 114, Y: 108}, geom.Point{X: 114, Y: 0}, geom.Point{X: 121, Y: 0}, geom.Point{X: 121, Y: 164}, geom.Point{X: 99, Y: 164}}, geom.Path{geom.Point{X: 0, Y: 499}, geom.Point{X: 0, Y: 488}, geom.Point{X: 88, Y: 488}, geom.Point{X: 88, Y: 465}, geom.Point{X: 97, Y: 465}, geom.Point{X: 97, Y: 326}, geom.Point{X: 79, Y: 326}, geom.Point{X: 79, Y: 258}, geom.Point{X: 121, Y: 258}, geom.Point{X: 121, Y: 499}, geom.Point{X: 0, Y: 499}}}}
	
mp2 := geom.MultiPolygon{geom.Polygon{geom.Path{geom.Point{X: 114, Y: 0}, geom.Point{X: 161, Y: 0}, geom.Point{X: 161, Y: 168}, geom.Point{X: 114, Y: 168}, geom.Point{X: 114, Y: 0}}}}

difference := mp2.Difference(mp1)

fmt.Printf("DIFFERENCE %+v", difference)

The green and blue polygons are mp1 and the magenta is mp2

image

@ctessum
Copy link
Owner

ctessum commented Jul 20, 2018

What is the difference expected to be in this case?

@pachopepe
Copy link
Author

pachopepe commented Jul 20, 2018

In the following drawings, green shapes are mp1 and magenta shape mp2, the expected result is mp2 shape(s) without mp1 parts

image

Maybe this drawing is better:
image

@ctessum ctessum linked a pull request Jul 22, 2018 that will close this issue
@ctessum
Copy link
Owner

ctessum commented Jul 22, 2018

Let me know whether #3 fixes the issue. You will also have to update the upstream library github.com/ctessum/polyclip-go.

@pachopepe
Copy link
Author

The case of the issue now is working, but I have a new one that doesn't. I will put here when I extract the coordinates. Thanks

@pachopepe
Copy link
Author

I made pull request #4 with a test file that gets the errors that I found in the library

@pachopepe
Copy link
Author

Hi, do you can run the tests?

@ctessum
Copy link
Owner

ctessum commented Jul 31, 2018

Thanks for the pull request, but it will probably be several days before I have time to take a look at it.

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 a pull request may close this issue.

2 participants