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

0027555: Visualization, AIS_Shape - own deviation coefficient change is not considered by Wireframe presentation mode

This commit is contained in:
kgv
2016-05-31 16:18:36 +03:00
committed by bugmaster
parent 52db475165
commit 83b0f13a58
6 changed files with 75 additions and 39 deletions

View File

@@ -252,3 +252,37 @@ Standard_Boolean StdPrs_ToolTriangulatedShape::Tessellate (const TopoDS_Shape&
return wasRecomputed;
}
// =======================================================================
// function : ClearOnOwnDeflectionChange
// purpose :
// =======================================================================
void StdPrs_ToolTriangulatedShape::ClearOnOwnDeflectionChange (const TopoDS_Shape& theShape,
const Handle(Prs3d_Drawer)& theDrawer,
const Standard_Boolean theToResetCoeff)
{
if (!theDrawer->IsAutoTriangulation()
|| theShape.IsNull())
{
return;
}
const Standard_Boolean isOwnDeviationAngle = theDrawer->HasOwnDeviationAngle();
const Standard_Boolean isOwnDeviationCoefficient = theDrawer->HasOwnDeviationCoefficient();
const Standard_Real anAngleNew = theDrawer->DeviationAngle();
const Standard_Real anAnglePrev = theDrawer->PreviousDeviationAngle();
const Standard_Real aCoeffNew = theDrawer->DeviationCoefficient();
const Standard_Real aCoeffPrev = theDrawer->PreviousDeviationCoefficient();
if ((!isOwnDeviationAngle || Abs (anAngleNew - anAnglePrev) <= Precision::Angular())
&& (!isOwnDeviationCoefficient || Abs (aCoeffNew - aCoeffPrev) <= Precision::Confusion()))
{
return;
}
BRepTools::Clean (theShape);
if (theToResetCoeff)
{
theDrawer->UpdatePreviousDeviationAngle();
theDrawer->UpdatePreviousDeviationCoefficient();
}
}

View File

@@ -59,6 +59,18 @@ public:
//! @return true if tesselation was recomputed and false otherwise.
Standard_EXPORT static Standard_Boolean Tessellate (const TopoDS_Shape& theShape,
const Handle(Prs3d_Drawer)& theDrawer);
//! If presentation has own deviation coefficient and IsAutoTriangulation() is true,
//! function will compare actual coefficients with previous values and will clear triangulation on their change
//! (regardless actual tessellation quality).
//! Function is placed here for compatibility reasons - new code should avoid using IsAutoTriangulation().
//! @param theShape [in] the shape
//! @param theDrawer [in] the display settings
//! @param theToResetCoeff [in] updates coefficients in theDrawer to actual state to avoid redundant recomputations
Standard_EXPORT static void ClearOnOwnDeflectionChange (const TopoDS_Shape& theShape,
const Handle(Prs3d_Drawer)& theDrawer,
const Standard_Boolean theToResetCoeff);
};
#endif