libigl v2.5.0
Loading...
Searching...
No Matches
arap_dof.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) 2013 Alec Jacobson <alecjacobson@gmail.com>
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 IGL_ARAP_ENERGY_TYPE_DOF_H
9#define IGL_ARAP_ENERGY_TYPE_DOF_H
10#include "igl_inline.h"
11
12#include <Eigen/Dense>
13#include <Eigen/Sparse>
14#include "ARAPEnergyType.h"
15#include <vector>
16
53
54
55namespace igl
56{
57
58 template <typename LbsMatrixType, typename SSCALAR>
59 struct ArapDOFData;
87 template <typename LbsMatrixType, typename SSCALAR>
89 const Eigen::MatrixXd & V,
90 const Eigen::MatrixXi & F,
91 const LbsMatrixType & M,
92 const Eigen::Matrix<int,Eigen::Dynamic,1> & G,
94
116 template <typename LbsMatrixType, typename SSCALAR>
118 const Eigen::Matrix<int,Eigen::Dynamic,1> & fixed_dim,
119 const Eigen::SparseMatrix<double> & A_eq,
121
138 template <typename LbsMatrixType, typename SSCALAR>
141 const Eigen::Matrix<double,Eigen::Dynamic,1> & B_eq,
142 const Eigen::MatrixXd & L0,
143 const int max_iters,
144 const double tol,
145 Eigen::MatrixXd & L
146 );
147
152 template <typename LbsMatrixType, typename SSCALAR>
154 {
156 typedef Eigen::Matrix<SSCALAR, Eigen::Dynamic, Eigen::Dynamic> MatrixXS;
160 Eigen::Matrix<int,Eigen::Dynamic,1> fixed_dim;
163 std::vector<Eigen::MatrixXd> CSM_M;
165 LbsMatrixType M_KG;
167 int n;
169 int m;
171 int dim;
175 Eigen::Matrix<int,Eigen::Dynamic,1> interpolated;
177 std::vector<bool> free_mask;
179 LbsMatrixType Q;
180
181
183 //Eigen::MatrixXd M_Solve; // TODO: remove from here
184
188
192 MatrixXS CSolveBlock1;
193
196
199 // I'm hiding the extra dynamics stuff in this struct, which sort of defeats
200 // the purpose of this function-based coding style...
201
203 double h;
204
210 //MatrixXS Lm1;
213
216
218 LbsMatrixType Mass_tilde;
219
221 Eigen::MatrixXd fgrav;
223 Eigen::Vector3d grav_dir;
225 double grav_mag;
226
229
230 // @private Default values
233 with_dynamics(false),
234 h(1),
235 grav_dir(0,-1,0),
236 grav_mag(0)
237 {
238 }
239 };
240}
241
242#ifndef IGL_STATIC_LIBRARY
243# include "arap_dof.cpp"
244#endif
245
246#endif
#define IGL_INLINE
Definition igl_inline.h:15
Definition AABB.h:17
bool arap_dof_precomputation(const Eigen::MatrixXd &V, const Eigen::MatrixXi &F, const LbsMatrixType &M, const Eigen::Matrix< int, Eigen::Dynamic, 1 > &G, ArapDOFData< LbsMatrixType, SSCALAR > &data)
Precomputes the system to optimize for "Fast Automatic Skinning Transformations" [Jacobson et al....
bool arap_dof_update(const ArapDOFData< LbsMatrixType, SSCALAR > &data, const Eigen::Matrix< double, Eigen::Dynamic, 1 > &B_eq, const Eigen::MatrixXd &L0, const int max_iters, const double tol, Eigen::MatrixXd &L)
Optimizes the transformations attached to each weight function based on precomputed system.
bool arap_dof_recomputation(const Eigen::Matrix< int, Eigen::Dynamic, 1 > &fixed_dim, const Eigen::SparseMatrix< double > &A_eq, ArapDOFData< LbsMatrixType, SSCALAR > &data)
Should always be called after arap_dof_precomputation, but may be called in between successive calls ...
ARAPEnergyType
Enum for choosing ARAP energy type.
Definition ARAPEnergyType.h:14
@ ARAP_ENERGY_TYPE_SPOKES
"As-rigid-as-possible Surface Modeling" by [Sorkine and Alexa 2007], rotations defined at vertices af...
Definition ARAPEnergyType.h:17
Structure that contains fields for all precomputed data or data that needs to be remembered at update...
Definition arap_dof.h:154
ArapDOFData()
Definition arap_dof.h:231
Eigen::Matrix< int, Eigen::Dynamic, 1 > fixed_dim
List of indices of fixed transformation entries.
Definition arap_dof.h:160
MatrixXS M_FullSolve
Full solve matrix that contains also conversion from rotations to the right hand side,...
Definition arap_dof.h:187
MatrixXS L0
#handles * dim * dim+1 list of transformation entries from previous solve
Definition arap_dof.h:207
MatrixXS Lvel0
"Velocity"
Definition arap_dof.h:212
bool with_dynamics
dynamics
Definition arap_dof.h:198
int n
Number of mesh vertices.
Definition arap_dof.h:167
MatrixXS Pi_1
Π1 from the paper.
Definition arap_dof.h:228
MatrixXS fext
#V by dim matrix of external forces
Definition arap_dof.h:215
double grav_mag
Magnitude of gravity.
Definition arap_dof.h:225
MatrixXS CSM
Precomputed condensed matrices (3x3 commutators folded to 1x1):
Definition arap_dof.h:190
igl::ARAPEnergyType energy
Type of arap energy we're solving.
Definition arap_dof.h:158
bool print_timings
Print timings at each update.
Definition arap_dof.h:195
std::vector< Eigen::MatrixXd > CSM_M
List of precomputed covariance scatter matrices multiplied by lbs matrices.
Definition arap_dof.h:163
int m
Number of weight functions.
Definition arap_dof.h:169
LbsMatrixType Mass_tilde
Mass_tilde: MT * Mass * M.
Definition arap_dof.h:218
std::vector< bool > free_mask
Mask of free variables.
Definition arap_dof.h:177
int dim
Number of dimensions.
Definition arap_dof.h:171
Eigen::Matrix< SSCALAR, Eigen::Dynamic, Eigen::Dynamic > MatrixXS
Matrix with SSCALAR type.
Definition arap_dof.h:156
Eigen::MatrixXd fgrav
Force due to gravity (premultiplier)
Definition arap_dof.h:221
Eigen::Vector3d grav_dir
Direction of gravity.
Definition arap_dof.h:223
int effective_dim
Effective dimensions.
Definition arap_dof.h:173
double h
Time step.
Definition arap_dof.h:203
Eigen::Matrix< int, Eigen::Dynamic, 1 > interpolated
List of indices into C of positional constraints.
Definition arap_dof.h:175
LbsMatrixType Q
Full quadratic coefficients matrix before lagrangian (should be dense)
Definition arap_dof.h:179