Skip to content

Commit

Permalink
add unit test for #975
Browse files Browse the repository at this point in the history
  • Loading branch information
Kobold authored and joergbrech committed Nov 21, 2023
1 parent 5f3e172 commit be0ea7c
Showing 1 changed file with 42 additions and 0 deletions.
42 changes: 42 additions & 0 deletions tests/unittests/tiglWingGuideCurves.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
#include "CCPACSGuideCurveAlgo.h"
#include "CCPACSWingSegment.h"
#include "tiglcommonfunctions.h"
#include "CTiglWingSegmentGuidecurveBuilder.h"

/******************************************************************************/

Expand Down Expand Up @@ -457,3 +458,44 @@ TEST_F(WingGuideCurve, tiglWingGuideCurve_CCPACSWingSegment)
ASSERT_NEAR(predictedPoint.Z(), point.Z(), 1E-14);
}
}

TEST_F(WingGuideCurve, bug975)
{
//https://github.com/DLR-SC/tigl/issues/975

tigl::CCPACSConfigurationManager& manager = tigl::CCPACSConfigurationManager::GetInstance();
tigl::CCPACSConfiguration& config = manager.GetConfiguration(tiglHandle);
tigl::CCPACSWing& wing = config.GetWing(1);


tigl::CCPACSWingSegment& segment1 = wing.GetSegment(1);
tigl::CTiglWingSegmentGuidecurveBuilder builder(segment1);

auto const& guideCurves = segment1.GetGuideCurves();
if(guideCurves) {
tigl::CCPACSGuideCurve const& guidecurve = guideCurves->GetGuideCurve(1);
auto points_before = builder.BuildGuideCurvePnts(&guidecurve);

tigl::CCPACSTransformation& trafo = wing.GetTransformation();
trafo.setRotation(tigl::CTiglPoint(0, 90, 0));
wing.SetTransformation(trafo);
tigl::CTiglTransformation const& wingTrafo = wing.GetTransformationMatrix();

auto points_after = builder.BuildGuideCurvePnts(&guidecurve);
int idx = 0;
for (auto const& p : points_after) {

// per design, the guide curve should have a zero x-component
EXPECT_NEAR(p.X(), 0.0, 1e-12);

// transforming the guide curve points of the untransformed wing should
// yield the same points as building the points after transforming the wing
gp_Pnt pt = wingTrafo.Transform(points_before[idx++]);
EXPECT_NEAR(p.X(), pt.X(), 1e-12);
EXPECT_NEAR(p.Y(), pt.Y(), 1e-12);
EXPECT_NEAR(p.Z(), pt.Z(), 1e-12);

}
}

}

0 comments on commit be0ea7c

Please sign in to comment.