Disturbances ( torsion ?) when building a pipe with BRepOffsetAPI_MakePipe

Hello,

I'm trying to build a pipe by providing a spline (transformed into TopoDS_Wire) as Spine, and a quadrilateral TopoDS_Face as Profile. The resulting pipe is regular over the first half of the spine's path (at least it corresponds to the expected shape), then undergoes perturbations at the end (see attached image, top right end of the pipe).

Image

The spline (Handle(Geom_BsplineCurve)) at the origin of the spine is approximated from a pointSet using the GeomAPI_PointsToBSpline class (see first and second image in the attached document).

The parameters used in the attached image are as follows:

GeomAPI_PointsToBSpline anApproximator;
anApproximator.Init(pointList, 0.0, 0.0, 1.0, 8, GeomAbs_C2, 2.5);

But overall, modifying weights 1, 2 and 3 has little effect on the disturbance described.

What is the cause of this twisting effect at the end of the run? How can it be avoided?

I've tried to re-approximate a second spline, on a pointset regularly re-spaced with GCPnts_UniformAbscissa, but the result is similar.

I'm running out of ideas...

Thanks for your help