Fix vtkCutter and add test for ContourLoopExtraction - #3637
Open
Jo-Byr wants to merge 3 commits into
Open
Conversation
finetjul
reviewed
Sep 7, 2026
| } | ||
| } | ||
|
|
||
| // Remove duplicate points |
Member
There was a problem hiding this comment.
you only remove duplicate cells, not duplicate points, do you ? (when you remove a cell, you are not removing its associated points)
Contributor
Author
There was a problem hiding this comment.
intersectedEdgesList lists intersected edges of the current cell, with associated intersection point. So I'm removing a point of this list so that it's treated as a line and not as a poly with a duplicated point.
Member
|
Does it mean the VTK C++ implementation also has the problem ? If so, please report a bug in VTK |
Fix bug in vtkCutter where the output would be invalid if the cutting plane intersecting a point of the input mesh
Change initial values and bounds of example's parameters to allow exploring the mesh properly
Contributor
Author
I didn't look into the C++ implementation but it does not produce this invalid result, I used a local python vtk as a truth test. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Context
vtkCutter yields invalid results if the plane intersects a point of the cut mesh. This is visible on vtkContourLoopExtraction's example where the loop extraction returns 8 loops (visibly 3: pink, green, pink but each actually has multiple layers under).
Results
By properly handling cases where the plane intersects a point, we can fix the issue and have only 2 loops (red and green):
Changes
Properly differentiate the 3 cases: negative sign, null sign (on plane) and positive sign
Dedupe points, result of a same point being counted twice.
For the green triangle, intersected in one of its vertices by the red plane, 2 edges will be counted as intersected on the same position.
Added a non-regression test on ContourLoopExtraction
Modified ContourLoopExtraction example's parameters to fit with the model's bounds.
PR Checklist