diff --git a/src/QABugs/QABugs_19.cxx b/src/QABugs/QABugs_19.cxx index cdb55f4e51..9e49574637 100644 --- a/src/QABugs/QABugs_19.cxx +++ b/src/QABugs/QABugs_19.cxx @@ -30,10 +30,13 @@ #include #include +#include #include #include #include +#include + #include //static Standard_Integer OCC230 (Draw_Interpretor& /*di*/, Standard_Integer /*argc*/, const char ** /*argv*/) @@ -70,11 +73,36 @@ static Standard_Integer OCC142 (Draw_Interpretor& di, Standard_Integer /*argc*/, return 0; } +static Standard_Integer OCC23361 (Draw_Interpretor& di, Standard_Integer /*argc*/, const char ** /*argv*/) +{ + gp_Pnt p(0, 0, 2); + + gp_Trsf t1, t2; + t1.SetRotation(gp_Ax1(p, gp_Dir(0, 1, 0)), -0.49328285294022267); + t2.SetRotation(gp_Ax1(p, gp_Dir(0, 0, 1)), 0.87538474718473880); + + gp_Trsf tComp = t2 * t1; + + gp_Pnt p1(10, 3, 4); + gp_Pnt p2 = p1.Transformed(tComp); + gp_Pnt p3 = p1.Transformed(t1); + p3.Transform(t2); + + // points must be equal + if ( ! p2.IsEqual(p3, Precision::Confusion()) ) + di << "ERROR OCC23361: equivalent transformations does not produce equal points" << "\n"; + else + di << "OCC23361: OK" << "\n"; + + return 0; +} + void QABugs::Commands_19(Draw_Interpretor& theCommands) { char *group = "QABugs"; theCommands.Add ("OCC230", "OCC230 TrimmedCurve Pnt2d Pnt2d", __FILE__, OCC230, group); theCommands.Add ("OCC142", "OCC142", __FILE__, OCC142, group); + theCommands.Add ("OCC23361", "OCC23361", __FILE__, OCC23361, group); return; } diff --git a/src/gp/gp_Trsf.cxx b/src/gp/gp_Trsf.cxx index 3164998b79..cb9ab504ca 100755 --- a/src/gp/gp_Trsf.cxx +++ b/src/gp/gp_Trsf.cxx @@ -464,7 +464,7 @@ void gp_Trsf::Multiply(const gp_Trsf& T) matrix = T.matrix; } else if (shape == gp_Rotation && T.shape == gp_Rotation) { - if (loc.X() != 0.0 || loc.Y() != 0.0 || loc.Z() != 0.0) { + if (T.loc.X() != 0.0 || T.loc.Y() != 0.0 || T.loc.Z() != 0.0) { loc.Add (T.loc.Multiplied (matrix)); } matrix.Multiply(T.matrix); diff --git a/tests/bugs/fclasses/bug23361 b/tests/bugs/fclasses/bug23361 new file mode 100755 index 0000000000..8e239e4531 --- /dev/null +++ b/tests/bugs/fclasses/bug23361 @@ -0,0 +1,11 @@ +puts "============" +puts "CR23361" +puts "===========" +puts "" +################################################ +# Bug in gp_Trsf::Multiply +################################################ + +pload QAcommands + +OCC23361