From a45f6f980f297bb77a0d63d0f662929267c8f99a Mon Sep 17 00:00:00 2001 From: Richard Brice <37087370+RickBrice@users.noreply.github.com> Date: Mon, 20 May 2024 13:17:18 -0700 Subject: [PATCH] Prevents divide by zero when clothoid constant is 0.0 --- src/ifcgeom/mapping/IfcCurveSegment.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/ifcgeom/mapping/IfcCurveSegment.cpp b/src/ifcgeom/mapping/IfcCurveSegment.cpp index b19fa7b94b..49a569c95d 100644 --- a/src/ifcgeom/mapping/IfcCurveSegment.cpp +++ b/src/ifcgeom/mapping/IfcCurveSegment.cpp @@ -171,7 +171,9 @@ class curve_segment_evaluator { } else { // This functor is f'(x) = dy/dx auto df = [fnX,fnY](double t) -> double { - return fnY(t) / fnX(t); + auto dy = fnY(t); + auto dx = fnX(t); + return dx ? dy / dx : 0.0; }; // This functor computes the curve length