Skip to content

Weird geometry after second coplanar subtraction of cubes #210

@ToyboxZach

Description

@ToyboxZach

Absolutely love this package and think its like 95% of the way there, you have done an amazing job with this but I am having one problem with coplanar faces:

Describe the bug

After a second subtraction with Coplanar objects such as two cube you start to get very weird behavior. This is improved after the triangle splitter PR, but not solved. From our experience this only happens when you have coplanar faces, when we shift these objects even slightly all the problems completely go away.

To Reproduce
Here is a fiddle:

https://jsfiddle.net/58yehc2z/28/


const baseGeometry = new BoxGeometry(1,1,1)
const firstSubtract =  new BoxGeometry(1,1,1)
const secondSubtract =  new BoxGeometry(1,1,1)
firstSubtract.translate(0.5,0.5,0);
secondSubtract.translate(0,0.5,0);

const csg = new Evaluator();
const base = new Brush(baseGeometry);
const first = new Brush(firstSubtract);
const second = new Brush(secondSubtract);

let result = csg.evaluate(base, first, SUBTRACTION);

let final_result = csg.evaluate(result, second, SUBTRACTION);

Live example

https://jsfiddle.net/58yehc2z/28/

Expected behavior
I would expect this to continue to be manifold, especially for a case such as simple cubes subtracting from each other

Screenshots
I have a much more complicated setup but the same operation ends up with something like this which is a bit easier to see than the fiddle I set up:

*edit: This picture was actually caused by an unrelated problem

image

This is after we pulled in the triangle splitter PR which is an amazing improvement, but doesn't solve this case.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions