44 lines
1.6 KiB
C++
44 lines
1.6 KiB
C++
#pragma once
|
|
#include "vde/mesh/halfedge_mesh.h"
|
|
|
|
namespace vde::mesh {
|
|
using core::Point2D;
|
|
using core::Point3D;
|
|
using core::Vector3D;
|
|
|
|
enum class SmoothMethod { Laplacian, Taubin, HCLaplacian, Bilateral };
|
|
|
|
struct SmoothOptions {
|
|
int iterations = 10;
|
|
double lambda = 0.5; // Laplacian weight
|
|
double mu = -0.53; // Taubin shrink (mu < -lambda for Taubin)
|
|
|
|
// HC Laplacian parameters
|
|
double hc_alpha = 0.0; // push-back strength (0 = default auto)
|
|
double hc_beta = 0.5; // push-forward blend
|
|
|
|
// Bilateral parameters
|
|
double bilateral_sigma_c = 0.0; // spatial sigma (0 = auto from avg edge length)
|
|
double bilateral_sigma_n = 0.3; // normal sigma (radians)
|
|
int bilateral_iters = 5;
|
|
|
|
SmoothMethod method = SmoothMethod::Laplacian;
|
|
};
|
|
|
|
/// Generic dispatcher — delegates to specific smooth functions
|
|
HalfedgeMesh smooth_mesh(const HalfedgeMesh& mesh, const SmoothOptions& opts = {});
|
|
|
|
/// Standard Laplacian smoothing
|
|
HalfedgeMesh smooth_laplacian(const HalfedgeMesh& mesh, int iterations, double lambda);
|
|
|
|
/// Taubin λ|μ smoothing (volume-preserving)
|
|
HalfedgeMesh smooth_taubin(const HalfedgeMesh& mesh, int iterations, double lambda, double mu);
|
|
|
|
/// HC Laplacian (Humphrey's Classes) — two-pass with push-back to preserve volume
|
|
HalfedgeMesh smooth_hc_laplacian(const HalfedgeMesh& mesh, const SmoothOptions& opts = {});
|
|
|
|
/// Bilateral mesh filtering — normal-weighted, preserves sharp features
|
|
HalfedgeMesh smooth_bilateral(const HalfedgeMesh& mesh, const SmoothOptions& opts = {});
|
|
|
|
} // namespace vde::mesh
|