View Issue Details

IDProjectCategoryView StatusLast Update
0023361CommunityOCCT:Foundation Classespublic2013-04-29 15:21
ReporterDan8 Assigned Toilv 
PrioritynormalSeveritymajor 
Status closedResolutionfixed 
PlatformAOSL 
Product Version6.5.3 
Target Version6.6.0Fixed in Version6.6.0 
Summary0023361: Bug in gp_Trsf::Multiply
Descriptiongp_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.
Steps To Reproduce    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));
TagsNo tags attached.
Test case numberbugs fclasses bug23361

Activities

ilv

2012-10-10 18:46

developer   ~0021712

Add branch CR23361, with bug fix, please check it

abv

2012-10-11 01:29

manager   ~0021714

Please add a test case (tests/bugs/fclasses/CR23361) and check that it works as expected both with fix (OK) and without it (fail)

abv

2012-10-23 06:44

manager   ~0021886

Reviewed with minor corrections: unused local variable removed, function is made to always return 0 (error is flagged by a message instead). Please test

apn

2012-11-01 14:28

administrator   ~0022056

Last edited: 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

Related Changesets

occt: master f6f03db9

2012-11-15 09:23:11

ilv

Details Diff
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
Affected Issues
0023361
mod - src/gp/gp_Trsf.cxx Diff File
mod - src/QABugs/QABugs_19.cxx Diff File
add - tests/bugs/fclasses/bug23361 Diff File

Issue History

Date Modified Username Field Change
2012-07-27 16:25 Dan8 New Issue
2012-07-27 16:25 Dan8 Assigned To => abv
2012-08-30 19:50 abv Status new => resolved
2012-10-03 08:28 abv Assigned To abv => ilv
2012-10-10 18:45 ilv Assigned To ilv => oan
2012-10-10 18:46 ilv Note Added: 0021712
2012-10-11 01:29 abv Note Added: 0021714
2012-10-11 01:29 abv Assigned To oan => ilv
2012-10-11 01:29 abv Status resolved => assigned
2012-10-19 15:38 abv Assigned To ilv => abv
2012-10-19 15:38 abv Status assigned => resolved
2012-10-23 06:44 abv Note Added: 0021886
2012-10-23 06:44 abv Assigned To abv => bugmaster
2012-10-23 06:44 abv Status resolved => reviewed
2012-10-23 16:39 mkv Assigned To bugmaster => mkv
2012-10-24 15:46 abv Target Version => 6.6.0
2012-11-01 14:28 apn Note Added: 0022056
2012-11-01 14:29 apn Note Edited: 0022056
2012-11-01 14:29 apn Test case number => bugs fclasses bug23361
2012-11-01 14:29 apn Assigned To mkv => bugmaster
2012-11-01 14:29 apn Status reviewed => tested
2012-11-16 13:03 ilv Changeset attached => occt master f6f03db9
2012-11-16 13:03 ilv Assigned To bugmaster => ilv
2012-11-16 13:03 ilv Status tested => verified
2012-11-16 13:03 ilv Resolution open => fixed
2012-12-10 17:16 ilv Changeset attached => occt master f6f03db9
2013-04-23 13:36 aiv Status verified => closed
2013-04-29 15:21 aiv Fixed in Version => 6.6.0