improve trimmed curve handling in both kernels

This commit is contained in:
Thomas Krijnen
2020-07-25 09:12:39 +02:00
parent badac24d6c
commit 63638a4d26
4 changed files with 21 additions and 7 deletions
+13 -1
View File
@@ -324,6 +324,11 @@ namespace {
} else {
std::tie(a, b) = param;
}
a = std::fmod(a, 2 * M_PI);
b = std::fmod(b, 2 * M_PI);
if (b < a) {
b += 2 * M_PI;
}
int num_segments = (int)std::ceil(std::fabs(a - b) / (2 * M_PI) * FULL_CIRCLE_NUM_SEGMENTS);
double du = (b - a) / num_segments;
taxonomy::point3 P;
@@ -352,6 +357,10 @@ namespace {
boost::apply_visitor(v1, e.start);
boost::apply_visitor(v2, e.end);
if (!e.orientation.get_value_or(true)) {
std::swap(v1.u, v2.u);
}
cgal_curve_creation_visitor v({ v1.u, v2.u });
dispatch_curve_creation<cgal_curve_creation_visitor>::dispatch(e.basis, v);
@@ -392,7 +401,10 @@ bool CgalKernel::convert(const taxonomy::loop* loop, cgal_wire_t& result) {
for (auto& e : edges) {
if (e->basis) {
std::vector<taxonomy::point3> edge;
convert_curve(e->basis, points);
convert_curve(e, edge);
if (!e->orientation_2.get_value_or(true)) {
std::reverse(edge.begin(), edge.end());
}
extend_wire(points, edge);
} else {
extend_wire(points, {