From 087a830a67be54dd34d177649b6c6b3697a68832 Mon Sep 17 00:00:00 2001 From: Christopher Lackner Date: Thu, 15 Apr 2021 22:48:16 +0200 Subject: [PATCH] store cumulated angle --- libsrc/csg/extrusion.cpp | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/libsrc/csg/extrusion.cpp b/libsrc/csg/extrusion.cpp index 9fd2c39d..82b2e651 100644 --- a/libsrc/csg/extrusion.cpp +++ b/libsrc/csg/extrusion.cpp @@ -42,6 +42,7 @@ namespace netgen } } + double cum_angle = 0.; for(auto i : Range(path->GetSplines())) { const auto& sp = path->GetSpline(i); @@ -49,7 +50,8 @@ namespace netgen t1.Normalize(); auto t2 = sp.GetTangent(1.); t2.Normalize(); - angles.Append(acos(t1 * t2)); + cum_angle += acos(t1 * t2); + angles.Append(cum_angle); } profile->GetCoeff(profile_spline_coeff); @@ -678,11 +680,7 @@ namespace netgen double h, int& zone) const { Surface::ToPlane(p3d, p2d, h, zone); - double angle = 0; - for(int i = latest_seg; i < tangential_plane_seg; i++) - angle += angles[i]; - for(int i = tangential_plane_seg; i < latest_seg; i++) - angle -= angles[i]; + double angle = angles[tangential_plane_seg] - angles[latest_seg]; if(fabs(angle) > 3.14/2.) zone = -1; }