-
Notifications
You must be signed in to change notification settings - Fork 5
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
Stackoverflow Exception on Difference Operation #21
Comments
Hi, I did a little bit of digging and came to the conclusion that the issue is when making a big polygon of all the vertices. CSG/src/CSG/Algorithms/Plane.cs Lines 36 to 126 in 79a60a3
I have not used this library in a production setting yet, so I am not sure how stable it is at scale. I am a bit surprised this library is faster than something else, I find this extremely slow. I assumed that every 3 vertex builds a triangle based on the data, and got this result. |
First of all, thank you for the prompt and detailed reply! I should have been more specific, you were correct in your assumption that the vertices are a large list of triangle data. Every 3 make up a triangle. In my implementation, I am doing the same thing as you (without the fancy linq chunk). I make 1 polygon per triangle. I tried your newest committed code. I no longer get the stack overflow exception, but I am hitting your new BSPMaxDepthException. I tried returning there, instead of throwing an exception, but then the model is missing its back face. I even tried replacing my polygon building with your linq query version and got the same polygons and the same final result. Maybe I misunderstood, were you saying this is a known limitation? Or am I still doing something wrong here? And finally to comment on the speed: Yes, CSG modelling is slow. But you should take pride in the fact that your library is essentially the only C# implementation that I have found actively being developed and in rudimentary tests, performs 4x faster than the other solution I am using. |
I had a look at it, and tried one solution that made it not crash, but it caused a lot of artifacts. I don't have have the bandwidth right now to look more at the issue. :( |
Describe the bug
I'm digging towards a deeper bug. I have a software that performs thousands of CSG operations, I am getting hard exits of the application (no exception or anything) with an access violation error code. When I log each operation, I found the last one it did was a difference (subtract) operation. I extracted the geometry for that operation and tried to manually do a difference operation between these two and I get a stack overflow exception. The geometry is pretty simple. The current CSG library that I am using succeeds this operation. I am looking to change to this CSG library (since it is ~4x faster that our current one).
To Reproduce
Code for turning the hash into vertices:
Expected behavior
The red cube should cut out from the purple rectangle
Screenshots
Desktop (please complete the following information):
Please let me know if there is anything else I can provide to help with the debugging of this issue.
Thanks!
The text was updated successfully, but these errors were encountered: