]> OCCT Git - occt-copy.git/commitdiff
corrections
authorisn <isn@opencascade.com>
Thu, 18 Jan 2018 14:06:04 +0000 (17:06 +0300)
committerisn <isn@opencascade.com>
Thu, 18 Jan 2018 14:06:04 +0000 (17:06 +0300)
src/QABugs/QABugs_20.cxx
src/gp/gp_Ax3.lxx
tests/bugs/fclasses/bug29406

index 4ad9d19e9d6f971e5dba6bac82a5c228886dcd00..07d49785fd4207725559a9974d85224aa1b18052 100644 (file)
@@ -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;
 }
 
index 2b501f24f2e87fff3cbba28772764b8f57c8ecd7..3111847c6224d6ad6ff26f4c9e9cdce36adc5fa4 100644 (file)
@@ -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); }
index 917bad3291c7c694168547006d91ab36cb5a4390..689ccfd42528f45fd42361d1ee110a3b98c3b97a 100644 (file)
@@ -1,2 +1,10 @@
+puts "========"
+puts "OCC29406"
+puts "========"
+puts ""
+#########################################################
+##  Foundation Classes - gp_Ax3 fails setting direction
+#########################################################
+
 pload QAcommands
 OCC29406