Skip to content

Handle contour polylines with >2-point line cells (#2377)#2593

Merged
akenmorris merged 1 commit into
masterfrom
amorris/2377-contour-polyline
Jul 15, 2026
Merged

Handle contour polylines with >2-point line cells (#2377)#2593
akenmorris merged 1 commit into
masterfrom
amorris/2377-contour-polyline

Conversation

@akenmorris

Copy link
Copy Markdown
Contributor

Resolves #2377

VTK can store a contour as a single polyline cell with more than two points. ShapeWorks assumed line cells always have exactly two points, so such a contour was misdetected as a mesh (the contour-detection check required GetCell(0) to have two points) and crashed in optimization.

  • OptimizeParameters: detect a contour by cell type (VTK_LINE or VTK_POLY_LINE) instead of point count, so polylines are routed to the contour path.
  • ContourDomain::SetPolyLine: split any polyline cell into two-point segments before building the contour, so the rest of the contour code (which assumes two-point line cells) works.

Adds OptimizeTests.contour_polyline_test with a fixture of polyline contours; without the fix the polyline is processed as a mesh and the optimization crashes.

VTK can store a contour as a single polyline cell with more than two
points. ShapeWorks assumed line cells always have exactly two points, so
such a contour was misdetected as a mesh (the contour-detection check
required GetCell(0) to have two points) and crashed in optimization.

- OptimizeParameters: detect a contour by cell type (VTK_LINE or
  VTK_POLY_LINE) instead of point count, so polylines are routed to the
  contour path.
- ContourDomain::SetPolyLine: split any polyline cell into two-point
  segments before building the contour, so the rest of the contour code
  (which assumes two-point line cells) works.

Adds OptimizeTests.contour_polyline_test with a fixture of polyline
contours; without the fix the polyline is processed as a mesh and the
optimization crashes.
@akenmorris
akenmorris merged commit 26e7254 into master Jul 15, 2026
5 checks passed
@akenmorris
akenmorris deleted the amorris/2377-contour-polyline branch July 15, 2026 04:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Contour type does not handle >2 point line cells

1 participant