From 206933a2f25c29a1c4b3cb9ed79122c992c75a61 Mon Sep 17 00:00:00 2001 From: Thomas Krijnen Date: Thu, 15 Jun 2023 16:18:48 +0200 Subject: [PATCH] #2819 Handle periodic bspline curves in serialization --- src/ifcgeom/Serialization.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/ifcgeom/Serialization.cpp b/src/ifcgeom/Serialization.cpp index 7a4f346528..8eabd1732b 100644 --- a/src/ifcgeom/Serialization.cpp +++ b/src/ifcgeom/Serialization.cpp @@ -18,6 +18,8 @@ #include "IfcGeom.h" +#include + template int convert_to_ifc(const T& t, U*& u, bool /*advanced*/) { std::vector coords(3); @@ -220,6 +222,15 @@ int convert_to_ifc(const Handle_Geom_Curve& c, IfcSchema::IfcCurve*& curve, bool } } + if (bspline->IsPeriodic() && points->size()) { + points->push(*points->begin()); + weights.push_back(weights[0]); + auto sum = std::accumulate(mults.begin(), mults.end(), 0); + auto d = sum - (bspline->Degree() + (int)points->size() + 1); + (*mults.begin()) -= d / 2; + (*mults.rbegin()) -= d / 2; + } + if (rational) { curve = new IfcSchema::IfcRationalBSplineCurveWithKnots( bspline->Degree(),