diff options
author | Sebastian Parborg <darkdefende@gmail.com> | 2019-08-26 19:34:11 +0300 |
---|---|---|
committer | Sebastian Parborg <darkdefende@gmail.com> | 2019-09-13 11:36:05 +0300 |
commit | 57e55906f04a48a951fbbcfd7c197eef35ad4387 (patch) | |
tree | a4246ffdd501027a37d7329dca05de4d9ed19b15 /extern/quadriflow/src/adjacent-matrix.cpp | |
parent | 1c44d08a69eb3e66c7f942d748f549d6b8ca138f (diff) |
Add QuadriFlow remesher
Diffstat (limited to 'extern/quadriflow/src/adjacent-matrix.cpp')
-rw-r--r-- | extern/quadriflow/src/adjacent-matrix.cpp | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/extern/quadriflow/src/adjacent-matrix.cpp b/extern/quadriflow/src/adjacent-matrix.cpp new file mode 100644 index 00000000000..e20ffb05f6d --- /dev/null +++ b/extern/quadriflow/src/adjacent-matrix.cpp @@ -0,0 +1,35 @@ +#include "config.hpp" +#include "adjacent-matrix.hpp" +#include "dedge.hpp" +#include <fstream> + +namespace qflow { + +void generate_adjacency_matrix_uniform( + const MatrixXi &F, const VectorXi &V2E, const VectorXi &E2E, + const VectorXi &nonManifold, AdjacentMatrix& adj) { + adj.resize(V2E.size()); +#ifdef WITH_OMP +#pragma omp parallel for +#endif + for (int i = 0; i < adj.size(); ++i) { + int start = V2E[i]; + int edge = start; + if (start == -1) + continue; + do { + int base = edge % 3, f = edge / 3; + int opp = E2E[edge], next = dedge_next_3(opp); + if (adj[i].empty()) + adj[i].push_back(Link(F((base + 2) % 3, f))); + if (opp == -1 || next != start) { + adj[i].push_back(Link(F((base + 1) % 3, f))); + if (opp == -1) + break; + } + edge = next; + } while (edge != start); + } +} + +} // namespace qflow |