Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

Volume Grid Isosurface mesh issue

未关闭
#285 1 条评论 1 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
48/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
停滞
技术栈
cpp

调研方向

从 src/volume_grid_scalar_quantity.cpp 开始,检查 createIsosurfaceProgram() 和 registerIsosurfaceAsMesh(),其中展示了 MarchingCube 调用和坐标变换。将两条路径中的网格维度顺序与体积缓冲区布局进行比较。当 volume-grid 等值面在两种用法中都以正确的方向和单元顺序渲染时,即表示完成。

由索引模型根据 Issue 内容生成。

描述

Hi,

I've run into an issue with the isosurface generation for volume grid scalar quantities. The problem appears to be that the change made to fix the frame transformation for #253 wasn't propagated into the grid dimensions passed to the MarchingCube library, resulting in the grid cells being interpreted in the wrong order.

The following shows a volume grid of the Stanford Bunny and its isosurface visualization with the 2.2.1 release:
Polyscope_Isosurface_Issue

By swizzling the grid dimensions passed into MarchingCube we get the following (correct) result instead:
Polyscope_Isosurface_Fix

The patch for the above fix is:

diff --git a/src/volume_grid_scalar_quantity.cpp b/src/volume_grid_scalar_quantity.cpp                                 
index cde441a..603841f 100644                                                                                          
--- a/src/volume_grid_scalar_quantity.cpp                                                                              
+++ b/src/volume_grid_scalar_quantity.cpp                                                                              
@@ -165,8 +165,8 @@ void VolumeGridNodeScalarQuantity::createIsosurfaceProgram() {                                     
                                                                                                                       
   // Extract the isosurface from the level set of the scalar field                                                    
   MC::mcMesh isosurfaceMesh;                                                                                          
-  MC::marching_cube(&values.data.front(), isosurfaceLevel.get(), parent.getGridNodeDim().x, parent.getGridNodeDim().y,
-                    parent.getGridNodeDim().z, isosurfaceMesh);                                                       
+  MC::marching_cube(&values.data.front(), isosurfaceLevel.get(), parent.getGridNodeDim().z, parent.getGridNodeDim().y,
+                    parent.getGridNodeDim().x, isosurfaceMesh);                                                       
                                                                                                                       
   // Transform the result to be aligned with our volume's spatial layout                                              
   glm::vec3 scale = parent.gridSpacing();                                                                             
@@ -215,8 +215,8 @@ SurfaceMesh* VolumeGridNodeScalarQuantity::registerIsosurfaceAsMesh(std::string                    
                                                                                                                       
   // extract the mesh                                                                                                 
   MC::mcMesh isosurfaceMesh;                                                                                          
-  MC::marching_cube(&values.data.front(), isosurfaceLevel.get(), parent.getGridNodeDim().x, parent.getGridNodeDim().y,
-                    parent.getGridNodeDim().z, isosurfaceMesh);                                                       
+  MC::marching_cube(&values.data.front(), isosurfaceLevel.get(), parent.getGridNodeDim().z, parent.getGridNodeDim().y,
+                    parent.getGridNodeDim().x, isosurfaceMesh);                                                       
   glm::vec3 scale = parent.gridSpacing();                                                                             
   for (auto& p : isosurfaceMesh.vertices) {                                                                           
     // swizzle to account for change of coordinate/buffer ordering in the MC lib                                      

I'm not sure how you prefer to manage the repo, but if you'd like me to open a PR for the fix I'm happy to. Thanks!

主要语言
C++
星标
2.2k
派生
242
平均合并
11 分钟
30 天内合并 PR
1

贡献指南

这个仓库没有索引到贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

nmwsharp/polyscope 的其他 Issue

查看 nmwsharp/polyscope 的全部 Issue

相似的 Issue

更多 C++ Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。