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.