MeshLib C++ Docs
Loading...
Searching...
No Matches
MR::Laplacian Class Reference

#include <MRLaplacian.h>

Public Types

enum class  RememberShape { Yes , No }
 

Public Member Functions

MRMESH_API Laplacian (Mesh &mesh)
 
 Laplacian (const MeshTopology &topology, VertCoords &points)
 
MRMESH_API void init (const VertBitSet &freeVerts, EdgeWeights weights, VertexMass vmass=VertexMass::Unit, RememberShape rem=Laplacian::RememberShape::Yes)
 
MRMESH_API void fixVertex (VertId v, bool smooth=true)
 
MRMESH_API void fixVertex (VertId v, const Vector3f &fixedPos, bool smooth=true)
 
MRMESH_API void updateSolver ()
 if you manually call this method after initialization and fixing vertices then next apply call will be much faster
 
MRMESH_API void apply ()
 given fixed vertices, computes positions of remaining region vertices
 
MRMESH_API void applyToScalar (VertScalars &scalarField)
 given a pre-resized scalar field with set values in fixed vertices, computes the values in free vertices
 
const VertBitSet & region () const
 return all initially free vertices and the first layer of vertices around them
 
const VertBitSet & freeVerts () const
 return currently free vertices
 
const VertBitSet & firstLayerFixedVerts () const
 return fixed vertices from the first layer around free vertices
 

Detailed Description

Laplacian to smoothly deform a region preserving mesh fine details. How to use:

  1. Initialize Laplacian for the region being deformed, here region properties are remembered.
  2. Change positions of some vertices within the region and call fixVertex for them.
  3. Optionally call updateSolver()
  4. Call apply() to change the remaining vertices within the region Then steps 1-4 or 2-4 can be repeated.

Member Enumeration Documentation

◆ RememberShape

enum class MR::Laplacian::RememberShape
strong
Enumerator
Yes 
No 

Constructor & Destructor Documentation

◆ Laplacian() [1/2]

MRMESH_API MR::Laplacian::Laplacian ( Mesh & mesh)
explicit

◆ Laplacian() [2/2]

MR::Laplacian::Laplacian ( const MeshTopology & topology,
VertCoords & points )
inline

Member Function Documentation

◆ apply()

MRMESH_API void MR::Laplacian::apply ( )

given fixed vertices, computes positions of remaining region vertices

◆ applyToScalar()

MRMESH_API void MR::Laplacian::applyToScalar ( VertScalars & scalarField)

given a pre-resized scalar field with set values in fixed vertices, computes the values in free vertices

◆ firstLayerFixedVerts()

const VertBitSet & MR::Laplacian::firstLayerFixedVerts ( ) const
inlinenodiscard

return fixed vertices from the first layer around free vertices

◆ fixVertex() [1/2]

MRMESH_API void MR::Laplacian::fixVertex ( VertId v,
bool smooth = true )

notify Laplacian that given vertex has changed after init and must be fixed during apply;

Parameters
smoothwhether to make the surface smooth in this vertex (sharp otherwise)

◆ fixVertex() [2/2]

MRMESH_API void MR::Laplacian::fixVertex ( VertId v,
const Vector3f & fixedPos,
bool smooth = true )

sets position of given vertex after init and it must be fixed during apply (THIS METHOD CHANGES THE MESH);

Parameters
smoothwhether to make the surface smooth in this vertex (sharp otherwise)

◆ freeVerts()

const VertBitSet & MR::Laplacian::freeVerts ( ) const
inlinenodiscard

return currently free vertices

◆ init()

MRMESH_API void MR::Laplacian::init ( const VertBitSet & freeVerts,
EdgeWeights weights,
VertexMass vmass = VertexMass::Unit,
RememberShape rem = Laplacian::RememberShape::Yes )

initialize Laplacian for the region being deformed, here region properties are remembered and precomputed;

Parameters
freeVertsmust not include all vertices of a mesh connected component

◆ region()

const VertBitSet & MR::Laplacian::region ( ) const
inlinenodiscard

return all initially free vertices and the first layer of vertices around them

◆ updateSolver()

MRMESH_API void MR::Laplacian::updateSolver ( )

if you manually call this method after initialization and fixing vertices then next apply call will be much faster


The documentation for this class was generated from the following file: