1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-04-05 18:16:23 +03:00

0026390: IntTools_Context should provide possibility to set tolerance used by PointOnSurf projector instead using of strict value 1.e-12

New method SetPOnSProjectionTolerance to set projection tolerance has been added IntTools_Context. By default it is set to 1.e-12
This commit is contained in:
oan 2015-07-02 12:52:42 +03:00 committed by bugmaster
parent 0f04f1e11d
commit b285c9fed2
2 changed files with 43 additions and 13 deletions

View File

@ -314,6 +314,15 @@ is
returns Boolean from Standard;
---Purpose: Returns true if the solid <theFace> has
-- infinite bounds
SetPOnSProjectionTolerance(me:mutable; theValue: Real from Standard);
---Purpose: Sets tolerance to be used for projection of point on surface.
-- Clears map of already cached projectors in order to maintain
-- correct value for all projectors
clearCachedPOnSProjectors(me: mutable)
is private;
---Purpose: Clears map of already cached projectors.
fields
myAllocator : BaseAllocator from BOPCol is protected;
@ -326,6 +335,7 @@ fields
myProjSDataMap:DataMapOfShapeAddress from BOPCol is protected;
myBndBoxDataMap:DataMapOfShapeAddress from BOPCol is protected;
myCreateFlag :Integer from Standard is protected;
myPOnSTolerance :Real from Standard is protected;
end Context;

View File

@ -58,7 +58,8 @@ IntTools_Context::IntTools_Context()
myHatcherMap(100, myAllocator),
myProjSDataMap(100, myAllocator),
myBndBoxDataMap(100, myAllocator),
myCreateFlag(0)
myCreateFlag(0),
myPOnSTolerance(1.e-12)
{
}
//=======================================================================
@ -77,7 +78,8 @@ IntTools_Context::IntTools_Context
myHatcherMap(100, myAllocator),
myProjSDataMap(100, myAllocator),
myBndBoxDataMap(100, myAllocator),
myCreateFlag(1)
myCreateFlag(1),
myPOnSTolerance(1.e-12)
{
}
//=======================================================================
@ -101,15 +103,7 @@ IntTools_Context::~IntTools_Context()
}
myFClass2dMap.Clear();
//
GeomAPI_ProjectPointOnSurf* pProjPS;
aIt.Initialize(myProjPSMap);
for (; aIt.More(); aIt.Next()) {
anAdr=aIt.Value();
pProjPS=(GeomAPI_ProjectPointOnSurf*)anAdr;
(*pProjPS).~GeomAPI_ProjectPointOnSurf();
myAllocator->Free(anAdr);
}
myProjPSMap.Clear();
clearCachedPOnSProjectors();
//
GeomAPI_ProjectPointOnCurve* pProjPC;
aIt.Initialize(myProjPCMap);
@ -264,7 +258,7 @@ GeomAPI_ProjectPointOnSurf& IntTools_Context::ProjPS(const TopoDS_Face& aF)
GeomAPI_ProjectPointOnSurf* pProjPS;
if (!myProjPSMap.IsBound(aF)) {
Standard_Real Umin, Usup, Vmin, Vsup, anEpsT=1.e-12 ;
Standard_Real Umin, Usup, Vmin, Vsup;
BRepAdaptor_Surface aBAS;
//
const Handle(Geom_Surface)& aS=BRep_Tool::Surface(aF);
@ -277,7 +271,7 @@ GeomAPI_ProjectPointOnSurf& IntTools_Context::ProjPS(const TopoDS_Face& aF)
//
pProjPS=(GeomAPI_ProjectPointOnSurf*)myAllocator->Allocate(sizeof(GeomAPI_ProjectPointOnSurf));
new (pProjPS) GeomAPI_ProjectPointOnSurf();
pProjPS->Init(aS ,Umin, Usup, Vmin, Vsup, anEpsT/*, Extrema_ExtAlgo_Tree*/);
pProjPS->Init(aS ,Umin, Usup, Vmin, Vsup, myPOnSTolerance/*, Extrema_ExtAlgo_Tree*/);
Extrema_ExtPS& anExtAlgo = const_cast<Extrema_ExtPS&>(pProjPS->Extrema());
anExtAlgo.SetFlag(Extrema_ExtFlag_MIN);
//
@ -940,3 +934,29 @@ Standard_Boolean IntTools_Context::ProjectPointOnEdge
return Standard_False;
}
//=======================================================================
//function : SetPOnSProjectionTolerance
//purpose :
//=======================================================================
void IntTools_Context::SetPOnSProjectionTolerance(const Standard_Real theValue)
{
myPOnSTolerance = theValue;
clearCachedPOnSProjectors();
}
//=======================================================================
//function : clearCachedPOnSProjectors
//purpose :
//=======================================================================
void IntTools_Context::clearCachedPOnSProjectors()
{
GeomAPI_ProjectPointOnSurf* pProjPS;
BOPCol_DataMapIteratorOfDataMapOfShapeAddress aIt(myProjPSMap);
for (; aIt.More(); aIt.Next()) {
Standard_Address anAdr=aIt.Value();
pProjPS=(GeomAPI_ProjectPointOnSurf*)anAdr;
(*pProjPS).~GeomAPI_ProjectPointOnSurf();
myAllocator->Free(anAdr);
}
myProjPSMap.Clear();
}