From bbf847ad1b3a05e276bf7c2459b574fbe75e50e0 Mon Sep 17 00:00:00 2001 From: Pawel Date: Thu, 6 Jun 2013 10:13:30 +0400 Subject: [PATCH] 0023501: Redundant triangulation cleaning/generation (1) in AIS_Shape.cxx Cleaning triangulation only if the AIS_Shape has either (1) OwnDeviationAngle and the values 'newangle' and 'prevangle' are different or (2) OwnDeviationCoefficient and the values 'newcoeff' and 'prevcoeff' are different Found similar problems in further code portions and corrected them. The same faulty condition found in XCAFPrs_AISObject.cxx --- src/AIS/AIS_Shape.cxx | 26 +++++++++++++------------- src/AIS/AIS_TexturedShape.cxx | 11 +++++------ src/XCAFPrs/XCAFPrs_AISObject.cxx | 8 ++++---- 3 files changed, 22 insertions(+), 23 deletions(-) diff --git a/src/AIS/AIS_Shape.cxx b/src/AIS/AIS_Shape.cxx index 01cf77f01a..1c4327b405 100755 --- a/src/AIS/AIS_Shape.cxx +++ b/src/AIS/AIS_Shape.cxx @@ -225,18 +225,17 @@ void AIS_Shape::Compute(const Handle(PrsMgr_PresentationManager3d)& /*aPresentat Standard_Real prevcoeff ; Standard_Real newcoeff ; - - if (OwnDeviationAngle(newangle,prevangle) || - OwnDeviationCoefficient(newcoeff,prevcoeff)) - if (Abs (newangle - prevangle) > Precision::Angular() || - Abs (newcoeff - prevcoeff) > Precision::Confusion() ) { + Standard_Boolean isOwnDeviationAngle = OwnDeviationAngle(newangle,prevangle); + Standard_Boolean isOwnDeviationCoefficient = OwnDeviationCoefficient(newcoeff,prevcoeff); + if (((Abs (newangle - prevangle) > Precision::Angular()) && isOwnDeviationAngle) || + ((Abs (newcoeff - prevcoeff) > Precision::Confusion()) && isOwnDeviationCoefficient)) { #ifdef DEB - cout << "AIS_Shape : compute"<4) @@ -326,9 +325,10 @@ void AIS_Shape::Compute(const Handle(Prs3d_Projector)& aProjector, // coefficients for calculation Standard_Real prevangle, newangle ,prevcoeff,newcoeff ; - if (OwnHLRDeviationAngle(newangle,prevangle) || OwnHLRDeviationCoefficient(newcoeff, prevcoeff)) - if (Abs (newangle - prevangle) > Precision::Angular() || - Abs (newcoeff - prevcoeff) > Precision::Confusion() ) { + Standard_Boolean isOwnHLRDeviationAngle = OwnHLRDeviationAngle(newangle,prevangle); + Standard_Boolean isOwnHLRDeviationCoefficient = OwnHLRDeviationCoefficient(newcoeff,prevcoeff); + if (((Abs (newangle - prevangle) > Precision::Angular()) && isOwnHLRDeviationAngle) || + ((Abs (newcoeff - prevcoeff) > Precision::Confusion()) && isOwnHLRDeviationCoefficient)) { #ifdef DEB cout << "AIS_Shape : compute"< Precision::Angular() || Abs (newcoeff - prevcoeff) > Precision::Confusion()) - { - BRepTools::Clean (myshape); - } + Standard_Boolean isOwnDeviationAngle = OwnDeviationAngle(newangle,prevangle); + Standard_Boolean isOwnDeviationCoefficient = OwnDeviationCoefficient(newcoeff,prevcoeff); + if (((Abs (newangle - prevangle) > Precision::Angular()) && isOwnDeviationAngle) || + ((Abs (newcoeff - prevcoeff) > Precision::Confusion()) && isOwnDeviationCoefficient)) { + BRepTools::Clean (myshape); } if (myshape.ShapeType() > TopAbs_FACE) { diff --git a/src/XCAFPrs/XCAFPrs_AISObject.cxx b/src/XCAFPrs/XCAFPrs_AISObject.cxx index 4e579b928f..69ed2045c0 100755 --- a/src/XCAFPrs/XCAFPrs_AISObject.cxx +++ b/src/XCAFPrs/XCAFPrs_AISObject.cxx @@ -260,10 +260,10 @@ void XCAFPrs_AISObject::AddStyledItem (const XCAFPrs_Style &style, Standard_Real prevcoeff ; Standard_Real newcoeff ; - if (OwnDeviationAngle(newangle,prevangle) || - OwnDeviationCoefficient(newcoeff,prevcoeff)) - if (Abs (newangle - prevangle) > Precision::Angular() || - Abs (newcoeff - prevcoeff) > Precision::Confusion() ) { + Standard_Boolean isOwnDeviationAngle = OwnDeviationAngle(newangle,prevangle); + Standard_Boolean isOwnDeviationCoefficient = OwnDeviationCoefficient(newcoeff,prevcoeff); + if (((Abs (newangle - prevangle) > Precision::Angular()) && isOwnDeviationAngle) || + ((Abs (newcoeff - prevcoeff) > Precision::Confusion()) && isOwnDeviationCoefficient)) { #ifdef DEB cout << "AIS_Shape : compute"<