mesh_volume — 3D mesh_process op

• 数据种类:mesh → measurement

• 调用: import fullseye as fs; fs.ledger.mesh_volume(mesh) -> 'float'(要直接调用实现,import mesh_props; mesh_props.mesh_volume(mesh) -> 'float';从台账取用则 ops3d.get("mesh_volume"))

用法

闭合三角形网格所围的有符号体积 → float。

由散度定理(divergence theorem)得 V = (1/6)·Σ v0 · (v1 × v2)。面的环绕顺序朝外(右手系)则为正,朝内则为负 —— 符号本身就是方向检查,若返回负值则法线是翻转的。

Args:

mesh: (vertices (N,3), faces (M,3)) 的元组。

Returns:

带符号体积(float,坐标单位的 3 次方)。

Raises:

ValueError: mesh 不是 (vertices, faces) 这 2 个元素、形状不正确、

坐标非有限、index 非整数、越界、为空时。

★voxel_to_mesh(marching cubes)的返回是朝内环绕的,因此直接传入会得到负值(实测: 1000 voxel 的立方体为 -985.67)。“负 = 法线翻转” 本身是对的,但在这种组合下翻转才是默认,所以如果只想要体积,请取 abs() 或用 faces[:, ::-1] 重新环绕。用于方向检查时,应针对自己决定了环绕顺序(或已统一方向)的网格。

局限(honest): 散度定理仅对闭合曲面成立。对开放网格(有孔的扫描)也会返回数值,但那是"把孔朝原点方向封住后的立体体积",并不是想要的量。是否闭合,请用 boundary_vertices 是否为空,或 mesh_edge_stats 的 boundary_edges 是否为 0 事先确认。存在自相交的网格中,重叠区域会带符号地被计数两次(这也是符合定理的行为,不做检测)。

Reference (public): 基于散度定理的多面体体积是标准公式。例如 C. Zhang & T. Chen, "Efficient feature extraction for 2D/3D objects in mesh representation", ICIP 2001。

背景知识指南(该算子背后的物理与约定)

• blender_interop — 与 Blender 配合使用 —— 在 Blender 中建形、用 fullseye 测量(坐标轴、单位、真值数据的陷阱)

参考(示例数据、文献)

• 示例数据目录(下载 URL / 许可证) —— 2-D 用 skimage.data(BSD/公有领域)加合成图,3-D 给出真实数据源(Stanford/PDS 等)的下载 URL。

• 算子来历与参考文献 —— 该算子族所依据的研究/方法出处。

可运行的示例(实际调用该算子并已验证的样例)

• hull_bounds — py -3.11 examples_3d/hull_bounds.py

• mesh_props — py -3.11 examples_3d/mesh_props.py

• minimal_surfaces — py -3.11 examples_3d/minimal_surfaces.py

类型可衔接的下一个算子(可接受 measurement 作为输入)

vol_gaussian_psf · fuse_to_voxel · fresnel_reflectance · snell_angle

同类别(mesh_process)

laplacian_smooth · taubin_smooth · decimate_qem · face_normals · vertex_normals · mesh_area · vertex_curvature · face_areas


*Provenance: mesh_props.py — 3D 算子登记表。本条目由 tools/opdocs.py md 自动生成(请勿手工编辑)。*

© 2026 Kazufumi Furuse — Fullseye operator documentation. Licensed under Apache-2.0.