From 9212f218bf2a24e3f668ca5f9d2b999b029bb461 Mon Sep 17 00:00:00 2001 From: isn Date: Thu, 18 Jan 2018 17:06:04 +0300 Subject: [PATCH] corrections --- src/QABugs/QABugs_20.cxx | 75 +++++++++++++----------------------- src/gp/gp_Ax3.lxx | 4 +- tests/bugs/fclasses/bug29406 | 8 ++++ 3 files changed, 37 insertions(+), 50 deletions(-) diff --git a/src/QABugs/QABugs_20.cxx b/src/QABugs/QABugs_20.cxx index 4ad9d19e9d..07d49785fd 100644 --- a/src/QABugs/QABugs_20.cxx +++ b/src/QABugs/QABugs_20.cxx @@ -2768,63 +2768,42 @@ static Standard_Integer OCC29371 (Draw_Interpretor& di, Standard_Integer n, cons return 0; } -static Standard_Integer OCC29406 (Draw_Interpretor&, Standard_Integer, const char**) +static void CheckAx3Dir(gp_Ax3& theAx, const gp_Dir& theDir ) { - gp_Ax3 anAx1, anAx2; - Standard_Boolean bDirect1 = anAx1.Direct(); - anAx1.SetDirection (gp::DX()); - if (bDirect1 != anAx1.Direct()) - { + Standard_Boolean bDirect = theAx.Direct(); + theAx.SetDirection (theDir); + if (bDirect != theAx.Direct()) std::cout << "Error: coordinate system is reversed\n"; - return 1; - } - // - Standard_Boolean bDirect2 = anAx2.Direct(); - anAx2.SetDirection (-gp::DX()); - if (bDirect2 != anAx2.Direct()) - { + if (!theDir.IsEqual(theAx.Direction(), Precision::Angular())) + std::cout << "Error: main dir was not set properly\n"; +} + +static void CheckAx3Ax1(gp_Ax3& theAx, const gp_Ax1& theAx0 ) +{ + Standard_Boolean bDirect = theAx.Direct(); + theAx.SetAxis (theAx0); + if (bDirect != theAx.Direct()) std::cout << "Error: coordinate system is reversed\n"; - return 1; - } - // - gp_Ax3 anAx3, anAx4; + if (!theAx0.Direction().IsEqual(theAx.Direction(), Precision::Angular())) + std::cout << "Error: main dir was not set properly\n"; +} + +static Standard_Integer OCC29406 (Draw_Interpretor&, Standard_Integer, const char**) +{ + gp_Ax3 anAx1, anAx2, anAx3, anAx4, anAx5, anAx6;; anAx3.ZReverse(); anAx4.ZReverse(); // - Standard_Boolean bDirect3 = anAx3.Direct(); - anAx3.SetDirection (gp::DX()); - if (bDirect3 != anAx3.Direct()) - { - std::cout << "Error: coordinate system is reversed\n"; - return 1; - } + CheckAx3Dir(anAx1, gp::DX()); + CheckAx3Dir(anAx2, -gp::DX()); + CheckAx3Dir(anAx3, gp::DX()); + CheckAx3Dir(anAx4, -gp::DX()); // - Standard_Boolean bDirect4 = anAx4.Direct(); - anAx4.SetDirection (gp::DX()); - if (bDirect4 != anAx3.Direct()) - { - std::cout << "Error: coordinate system is reversed\n"; - return 1; - } - // - gp_Ax3 anAx5, anAx6; gp_Ax1 anAx0_1 (gp::Origin(), gp::DX()); - Standard_Boolean bDirect5 = anAx5.Direct(); - anAx5.SetAxis (anAx0_1); - if (bDirect5 != anAx5.Direct()) - { - std::cout << "Error: coordinate system is reversed\n"; - return 1; - } - // gp_Ax1 anAx0_2 (gp::Origin(), -gp::DX()); - Standard_Boolean bDirect6 = anAx6.Direct(); - anAx6.SetAxis (anAx0_1); - if (bDirect6 != anAx6.Direct()) - { - std::cout << "Error: coordinate system is reversed\n"; - return 1; - } + // + CheckAx3Ax1(anAx5, anAx0_1); + CheckAx3Ax1(anAx6, anAx0_2); return 0; } diff --git a/src/gp/gp_Ax3.lxx b/src/gp/gp_Ax3.lxx index 2b501f24f2..3111847c62 100644 --- a/src/gp/gp_Ax3.lxx +++ b/src/gp/gp_Ax3.lxx @@ -44,7 +44,6 @@ inline void gp_Ax3::ZReverse() inline void gp_Ax3::SetAxis(const gp_Ax1& A1) { - Standard_Boolean direct = Direct(); Standard_Real dot = A1.Direction().Dot(vxdir); if(Abs(Abs(dot) - 1.) <= Precision::Angular()) { @@ -59,6 +58,7 @@ inline void gp_Ax3::SetAxis(const gp_Ax1& A1) } else { + Standard_Boolean direct = Direct(); axis = A1; vxdir = axis.Direction().CrossCrossed (vxdir, axis.Direction()); if(direct) { vydir = axis.Direction().Crossed(vxdir); } @@ -68,7 +68,6 @@ inline void gp_Ax3::SetAxis(const gp_Ax1& A1) inline void gp_Ax3::SetDirection(const gp_Dir& V) { - Standard_Boolean direct = Direct(); Standard_Real dot = V.Dot(vxdir); if(Abs(Abs(dot) - 1.) <= Precision::Angular()) { @@ -83,6 +82,7 @@ inline void gp_Ax3::SetDirection(const gp_Dir& V) } else { + Standard_Boolean direct = Direct(); axis.SetDirection (V); vxdir = V.CrossCrossed (vxdir, V); if (direct) { vydir = V.Crossed (vxdir); } diff --git a/tests/bugs/fclasses/bug29406 b/tests/bugs/fclasses/bug29406 index 917bad3291..689ccfd425 100644 --- a/tests/bugs/fclasses/bug29406 +++ b/tests/bugs/fclasses/bug29406 @@ -1,2 +1,10 @@ +puts "========" +puts "OCC29406" +puts "========" +puts "" +######################################################### +## Foundation Classes - gp_Ax3 fails setting direction +######################################################### + pload QAcommands OCC29406 -- 2.39.5