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

49 lines
1.4 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/mesh/halfedge_mesh.h"
#include <vector>
namespace vde::mesh {
using core::Point2D;
using core::Point3D;
using core::Vector3D;
/**
* @brief 离散曲率计算结果
* @ingroup mesh
*/
struct CurvatureResult {
std::vector<double> gaussian; ///< 每顶点高斯曲率 K = κ₁·κ₂
std::vector<double> mean; ///< 每顶点平均曲率 H = (κ₁+κ₂)/2
std::vector<double> area; ///< 每顶点 Voronoi 面积(曲率归一化权重)
};
/**
* @brief 离散曲率计算(Cotan 公式,Meyer et al. 2003
*
* 对三角网格每个顶点计算离散高斯曲率和平均曲率。
*
* 高斯曲率(内点):
* K(v) = (2π - Σ_j θ_j) / A_v
* 其中 θ_j 是顶点 v 处面角的总和,A_v 是 Voronoi 面积
*
* 平均曲率:
* H(v) = || Σ_j (cot α_j + cot β_j) · e_j || / (2 · A_v)
* 其中 α_j,β_j 是与边 e_j 相对的两个角
*
* 边界顶点使用角度缺损公式修正。
*
* @param mesh 输入三角网格
* @return CurvatureResult 每顶点曲率
*
* @note 要求网格为流形;边界顶点曲率使用近似公式
* @code{.cpp}
* auto crv = compute_curvature(mesh);
* double max_curvature = *std::max_element(crv.gaussian.begin(), crv.gaussian.end());
* // 可用于特征检测、网格分割等
* @endcode
* @ingroup mesh
*/
CurvatureResult compute_curvature(const HalfedgeMesh& mesh);
} // namespace vde::mesh