libigl v2.5.0
Loading...
Searching...
No Matches
slim.h
Go to the documentation of this file.
1// This file is part of libigl, a simple c++ geometry processing library.
2//
3// Copyright (C) 2016 Michael Rabinovich
4//
5// This Source Code Form is subject to the terms of the Mozilla Public License
6// v. 2.0. If a copy of the MPL was not distributed with this file, You can
7// obtain one at http://mozilla.org/MPL/2.0/.
8#ifndef SLIM_H
9#define SLIM_H
10
11#include "igl_inline.h"
12#include "MappingEnergyType.h"
13#include <Eigen/Dense>
14#include <Eigen/Sparse>
15
16// This option makes the iterations faster (all except the first) by caching the
17// sparsity pattern of the matrix involved in the assembly. It should be on if
18// you plan to do many iterations, off if you have to change the matrix
19// structure at every iteration.
20#define SLIM_CACHED
21
22#ifdef SLIM_CACHED
23#include "AtA_cached.h"
24#endif
25
26namespace igl
27{
28
34{
36 Eigen::MatrixXd V;
38 Eigen::MatrixXi F;
41
42 // Optional Input
44 Eigen::VectorXi b;
46 Eigen::MatrixXd bc;
49
51 double exp_factor;
54
55 // Output
57 Eigen::MatrixXd V_o;
59 double energy;
60
61 // INTERNAL
62 Eigen::VectorXd M;
63 double mesh_area;
65 int v_num;
66 int f_num;
67 double proximal_p;
68
69 Eigen::VectorXd WGL_M;
70 Eigen::VectorXd rhs;
71 Eigen::MatrixXd Ri,Ji;
72 Eigen::MatrixXd W;
73 Eigen::SparseMatrix<double> Dx,Dy,Dz;
74 int f_n,v_n;
76 bool has_pre_calc = false;
77 int dim;
78
79 #ifdef SLIM_CACHED
80 Eigen::SparseMatrix<double> A;
81 Eigen::VectorXi A_data;
82 Eigen::SparseMatrix<double> AtA;
84 #endif
85};
86
100 const Eigen::MatrixXd& V,
101 const Eigen::MatrixXi& F,
102 const Eigen::MatrixXd& V_init,
103 SLIMData& data,
104 MappingEnergyType slim_energy,
105 const Eigen::VectorXi& b,
106 const Eigen::MatrixXd& bc,
107 double soft_p);
108
116IGL_INLINE Eigen::MatrixXd slim_solve(
117 SLIMData& data,
118 int iter_num);
119
130 const Eigen::MatrixXd &Ji,
131 igl::MappingEnergyType slim_energy,
132 double exp_factor,
133 Eigen::MatrixXd &W,
134 Eigen::MatrixXd &Ri);
135
144 const Eigen::SparseMatrix<double> &Dx,
145 const Eigen::SparseMatrix<double> &Dy,
146 const Eigen::SparseMatrix<double> &Dz,
147 const Eigen::MatrixXd &W,
148 std::vector<Eigen::Triplet<double> > & IJV);
149}
150
151#ifndef IGL_STATIC_LIBRARY
152# include "slim.cpp"
153#endif
154
155#endif
#define IGL_INLINE
Definition igl_inline.h:15
Definition AABB.h:17
void slim_update_weights_and_closest_rotations_with_jacobians(const Eigen::MatrixXd &Ji, igl::MappingEnergyType slim_energy, double exp_factor, Eigen::MatrixXd &W, Eigen::MatrixXd &Ri)
Internal Routine.
void slim_precompute(const Eigen::MatrixXd &V, const Eigen::MatrixXi &F, const Eigen::MatrixXd &V_init, SLIMData &data, MappingEnergyType slim_energy, const Eigen::VectorXi &b, const Eigen::MatrixXd &bc, double soft_p)
Compute necessary information to start using SLIM.
Eigen::MatrixXd slim_solve(SLIMData &data, int iter_num)
Run iter_num iterations of SLIM.
MappingEnergyType
Energy Types used for Parameterization/Mapping.
Definition MappingEnergyType.h:16
void slim_buildA(const Eigen::SparseMatrix< double > &Dx, const Eigen::SparseMatrix< double > &Dy, const Eigen::SparseMatrix< double > &Dz, const Eigen::MatrixXd &W, std::vector< Eigen::Triplet< double > > &IJV)
Undocumented function related to SLIM optimization.
Hold precomputed data for AtA_cached.
Definition AtA_cached.h:18
Parameters and precomputed data for computing a SLIM map as derived in "Scalable Locally Injective Ma...
Definition slim.h:34
Eigen::VectorXd rhs
Definition slim.h:70
Eigen::MatrixXd Ri
Definition slim.h:71
MappingEnergyType slim_energy
Mapping energy type.
Definition slim.h:40
int f_num
Definition slim.h:66
bool mesh_improvement_3d
only supported for 3d
Definition slim.h:53
int v_num
Definition slim.h:65
Eigen::VectorXd M
Definition slim.h:62
igl::AtA_cached_data AtA_data
Definition slim.h:83
Eigen::MatrixXd Ji
Definition slim.h:71
double exp_factor
used for exponential energies, ignored otherwise
Definition slim.h:51
double energy
objective value
Definition slim.h:59
Eigen::MatrixXd V_o
V by dim list of mesh vertex positions (dim = 2 for parametrization, 3 otherwise)
Definition slim.h:57
Eigen::MatrixXd V
V by 3 list of mesh vertex positions
Definition slim.h:36
double proximal_p
Definition slim.h:67
Eigen::SparseMatrix< double > Dx
Definition slim.h:73
Eigen::MatrixXi F
F by 3/4 list of mesh faces (triangles/tets)
Definition slim.h:38
Eigen::MatrixXd bc
Fixed values.
Definition slim.h:46
bool has_pre_calc
Definition slim.h:76
int v_n
Definition slim.h:74
Eigen::VectorXd WGL_M
Definition slim.h:69
Eigen::SparseMatrix< double > Dz
Definition slim.h:73
Eigen::SparseMatrix< double > Dy
Definition slim.h:73
double soft_const_p
Weight for enforcing fixed values as soft constraint.
Definition slim.h:48
int f_n
Definition slim.h:74
double avg_edge_length
Definition slim.h:64
Eigen::SparseMatrix< double > A
Definition slim.h:80
Eigen::SparseMatrix< double > AtA
Definition slim.h:82
double mesh_area
Definition slim.h:63
int dim
Definition slim.h:77
Eigen::VectorXi b
Fixed indices.
Definition slim.h:44
Eigen::MatrixXd W
Definition slim.h:72
bool first_solve
Definition slim.h:75
Eigen::VectorXi A_data
Definition slim.h:81