MantisBT - Community
View Issue Details
0023501Community[OCCT] OCCT:Visualizationpublic2012-10-30 18:012013-12-19 13:55
Pawel 
Pawel 
normalminor 
closedfixed 
WindowsVC++ 200832 bit
[OCCT] 6.5.3 
[OCCT] 6.7.0[OCCT] 6.7.0 
Not needed
0023501: Redundant triangulation cleaning/generation (1) in AIS_Shape.cxx
In AIS_Shape.cxx, starting in line 241, the code:

      if (OwnDeviationAngle(newangle,prevangle) ||
          OwnDeviationCoefficient(newcoeff,prevcoeff))
        if (Abs (newangle - prevangle) > Precision::Angular() ||
            Abs (newcoeff - prevcoeff) > Precision::Confusion() ) {
          BRepTools::Clean(myshape);
        }

will clean the triangulation even if:
(1) OwnDeviationAngle is false, Abs (newangle - prevangle) > Precision::Angular()
(2) OwnDeviationCoefficient is false, Abs (newcoeff - prevcoeff) > Precision::Confusion()

which I think was not intended.

I guess it makes sense to differentiate between the two cases: (1)OwnDeviationAngle is true, (2)OwnDeviationCoefficient is true.
Draw reproducer:

box b 10 20 30
vinit
vsetshading b 0.001 #!!! Take the standard coefficient value for the drawer so that no change takes effect !!!
vdisplay b
vsetdispmode b 1 #Triangulation cleared

=====================
or directly in C++:

TopoDS_Shape box = BRepPrimAPI_MakeBox(gp_Pnt(0, 0, 0), gp_Pnt(10, 30, 20));
Handle (AIS_InteractiveObject) AISshape = new AIS_Shape(box);
myAISContext->Display(AISshape, Standard_False);
myAISContext->SetDeviationCoefficient(AISshape, myAISContext->DeviationCoefficient(), Standard_False);
myAISContext->SetDisplayMode(AISshape, AIS_Shaded, Standard_False);
myAISContext->UpdateCurrentViewer();
No tags attached.
related to 0023200closed bugmaster Visualization - prevent multiple triangulating of a shape that already has been triangulated 
Issue History
2012-10-30 18:01PawelNew Issue
2012-10-30 18:01PawelAssigned To => Pawel
2012-10-30 18:11PawelNote Added: 0022022
2012-10-30 18:11PawelAssigned ToPawel => bugmaster
2012-10-30 18:11PawelStatusnew => resolved
2012-11-02 17:45PawelRelationship addedrelated to 0023200
2012-11-02 18:28abvAssigned Tobugmaster => san
2012-11-02 18:29abvNote Added: 0022091
2012-11-02 22:17PawelNote Added: 0022092
2012-11-06 16:08PawelSteps to Reproduce Updatedbug_revision_view_page.php?rev_id=4480#r4480
2013-02-26 18:32sanTarget Version6.6.0 => 6.7.0
2013-05-23 18:47PawelNote Added: 0024499
2013-05-27 10:24sanNote Added: 0024518
2013-05-27 10:24sanAssigned Tosan => bugmaster
2013-05-27 10:24sanStatusresolved => reviewed
2013-05-28 14:07PawelNote Added: 0024533
2013-05-28 14:07PawelAssigned Tobugmaster => san
2013-05-28 14:07PawelStatusreviewed => feedback
2013-05-29 18:49sanNote Added: 0024552
2013-05-29 18:49sanAssigned Tosan => bugmaster
2013-05-29 18:49sanStatusfeedback => reviewed
2013-05-29 18:50sanNote Edited: 0024552bug_revision_view_page.php?bugnote_id=24552#r5456
2013-05-29 20:15PawelNote Added: 0024553
2013-05-29 22:46sanNote Added: 0024554
2013-05-30 15:31bugmasterAssigned Tobugmaster => mkv
2013-06-03 20:27mkvNote Added: 0024617
2013-06-03 20:28mkvTest case number => Not needed
2013-06-03 20:28mkvAssigned Tomkv => bugmaster
2013-06-03 20:28mkvStatusreviewed => tested
2013-06-10 10:30PawelChangeset attached => occt master bbf847ad
2013-06-10 10:30PawelAssigned Tobugmaster => Pawel
2013-06-10 10:30PawelStatustested => verified
2013-06-10 10:30PawelResolutionopen => fixed
2013-12-19 13:53bugmasterStatusverified => closed
2013-12-19 13:55bugmasterFixed in Version => 6.7.0

Notes
(0022022)
Pawel   
2012-10-30 18:11   
Branch CR23501 pushed. Please review.
(0022091)
abv   
2012-11-02 18:29   
It seems the fix is in branch CR23200, not CR23501
(0022092)
Pawel   
2012-11-02 22:17   
No. Those are two separate problems/fixes.

Actually this one (CR23501) is a bugfix. It avoids cleaning and then recomputing the triangulation if not necessary.

CR23200 is a workaround (it is not a general solution and I would NOT recommend including it in OCCT). It simply kills the triangulation code because it gets called automatically through XDE.

I hope this clarifies the case. If not I can elaborate on these issues.
(0024499)
Pawel   
2013-05-23 18:47   
I have found similar problems in AIS package and corrected them in branch CR23501_2. Ready to review.
(0024518)
san   
2013-05-27 10:24   
Branch CR23501_2 reviewed without remarks, ready for testing.
(0024533)
Pawel   
2013-05-28 14:07   
Again, I have found the same problem in XCAFPrs_AISObject.cxx and pushed the solution using branch CR23501_3.

Please review.
Thank you.
(0024552)
san   
2013-05-29 18:49   
(edited on: 2013-05-29 18:50)
Branch CR23501_3 reviewed without remarks, ready for testing.

NB for Pawel: don't you think that even after your patch the triangulation will be cleaned each time AIS_Shape::Compute() is called? Once a non-default deviation coefficient is set, newcoeff and prevcoeff will always differ.

(0024553)
Pawel   
2013-05-29 20:15   
Hello Sergey,

the point of this patch is to SEPARATE the flags 'OwnDeviationAngle' and 'OwnDeviationCoefficient' because if one of them is set and the other NOT then OwnDeviationAngle/OwnDeviationCoefficient always returns 0 for the previous value if the 'Own' flag is not set. Thus '0' is different than the 'new value' and so the condition is always true.

Hope it clarifies.
(0024554)
san   
2013-05-29 22:46   
Dear Pawel,

Yes, that is clear, my concern is that it still does not work as expected (triangulation is still cleaned when it should not be) so we will need to take another step in the same direction.
And this particular patch is OK, it does exactly what it is meant to do.
(0024617)
mkv   
2013-06-03 20:27   
Dear BugMaster,

Branch CR23501_3 (and products from GIT master) was compiled on Linux and Windows platforms and tested.
SHA-1: 01d8a09cedb65a88c6c425b0432f390c983054b2

Number of compiler warnings:

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

products component :
Linux: 0 (0 on master)
Windows: 63 (63 on master)

Regressions:
No regressions

Improvements:
No improvements

Testing cases:
Not needed

Testing on Linux:
Total MEMORY difference: 366240644 / 366080260
Total CPU difference: 41852.88000000145 / 44999.77000000119

Testing on Windows:
Total MEMORY difference: 420103112 / 417291612
Total CPU difference: 32347.796875 / 35719.34375

There are not differences in images found by testdiff.