MantisBT - Community
View Issue Details
0023361Community[OCCT] OCCT:Foundation Classespublic2012-07-27 16:252013-04-29 15:21
Dan8 
ilv 
normalmajor 
closedfixed 
ALL
[OCCT] 6.5.3 
[OCCT] 6.6.0[OCCT] 6.6.0 
bugs fclasses bug23361
0023361: Bug in gp_Trsf::Multiply
gp_Trsf::Multiply creates incorrect transformation in some cases (see step to reproduce).

This can be fixed in file gp_Trsf.cxx, method void gp_Trsf::Multiply(const gp_Trsf& T):
replace code:

else if (shape == gp_Rotation && T.shape == gp_Rotation) {
  if (loc.X() != 0.0 || loc.Y() != 0.0 || loc.Z() != 0.0) {
    loc.Add (T.loc.Multiplied (matrix));
  }

by code:

else if (shape == gp_Rotation && T.shape == gp_Rotation) {
  if (T.loc.X() != 0.0 || T.loc.Y() != 0.0 || T.loc.Z() != 0.0) {
    loc.Add (T.loc.Multiplied (matrix));
  }

I hope this helps.
    gp_Pnt p(0, 0, 2);
    
    gp_Trsf t1;
    t1.SetRotation(gp_Ax1(p, gp_Dir(0, 1, 0)), -0.49328285294022267);
    Base::Trsf t2;
    t2.SetRotation(gp_Ax1(p, gp_Dir(0, 0, 1)), 0.87538474718473880);

    // From the help:
    // Computes the transformation composed with T and <me>.

    // In a C++ implementation you can also write Tcomposed = <me> * T.

    // Example :

    // Trsf T1, T2, Tcomp; ...............

    // Tcomp = T2.Multiplied(T1); // or (Tcomp = T2 * T1)

    // Pnt P1(10.,3.,4.);

    // Pnt P2 = P1.Transformed(Tcomp); //using Tcomp

    // Pnt P3 = P1.Transformed(T1); //using T1 then T2

    // P3.Transform(T2); // P3 = P2 !!!

    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);

    CPPUNIT_ASSERT(p2.isEqual(p3, 1e-6));
No tags attached.
Issue History
2012-07-27 16:25Dan8New Issue
2012-07-27 16:25Dan8Assigned To => abv
2012-08-30 19:50abvStatusnew => resolved
2012-09-24 19:23abvRelationship addedrelated to 0020523
2012-10-03 08:28abvAssigned Toabv => ilv
2012-10-10 18:45ilvAssigned Toilv => oan
2012-10-10 18:46ilvNote Added: 0021712
2012-10-11 01:29abvNote Added: 0021714
2012-10-11 01:29abvAssigned Tooan => ilv
2012-10-11 01:29abvStatusresolved => assigned
2012-10-19 15:38abvAssigned Toilv => abv
2012-10-19 15:38abvStatusassigned => resolved
2012-10-23 06:44abvNote Added: 0021886
2012-10-23 06:44abvAssigned Toabv => bugmaster
2012-10-23 06:44abvStatusresolved => reviewed
2012-10-23 16:39mkvAssigned Tobugmaster => mkv
2012-10-24 15:46abvTarget Version => 6.6.0
2012-11-01 14:28apnNote Added: 0022056
2012-11-01 14:29apnNote Edited: 0022056bug_revision_view_page.php?bugnote_id=22056#r4467
2012-11-01 14:29apnTest case number => bugs fclasses bug23361
2012-11-01 14:29apnAssigned Tomkv => bugmaster
2012-11-01 14:29apnStatusreviewed => tested
2012-11-16 13:03ilvChangeset attached => occt master f6f03db9
2012-11-16 13:03ilvAssigned Tobugmaster => ilv
2012-11-16 13:03ilvStatustested => verified
2012-11-16 13:03ilvResolutionopen => fixed
2012-12-10 17:16ilvChangeset attached => occt master f6f03db9
2013-04-23 13:36aivStatusverified => closed
2013-04-29 15:21aivFixed in Version => 6.6.0

Notes
(0021712)
ilv   
2012-10-10 18:46   
Add branch CR23361, with bug fix, please check it
(0021714)
abv   
2012-10-11 01:29   
Please add a test case (tests/bugs/fclasses/CR23361) and check that it works as expected both with fix (OK) and without it (fail)
(0021886)
abv   
2012-10-23 06:44   
Reviewed with minor corrections: unused local variable removed, function is made to always return 0 (error is flagged by a message instead). Please test
(0022056)
apn   
2012-11-01 14:28   
(edited on: 2012-11-01 14:29)
Dear BugMaster,
Branch CR23361_2 (and products from GIT master) was compiled on Linux and Windows platforms and tested.

Regression:
Not detected

Improvements:
Not detected

Testing case:
bugs fclasses bug23361 - OK