From f4ba3fe4874721424e09a789c0f689a6c93b08a6 Mon Sep 17 00:00:00 2001 From: Richard Brice <37087370+RickBrice@users.noreply.github.com> Date: Thu, 16 Nov 2023 16:17:41 -0800 Subject: [PATCH] Still trying to figure out cant --- src/ifcgeom/mapping/IfcCurveSegment.cpp | 18 ++++++++++++------ .../mapping/IfcSegmentedReferenceCurve.cpp | 5 ++--- 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/src/ifcgeom/mapping/IfcCurveSegment.cpp b/src/ifcgeom/mapping/IfcCurveSegment.cpp index e059fb2a8c..69279bb61b 100644 --- a/src/ifcgeom/mapping/IfcCurveSegment.cpp +++ b/src/ifcgeom/mapping/IfcCurveSegment.cpp @@ -275,10 +275,16 @@ class cant_adjuster : public segment_geometry_adjuster { auto l = get_length(); for (int i = 0; i < 4; i++) { - p.col(i) = start_this.col(i) + (start_next.col(i) - start_this.col(i)) * u / l; - if (i < 3) { - p.col(i).normalize(); - }; + //p.col(i) = start_this.col(i) + (start_next.col(i) - start_this.col(i)) * u / l; + for (int j = 0; j < 3; j++) { + auto st = start_this.col(i)(j); + auto sn = start_next.col(i)(j); + auto result = st + (sn - st) * u / l; + p.col(i)(j) = result; + } + //if (i < 3) { + // p.col(i).normalize(); + //}; } } @@ -405,7 +411,7 @@ class curve_segment_evaluator { //auto dx = run / l; //auto dy = rise / l; - auto slope = fnSlope(u); + auto slope = fnSlope(b); auto dx = signX(u) * cos(slope); auto dy = signY(u) * sin(slope); @@ -509,7 +515,7 @@ class curve_segment_evaluator { auto fn_x = [A, s](double t) -> double { return s * cos(PI * fabs(A) * t * t / (2 * fabs(A))); }; auto fn_y = [A, s](double t) -> double { return s * sin(PI * fabs(A) * t * t / (2 * fabs(A))); }; //auto fn_slope = [A](double t) -> double { return sqrt(PI) * t * t / (2 * abs(A)); }; - auto fn_slope = [A](double t) -> double { return pow(t / A, 2) / 2; }; + auto fn_slope = [A, s](double t) -> double { return pow(t*s / A, 2) / 2; }; set_spiral_function(mapping_, c, s, sign_x, fn_x, sign_y, fn_y, fn_slope); } diff --git a/src/ifcgeom/mapping/IfcSegmentedReferenceCurve.cpp b/src/ifcgeom/mapping/IfcSegmentedReferenceCurve.cpp index f73a14d31b..2dfb5f1c1e 100644 --- a/src/ifcgeom/mapping/IfcSegmentedReferenceCurve.cpp +++ b/src/ifcgeom/mapping/IfcSegmentedReferenceCurve.cpp @@ -50,7 +50,7 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcSegmentedReferenceCurve* ins } auto composition = [gradient, cant](double u)->Eigen::Matrix4d { - auto xyz = gradient->evaluate(u); + auto g = gradient->evaluate(u); auto c = cant->evaluate(u); // when cant results are combined with the gradient curve @@ -59,10 +59,9 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcSegmentedReferenceCurve* ins c.col(3)(0) = 0; std::swap(c.col(3)(1), c.col(3)(2)); - //c.col(0).swap(c.col(1)); Eigen::Matrix4d m; - m = xyz * c; + m = g * c; return m; };