Fix tigl wing get segment upper surface area trimmed #960
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Closes #961
Bug Description
The API function tiglWingGetSegmentUpperSurfaceAreaTrimmed(...) terminated with return code 1, when passing the valid arguments (tiglHandle, 1, 1, 0, 0, 0, 1, 0.05, 1, 0.05, 0, double*ReturnValue).
Bug Analysis
This bug arises due to the fact that the implementation of the mentioned function contained a cast from TopoDS_Compound to a TopoDS_Face. As the used test data configuration has the property, that both its upper and lower wing consists of more than one face, respectively, arising through the use of additional guide curves, both the upper and lower wing are given by compounds containing more than one element, respectively. Trying to cast each of these compounds to a face yields an error.
The bug originates due to the fact that earlier, both upper and lower wings consisted of only one face, respectively. Hence, the mentioned conversion was not a problem.
Bug Fix
It has been fixed by avoiding these falsy conversions by minor refactoring of the code.
How Has This Been Tested?
Two unit tests have been added: One test for the correct return value of the above API function, and the second giving a roughly estimated check if the computed area leads to the right value.