Files
茂之钳 4c9ee4f760
CI / Build & Test (push) Failing after 29s
CI / Release Build (push) Failing after 38s
docs: doxygen annotations for curves + mesh + sketch
2026-07-24 11:04:04 +00:00

54 lines
1.8 KiB
C++
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#pragma once
#include "vde/core/point.h"
#include "vde/mesh/delaunay_3d.h"
#include <vector>
namespace vde::mesh {
using core::Point2D;
using core::Point3D;
using core::Vector3D;
/**
* @brief Alpha Shapes 点云表面重建
*
* 从 3D 点云的 Delaunay 四面体化中提取表面,通过参数 α 控制细节级别:
* - α → ∞:返回凸包(所有边界四面体面都保留)
* - α → 0:返回所有 Delaunay 面(非常详细,含内部结构)
* - 中间值:剔除外接球半径 > α 的四面体,保留细节适中的表面
*
* 算法:对每个 Delaunay 四面体,检查其外接球半径。
* 若半径 ≤ α,四面体保留;否则剔除。最终表面 = 保留四面体与
* 被剔除四面体(或外部)之间的边界三角形面。
*
* @param points 输入 3D 点云
* @param alpha α 半径阈值,通常取平均点间距的 1~3 倍
* @return TetrahedronMesh 保留的四面体网格
*
* @code{.cpp}
* // 从点云重建表面
* auto tets = alpha_shapes(point_cloud, 0.5);
* auto [verts, tris] = alpha_shapes_surface(tets);
* @endcode
* @see alpha_shapes_surface delaunay_3d
* @ingroup mesh
*/
TetrahedronMesh alpha_shapes(const std::vector<Point3D>& points, double alpha);
/**
* @brief 将 Alpha Shapes 四面体网格的表面提取为三角形网格
*
* 遍历四面体网格,提取所有仅出现在一个四面体上的面(边界面),
* 即为重建的表面三角形。
*
* @param tet_mesh Alpha Shapes 输出的四面体网格
* @return {顶点数组, 三角形索引数组}
*
* @note 表面三角形法向指向四面体外部(右手定则)
* @see alpha_shapes
* @ingroup mesh
*/
std::pair<std::vector<Point3D>, std::vector<std::array<int,3>>>
alpha_shapes_surface(const TetrahedronMesh& tet_mesh);
} // namespace vde::mesh