feat(volume_mesh): add prism and pyramid cell support (upstream PR #353)#5
Conversation
- cell_type_of(): 1-3 slot checks instead of iter-filter-count, removes per-cell sentinel scan from 9 hot loops. - decompose_to_tets / num_tets: drop per-cell Vec allocation via for_each_tet callback; num_tets is now O(n) instead of O(decompose+alloc). - cell_centroid: iterate only real vert count from cell type. - slice_hex/prism/pyramid: extract shared slice_via_tet_decomposition. - Fix UI label that miscounted prisms/pyramids as hexes. - Update stale "tetrahedral or hexahedral" doc on VolumeMesh.
|
@copilot resolve the merge conflicts in this pull request |
There was a problem hiding this comment.
Pull request overview
Ports upstream Polyscope PR #353 to add prism (wedge) and pyramid cell support to VolumeMesh, expanding mixed-cell functionality (cell-type detection, face iteration/rendering, slicing) to cover all four upstream cell types.
Changes:
- Added new prism/pyramid registration + constructors and a mixed-cell demo example.
- Refactored per-cell face/tet decomposition logic into a new
cell_datatable and switchedcell_typedetection to sentinel-count classification. - Extended slice helpers to support prism/pyramid via tet decomposition, with accompanying tests and documentation updates.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| examples/volume_mesh_mixed_cells_demo.rs | New example showing tet/hex/prism/pyramid side-by-side. |
| docs/feature-status.md | Updates feature parity notes to include prism/pyramid support. |
| crates/polyscope/src/volume_mesh.rs | Adds register_prism_mesh / register_pyramid_mesh public API. |
| crates/polyscope/Cargo.toml | Registers the new example target. |
| crates/polyscope-structures/src/volume_mesh/slice_geometry.rs | Adds slice_prism / slice_pyramid and shared slicing helper. |
| crates/polyscope-structures/src/volume_mesh/mod.rs | Adds new cell types, constructors, sentinel-based cell_type, and dispatches loops via cell_data. |
| crates/polyscope-structures/src/volume_mesh/cell_data.rs | New centralized face/triangulation + tet-decomposition tables per cell type. |
| CHANGELOG.md | Documents the new cell types, APIs, and sentinel-based classification change. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Agent-Logs-Url: https://github.com/xarthurx/polyscope-rs/sessions/ac8c73f6-5b86-422b-a2ef-a39b2b4091ec Co-authored-by: xarthurx <1921878+xarthurx@users.noreply.github.com>
Resolved by merging |
The triangulation [[2,4,5], [2,1,4]] for prism side quad 2 was wound opposite to its polygon order [2,5,4,1], producing inward face normals in init_render_data (which uses (p1-p0).cross(p2-p0)). Other prism faces and tet/hex/pyramid stencils are consistent. Switch to [[2,5,4], [4,1,2]] (same diagonal split, CCW). Upstream C++ Polyscope ships the same inward stencil — likely latent there too.
…m-pyramid # Conflicts: # CHANGELOG.md # docs/feature-status.md
Rustdoc parsed p[0], p[2], p[1], p[3] as broken intra-doc links, failing the workspace doc build with -D warnings. Wrap the expressions in backticks so rustdoc treats them as code spans.
Summary
Ports upstream C++ Polyscope PR #353 (commit
dcbaedb) — adds prism (6-vertex wedge) and pyramid (5-vertex) cells to `VolumeMesh`, reaching parity with all four upstream cell types.Changes
Test Plan
Notes
🤖 Generated with Claude Code