DLR-SC / tigl

The TiGL Geometry Library to process aircraft geometries in pre-design.
https://dlr-sc.github.io/tigl/
Apache License 2.0
231 stars 60 forks source link

TiGLViewer crashes when trailing edge GuideCurve is missing #987

Open LucasKugler opened 7 months ago

LucasKugler commented 7 months ago

In some situations, TiGLViewer crashes when a wing has a guide curve defined a the leading edge, but not at the trailing edge.

I have attached a modified verison of the CPACS example simpleAircraft, where i have added guidecurves to the htp. When commenting out one of the TE guide curves from the VTP (l.1107), TiGL fails to render it but does not crash. When doing the same to the HTP (l.1206) however, there is a hard crash.

example_issue#987.zip

joergbrech commented 7 months ago

I can confirm this. Thanks for the find!

Some more info: Commenting out the VTP TE guide curve in line 1107 gives the error:

ERR 12/20 10:51:59 CTiglMakeLoft.cpp:229] Could not create loft with guide curves. Error code = 2
ERR 12/20 10:51:59 CTiglWingBuilder.cpp:148] CCPACSWingBuilder: Unable to determine wing face names from wing loft.
joergbrech commented 7 months ago

I think this might be the same as https://github.com/DLR-SC/tigl/issues/891, but I would have to verify.

In general, TiGL requires you to define a valid curve network when you use guide curves. That is 1.) Every section curve's start and end point must lie on a guide curve and vice versa 2.) A section curve must always intersect all guide curves (i.e. no hanging nodes) and vice versa

Commenting out one of the TE guide curves violates the first point. Let me try to illustrate with ASCII art. Vertical lines are section curves, horizontal lines are guide curves. Imagine looking at the LE and unraveling the wing shell to a flat surface.

s1      s2
             guide curve lower TE missing
 |     |
 -------     guide curve LE
 |     |
 -------     guide curve upper TE

Since the guide curve for the lower trailing edge is missing, section curves s1 and s2 are not starting at a guide curve.

Still this should be documented properly, error messages should be clear and TiGL should never hard crash.