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

JSM.BooleanOperation create a lot of new polygons on the same face #21

Open
AliceDreaming opened this issue Dec 23, 2016 · 5 comments
Open
Assignees

Comments

@AliceDreaming
Copy link

I am doing a "Differnce" boolean operation with two cubes. Each has 6 faces(polygons). After the boolean, I found some faces has more than one polygons on them. It looks like a single face has been cut into serveral pieces after the boolean. Do you have plan to merge the polygons after the boolean?

@kovacsv
Copy link
Owner

kovacsv commented Dec 23, 2016

Yes, I know about this behavior. This is how boolean operations work. The object is cutted with all the polygon planes of the other object. I have a plan in my mind to merge the connecting faces, but I haven't found a fast solution yet.

@kovacsv kovacsv self-assigned this Dec 23, 2016
@AliceDreaming
Copy link
Author

I have searched the github a bit and found that the JSClipper can do the polygon union. Here is the github repository. https://github.com/Delapouite/JsClipper
I played with their demo for a while to union two rectangles. Sounds like the result is as expected. Do you think this library can help us to the polygon union?
http://delapouite.github.io/JsClipper/demo.html
PS: I found the demos only have x and y coordinates, no z coordinates. Sounds like we need to convert betweeb 2D and 3D coordinates.

@kovacsv
Copy link
Owner

kovacsv commented Dec 28, 2016

Yes, it could work, but wouldn't be very efficient to convert 3D polygons to 2D polygons, calculate the union, then convert back to 3D and connect to the original vertices. There can be a lot of polygons if you calculate the difference with a sphere: http://jsfiddle.net/8xcjv6m9/1/

I think the correct solution should work based on the information calculated during the boolean operation (we know the original polygon index for every new polygon). I will investigate the possibilities.

@AliceDreaming
Copy link
Author

So you mean that the polygons should be merged based on their original polygons? I got from the code that the polygon only remembers the index of its immediate ancestor. Sounds like after a few boolean operation, the merge will become difficult.

@kovacsv
Copy link
Owner

kovacsv commented Jan 12, 2017

I think it should be done after every operation separately, so the next operation will run on the merged model. I see no problem with chained operations is the merge happens after each operation.

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

No branches or pull requests

2 participants