mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-04-16 10:08:36 +03:00
0023361: Bug in gp_Trsf::Multiply
Bug in gp_Trsf::Multiply fixed. If we multiply 2 gp_Trsf objects (shape == gp_Rotation), for example, t1 * t2, and t2.loc = 0 (t2.loc.x == 0 and t2.loc.y == 0 and t2.loc.z == 0) then t1.loc will not change (you can verify it from the matrix multiplication) Adding test case
This commit is contained in:
parent
3d8539a3e5
commit
f6f03db9d0
@ -30,10 +30,13 @@
|
|||||||
#include <TopoDS_Shape.hxx>
|
#include <TopoDS_Shape.hxx>
|
||||||
|
|
||||||
#include <gp_Pnt2d.hxx>
|
#include <gp_Pnt2d.hxx>
|
||||||
|
#include <gp_Ax1.hxx>
|
||||||
#include <GCE2d_MakeSegment.hxx>
|
#include <GCE2d_MakeSegment.hxx>
|
||||||
#include <Geom2d_TrimmedCurve.hxx>
|
#include <Geom2d_TrimmedCurve.hxx>
|
||||||
#include <DrawTrSurf.hxx>
|
#include <DrawTrSurf.hxx>
|
||||||
|
|
||||||
|
#include <Precision.hxx>
|
||||||
|
|
||||||
#include <PCollection_HAsciiString.hxx>
|
#include <PCollection_HAsciiString.hxx>
|
||||||
|
|
||||||
//static Standard_Integer OCC230 (Draw_Interpretor& /*di*/, Standard_Integer /*argc*/, const char ** /*argv*/)
|
//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;
|
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) {
|
void QABugs::Commands_19(Draw_Interpretor& theCommands) {
|
||||||
char *group = "QABugs";
|
char *group = "QABugs";
|
||||||
|
|
||||||
theCommands.Add ("OCC230", "OCC230 TrimmedCurve Pnt2d Pnt2d", __FILE__, OCC230, group);
|
theCommands.Add ("OCC230", "OCC230 TrimmedCurve Pnt2d Pnt2d", __FILE__, OCC230, group);
|
||||||
theCommands.Add ("OCC142", "OCC142", __FILE__, OCC142, group);
|
theCommands.Add ("OCC142", "OCC142", __FILE__, OCC142, group);
|
||||||
|
theCommands.Add ("OCC23361", "OCC23361", __FILE__, OCC23361, group);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -464,7 +464,7 @@ void gp_Trsf::Multiply(const gp_Trsf& T)
|
|||||||
matrix = T.matrix;
|
matrix = T.matrix;
|
||||||
}
|
}
|
||||||
else if (shape == gp_Rotation && T.shape == gp_Rotation) {
|
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));
|
loc.Add (T.loc.Multiplied (matrix));
|
||||||
}
|
}
|
||||||
matrix.Multiply(T.matrix);
|
matrix.Multiply(T.matrix);
|
||||||
|
11
tests/bugs/fclasses/bug23361
Executable file
11
tests/bugs/fclasses/bug23361
Executable file
@ -0,0 +1,11 @@
|
|||||||
|
puts "============"
|
||||||
|
puts "CR23361"
|
||||||
|
puts "==========="
|
||||||
|
puts ""
|
||||||
|
################################################
|
||||||
|
# Bug in gp_Trsf::Multiply
|
||||||
|
################################################
|
||||||
|
|
||||||
|
pload QAcommands
|
||||||
|
|
||||||
|
OCC23361
|
Loading…
x
Reference in New Issue
Block a user