Csg icon indicating copy to clipboard operation
Csg copied to clipboard

Unexpected output in some cases.

Open falkartis opened this issue 6 years ago • 13 comments

I'm trying to subtract one mesh from another but it gives a unexpected output.

I have uploaded a zip file with 3 stl files in it. http://downloads.icore9.com/2019-07-04-09-44-50.zip

I'm running the nuget version 0.3.26.

The first mesh is a representation of a slab of a building, and the second mesh that represents a hole in the slab. The third is the slab - the hole.

The hole is generated correctly, but other parts of the slab are totally broken.

By the way, some faces of the hole and the slab seem to be coplanar, I don't know if this could cause the problem.

Any help would be appreciated.

falkartis avatar Jul 04 '19 08:07 falkartis

By the way, I just tried scaling the hole by 1.01, so the faces aren't coplanar any more, but the problem still persists.

falkartis avatar Jul 04 '19 09:07 falkartis

I am using this library in my project, but I have no such issue http://notecad.xyz/?filename=bool-test.xml You can see - objects is big - length is 54000. Even is this case operation performed successfully.

Evil-Spirit avatar Jul 04 '19 13:07 Evil-Spirit

Could I know which version you are using? Is there some parameter/property/method that should be set before calling Substract?

falkartis avatar Jul 04 '19 14:07 falkartis

https://github.com/NoteCAD/Csg https://github.com/NoteCAD/NoteCAD/blob/master/Assets/Code/DetailEditor/DetailEditor.cs#L247

Evil-Spirit avatar Jul 04 '19 17:07 Evil-Spirit

Hi @Evil-Spirit it seems that your Csg fork is 4 commits ahead and 40 commits behind from the praeclarum's master branch. Did you fix any issue in your fork? Should I expect praeclarum's master branch to work the same way?

falkartis avatar Jul 09 '19 12:07 falkartis

No, I haven't fix anything except performance and allocations. Also, I made minor features I need. Nothing about stability.

Evil-Spirit avatar Jul 10 '19 18:07 Evil-Spirit

@falkartis I suppose, you can switch to commit before my changes on master and check how it works. If this will work, after you can use git bisect to find the commit that introduces this wrong behaviour.

Evil-Spirit avatar Jul 10 '19 18:07 Evil-Spirit

Hi, I wasn't able to compile the project on ms visual studio 2019. But I tried to downgrade the version 0.3.24 and it seems to work fine. I don't know why it fails on version 0.3.26.

falkartis avatar Jul 11 '19 12:07 falkartis

I don't get the expected result as well when subtracting a hole from a wall, see the attached zip file for the input and result stl files (result = wall.Subtract(hole)). It seems as though the hole is output as the final result. I've tried both version 0.3.24 and 0.3.26, but to no avail. Does anyone know how to fix this? Wall_and_hole.zip

m1900 avatar Aug 01 '19 14:08 m1900

@m1900 It seems like some faces of the hole are coplanar with some faces of the wall. This kind of setups usually cause some kind of trouble. If it's possible increase the size of the hole by a very small amount, just enough that the faces aren't coplanar any more.

falkartis avatar Aug 01 '19 14:08 falkartis

I should have mentioned that I have indeed tried this with an increased hole (see screenshot) to circumvent the coplanar issue, but the outcome remained the same. Hole_scaled_in_x_direction

m1900 avatar Aug 01 '19 14:08 m1900

@m1900 In this case I don't know either what's causes the problem. I don't have that much experience in 3D geometry.

falkartis avatar Aug 03 '19 10:08 falkartis

@falkartis thank you for trying to help me.

m1900 avatar Aug 06 '19 13:08 m1900