Skip to content

Commit

Permalink
Merge branch 'occt_761' of https://github.com/DLR-SC/tigl into occt_761
Browse files Browse the repository at this point in the history
  • Loading branch information
rainman110 committed Dec 7, 2023
2 parents d7e763f + 9be8a94 commit e2ac77d
Show file tree
Hide file tree
Showing 6 changed files with 47 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .github/actions/test-macos/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ runs:
- name: Install tixi and pythonocc-core from conda
shell: bash -l {0}
run: |
conda install tixi3=3.3.0 pythonocc-core=7.4.1 -c dlr-sc -c dlr-sc/label/tigl-dev
conda install python=3.8 tixi3=3.3.0 pythonocc-core=7.4.1 -c dlr-sc -c dlr-sc/label/tigl-dev
- name: Download built test directory
uses: actions/download-artifact@v3
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/pull_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ jobs:

continuous-integration:
uses: ./.github/workflows/continuous-integration.yml
secrets: inherit
2 changes: 1 addition & 1 deletion TIGLViewer/shaders/PhongShading-v6.fs
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ vec4 computeLighting (in vec3 theNormal,
vec3 v = vec3(0., 0., -1.);

// Direction of the view reflected on the surface
vec3 vReflect = 2. * (dot(Normal, v)*Normal - v);
vec3 vReflect = 2. * (dot(theNormal, v)*theNormal - v);

// normal vector of the light stripe plane
vec3 lightDir = normalize(vec3(0., 1., 0.));
Expand Down
2 changes: 1 addition & 1 deletion TIGLViewer/shaders/PhongShading-v7.fs
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ vec4 computeLighting (in vec3 theNormal,
vec3 v = vec3(0., 0., -1.);

// Direction of the view reflected on the surface
vec3 vReflect = 2. * (dot(Normal, v)*Normal - v);
vec3 vReflect = 2. * (dot(theNormal, v)*theNormal - v);

// normal vector of the light stripe plane
vec3 lightDir = normalize(vec3(0., 1., 0.));
Expand Down
2 changes: 1 addition & 1 deletion src/wing/CTiglWingSegmentGuidecurveBuilder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ std::vector<gp_Pnt> CTiglWingSegmentGuidecurveBuilder::BuildGuideCurvePnts(const
}

// get local x-direction for the guide curve
gp_Dir rxDir = gp_Dir(1., 0., 0.);
gp_Dir rxDir = wingTransform.Transform(gp_Dir(1., 0., 0.));
if (guideCurve->GetRXDirection()) {
rxDir.SetX(guideCurve->GetRXDirection()->GetX());
rxDir.SetY(guideCurve->GetRXDirection()->GetY());
Expand Down
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 e2ac77d

Please sign in to comment.