Archived issue #0029406
Foundation Classes - gp_Ax3 fails setting direction
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);
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.
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.
[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.
/view/CR29406-master-isn/view/COMPARE/
Please rebase the branch on current master and re-test. The commit must be based on master only (not on 28642 fix).
Branch [archived branch] has been updated forcibly by Participant.
[revision removed]
[revision removed]
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.
- 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.
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
[revision removed]
Detailed log of new commits:
Author: isn
Date: Thu Jan 18 17:06:04 2018 +0300
corrections
Reviewed.
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:
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());
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
[revision removed]
Detailed log of new commits:
Author: isn
Date: Fri Jan 19 14:33:52 2018 +0300
remark
/view/CR29406-master-isn/view
Please rebase on current master and retest.
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.
[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.
Mikhail, should we consider this patch for OCCT 7.6.0, or it is not ready?
The methods SetXDirection and SetYDirection do also have the same problem.
I think we should fix these methods in this patch, too.
I think we should fix these methods in this patch, too.
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.
[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.
Branch [archived branch] has been updated forcibly by Participant.
[revision removed]
[revision removed]
+ 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").
Branch [archived branch] has been updated forcibly by Participant.
[revision removed]
[revision removed]
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/
Tests results are here: http://jenkins-test-occt.nnov.opencascade.com/view/CR29406_2-master-ASURAVEN/view/COMPARE/
src/gp/gp_Ax3.hxx
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.
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.
Branch [archived branch] has been updated forcibly by Participant.
[revision removed]
[revision removed]
Remarks fixed in branch CR329406_2
Tests are running now
Tests are running now
+## 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.
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().
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().
Branch [archived branch] has been updated forcibly by Participant.
[revision removed]
[revision removed]
Remarks fixed in branch CR329406_2
//gp_Dir aY = theAxis.Direction().Crossed(theAxis.XDirection());
Remove useless commented line.
Branch [archived branch] has been updated forcibly by Participant.
[revision removed]
[revision removed]
fixed
For integration:
occt - CR29406_2
products -none
occt - CR29406_2
products -none
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
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
Branch [archived branch] has been deleted by Participant.
[revision removed]
[revision removed]
Branch [archived branch] has been deleted by Participant.
[revision removed]
[revision removed]
Branch [archived branch] has been deleted by Participant.
[revision removed]
[revision removed]
Related records