DiscussionsIssue archiveOCCT:Foundation Classes

Archived issue #0029406

Foundation Classes - gp_Ax3 fails setting direction

Open CASCADEOCCT:Foundation Classesclosed34 public notes

Search issues

Description

The following simple code fails due to stupid implementation of gp_Ax3 which does not check that newly set direction is parallel to currently set X direction, and tries to use their cross product to define new Y:

gp_Ax3 anAx;
anAx.SetDirection (gp::DX());

The same occurs with construction from gp_Ax1:

gp_Ax1 anAx1 (gp::Origin(), gp::DX());
anAx.SetAxis (anAx1);

Steps to reproduce

.

Public activity

34 archived notes

Participants are labeled by their role within this record.

01Commenter 1
Branch [archived branch] has been created by Participant.

[revision removed]


Detailed log of new commits:

Author: isn
Date: Thu Jan 11 19:03:03 2018 +0300

    0029406: Foundation Classes - gp_Ax3 fails setting direction
    
    Avoid exception in gp_Ax3::SetDirection(), SetAxis(): check if XDir of Ax3 is parallel to newly given direction.
02Commenter 2
/view/CR29406-master-isn/view/COMPARE/

03Commenter 3
Please rebase the branch on current master and re-test. The commit must be based on master only (not on 28642 fix).
04Commenter 1
Branch [archived branch] has been updated forcibly by Participant.

[revision removed]
05Commenter 5
tests/bugs/fclasses/bug29406
- Add standard header into the test script.

src/gp/gp_Ax3.lxx
- 47,71: move this definition to the scope where it is used.

src/QABugs/QABugs_20.cxx
- 2803: set negative DX.
- Eliminate code duplication by defining a new function that makes needed checks and puts error in cout. No need to return 1 for the test became failure.
- Add checking of the fact that direction in the object has the value that has been just set.
06Commenter 1
Branch [archived branch] has been updated by Participant.

[revision removed]


Detailed log of new commits:

Author: isn
Date: Thu Jan 18 17:06:04 2018 +0300

    corrections

07Commenter 7
Reviewed.
08Commenter 8
Oops, I have (thanks to EMV) another remark.

Please, remove code duplication in the methods gp_Ax3::SetAxis and gp_Ax3::SetDirection. For that, make the following implementation of the method gp_Ax3::SetAxis:

axis.SetLocation(A1.Location());
SetDirection(A1.Direction());


09Commenter 1
Branch [archived branch] has been updated by Participant.

[revision removed]


Detailed log of new commits:

Author: isn
Date: Fri Jan 19 14:33:52 2018 +0300

    remark

10Commenter 10
/view/CR29406-master-isn/view
11Commenter 11
Please rebase on current master and retest.
12Commenter 1
Branch [archived branch] has been created by Participant.

[revision removed]


Detailed log of new commits:

Author: isn
Date: Thu Jan 11 19:03:03 2018 +0300

    0029406: Foundation Classes - gp_Ax3 fails setting direction
    
    Avoid exception in gp_Ax3::SetDirection(), SetAxis(): check if XDir of Ax3 is parallel to newly given direction.
13Commenter 2
Mikhail, should we consider this patch for OCCT 7.6.0, or it is not ready?
14Commenter 14
The methods SetXDirection and SetYDirection do also have the same problem.
I think we should fix these methods in this patch, too.
15Commenter 1
Branch [archived branch] has been created by Participant.

[revision removed]


Detailed log of new commits:

Author: isn
Date: Thu Jan 11 19:03:03 2018 +0300

    0029406: Foundation Classes - gp_Ax3 fails setting direction
    
    Avoid exception in gp_Ax3::SetDirection(), SetAxis(): check if XDir of Ax3 is parallel to newly given direction.
16Commenter 1
Branch [archived branch] has been updated forcibly by Participant.

[revision removed]
17Commenter 2
+  theCommands.Add ("OCC29406_1", "OCC29406_1", __FILE__, OCC29406_1, group);
+  theCommands.Add ("OCC29406_2", "OCC29406_2", __FILE__, OCC29406_2, group);
+  theCommands.Add ("OCC29406_3", "OCC29406_3", __FILE__, OCC29406_3, group);

Andrey, I would suggest merging unit-alike tests into a single command and provide a meaningful description to it.
QANCollection could be used as a better example for such kind of commands (like "QANColTestMap").
18Commenter 1
Branch [archived branch] has been updated forcibly by Participant.

[revision removed]
19Commenter 23
Dear Michael, please review branch CR29406_2
Tests results are here: http://jenkins-test-occt.nnov.opencascade.com/view/CR29406_2-master-ASURAVEN/view/COMPARE/
20Commenter 24
src/gp/gp_Ax3.hxx
  if(Abs(Abs(aDot) - 1.) <= Precision::Angular()) 

Extra Abs() is called. Can be replaced with (1. - Abs(aDot))

src/QABugs/QABugs_20.cxx
- 4050: this check is incorrect, because the new X direction might not be equal to the requested one according to the method documentation and implementation.
- 4064: the same as for CheckAx3DirX.
21Commenter 1
Branch [archived branch] has been updated forcibly by Participant.

[revision removed]
22Commenter 26
Remarks fixed in branch CR329406_2
Tests are running now
23Commenter 2
+##  Foundation Classes - gp_Ax3 fails setting direction

Please move test case description to puts.

+  theCommands.Add ("OCC29406", "OCC29406", __FILE__, OCC29406, group);

Please add description to the command.
24Commenter 28
You did not understand me right concerning the checks in QABugs.
Now you check preconditions that are always true for an Ax3 object.
My idea is the following (for CheckAx3DirX):
 gp_Dir aGoodY = theAx.Direction().Crossed(theDir);
and check aGoodY with theAx.YDirection().
25Commenter 1
Branch [archived branch] has been updated forcibly by Participant.

[revision removed]
26Commenter 30
Remarks fixed in branch CR329406_2
27Commenter 31
  //gp_Dir aY = theAxis.Direction().Crossed(theAxis.XDirection());

Remove useless commented line.
28Commenter 1
Branch [archived branch] has been updated forcibly by Participant.

[revision removed]
29Commenter 33
fixed
30Commenter 34
For integration:
occt - CR29406_2
products -none
31Commenter 35
Combination -
OCCT branch : [archived branch]
master SHA - [revision removed]
[revision removed]
Products branch : [archived branch] SHA - [revision removed]
was compiled on Linux, MacOS and Windows platforms and tested in optimize mode.

Number of compiler warnings:
No new/fixed warnings

Regressions/Differences/Improvements:
No regressions/differences

CPU differences:
Debian80-64:
OCCT
Total CPU difference: 18390.380000000398 / 18549.650000000624 [-0.86%]
Products
Total CPU difference: 11648.280000000103 / 11661.570000000122 [-0.11%]
Windows-64-VC14:
OCCT
Total CPU difference: 19927.859375 / 19945.046875 [-0.09%]
Products
Total CPU difference: 13059.03125 / 13091.625 [-0.25%]


Image differences :
No differences that require special attention

Memory differences :
No differences that require special attention
32Commenter 1
Branch [archived branch] has been deleted by Participant.

[revision removed]
33Commenter 1
Branch [archived branch] has been deleted by Participant.

[revision removed]
34Commenter 1
Branch [archived branch] has been deleted by Participant.

[revision removed]

Related records