A tool for finding critical points and further figuring out loops and singular points in surface intersection.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

66 lines
2.4 KiB

#include <iostream>
#include "loop_detector.h"
int main() {
LoopDetector loopDetector;
tinynurbs::RationalSurface<float> s;
tinynurbs::RationalSurface<float> f;
s.degree_u = 3;
s.degree_v = 3;
s.knots_u = {0, 0, 0, 0, 1, 1, 1, 1};
s.knots_v = {0, 0, 0, 0, 1, 1, 1, 1};
s.control_points = {4, 4, {
glm::vec3(0, 0.3, 0.9), glm::vec3(0, 0.6, 1), glm::vec3(0, 0.9, 1.1), glm::vec3(0, 1.2, 1),
glm::vec3(0.33, 0.3, 0.12), glm::vec3(0.33, 0.6, 0.12), glm::vec3(0.33, 0.9, 0.12),
glm::vec3(0.33, 1.2, 0.12),
glm::vec3(0.66, 0.3, 0.12), glm::vec3(0.66, 0.6, 0.12), glm::vec3(0.66, 0.9, 0.12),
glm::vec3(0.66, 1.2, 0.12),
glm::vec3(1, 0.3, 0.8), glm::vec3(1, 0.6, 1), glm::vec3(1, 0.9, 1.1), glm::vec3(1, 1.2, 1)
}};
s.weights = {4, 4,
{
1, 1, 1, 1,
1, 1, 1, 1,
1, 1, 1, 1,
1, 1, 1, 1,
}
};
f.degree_u = 3;
f.degree_v = 3;
f.knots_u = {0, 0, 0, 0, 1, 1, 1, 1};
f.knots_v = {0, 0, 0, 0, 1, 1, 1, 1};
f.control_points = {4, 4, {
glm::vec3(0, 0.2, 0.9), glm::vec3(0, 0.5, 1.8), glm::vec3(0, 0.8, 1.1), glm::vec3(0, 1.2, 1),
glm::vec3(0.33, 0.2, 0.12), glm::vec3(0.33, 0.5, 0.42), glm::vec3(0.33, 0.9, -0.62),
glm::vec3(0.33, 1.1, -1.756),
glm::vec3(0.66, 0.2, 0.12), glm::vec3(0.66, 0.5, 0.42), glm::vec3(0.66, 0.9, -0.62),
glm::vec3(0.66, 1.0, -1.756),
glm::vec3(1, 0.2, 0.8), glm::vec3(1, 0.5, 1), glm::vec3(1, 0.9, 1.1), glm::vec3(1, 1.2, 1)
}};
f.weights = {4, 4,
{
1, 1, 1, 1,
1, 1, 1, 1,
1, 1, 1, 1,
1, 1, 1, 1,
}
};
loopDetector.s = s;
loopDetector.f = f;
loopDetector.maxSplitLayer = 6;
// 需要做Loop检测的sub patch在最后一层上的下标的范围(每个范围都真包含于[0, 2^(maxSplitLayer-1)-1])
// 这里范围真包含于[0, 31]
loopDetector.detect({3, 11}, {4, 11}, {2, 7}, {6, 15});
// 结果
for (const auto& line: loopDetector.rotationNumbers) {
for (const auto& el: line) {
cout << el << " ";
}
cout << endl;
}
return 0;
}