tigl
tigl copied to clipboard
fuselage lofting issues with guide curves
The lofting of a fuselage fails if
- a segment contains guide curves, but none is located at relative circumference 0.
- a segment contains a single guide curve.
This issue can be reproduced using the following test case: ColaGuideCurve.zip. Without any modifications, the test case should work (TiGL creates the expected fuselage loft). The fuselage consists of a single segment with guide curves at relative circumference 0 and 0.5. Commenting out either of the two guide curves will cause TiGL to not successfully create the loft and return the following error:
ERR 03/30 12:09:05 CTiglMakeLoft.cpp:229] Could not create loft with guide curves. Error code = 2
It seems like the error originates in src/contrib/MakeLoops.cxx
.
Click for some first debugging insights.
Case 1: A segment contains guide curves, but none is located at relative circumference 0
This can be reproduced with the test case by commenting out or deleting the guide curve with uID Duct_9_upperGuideCurveSegment1
. This leaves a single guide curve at relative circumference 0.5.
ERR 03/30 12:09:05 CTiglMakeLoft.cpp:229] Could not create loft with guide curves. Error code = 2
Debugging reveals that the source of the error lies in this piece of code:
https://github.com/DLR-SC/tigl/blob/e5d4ee8d0ab56b1b66729c2a9616e4fc7ea71472/src/contrib/MakeLoops.cxx#L178-L215
TiGL searches the grid of profiles and guide curves for a starting corner, which is a vertex with minimum neighboring edges. At this vertex, TiGL finds a "ForwardSection", i.e. the fuselage profile, but no "ForwardGuide" (presumably because none is defined at relative circumference 0). As a consequence, MakeLoops
returns with status MAKELOOPS_FAIL_STARTINGPOINT
.
Case 2: A segment contains a single guide curve.
Case 1 is a special case of this one. This can be reproduced by commenting out either of the two guide curves Duct_9_upperGuideCurveSegment1
or Duct_9_lowerGuideCurveSegment1
. Let's assume that we comment out the second guide curve and keep the guide curve Duct_9_upperGuideCurveSegment1
at relative circumference 0, as this reveals a different bug.
Debugging reveals that in the first pass of the while-loop starting in
https://github.com/DLR-SC/tigl/blob/e5d4ee8d0ab56b1b66729c2a9616e4fc7ea71472/src/contrib/MakeLoops.cxx#L274
the code will enter the true-branch of this if-clause:
https://github.com/DLR-SC/tigl/blob/e5d4ee8d0ab56b1b66729c2a9616e4fc7ea71472/src/contrib/MakeLoops.cxx#L559-L567
But at this time, NextStartCorner
is null, so that for the second pass of the while-loop, both StartCorner
and NextCorner
are null as well. At the beginning of the second pass of the while-loop
https://github.com/DLR-SC/tigl/blob/e5d4ee8d0ab56b1b66729c2a9616e4fc7ea71472/src/contrib/MakeLoops.cxx#L275-L278
Corner
will be null, so that we never enter the true-branch of
https://github.com/DLR-SC/tigl/blob/e5d4ee8d0ab56b1b66729c2a9616e4fc7ea71472/src/contrib/MakeLoops.cxx#L298-L314
and therefore E1
will remain null. Finally, this causes MakeLoops
to fail here:
https://github.com/DLR-SC/tigl/blob/e5d4ee8d0ab56b1b66729c2a9616e4fc7ea71472/src/contrib/MakeLoops.cxx#L330-L334