Marching Cubes
来源:互联网 发布:你不在北京知乎 编辑:程序博客网 时间:2024/05/01 17:46
Marching Cubes
created: May 2000, updated: November 2001
Using the Open Inventor libraries I created a subclass of SoEnginefor computing an isosurface using Marching Cubes: A High Resolution 3D Surface Construction Algorithm, byWilliam Lorensen and Harvey E. Cline. This implementation isVERY different from a previous version posted on this site. This version properly subclasses Open Inventor and efficiently creates an isosurface. The tables provided in the code found at Paul Bourke's page Polygonising a scalar field were used in this implementation.
The engine takes as input a scalar field and an isovalue. Then as output are the points, normals, and indexes into the points array used to create the triangles. The engine can easily be connected to other Inventor nodes to create an SoIndexedFaceSet. Below is an example of connecting the engine into a scene graph.
Without Blending
With BlendingThe blending reduces the number of triangles of a surface by 40% in some cases. When tested with the MRI data to produce the brain surface, the triangles were reduced from 1,065,244 to 636,702 without loss to the mesh structure. An interactive example of the blending technique can be found by downloading the 3D Grapher Open Inventor application.
The MarchingCubes engine was used to create all the images on this page. Below are links to the MarchingCubes source code as well as an example which creates a sphere dataset and displays it with the engine node. (TheSFScalarField class is needed by MarchingCubes.)
created: May 2000, updated: November 2001
Using the Open Inventor libraries I created a subclass of SoEnginefor computing an isosurface using Marching Cubes: A High Resolution 3D Surface Construction Algorithm, byWilliam Lorensen and Harvey E. Cline. This implementation isVERY different from a previous version posted on this site. This version properly subclasses Open Inventor and efficiently creates an isosurface. The tables provided in the code found at Paul Bourke's page Polygonising a scalar field were used in this implementation.
The engine takes as input a scalar field and an isovalue. Then as output are the points, normals, and indexes into the points array used to create the triangles. The engine can easily be connected to other Inventor nodes to create an SoIndexedFaceSet. Below is an example of connecting the engine into a scene graph.
// create MarchingCubes object and connect fieldsMarchingCubes *mcubes = new MarchingCubes();mcubes->ref();mcubes->data.setValue(dims, data);mcubes->isoValue = 1.0;// MarchingCubes gives the triangles with the// vertices ordered clockwiseSoShapeHints *hints = new SoShapeHints();hints->vertexOrdering. setValue(SoShapeHints::CLOCKWISE);root->addChild(hints);// connect the MarchingCubes points and// normals to an SoVertexProperty nodeSoVertexProperty *vprop = new SoVertexProperty();vprop->ref();vprop->vertex.connectFrom(&mcubes->points);vprop->normal.connectFrom(&mcubes->normals);// connect the indexes from MarchingCubesSoIndexedFaceSet *faceSet = new SoIndexedFaceSet();faceSet->vertexProperty = vprop;faceSet->coordIndex.connectFrom(&mcubes->indexes);root->addChild(faceSet);Thanks to Gokhan Kisacikoglu, a vertex blending technique was added. The blending is nothing but a simple test to the closest voxel corner based on a percentage from the corner. Below is an example with the blending and without. Also a gif animation showing the blending can be found here.
Without Blending
With BlendingThe blending reduces the number of triangles of a surface by 40% in some cases. When tested with the MRI data to produce the brain surface, the triangles were reduced from 1,065,244 to 636,702 without loss to the mesh structure. An interactive example of the blending technique can be found by downloading the 3D Grapher Open Inventor application.
The MarchingCubes engine was used to create all the images on this page. Below are links to the MarchingCubes source code as well as an example which creates a sphere dataset and displays it with the engine node. (TheSFScalarField class is needed by MarchingCubes.)
- MarchingCubes.h
- MarchingCubes.cpp
- main.cpp
- main.cpp.in
- All code needed to compile example (including a configure script):mcubesdemo-1.0.tar.gz
- All code needed to compile example on Irix (no configure script):mcubes.tar.gz
- Marching Cubes
- Marching Cubes
- Marching Cubes
- Marching Cubes
- Marching squares & Marching cubes
- Overview of the Marching Cubes Algorithm
- OpenGL笔记——Marching cubes算法
- 一个极简的Marching Cubes算法实现
- 三维重建移动立方体法(Marching Cubes Algorithm)的查找表的构造
- Marching squares
- 我的Fast marching...
- Unity3d Ray Marching
- ray marching shader
- Marching squares (triangle)
- 2D Fast Marching Computations
- Colored Cubes
- Risky cubes
- Perfect Cubes
- 1327 合并果子
- sql server 2000 删除xp cmdshell存储过程
- myeclipse修改代码无效
- 1329 最小钱币张数
- 美观下拉框实例
- Marching Cubes
- PCLint+8.0使用说明
- java.util.vector中的vector的详细用法
- MYSQL DATE_ADD()的用法
- web性能优化
- Cairngorm
- 正则
- S3C6410,Tiny6410,Mini6410,MoblieDDR内存驱动
- 缅怀TOC理论的创建者高德拉特先生