ImFusion SDK 4.3
ImFusion::MeshInterpolation Namespace Reference

Functions for interpolating scalar functions on mesh surfaces. More...

Detailed Description

Functions for interpolating scalar functions on mesh surfaces.

Enumerations

enum class  LaplaceInterpolationMethod { ZeroLaplaceAtUnknownPoints , MinimizeLaplaceAtAllPoints }
 Interpolation methods described in: [1] https://doi.org/10.1016/0021-9991(89)90103-4. More...
 

Functions

Eigen::MatrixXd laplaceInterpolation (const Eigen::SparseMatrix< double > &laplacian, const std::vector< int > &idsKnown, const Eigen::MatrixXd &valuesKnown, LaplaceInterpolationMethod method)
 Interpolates values from the vertices with idsKnown to all vertices using one of the two methods described in https://doi.org/10.1016/0021-9991(89)90103-4.
 
Eigen::SparseMatrix< double > laplaceInterpolationMatrix (const Eigen::SparseMatrix< double > &laplacian, const std::vector< int > &idsKnown, LaplaceInterpolationMethod method)
 Returns a sparse matrix that interpolates values from the vertices with idsKnown to all vertices using one of the two methods described in https://doi.org/10.1016/0021-9991(89)90103-4.
 

Enumeration Type Documentation

◆ LaplaceInterpolationMethod

enum class LaplaceInterpolationMethod
strong

Interpolation methods described in: [1] https://doi.org/10.1016/0021-9991(89)90103-4.

Enumerator
ZeroLaplaceAtUnknownPoints 

Method A in [1].

MinimizeLaplaceAtAllPoints 

Method B in [1].

Function Documentation

◆ laplaceInterpolation()

Eigen::MatrixXd laplaceInterpolation ( const Eigen::SparseMatrix< double > & laplacian,
const std::vector< int > & idsKnown,
const Eigen::MatrixXd & valuesKnown,
LaplaceInterpolationMethod method )

Interpolates values from the vertices with idsKnown to all vertices using one of the two methods described in https://doi.org/10.1016/0021-9991(89)90103-4.

laplacian must be the mesh's discrete Laplace operator. Returns an empty matrix on failure. This example shows how to use this function to interpolate vertex positions from known to all other vertices:

Mesh& mesh = ...;
std::vector<int> idsKnown = ...;
auto laplacian = MeshLaplacian(mesh).getLaplacian();
matX3 values = Eigen::Map<const mat3X>(mesh.verticesPointer()->data(), 3, mesh.numberOfVertices()).transpose();
matX3 valuesKnown = vertices(Eigen::Map<vecXi>(idsKnown.data(), idsKnown.size()), Eigen::all);
matX3 valuesInterp = laplaceInterpolation(laplacian, idsKnown, valuesKnown,
mesh.beginUpdate();
for (int i = 0; i < valuesInterp.rows(); ++i)
mesh.setVertex(i, valuesInterp.row(i));
mesh.endUpdate();
Represents a triangle mesh.
Definition Mesh.h:43
void computeVertexNormals(VertexNormalWeighting weighting=VertexNormalWeighting::NelsonMax)
Compute vertex normals as weighted average of normals of faces around a vertex. Replaces previous nor...
void endUpdate()
End update and send mesh changed signal.
size_t numberOfVertices() const
Number of vertices currently stored. May still include recently deleted vertices if no garbage collec...
void beginUpdate()
After this call no signals will be emitted if the mesh data is changed.
Compute co-tangent laplacian of a mesh and its eigen decomposition.
Definition MeshLaplacian.h:21
T data(T... args)
Eigen::MatrixXd laplaceInterpolation(const Eigen::SparseMatrix< double > &laplacian, const std::vector< int > &idsKnown, const Eigen::MatrixXd &valuesKnown, LaplaceInterpolationMethod method)
Interpolates values from the vertices with idsKnown to all vertices using one of the two methods desc...
@ ZeroLaplaceAtUnknownPoints
Method A in [1].
Definition MeshInterpolation.h:22
T size(T... args)

◆ laplaceInterpolationMatrix()

Eigen::SparseMatrix< double > laplaceInterpolationMatrix ( const Eigen::SparseMatrix< double > & laplacian,
const std::vector< int > & idsKnown,
LaplaceInterpolationMethod method )

Returns a sparse matrix that interpolates values from the vertices with idsKnown to all vertices using one of the two methods described in https://doi.org/10.1016/0021-9991(89)90103-4.

laplacian must be the mesh's discrete Laplace operator. Returns an empty matrix on failure. This example shows how to use this function to interpolate vertex positions from known to all other vertices:

Mesh& mesh = ...;
std::vector<int> idsKnown = ...;
auto laplacian = MeshLaplacian(mesh).getLaplacian();
matX3 values = Eigen::Map<const mat3X>(mesh.verticesPointer()->data(), 3, mesh.numberOfVertices()).transpose();
matX3 valuesKnown = vertices(Eigen::Map<vecXi>(idsKnown.data(), idsKnown.size()), Eigen::all);
auto interpMat = laplaceInterpolationMatrix(laplacian, idsKnown,
matX3 valuesInterp = interpMat * valuesKnown;
mesh.beginUpdate();
for (int i = 0; i < valuesInterp.rows(); ++i)
mesh.setVertex(i, valuesInterp.row(i));
mesh.endUpdate();
Eigen::SparseMatrix< double > laplaceInterpolationMatrix(const Eigen::SparseMatrix< double > &laplacian, const std::vector< int > &idsKnown, LaplaceInterpolationMethod method)
Returns a sparse matrix that interpolates values from the vertices with idsKnown to all vertices usin...
Search Tab / S to search, Esc to close