View Issue Details

IDProjectCategoryView StatusLast Update
0024945Open CASCADEOCCT:Modeling Datapublic2014-12-10 15:55
Reporteroan Assigned Toapn  
PrioritynormalSeveritytrivial 
Status closedResolutionfixed 
Target Version6.8.0Fixed in Version6.8.0 
Summary0024945: Extrema_ExtPElC::Perform does not consider angular tolerance when calculates angle between two vectors
DescriptionThis bug came from issue #24419 and can be observed during procedure of translation of edge from STEP to BREP.

Extrema_ExtPElC expects calculation of first parameter as an angle between two vectors within -PI and PI. The reference vector that takes part in calculations have small deviation by Z axis (-4.22741e-013) that as a result leads to deviation of calculated angle which is differ from PI by less than 1e-15. Extrema_ExtPElC does not consider this divergence that, in turn, leads to incorrect calculation of parameters on cylinder using projected point.

The point is that deviation in useless digits is critical for trigonometric functions, for instance:
1) Sin( 3.1415926535897936 ) = -3.6153735661672049711580128817413e-16
2) Sin( 3.1415926535897931 ) = 1.3846264338327950288419902940223e-16

The code below produces the following results for initial code and for one that takes into account an angular deviation correspondingly (see the difference of U parameter):
1) Projected point: X = -1726; Y = 843.26; Z = -5.5511e-013
   Parameters on cylinder: U = 3.2162e-016; V = 1260.6

2) Projected point: X = -1726; Y = 843.26; Z = 2.1137e-013
   Parameters on cylinder: U = 6.2832; V = 1260.6
Steps To Reproduce// Calculating end point
gp_Pnt aP3D( -1725.97, 843.257, -4.22741e-013 );
gp_Ax2 aAxis( gp_Pnt( 0, 843.257, 0 ), gp_Dir( 0, -1, 0 ), gp::DX() );
Handle( Geom_Circle ) aCircle = new Geom_Circle( aAxis, 1725.9708621929999 );
GeomAdaptor_Curve aC3D( aCircle );

Extrema_ExtPC aExtPC( aP3D, aC3D );
Standard_Real aParam = (aExtPC.Point(1)).Parameter();
gp_Pnt aProj = (aExtPC.Point(1)).Value();
cout << "Projected point: X = " << aProj.X() <<
  "; Y = " << aProj.Y() << "; Z = " << aProj.Z() << endl;

// Result of deviation
gp_Ax2 aCylAxis( gp_Pnt( 0, 2103.87, 0 ), -gp::DY(), -gp::DX() );
gp_Cylinder aCylinder( aCylAxis, 1890. );

Standard_Real aU = 0., aV = 0.;
ElSLib::Parameters( aCylinder, aProj, aU, aV );
cout << "Parameters on cylinder: U = " << aU << "; V = " << aV << endl;
  
TagsNo tags attached.
Test case numberbugs moddata_3 bug24945

Activities

oan

2014-05-23 12:41

developer   ~0029489

Changes have been pushed to branch CR24945. Please review.

abv

2014-05-28 10:56

manager   ~0029560

I suggest the code could be simplified to reduce number of comparisons:

if ( Usol[0] + M_PI < Precision::Angular() )
  Usol[0] = -M_PI;
else if ( Usol[0] - M_PI > -Precision::Angular() )
  Usol[0] = M_PI;

abv

2014-05-28 10:56

manager   ~0029561

Alexander, please give your opinion on the fix

abk

2014-05-28 15:19

developer   ~0029574

The proper place for the fix is method ElCLib::AdjustPeriodic.

oan

2014-05-28 19:29

developer   ~0029589

I kindly disagree with you, because ElCLib::AdjustPeriodic calculates period basing on the given parameters of UFirst and ULast and in fact can be different than PI on in more detail can be any value. Hence, it is not correct to apply such kind of modifications here.

So, I affirm that Extrema_ExtPElC::Perform is the correct place for the fix.

oan

2014-05-29 14:26

developer   ~0029609

Please review.

oan

2014-06-02 19:25

