mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-04 13:13:25 +03:00
0028165: Improve performance of Boolean Operations
1. Unification of the usage of the BRepAdaptor_Surface in Boolean Operations algorithm. For each face when it is necessary the Adaptor is initialized only once and stored in Context. For that purpose the new IntTools_Context::SurfaceAdaptor(const TopoDS_Face&) method has been implemented. To provide possibility to take the Adaptor from the context, the context has been added as a parameter in following methods: BOPTools_AlgoTools::MakePCurve() BOPTools_AlgoTools::Sence() BOPTools_AlgoTools2D::BuildPCurveForEdgeOnFace() BOPTools_AlgoTools2D::PointOnSurface BOPTools_AlgoTools2D::CurveOnSurface BOPTools_AlgoTools2D::AdjustPCurveOnFace BOPTools_AlgoTools2D::Make2D BOPTools_AlgoTools2D::MakePCurveOnFace BOPTools_AlgoTools3D::GetNormalToFaceOnEdge It is also possible now to pass the context into BOPAlgo_WireSplitter algorithm. Also, the new IntTools_Context::UVBounds(const TopoDS_Face&) method has been implemented to get the UV bounds of a face. 2. Additional improvement is a calculation of reduced intersection range only for the intersection type VERTEX during computation of Edge/Face interference. 3. The methods IntTools_EdgeFace::Prepare() and IntTools_EdgeFace::FindProjectableRoot() and the fields IntTools_EdgeFace::myProjectableRanges and IntTools_EdgeFace::myFClass2d have been removed as obsolete. 4. Test cases for the issue.
This commit is contained in:
@@ -44,7 +44,7 @@
|
||||
#include <IntTools_Context.hxx>
|
||||
#include <IntTools_CurveRangeLocalizeData.hxx>
|
||||
#include <IntTools_CurveRangeSample.hxx>
|
||||
#include <IntTools_EdgeFace.hxx>
|
||||
#include <IntTools_CArray1OfReal.hxx>
|
||||
#include <IntTools_ListIteratorOfListOfBox.hxx>
|
||||
#include <IntTools_ListIteratorOfListOfCurveRangeSample.hxx>
|
||||
#include <IntTools_ListIteratorOfListOfSurfaceRangeSample.hxx>
|
||||
@@ -214,8 +214,12 @@ IntTools_BeanFaceIntersector::IntTools_BeanFaceIntersector(const BRepAdaptor_Cur
|
||||
void IntTools_BeanFaceIntersector::Init(const TopoDS_Edge& theEdge,
|
||||
const TopoDS_Face& theFace)
|
||||
{
|
||||
if (myContext.IsNull()) {
|
||||
myContext = new IntTools_Context;
|
||||
}
|
||||
//
|
||||
myCurve.Initialize(theEdge);
|
||||
mySurface.Initialize(theFace);
|
||||
mySurface = myContext->SurfaceAdaptor(theFace);
|
||||
myTrsfSurface = Handle(Geom_Surface)::DownCast(mySurface.Surface().Surface()->Transformed(mySurface.Trsf()));
|
||||
myBeanTolerance = BRep_Tool::Tolerance(theEdge);
|
||||
myFaceTolerance = BRep_Tool::Tolerance(theFace);
|
||||
|
@@ -46,7 +46,7 @@
|
||||
#include <TopoDS_Solid.hxx>
|
||||
#include <TopoDS_Vertex.hxx>
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(IntTools_Context,MMgt_TShared)
|
||||
IMPLEMENT_STANDARD_RTTIEXT(IntTools_Context,Standard_Transient)
|
||||
|
||||
//
|
||||
//=======================================================================
|
||||
@@ -64,6 +64,7 @@ IntTools_Context::IntTools_Context()
|
||||
myHatcherMap(100, myAllocator),
|
||||
myProjSDataMap(100, myAllocator),
|
||||
myBndBoxDataMap(100, myAllocator),
|
||||
mySurfAdaptorMap(100, myAllocator),
|
||||
myCreateFlag(0),
|
||||
myPOnSTolerance(1.e-12)
|
||||
{
|
||||
@@ -84,6 +85,7 @@ IntTools_Context::IntTools_Context
|
||||
myHatcherMap(100, myAllocator),
|
||||
myProjSDataMap(100, myAllocator),
|
||||
myBndBoxDataMap(100, myAllocator),
|
||||
mySurfAdaptorMap(100, myAllocator),
|
||||
myCreateFlag(1),
|
||||
myPOnSTolerance(1.e-12)
|
||||
{
|
||||
@@ -171,6 +173,16 @@ IntTools_Context::~IntTools_Context()
|
||||
myAllocator->Free(anAdr);
|
||||
}
|
||||
myBndBoxDataMap.Clear();
|
||||
//
|
||||
BRepAdaptor_Surface* pSurfAdaptor;
|
||||
aIt.Initialize(mySurfAdaptorMap);
|
||||
for (; aIt.More(); aIt.Next()) {
|
||||
anAdr=aIt.Value();
|
||||
pSurfAdaptor=(BRepAdaptor_Surface*)anAdr;
|
||||
(*pSurfAdaptor).~BRepAdaptor_Surface();
|
||||
myAllocator->Free(anAdr);
|
||||
}
|
||||
mySurfAdaptorMap.Clear();
|
||||
}
|
||||
//=======================================================================
|
||||
//function : BndBox
|
||||
@@ -265,15 +277,8 @@ GeomAPI_ProjectPointOnSurf& IntTools_Context::ProjPS(const TopoDS_Face& aF)
|
||||
|
||||
if (!myProjPSMap.IsBound(aF)) {
|
||||
Standard_Real Umin, Usup, Vmin, Vsup;
|
||||
BRepAdaptor_Surface aBAS;
|
||||
//
|
||||
UVBounds(aF, Umin, Usup, Vmin, Vsup);
|
||||
const Handle(Geom_Surface)& aS=BRep_Tool::Surface(aF);
|
||||
aBAS.Initialize (aF, Standard_True);
|
||||
//
|
||||
Umin=aBAS.FirstUParameter();
|
||||
Usup=aBAS.LastUParameter ();
|
||||
Vmin=aBAS.FirstVParameter();
|
||||
Vsup=aBAS.LastVParameter ();
|
||||
//
|
||||
pProjPS=(GeomAPI_ProjectPointOnSurf*)myAllocator->Allocate(sizeof(GeomAPI_ProjectPointOnSurf));
|
||||
new (pProjPS) GeomAPI_ProjectPointOnSurf();
|
||||
@@ -376,6 +381,32 @@ BRepClass3d_SolidClassifier& IntTools_Context::SolidClassifier
|
||||
return *pSC;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : SurfaceAdaptor
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
BRepAdaptor_Surface& IntTools_Context::SurfaceAdaptor
|
||||
(const TopoDS_Face& theFace)
|
||||
{
|
||||
Standard_Address anAdr;
|
||||
BRepAdaptor_Surface* pBAS;
|
||||
|
||||
if (!mySurfAdaptorMap.IsBound(theFace)) {
|
||||
//
|
||||
pBAS=(BRepAdaptor_Surface*)myAllocator->Allocate(sizeof(BRepAdaptor_Surface));
|
||||
new (pBAS) BRepAdaptor_Surface(theFace, Standard_True);
|
||||
//
|
||||
anAdr=(Standard_Address)pBAS;
|
||||
mySurfAdaptorMap.Bind(theFace, anAdr);
|
||||
}
|
||||
|
||||
else {
|
||||
anAdr=mySurfAdaptorMap.Find(theFace);
|
||||
pBAS =(BRepAdaptor_Surface*)anAdr;
|
||||
}
|
||||
return *pBAS;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Hatcher
|
||||
//purpose :
|
||||
@@ -1042,3 +1073,20 @@ void IntTools_Context::clearCachedPOnSProjectors()
|
||||
}
|
||||
myProjPSMap.Clear();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : UVBounds
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void IntTools_Context::UVBounds(const TopoDS_Face& theFace,
|
||||
Standard_Real& UMin,
|
||||
Standard_Real& UMax,
|
||||
Standard_Real& VMin,
|
||||
Standard_Real& VMax)
|
||||
{
|
||||
const BRepAdaptor_Surface& aBAS = SurfaceAdaptor(theFace);
|
||||
UMin = aBAS.FirstUParameter();
|
||||
UMax = aBAS.LastUParameter ();
|
||||
VMin = aBAS.FirstVParameter();
|
||||
VMax = aBAS.LastVParameter ();
|
||||
}
|
@@ -27,6 +27,7 @@
|
||||
#include <MMgt_TShared.hxx>
|
||||
#include <TopAbs_State.hxx>
|
||||
#include <Standard_Boolean.hxx>
|
||||
#include <BRepAdaptor_Surface.hxx>
|
||||
class IntTools_FClass2d;
|
||||
class TopoDS_Face;
|
||||
class GeomAPI_ProjectPointOnSurf;
|
||||
@@ -45,17 +46,12 @@ class Bnd_Box;
|
||||
class TopoDS_Shape;
|
||||
|
||||
|
||||
class IntTools_Context;
|
||||
DEFINE_STANDARD_HANDLE(IntTools_Context, MMgt_TShared)
|
||||
|
||||
|
||||
//! The intersection Context contains geometrical
|
||||
//! and topological toolkit (classifiers, projectors, etc).
|
||||
//! The intersection Context is for caching the tools
|
||||
//! to increase the performance.
|
||||
class IntTools_Context : public MMgt_TShared
|
||||
class IntTools_Context : public Standard_Transient
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
|
||||
@@ -99,6 +95,15 @@ Standard_EXPORT virtual ~IntTools_Context();
|
||||
//! for given face
|
||||
Standard_EXPORT Geom2dHatch_Hatcher& Hatcher (const TopoDS_Face& aF);
|
||||
|
||||
//! Returns a reference to surface adaptor for given face
|
||||
Standard_EXPORT BRepAdaptor_Surface& SurfaceAdaptor (const TopoDS_Face& theFace);
|
||||
|
||||
//! Computes the boundaries of the face using surface adaptor
|
||||
Standard_EXPORT void UVBounds (const TopoDS_Face& theFace,
|
||||
Standard_Real& UMin,
|
||||
Standard_Real& UMax,
|
||||
Standard_Real& VMin,
|
||||
Standard_Real& VMax);
|
||||
|
||||
//! Computes parameter of the Point theP on
|
||||
//! the edge aE.
|
||||
@@ -230,7 +235,7 @@ Standard_EXPORT virtual ~IntTools_Context();
|
||||
|
||||
|
||||
|
||||
DEFINE_STANDARD_RTTIEXT(IntTools_Context,MMgt_TShared)
|
||||
DEFINE_STANDARD_RTTIEXT(IntTools_Context,Standard_Transient)
|
||||
|
||||
protected:
|
||||
|
||||
@@ -244,6 +249,7 @@ protected:
|
||||
BOPCol_DataMapOfShapeAddress myHatcherMap;
|
||||
BOPCol_DataMapOfShapeAddress myProjSDataMap;
|
||||
BOPCol_DataMapOfShapeAddress myBndBoxDataMap;
|
||||
BOPCol_DataMapOfShapeAddress mySurfAdaptorMap;
|
||||
Standard_Integer myCreateFlag;
|
||||
Standard_Real myPOnSTolerance;
|
||||
|
||||
@@ -256,4 +262,6 @@ private:
|
||||
|
||||
};
|
||||
|
||||
DEFINE_STANDARD_HANDLE(IntTools_Context, Standard_Transient)
|
||||
|
||||
#endif // _IntTools_Context_HeaderFile
|
||||
|
@@ -39,13 +39,12 @@
|
||||
#include <IntCurveSurface_HInter.hxx>
|
||||
#include <IntCurveSurface_IntersectionPoint.hxx>
|
||||
#include <IntTools.hxx>
|
||||
#include <IntTools_Array1OfRange.hxx>
|
||||
#include <IntTools_BeanFaceIntersector.hxx>
|
||||
#include <IntTools_CArray1OfInteger.hxx>
|
||||
#include <IntTools_CArray1OfReal.hxx>
|
||||
#include <IntTools_CommonPrt.hxx>
|
||||
#include <IntTools_Context.hxx>
|
||||
#include <IntTools_EdgeFace.hxx>
|
||||
#include <IntTools_FClass2d.hxx>
|
||||
#include <IntTools_Range.hxx>
|
||||
#include <IntTools_Root.hxx>
|
||||
#include <IntTools_Tools.hxx>
|
||||
@@ -61,10 +60,6 @@ static
|
||||
Standard_Boolean IsRadius (const BRepAdaptor_Curve& aCurve ,
|
||||
const BRepAdaptor_Surface& aSurface,
|
||||
const Standard_Real aCriteria);
|
||||
static
|
||||
Standard_Integer AdaptiveDiscret (const Standard_Integer iDiscret,
|
||||
const BRepAdaptor_Curve& aCurve ,
|
||||
const BRepAdaptor_Surface& aSurface);
|
||||
|
||||
//=======================================================================
|
||||
//function : IntTools_EdgeFace::IntTools_EdgeFace
|
||||
@@ -303,170 +298,7 @@ void IntTools_EdgeFace::CheckData()
|
||||
myErrorStatus=3;
|
||||
}
|
||||
}
|
||||
//=======================================================================
|
||||
//function : Prepare
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void IntTools_EdgeFace::Prepare()
|
||||
{
|
||||
Standard_Integer pri;
|
||||
Standard_Real aTmin, aTmax;
|
||||
IntTools_CArray1OfReal aPars;
|
||||
|
||||
//
|
||||
// 1.Prepare Curve's data and Surface's data
|
||||
myC.Initialize(myEdge);
|
||||
GeomAbs_CurveType aCurveType;
|
||||
aCurveType=myC.GetType();
|
||||
//
|
||||
// 2.Prepare myCriteria
|
||||
Standard_Real aFuzz = myFuzzyValue / 2.;
|
||||
Standard_Real aTolF = BRep_Tool::Tolerance(myFace) + aFuzz;
|
||||
Standard_Real aTolE = BRep_Tool::Tolerance(myEdge) + aFuzz;
|
||||
if (aCurveType == GeomAbs_BSplineCurve ||
|
||||
aCurveType == GeomAbs_BezierCurve) {
|
||||
myCriteria = 1.5*aTolE + aTolF;
|
||||
}
|
||||
else {
|
||||
myCriteria = aTolE + aTolF;
|
||||
}
|
||||
// 2.a myTmin, myTmax
|
||||
aTmin=myRange.First();
|
||||
aTmax=myRange.Last();
|
||||
// 2.b myFClass2d
|
||||
myS.Initialize (myFace,Standard_True);
|
||||
myFClass2d.Init(myFace, 1.e-6);
|
||||
//
|
||||
// 2.c Prepare adaptive myDiscret
|
||||
myDiscret=AdaptiveDiscret(myDiscret, myC, myS);
|
||||
//
|
||||
//
|
||||
// 3.Prepare myPars
|
||||
pri = IntTools::PrepareArgs(myC, aTmax, aTmin,
|
||||
myDiscret, myDeflection, aPars);
|
||||
if (pri) {
|
||||
myErrorStatus=6;
|
||||
return;
|
||||
}
|
||||
// 4.
|
||||
//ProjectableRanges
|
||||
Standard_Integer i, iProj, aNb, aNbProj, ind0, ind1;
|
||||
Standard_Real t0, t1, tRoot;
|
||||
|
||||
//
|
||||
// Table of Projection's function values
|
||||
aNb=aPars.Length();
|
||||
IntTools_CArray1OfInteger anArrProjectability;
|
||||
anArrProjectability.Resize(aNb);
|
||||
|
||||
for (iProj=0, i=0; i<aNb; i++) {
|
||||
t0=aPars(i);
|
||||
aNbProj=IsProjectable (t0);
|
||||
|
||||
anArrProjectability(i)=0;
|
||||
if (aNbProj) {
|
||||
anArrProjectability(i)=1;
|
||||
iProj++;
|
||||
}
|
||||
}
|
||||
//
|
||||
// Checking
|
||||
if (!iProj ) {
|
||||
myErrorStatus=7;
|
||||
return;
|
||||
}
|
||||
|
||||
//
|
||||
// Projectable Ranges
|
||||
IntTools_Range aRange;
|
||||
|
||||
ind0=anArrProjectability(0);
|
||||
if (ind0) {
|
||||
t0=aPars(0);
|
||||
aRange.SetFirst(t0);
|
||||
}
|
||||
|
||||
for(i=1; i<aNb; i++) {
|
||||
ind1=anArrProjectability(i);
|
||||
t0=aPars(i-1);
|
||||
t1=aPars(i);
|
||||
|
||||
if (i==(aNb-1)) {
|
||||
if (ind1 && ind0) {
|
||||
aRange.SetLast(t1);
|
||||
myProjectableRanges.Append(aRange);
|
||||
}
|
||||
if (ind1 && !ind0) {
|
||||
FindProjectableRoot(t0, t1, ind0, ind1, tRoot);
|
||||
aRange.SetFirst(tRoot);
|
||||
aRange.SetLast(t1);
|
||||
myProjectableRanges.Append(aRange);
|
||||
}
|
||||
//
|
||||
if (ind0 && !ind1) {
|
||||
FindProjectableRoot(t0, t1, ind0, ind1, tRoot);
|
||||
aRange.SetLast(tRoot);
|
||||
myProjectableRanges.Append(aRange);
|
||||
}
|
||||
//
|
||||
break;
|
||||
}
|
||||
|
||||
if (ind0 != ind1) {
|
||||
FindProjectableRoot(t0, t1, ind0, ind1, tRoot);
|
||||
|
||||
if (ind0 && !ind1) {
|
||||
aRange.SetLast(tRoot);
|
||||
myProjectableRanges.Append(aRange);
|
||||
}
|
||||
else {
|
||||
aRange.SetFirst(tRoot);
|
||||
}
|
||||
} // if (ind0 != ind1)
|
||||
ind0=ind1;
|
||||
} // for(i=1; i<aNb; i++) {
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : FindProjectableRoot
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void IntTools_EdgeFace::FindProjectableRoot (const Standard_Real tt1,
|
||||
const Standard_Real tt2,
|
||||
const Standard_Integer ff1,
|
||||
const Standard_Integer /*ff2*/,
|
||||
Standard_Real& tRoot)
|
||||
{
|
||||
Standard_Real tm, t1, t2, aEpsT;
|
||||
Standard_Integer anIsProj1, anIsProjm;
|
||||
aEpsT = 0.5 * myEpsT;
|
||||
|
||||
// Root is inside [tt1, tt2]
|
||||
t1 = tt1;
|
||||
t2 = tt2;
|
||||
anIsProj1 = ff1;
|
||||
|
||||
for(;;)
|
||||
{
|
||||
if (fabs(t1 - t2) < aEpsT)
|
||||
{
|
||||
tRoot = (anIsProj1) ? t1 : t2;
|
||||
return;
|
||||
}
|
||||
tm = 0.5 * (t1 + t2);
|
||||
anIsProjm = IsProjectable(tm);
|
||||
|
||||
if (anIsProjm != anIsProj1)
|
||||
{
|
||||
t2 = tm;
|
||||
}
|
||||
else
|
||||
{
|
||||
t1 = tm;
|
||||
anIsProj1 = anIsProjm;
|
||||
}
|
||||
} // for(;;)
|
||||
}
|
||||
//=======================================================================
|
||||
//function : IsProjectable
|
||||
//purpose :
|
||||
@@ -651,6 +483,11 @@ Standard_Boolean IntTools_EdgeFace::CheckTouch
|
||||
(const IntTools_CommonPrt& aCP,
|
||||
Standard_Real& aTx)
|
||||
{
|
||||
if (myC.GetType() == GeomAbs_Line &&
|
||||
myS.GetType() == GeomAbs_Plane) {
|
||||
return Standard_False;
|
||||
}
|
||||
//
|
||||
Standard_Real aTF, aTL, Tol, U1f, U1l, V1f, V1l, af, al,aDist2, aMinDist2;
|
||||
Standard_Boolean theflag=Standard_False;
|
||||
Standard_Integer aNbExt, iLower;
|
||||
@@ -816,12 +653,8 @@ void IntTools_EdgeFace::Perform()
|
||||
myCriteria = aTolE + aTolF;
|
||||
}
|
||||
|
||||
myS.Initialize (myFace,Standard_True);
|
||||
myS = myContext->SurfaceAdaptor(myFace);
|
||||
|
||||
if(myContext.IsNull()) {
|
||||
myFClass2d.Init(myFace, 1.e-6);
|
||||
}
|
||||
//
|
||||
if (myQuickCoincidenceCheck) {
|
||||
if (IsCoincident()) {
|
||||
aCommonPrt.SetType(TopAbs_EDGE);
|
||||
|
@@ -28,8 +28,6 @@
|
||||
#include <BRepAdaptor_Surface.hxx>
|
||||
#include <Standard_Boolean.hxx>
|
||||
#include <IntTools_SequenceOfRanges.hxx>
|
||||
#include <IntTools_FClass2d.hxx>
|
||||
#include <IntTools_CArray1OfReal.hxx>
|
||||
#include <IntTools_SequenceOfCommonPrts.hxx>
|
||||
#include <IntTools_Range.hxx>
|
||||
class IntTools_Context;
|
||||
@@ -38,7 +36,6 @@ class TopoDS_Face;
|
||||
class IntTools_Range;
|
||||
class gp_Pnt;
|
||||
class BRepAdaptor_Surface;
|
||||
class IntTools_CArray1OfReal;
|
||||
class IntTools_CommonPrt;
|
||||
|
||||
|
||||
@@ -151,12 +148,8 @@ protected:
|
||||
Standard_EXPORT static Standard_Boolean IsEqDistance (const gp_Pnt& aP, const BRepAdaptor_Surface& aS, const Standard_Real aT, Standard_Real& aD);
|
||||
Standard_EXPORT void CheckData();
|
||||
|
||||
Standard_EXPORT void Prepare();
|
||||
|
||||
Standard_EXPORT Standard_Boolean IsProjectable (const Standard_Real t) const;
|
||||
|
||||
Standard_EXPORT void FindProjectableRoot (const Standard_Real t1, const Standard_Real t2, const Standard_Integer f1, const Standard_Integer f2, Standard_Real& tRoot);
|
||||
|
||||
Standard_EXPORT Standard_Real DistanceFunction (const Standard_Real t);
|
||||
|
||||
Standard_EXPORT Standard_Integer MakeType (IntTools_CommonPrt& aCP);
|
||||
@@ -186,8 +179,6 @@ private:
|
||||
Standard_Boolean myIsDone;
|
||||
Standard_Integer myErrorStatus;
|
||||
Handle(IntTools_Context) myContext;
|
||||
IntTools_SequenceOfRanges myProjectableRanges;
|
||||
IntTools_FClass2d myFClass2d;
|
||||
IntTools_SequenceOfCommonPrts mySeqOfCommonPrts;
|
||||
IntTools_Range myRange;
|
||||
|
||||
|
@@ -134,7 +134,8 @@ static
|
||||
//
|
||||
static
|
||||
Standard_Boolean CheckPCurve(const Handle(Geom2d_Curve)& aPC,
|
||||
const TopoDS_Face& aFace);
|
||||
const TopoDS_Face& aFace,
|
||||
const Handle(IntTools_Context)& theCtx);
|
||||
|
||||
static
|
||||
Standard_Real MaxDistance(const Handle(Geom_Curve)& theC,
|
||||
@@ -313,26 +314,25 @@ void IntTools_FaceFace::SetList(IntSurf_ListOfPntOn2S& aListOfPnts)
|
||||
}
|
||||
|
||||
|
||||
static Standard_Boolean isTreatAnalityc(const TopoDS_Face& theF1,
|
||||
const TopoDS_Face& theF2,
|
||||
static Standard_Boolean isTreatAnalityc(const BRepAdaptor_Surface& theBAS1,
|
||||
const BRepAdaptor_Surface& theBAS2,
|
||||
const Standard_Real theTol)
|
||||
{
|
||||
const Standard_Real Tolang = 1.e-8;
|
||||
Standard_Real aHigh = 0.0;
|
||||
|
||||
const BRepAdaptor_Surface aBAS1(theF1), aBAS2(theF2);
|
||||
const GeomAbs_SurfaceType aType1=aBAS1.GetType();
|
||||
const GeomAbs_SurfaceType aType2=aBAS2.GetType();
|
||||
const GeomAbs_SurfaceType aType1=theBAS1.GetType();
|
||||
const GeomAbs_SurfaceType aType2=theBAS2.GetType();
|
||||
|
||||
gp_Pln aS1;
|
||||
gp_Cylinder aS2;
|
||||
if(aType1 == GeomAbs_Plane)
|
||||
{
|
||||
aS1=aBAS1.Plane();
|
||||
aS1=theBAS1.Plane();
|
||||
}
|
||||
else if(aType2 == GeomAbs_Plane)
|
||||
{
|
||||
aS1=aBAS2.Plane();
|
||||
aS1=theBAS2.Plane();
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -341,9 +341,9 @@ static Standard_Boolean isTreatAnalityc(const TopoDS_Face& theF1,
|
||||
|
||||
if(aType1 == GeomAbs_Cylinder)
|
||||
{
|
||||
aS2=aBAS1.Cylinder();
|
||||
const Standard_Real VMin = aBAS1.FirstVParameter();
|
||||
const Standard_Real VMax = aBAS1.LastVParameter();
|
||||
aS2=theBAS1.Cylinder();
|
||||
const Standard_Real VMin = theBAS1.FirstVParameter();
|
||||
const Standard_Real VMax = theBAS1.LastVParameter();
|
||||
|
||||
if( Precision::IsNegativeInfinite(VMin) ||
|
||||
Precision::IsPositiveInfinite(VMax))
|
||||
@@ -353,10 +353,10 @@ static Standard_Boolean isTreatAnalityc(const TopoDS_Face& theF1,
|
||||
}
|
||||
else if(aType2 == GeomAbs_Cylinder)
|
||||
{
|
||||
aS2=aBAS2.Cylinder();
|
||||
aS2=theBAS2.Cylinder();
|
||||
|
||||
const Standard_Real VMin = aBAS2.FirstVParameter();
|
||||
const Standard_Real VMax = aBAS2.LastVParameter();
|
||||
const Standard_Real VMin = theBAS2.FirstVParameter();
|
||||
const Standard_Real VMax = theBAS2.LastVParameter();
|
||||
|
||||
if( Precision::IsNegativeInfinite(VMin) ||
|
||||
Precision::IsPositiveInfinite(VMax))
|
||||
@@ -407,8 +407,8 @@ void IntTools_FaceFace::Perform(const TopoDS_Face& aF1,
|
||||
myFace1=aF1;
|
||||
myFace2=aF2;
|
||||
|
||||
const BRepAdaptor_Surface aBAS1(myFace1, Standard_False);
|
||||
const BRepAdaptor_Surface aBAS2(myFace2, Standard_False);
|
||||
const BRepAdaptor_Surface& aBAS1 = myContext->SurfaceAdaptor(myFace1);
|
||||
const BRepAdaptor_Surface& aBAS2 = myContext->SurfaceAdaptor(myFace2);
|
||||
GeomAbs_SurfaceType aType1=aBAS1.GetType();
|
||||
GeomAbs_SurfaceType aType2=aBAS2.GetType();
|
||||
|
||||
@@ -462,11 +462,11 @@ void IntTools_FaceFace::Perform(const TopoDS_Face& aF1,
|
||||
if(aType1==GeomAbs_Plane && aType2==GeomAbs_Plane) {
|
||||
Standard_Real umin, umax, vmin, vmax;
|
||||
//
|
||||
BRepTools::UVBounds(myFace1, umin, umax, vmin, vmax);
|
||||
myContext->UVBounds(myFace1, umin, umax, vmin, vmax);
|
||||
CorrectPlaneBoundaries(umin, umax, vmin, vmax);
|
||||
myHS1->ChangeSurface().Load(S1, umin, umax, vmin, vmax);
|
||||
//
|
||||
BRepTools::UVBounds(myFace2, umin, umax, vmin, vmax);
|
||||
myContext->UVBounds(myFace2, umin, umax, vmin, vmax);
|
||||
CorrectPlaneBoundaries(umin, umax, vmin, vmax);
|
||||
myHS2->ChangeSurface().Load(S2, umin, umax, vmin, vmax);
|
||||
//
|
||||
@@ -514,11 +514,11 @@ void IntTools_FaceFace::Perform(const TopoDS_Face& aF1,
|
||||
{
|
||||
Standard_Real umin, umax, vmin, vmax;
|
||||
// F1
|
||||
BRepTools::UVBounds(myFace1, umin, umax, vmin, vmax);
|
||||
myContext->UVBounds(myFace1, umin, umax, vmin, vmax);
|
||||
CorrectPlaneBoundaries(umin, umax, vmin, vmax);
|
||||
myHS1->ChangeSurface().Load(S1, umin, umax, vmin, vmax);
|
||||
// F2
|
||||
BRepTools::UVBounds(myFace2, umin, umax, vmin, vmax);
|
||||
myContext->UVBounds(myFace2, umin, umax, vmin, vmax);
|
||||
CorrectSurfaceBoundaries(myFace2, myTol * 2., umin, umax, vmin, vmax);
|
||||
myHS2->ChangeSurface().Load(S2, umin, umax, vmin, vmax);
|
||||
}
|
||||
@@ -526,21 +526,21 @@ void IntTools_FaceFace::Perform(const TopoDS_Face& aF1,
|
||||
{
|
||||
Standard_Real umin, umax, vmin, vmax;
|
||||
//F1
|
||||
BRepTools::UVBounds(myFace1, umin, umax, vmin, vmax);
|
||||
myContext->UVBounds(myFace1, umin, umax, vmin, vmax);
|
||||
CorrectSurfaceBoundaries(myFace1, myTol * 2., umin, umax, vmin, vmax);
|
||||
myHS1->ChangeSurface().Load(S1, umin, umax, vmin, vmax);
|
||||
// F2
|
||||
BRepTools::UVBounds(myFace2, umin, umax, vmin, vmax);
|
||||
myContext->UVBounds(myFace2, umin, umax, vmin, vmax);
|
||||
CorrectPlaneBoundaries(umin, umax, vmin, vmax);
|
||||
myHS2->ChangeSurface().Load(S2, umin, umax, vmin, vmax);
|
||||
}
|
||||
else
|
||||
{
|
||||
Standard_Real umin, umax, vmin, vmax;
|
||||
BRepTools::UVBounds(myFace1, umin, umax, vmin, vmax);
|
||||
myContext->UVBounds(myFace1, umin, umax, vmin, vmax);
|
||||
CorrectSurfaceBoundaries(myFace1, myTol * 2., umin, umax, vmin, vmax);
|
||||
myHS1->ChangeSurface().Load(S1, umin, umax, vmin, vmax);
|
||||
BRepTools::UVBounds(myFace2, umin, umax, vmin, vmax);
|
||||
myContext->UVBounds(myFace2, umin, umax, vmin, vmax);
|
||||
CorrectSurfaceBoundaries(myFace2, myTol * 2., umin, umax, vmin, vmax);
|
||||
myHS2->ChangeSurface().Load(S2, umin, umax, vmin, vmax);
|
||||
}
|
||||
@@ -626,7 +626,7 @@ void IntTools_FaceFace::Perform(const TopoDS_Face& aF1,
|
||||
}
|
||||
#endif
|
||||
|
||||
const Standard_Boolean isGeomInt = isTreatAnalityc(aF1, aF2, myTol);
|
||||
const Standard_Boolean isGeomInt = isTreatAnalityc(aBAS1, aBAS2, myTol);
|
||||
myIntersector.Perform(myHS1, dom1, myHS2, dom2, TolArc, TolTang,
|
||||
myListOfPnts, RestrictLine, isGeomInt);
|
||||
|
||||
@@ -1648,7 +1648,7 @@ void IntTools_FaceFace::MakeCurve(const Standard_Integer Index,
|
||||
}
|
||||
}
|
||||
// ###########################################
|
||||
bPCurvesOk = CheckPCurve(BS1, myFace2);
|
||||
bPCurvesOk = CheckPCurve(BS1, myFace2, myContext);
|
||||
aCurve.SetSecondCurve2d(BS1);
|
||||
}
|
||||
else {
|
||||
@@ -1674,7 +1674,7 @@ void IntTools_FaceFace::MakeCurve(const Standard_Integer Index,
|
||||
}
|
||||
}
|
||||
// ###########################################
|
||||
bPCurvesOk = bPCurvesOk && CheckPCurve(BS2, myFace1);
|
||||
bPCurvesOk = bPCurvesOk && CheckPCurve(BS2, myFace1, myContext);
|
||||
aCurve.SetFirstCurve2d(BS2);
|
||||
}
|
||||
else {
|
||||
@@ -1693,12 +1693,12 @@ void IntTools_FaceFace::MakeCurve(const Standard_Integer Index,
|
||||
|
||||
if(myApprox1) {
|
||||
H1 = GeomInt_IntSS::MakeBSpline2d(WL, ifprm, ilprm, Standard_True);
|
||||
bPCurvesOk = CheckPCurve(H1, myFace1);
|
||||
bPCurvesOk = CheckPCurve(H1, myFace1, myContext);
|
||||
}
|
||||
|
||||
if(myApprox2) {
|
||||
H2 = GeomInt_IntSS::MakeBSpline2d(WL, ifprm, ilprm, Standard_False);
|
||||
bPCurvesOk = bPCurvesOk && CheckPCurve(H2, myFace2);
|
||||
bPCurvesOk = bPCurvesOk && CheckPCurve(H2, myFace2, myContext);
|
||||
}
|
||||
//
|
||||
//if pcurves created without approximation are out of the
|
||||
@@ -1753,7 +1753,7 @@ void IntTools_FaceFace::MakeCurve(const Standard_Integer Index,
|
||||
newCheck.FixTangent(Standard_True,Standard_True);
|
||||
//
|
||||
if (!reApprox) {
|
||||
bIsValid1=CheckPCurve(BS1, myFace1);
|
||||
bIsValid1=CheckPCurve(BS1, myFace1, myContext);
|
||||
}
|
||||
//
|
||||
aCurve.SetFirstCurve2d(BS1);
|
||||
@@ -1785,7 +1785,7 @@ void IntTools_FaceFace::MakeCurve(const Standard_Integer Index,
|
||||
newCheck.FixTangent(Standard_True,Standard_True);
|
||||
//
|
||||
if (!reApprox) {
|
||||
bIsValid2=CheckPCurve(BS2, myFace2);
|
||||
bIsValid2=CheckPCurve(BS2, myFace2, myContext);
|
||||
}
|
||||
aCurve.SetSecondCurve2d(BS2);
|
||||
}
|
||||
@@ -2961,14 +2961,15 @@ Standard_Real MaxDistance(const Handle(Geom_Curve)& theC,
|
||||
//function : CheckPCurve
|
||||
//purpose : Checks if points of the pcurve are out of the face bounds.
|
||||
//=======================================================================
|
||||
Standard_Boolean CheckPCurve(const Handle(Geom2d_Curve)& aPC,
|
||||
const TopoDS_Face& aFace)
|
||||
Standard_Boolean CheckPCurve(const Handle(Geom2d_Curve)& aPC,
|
||||
const TopoDS_Face& aFace,
|
||||
const Handle(IntTools_Context)& theCtx)
|
||||
{
|
||||
const Standard_Integer NPoints = 23;
|
||||
Standard_Integer i;
|
||||
Standard_Real umin,umax,vmin,vmax;
|
||||
|
||||
BRepTools::UVBounds(aFace, umin, umax, vmin, vmax);
|
||||
theCtx->UVBounds(aFace, umin, umax, vmin, vmax);
|
||||
Standard_Real tolU = Max ((umax-umin)*0.01, Precision::Confusion());
|
||||
Standard_Real tolV = Max ((vmax-vmin)*0.01, Precision::Confusion());
|
||||
Standard_Real fp = aPC->FirstParameter();
|
||||
|
Reference in New Issue
Block a user