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

CSG subtract failing test case #3755

Closed
ericwa opened this issue Feb 26, 2021 · 2 comments
Closed

CSG subtract failing test case #3755

ericwa opened this issue Feb 26, 2021 · 2 comments
Assignees
Labels
Prio:2 Medium priority: Non crash bugs that impede the user, features that add new functionality. Type:Bug Errors and problems

Comments

@ericwa
Copy link
Collaborator

ericwa commented Feb 26, 2021

System Information

Windows 10.

  • fails in 2020.2 (everything is deleted, including parts of the brush that shouldn't be)
  • fails in 2021.1 (nothing is deleted)

Expected Behavior

Should produce 1 brush: the bottom part of the "elbow" that sticks out below the subtrahend.

Steps to Reproduce

  • open map: csgSubtractFailure.map.txt

  • select all and Ctrl+U to jump to the brushes

  • select the large axis aligned box (seen here with face rendered disabled, for clarity).

    csgsubtract

  • Ctrl+K to CSG subtract

@ericwa ericwa added Type:Bug Errors and problems Prio:2 Medium priority: Non crash bugs that impede the user, features that add new functionality. labels Feb 26, 2021
@ericwa ericwa self-assigned this Mar 5, 2021
ericwa added a commit that referenced this issue Mar 7, 2021
- Brush::subtract now ignores any brushes that fail to create,
  previously these would block the csgSubtract operation
- in csgHollow, if one brush is too small to hollow, don't prevent
  the whole operation

Fixes #3755
@ericwa
Copy link
Collaborator Author

ericwa commented Mar 7, 2021

Test case can be reduced further to just the brush that sticks out, and the box (subtrahend).
csgSubtractFailure-reduced.map.txt

To recap, the BrushGeometry::subtract produces 3 result polyhedrons, the first 2 are nonsense (polygons), and the 3rd is the expected result of the subtraction.

I'm looking in to why the subtraction was producing these 2 empty brushes in the first place. Loading them in blender, they appear to be two faces of the minuend.

Screen Shot 2021-03-06 at 10 32 37 PM

@ericwa
Copy link
Collaborator Author

ericwa commented Mar 7, 2021

Ok, https://github.com/TrenchBroom/TrenchBroom/blob/master/common/src/Model/Polyhedron_CSG.h#L85 is the source of the problem, if I remove that I just get the expected 1 polyhedron from BrushGeometry::subtract rather than 2 garbage + 1 expected.

ericwa added a commit that referenced this issue Mar 8, 2021
- Brush::subtract now ignores any brushes that fail to create,
  previously these would block the csgSubtract operation
- in csgHollow, if one brush is too small to hollow, don't prevent
  the whole operation

Fixes #3755
ericwa added a commit that referenced this issue Mar 10, 2021
- Brush::subtract now returns brushes that fail to create,
  previously these would block the csgSubtract operation
- in csgHollow, if one brush is too small to hollow, don't prevent
  the whole operation

Fixes #3755
@ericwa ericwa closed this as completed in 28d760e Mar 10, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Prio:2 Medium priority: Non crash bugs that impede the user, features that add new functionality. Type:Bug Errors and problems
Projects
None yet
Development

No branches or pull requests

1 participant