MeshLib C Docs
Loading...
Searching...
No Matches
MRLaplacian.h File Reference
#include <MRCMesh/MREnums.h>
#include <MRCMesh/MRId.h>
#include <MRCMisc/common.h>
#include <MRCMisc/exports.h>
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>

Go to the source code of this file.

Typedefs

typedef struct MR_Mesh MR_Mesh
 
typedef struct MR_MeshTopology MR_MeshTopology
 
typedef struct MR_Vector3f MR_Vector3f
 
typedef struct MR_VertBitSet MR_VertBitSet
 
typedef struct MR_VertCoords MR_VertCoords
 
typedef struct MR_VertScalars MR_VertScalars
 
typedef struct MR_Laplacian MR_Laplacian
 
typedef int32_t MR_Laplacian_RememberShape
 

Enumerations

enum  { MR_Laplacian_RememberShape_Yes = 0 , MR_Laplacian_RememberShape_No = 1 }
 

Functions

MRC_API MR_LaplacianMR_Laplacian_ConstructFromAnother (MR_PassBy _other_pass_by, MR_Laplacian *_other)
 
MRC_API const MR_LaplacianMR_Laplacian_OffsetPtr (const MR_Laplacian *ptr, ptrdiff_t i)
 Offsets a pointer to an array element by i positions (not bytes). Use only if you're certain that the pointer points to an array element.
 
MRC_API MR_LaplacianMR_Laplacian_OffsetMutablePtr (MR_Laplacian *ptr, ptrdiff_t i)
 Offsets a pointer to an array element by i positions (not bytes). Use only if you're certain that the pointer points to an array element.
 
MRC_API MR_LaplacianMR_Laplacian_Construct_1 (MR_Mesh *mesh)
 
MRC_API MR_LaplacianMR_Laplacian_Construct_2 (const MR_MeshTopology *topology, MR_VertCoords *points)
 
MRC_API void MR_Laplacian_Destroy (const MR_Laplacian *_this)
 Destroys a heap-allocated instance of MR_Laplacian. Does nothing if the pointer is null.
 
MRC_API void MR_Laplacian_DestroyArray (const MR_Laplacian *_this)
 Destroys a heap-allocated array of MR_Laplacian. Does nothing if the pointer is null.
 
MRC_API void MR_Laplacian_init (MR_Laplacian *_this, const MR_VertBitSet *freeVerts, MR_EdgeWeights weights, const MR_VertexMass *vmass, const MR_Laplacian_RememberShape *rem)
 
MRC_API void MR_Laplacian_fixVertex_2 (MR_Laplacian *_this, MR_VertId v, const bool *smooth)
 
MRC_API void MR_Laplacian_fixVertex_3 (MR_Laplacian *_this, MR_VertId v, const MR_Vector3f *fixedPos, const bool *smooth)
 
MRC_API void MR_Laplacian_updateSolver (MR_Laplacian *_this)
 
MRC_API void MR_Laplacian_apply (MR_Laplacian *_this)
 
MRC_API void MR_Laplacian_applyToScalar (MR_Laplacian *_this, MR_VertScalars *scalarField)
 
MRC_API const MR_VertBitSetMR_Laplacian_region (const MR_Laplacian *_this)
 
MRC_API const MR_VertBitSetMR_Laplacian_freeVerts (const MR_Laplacian *_this)
 
MRC_API const MR_VertBitSetMR_Laplacian_firstLayerFixedVerts (const MR_Laplacian *_this)
 

Typedef Documentation

◆ MR_Laplacian

typedef struct MR_Laplacian MR_Laplacian

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.
    Generated from class MR::Laplacian.

◆ MR_Laplacian_RememberShape

typedef int32_t MR_Laplacian_RememberShape

◆ MR_Mesh

typedef struct MR_Mesh MR_Mesh

◆ MR_MeshTopology

◆ MR_Vector3f

typedef struct MR_Vector3f MR_Vector3f

◆ MR_VertBitSet

typedef struct MR_VertBitSet MR_VertBitSet

◆ MR_VertCoords

typedef struct MR_VertCoords MR_VertCoords

◆ MR_VertScalars

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
MR_Laplacian_RememberShape_Yes 
MR_Laplacian_RememberShape_No 

Function Documentation

◆ MR_Laplacian_apply()

MRC_API void MR_Laplacian_apply ( MR_Laplacian * _this)

given fixed vertices, computes positions of remaining region vertices Generated from a method of class MR::Laplacian named apply. Parameter _this can not be null. It is a single object.

◆ MR_Laplacian_applyToScalar()

MRC_API void MR_Laplacian_applyToScalar ( MR_Laplacian * _this,
MR_VertScalars * scalarField )

given a pre-resized scalar field with set values in fixed vertices, computes the values in free vertices Generated from a method of class MR::Laplacian named applyToScalar. Parameter _this can not be null. It is a single object. Parameter scalarField can not be null. It is a single object.

◆ MR_Laplacian_Construct_1()

MRC_API MR_Laplacian * MR_Laplacian_Construct_1 ( MR_Mesh * mesh)