developer   ~0029637

Last edited: 2014-06-02 19:26

Dear Andrey,

I've made changes suggested by you and pushed it to CR24945_1. Please verify and accept test campaign at the end.

abv

2014-06-03 14:09

manager   ~0029647

Reviewed, please test

mkv

2014-06-04 15:11

tester   ~0029676

Dear BugMaster,

Branch CR24945_1 (and products from GIT master) was compiled on Linux, MacOS and Windows platforms and tested.
Products branch CR24945_1 was created.
SHA-1: e8eaa04586800beec17d43047eba406cf4e3fca0

Number of compiler warnings:

occt component :
Linux: 16 (16 on master)
Windows: 0 (0 on master)
MacOS: 200 (203 on master)

products component :
Linux: 11 (11 on master)
Windows: 2 (2 on master)

Regressions/Differences:
products test cases:
sat doc_1 B8 O4
sat load B3
sat simple B3
Test cases were modified according to this new behavior.

Testing cases:
bugs moddata_3 bug24945 - OK

Testing on Linux:
Total MEMORY difference: 360952640 / 361153720
Total CPU difference: 52330.56999999994 / 53125.700000000004

Testing on Windows:
Total MEMORY difference: 383391684 / 383777312
Total CPU difference: 43902.8125 / 42766.515625

There are no differences in images found by testdiff.

Related Changesets

occt: master c764e804

2014-06-05 10:16:48

oan


Committer: apn Details Diff
0024945: Extrema_ExtPElC::Perform does not consider angular tolerance when calculates angle between two vectors

Consider angular tolerance during calculation of angle between two vectors for protection against deviations that are significantly less than tolerance.
Simplified code to reduce number of comparison
Added QA command OCC24945 and test case bugs/moddata_3/bug24945
Affected Issues
0024945
mod - src/Extrema/Extrema_ExtPElC.cxx Diff File
mod - src/QABugs/QABugs_19.cxx Diff File
add - tests/bugs/moddata_3/bug24945 Diff File

Issue History

Date Modified Username Field Change
2014-05-22 11:18 oan New Issue
2014-05-22 11:18 oan Assigned To => oan
2014-05-22 11:27 oan Description Updated
2014-05-23 12:41 oan Note Added: 0029489
2014-05-23 12:41 oan Assigned To oan => abv
2014-05-23 12:41 oan Status new => resolved
2014-05-28 10:56 abv Note Added: 0029560
2014-05-28 10:56 abv Assigned To abv => abk
2014-05-28 10:56 abv Note Added: 0029561
2014-05-28 15:19 abk Note Added: 0029574
2014-05-28 15:19 abk Assigned To abk => oan
2014-05-28 15:19 abk Status resolved => feedback
2014-05-28 19:29 oan Assigned To oan => abk
2014-05-28 19:29 oan Note Added: 0029589
2014-05-29 14:26 oan Note Added: 0029609
2014-05-29 14:26 oan Status feedback => assigned
2014-06-02 19:25 oan Note Added: 0029637
2014-06-02 19:25 oan Note Edited: 0029637
2014-06-02 19:25 oan Assigned To abk => abv
2014-06-02 19:25 oan Status assigned => resolved
2014-06-02 19:26 oan Note Edited: 0029637
2014-06-03 14:09 abv Note Added: 0029647
2014-06-03 14:09 abv Assigned To abv => bugmaster
2014-06-03 14:09 abv Status resolved => reviewed
2014-06-04 15:11 mkv Note Added: 0029676
2014-06-04 15:12 mkv Test case number => bugs moddata_3 bug24945
2014-06-04 15:12 mkv Status reviewed => tested
2014-06-04 15:12 mkv Target Version => 6.8.0
2014-06-06 12:04 apn Changeset attached => occt master c764e804
2014-06-06 12:04 apn Assigned To bugmaster => apn
2014-06-06 12:04 apn Status tested => verified
2014-06-06 12:04 apn Resolution open => fixed
2014-11-11 12:46 aiv Fixed in Version => 6.8.0
2014-11-11 12:52 aiv Status verified => closed