-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patharap.hpp
More file actions
47 lines (35 loc) · 1.12 KB
/
Copy patharap.hpp
File metadata and controls
47 lines (35 loc) · 1.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#pragma once
#include <Eigen/SparseCore>
#include <Eigen/SparseCholesky>
#include <Eigen/SparseLU>
#include <mutex>
struct Mesh {
Eigen::MatrixXd V;
Eigen::MatrixXi F;
Eigen::MatrixXd N;
};
struct FixedVertex {
Eigen::Index index;
size_t group;
};
struct LaplacianSystem {
Mesh* mesh;
bool is_bound;
int free_dimension;
std::vector<Eigen::Index> swizzle;
std::vector<Eigen::Index> deswizzle;
Eigen::MatrixXd V0;
std::vector<Eigen::Matrix3d> optimal_rotations;
double rotation_variation_penalty;
Eigen::SparseMatrix<double> laplacian_matrix;
Eigen::SparseMatrix<double> fixed_constraint_matrix;
Eigen::SparseMatrix<double> cotangent_weights;
Eigen::SimplicialLDLT<Eigen::SparseMatrix<double>> solver;
Eigen::Matrix<double, Eigen::Dynamic, 3> rhs;
std::mutex mesh_access;
int iterations;
};
void system_init(LaplacianSystem& system, Mesh* mesh, double alpha);
bool system_bind(LaplacianSystem& system, const std::vector<FixedVertex>& fixed_vertices);
void system_solve(LaplacianSystem& system, int iterations);
bool system_iterate(LaplacianSystem& system);