Generated from a constructor of class MR::Laplacian. Parameter mesh can not be null. It is a single object. Never returns null. Returns an instance allocated on the heap! Must call MR_Laplacian_Destroy() to free it when you're done using it.

◆ MR_Laplacian_Construct_2()

MRC_API MR_Laplacian * MR_Laplacian_Construct_2 ( const MR_MeshTopology * topology,
MR_VertCoords * points )

Generated from a constructor of class MR::Laplacian. Parameter topology can not be null. It is a single object. Parameter points can not be null. It is a single object. Never returns null. Returns an instance allocated on the heap! Must call MR_Laplacian_Destroy() to free it when you're done using it.

◆ MR_Laplacian_ConstructFromAnother()

MRC_API MR_Laplacian * MR_Laplacian_ConstructFromAnother ( MR_PassBy _other_pass_by,
MR_Laplacian * _other )

Generated from a constructor of class MR::Laplacian. Never returns null. Returns an instance allocated on the heap! Must call MR_Laplacian_Destroy() to free it when you're done using it.

◆ MR_Laplacian_Destroy()

MRC_API void MR_Laplacian_Destroy ( const MR_Laplacian * _this)

Destroys a heap-allocated instance of MR_Laplacian. Does nothing if the pointer is null.

◆ MR_Laplacian_DestroyArray()

MRC_API void MR_Laplacian_DestroyArray ( const MR_Laplacian * _this)

Destroys a heap-allocated array of MR_Laplacian. Does nothing if the pointer is null.

◆ MR_Laplacian_firstLayerFixedVerts()

MRC_API const MR_VertBitSet * MR_Laplacian_firstLayerFixedVerts ( const MR_Laplacian * _this)

return fixed vertices from the first layer around free vertices Generated from a method of class MR::Laplacian named firstLayerFixedVerts. Parameter _this can not be null. It is a single object. The returned pointer will never be null. It is non-owning, do NOT destroy it.

◆ MR_Laplacian_fixVertex_2()

MRC_API void MR_Laplacian_fixVertex_2 ( MR_Laplacian * _this,
MR_VertId v,
const bool * smooth )

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) Generated from a method of class MR::Laplacian named fixVertex. Parameter _this can not be null. It is a single object. Parameter smooth has a default argument: true, pass a null pointer to use it.

◆ MR_Laplacian_fixVertex_3()

MRC_API void MR_Laplacian_fixVertex_3 ( MR_Laplacian * _this,
MR_VertId v,
const MR_Vector3f * fixedPos,
const bool * smooth )

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) Generated from a method of class MR::Laplacian named fixVertex. Parameter _this can not be null. It is a single object. Parameter fixedPos can not be null. It is a single object. Parameter smooth has a default argument: true, pass a null pointer to use it.

◆ MR_Laplacian_freeVerts()

MRC_API const MR_VertBitSet * MR_Laplacian_freeVerts ( const MR_Laplacian * _this)

return currently free vertices Generated from a method of class MR::Laplacian named freeVerts. Parameter _this can not be null. It is a single object. The returned pointer will never be null. It is non-owning, do NOT destroy it.

◆ MR_Laplacian_init()

MRC_API void MR_Laplacian_init ( MR_Laplacian * _this,
const MR_VertBitSet * freeVerts,
MR_EdgeWeights weights,
const MR_VertexMass * vmass,
const MR_Laplacian_RememberShape * rem )

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 Generated from a method of class MR::Laplacian named init. Parameter _this can not be null. It is a single object. Parameter freeVerts can not be null. It is a single object. Parameter vmass has a default argument: VertexMass::Unit, pass a null pointer to use it. Parameter rem has a default argument: Laplacian::RememberShape::Yes, pass a null pointer to use it.

◆ MR_Laplacian_OffsetMutablePtr()

MRC_API MR_Laplacian * MR_Laplacian_OffsetMutablePtr ( MR_Laplacian * ptr,
ptrdiff_t i )

Offsets a pointer to an array element by i positions (not bytes). Use only if you're certain that the pointer points to an array element.

◆ MR_Laplacian_OffsetPtr()

MRC_API const MR_Laplacian * MR_Laplacian_OffsetPtr ( const MR_Laplacian * ptr,
ptrdiff_t i )

Offsets a pointer to an array element by i positions (not bytes). Use only if you're certain that the pointer points to an array element.

◆ MR_Laplacian_region()

MRC_API const MR_VertBitSet * MR_Laplacian_region ( const MR_Laplacian * _this)

return all initially free vertices and the first layer of vertices around them Generated from a method of class MR::Laplacian named region. Parameter _this can not be null. It is a single object. The returned pointer will never be null. It is non-owning, do NOT destroy it.

◆ MR_Laplacian_updateSolver()

MRC_API void MR_Laplacian_updateSolver ( MR_Laplacian * _this)

if you manually call this method after initialization and fixing vertices then next apply call will be much faster Generated from a method of class MR::Laplacian named updateSolver. Parameter _this can not be null. It is a single object.