Marching Cubes算法

在这里插入图片描述

Marching cubes是做什么的?

是一种重建算法。
Marching cubes uses a divide-and-conquer approach to locate the surface in a logical cube created from eight pixels; four each from two adjacent slices.

具体步骤?

将一个3D几何体划分为若干个小正方体的组成(体素化)。
判断每一个体素的顶点是否在3D几何体内。
通过体素顶点可以进行重建。

2D版本叫Marching Squares.

下面以marching squares为例进行描述。
在这里插入图片描述
将上述2D图形分成grid(与三位cube相对应)
在这里插入图片描述
可以得到每一个grid四个顶点的状态,红色是在体内,蓝色是在几何体外。

在这里插入图片描述
通过连接中线近似即可重建出图形。

在这里插入图片描述
在存储方面,可以按照栅格顶点的状态进行分类。
在这里插入图片描述
所以上面图形的第一行可以存储为:00231000

3D版本叫Marching cubes

算法步骤:
1. Read four slices into memory.
2. Scan two slices and create a cube from four neighbors on one slice and four neighbors on the next slice.
3. Calculate an index for the cube by comparing the eight density values at the cube vertices with the surface constant.
4. Using the index, look up the list of edges from a precalculated table.
5. Using the densities at each edge vertex, find the surface-edge intersection via linear interpolation.
6. Calculate a unit normal at each cube vertex using central differences. Interpolate the normal to each triangle vertex.
7. Output the triangle vertices and vertex normal.

顶点值高于等值在表面的内部,等于等值在表面上,低于等值在表面外。
在这里插入图片描述
每个顶点有两种状态,总共有256种,可以制作一个查找表(look up table)

但由于反转状态不变,所以可以减少一半,为128种。

再根据旋转不变形,又可以减少到14种情况。

可以认为这14中类似于基,经过旋转,反转可以得到256种状态对应的结果。
在这里插入图片描述
在这里插入图片描述

  • 0
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

SoaringPigeon

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值