TTK
Loading...
Searching...
No Matches
QuadrangulationSubdivision.cpp
Go to the documentation of this file.
2
4 ttk::QuadrangulationSubdivision::findQuadBary(std::vector<float> &sum,
5 const Quad &quad) const {
6
7 sum.resize(vertexDistance_[quad[0]].size());
8 std::fill(sum.begin(), sum.end(), std::numeric_limits<float>::infinity());
9
10 for(size_t i = 0; i < sum.size(); ++i) {
11
12 // skip following computation if too far from any parent quad vertex
13 bool skip = false;
14
15 for(const auto vert : quad) {
16 if(vertexDistance_[vert][i] == std::numeric_limits<float>::infinity()) {
17 skip = true;
18 break;
19 }
20 }
21
22 if(skip) {
23 continue;
24 }
25
26 const auto &m{vertexDistance_[quad[0]][i]};
27 const auto &n{vertexDistance_[quad[1]][i]};
28 const auto &o{vertexDistance_[quad[2]][i]};
29 const auto &p{vertexDistance_[quad[3]][i]};
30
31 // try to be "near" the four parent vertices
32 sum[i] = m + n + o + p;
33
34 // try to be on the diagonals intersection
35 sum[i] += std::abs(m - o);
36 sum[i] += std::abs(n - p);
37 }
38
39 return std::min_element(sum.begin(), sum.end()) - sum.begin();
40}
41
42void ttk::QuadrangulationSubdivision::clearData() {
43 outputQuads_.clear();
44 outputPoints_.clear();
45 outputValences_.clear();
46 outputVertType_.clear();
47 outputSubdivision_.clear();
48 quadNeighbors_.clear();
49 vertexDistance_.clear();
50}
std::vector< std::vector< float > > vertexDistance_
int SimplexId
Identifier type for simplices of any dimension.
Definition: DataTypes.h:22