Lagrange
Loading...
Searching...
No Matches
lagrange::filtering::smoothing_utils Namespace Reference

Common utility functions for mesh and attribute smoothing. More...

Functions

template<typename Scalar, typename Index>
void get_triangles (const SurfaceMesh< Scalar, Index > &t_mesh, std::vector< SimplexIndex< K, int > > &triangles)
 Extract triangles from a mesh.
 
template<typename Scalar, typename Index>
void get_vertices_and_normals (const SurfaceMesh< Scalar, Index > &t_mesh, std::vector< Vector< Real, Dim > > &vertices, std::vector< Vector< Real, Dim > > &normals, AttributeId normal_id)
 Extract vertices and normals from a mesh.
 
template<typename Scalar, typename Index>
void set_vertices (SurfaceMesh< Scalar, Index > &mesh, const std::vector< Vector< Real, Dim > > &vertices)
 Set vertices in a mesh.
 
template<typename Scalar, typename Index>
std::unique_ptr< FEM::RiemannianMesh< Real > > setup_for_smoothing (SurfaceMesh< Scalar, Index > &mesh, SurfaceMesh< Scalar, Index > &_mesh, std::vector< SimplexIndex< K, int > > &triangles, std::vector< Vector< Real, Dim > > &vertices, std::vector< Vector< Real, Dim > > &normals, Solver &solver, Real &original_area)
 Setup a mesh for smoothing operations.
 
void adjust_metric_for_curvature (FEM::RiemannianMesh< Real > &r_mesh, const std::vector< Vector< Real, Dim > > &vertices, const std::vector< Vector< Real, Dim > > &normals, Real original_area, double curvature_weight, double normal_smoothing_weight, Solver &solver)
 Adjust the metric based on curvature.
 

Detailed Description

Common utility functions for mesh and attribute smoothing.

Function Documentation

◆ get_triangles()

template<typename Scalar, typename Index>
void get_triangles ( const SurfaceMesh< Scalar, Index > & t_mesh,
std::vector< SimplexIndex< K, int > > & triangles )

Extract triangles from a mesh.

Template Parameters
ScalarThe scalar type used for mesh coordinates
IndexThe index type used for mesh connectivity
Parameters
t_meshThe input mesh
trianglesOutput vector of triangles

◆ get_vertices_and_normals()

template<typename Scalar, typename Index>
void get_vertices_and_normals ( const SurfaceMesh< Scalar, Index > & t_mesh,
std::vector< Vector< Real, Dim > > & vertices,
std::vector< Vector< Real, Dim > > & normals,
AttributeId normal_id )

Extract vertices and normals from a mesh.

Template Parameters
ScalarThe scalar type used for mesh coordinates
IndexThe index type used for mesh connectivity
Parameters
t_meshThe input mesh
verticesOutput vector of vertices
normalsOutput vector of normals
normal_idThe attribute ID for normals

◆ set_vertices()

template<typename Scalar, typename Index>
void set_vertices ( SurfaceMesh< Scalar, Index > & mesh,
const std::vector< Vector< Real, Dim > > & vertices )

Set vertices in a mesh.

Template Parameters
ScalarThe scalar type used for mesh coordinates
IndexThe index type used for mesh connectivity
Parameters
meshThe mesh to update
verticesThe new vertex positions

◆ setup_for_smoothing()

template<typename Scalar, typename Index>
std::unique_ptr< FEM::RiemannianMesh< Real > > setup_for_smoothing ( SurfaceMesh< Scalar, Index > & mesh,
SurfaceMesh< Scalar, Index > & _mesh,
std::vector< SimplexIndex< K, int > > & triangles,
std::vector< Vector< Real, Dim > > & vertices,
std::vector< Vector< Real, Dim > > & normals,
Solver & solver,
Real & original_area )

Setup a mesh for smoothing operations.

This function performs common setup operations for both mesh and attribute smoothing:

  1. Triangulates polygonal facets
  2. Ensures normals are available and properly formatted
  3. Extracts triangles, vertices, and normals
  4. Creates and sets up the Riemannian mesh
Template Parameters
ScalarThe scalar type used for mesh coordinates
IndexThe index type used for mesh connectivity
Parameters
meshThe input mesh
_meshOutput triangulated mesh
trianglesOutput vector of triangles
verticesOutput vector of vertices
normalsOutput vector of normals
solverThe solver to use
original_areaOutput original mesh area
Returns
The Riemannian mesh

◆ adjust_metric_for_curvature()

void adjust_metric_for_curvature ( FEM::RiemannianMesh< Real > & r_mesh,
const std::vector< Vector< Real, Dim > > & vertices,
const std::vector< Vector< Real, Dim > > & normals,
Real original_area,
double curvature_weight,
double normal_smoothing_weight,
Solver & solver )

Adjust the metric based on curvature.

Parameters
r_meshThe Riemannian mesh
verticesThe mesh vertices
normalsThe mesh normals
original_areaThe original mesh area
curvature_weightThe curvature weight
normal_smoothing_weightThe normal smoothing weight
solverThe solver to use