Anonymous | Login 2020-12-04 18:10 MSK Project: All Projects Community Open CASCADE
 My View | View Issues | Change Log | Roadmap

View Issue Details  Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0024945Open CASCADE[OCCT] OCCT:Modeling Datapublic2014-05-22 11:182014-12-10 15:55
Reporteroan
Assigned Toapn
PrioritynormalSeveritytrivial
StatusclosedResolutionfixed
PlatformOSOS Version
Product Version
Target Version[OCCT] 6.8.0Fixed in Version[OCCT] 6.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 );

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
Attached Files

 Relationships

 Notes oan (developer) 2014-05-23 12:41 Changes have been pushed to branch CR24945. Please review. abv (manager) 2014-05-28 10:56 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 (manager) 2014-05-28 10:56 Alexander, please give your opinion on the fix abk (developer) 2014-05-28 15:19 The proper place for the fix is method ElCLib::AdjustPeriodic. oan (developer) 2014-05-28 19:29 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 (developer) 2014-05-29 14:26 Please review. oan (developer) 2014-06-02 19:25 edited on: 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 (manager) 2014-06-03 14:09 Reviewed, please test mkv (tester) 2014-06-04 15:11 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.