1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-04 13:13:25 +03:00

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
This commit is contained in:
Pawel 2013-06-06 10:13:30 +04:00
parent c6df241cea
commit bbf847ad1b
3 changed files with 22 additions and 23 deletions

View File

@ -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"<<endl;
cout << "newangl : " << newangle << " # de " << "prevangl : " << prevangle << " OU "<<endl;
cout << "newcoeff : " << newcoeff << " # de " << "prevcoeff : " << prevcoeff << endl;
cout << "AIS_Shape : compute"<<endl;
cout << "newangl : " << newangle << " # de " << "prevangl : " << prevangle << " OU "<<endl;
cout << "newcoeff : " << newcoeff << " # de " << "prevcoeff : " << prevcoeff << endl;
#endif
BRepTools::Clean(myshape);
}
BRepTools::Clean(myshape);
}
//shading only on face...
if ((Standard_Integer) myshape.ShapeType()>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"<<endl;
cout << "newangle : " << newangle << " # de " << "prevangl : " << prevangle << " OU "<<endl;

View File

@ -273,12 +273,11 @@ void AIS_TexturedShape::Compute (const Handle(PrsMgr_PresentationManager3d)& /*t
Standard_Real prevcoeff;
Standard_Real newcoeff;
if (OwnDeviationAngle (newangle, prevangle) || OwnDeviationCoefficient (newcoeff, prevcoeff))
{
if (Abs (newangle - prevangle) > 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)
{

View File

@ -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"<<endl;
cout << "newangl : " << newangle << " # de " << "prevangl : " << prevangle << " OU "<<endl;