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

0024639: Parallelization FillDS part of BO

The contents dealing with the parallel computation of Vertex/Face interferences.
This commit is contained in:
pkv
2014-04-08 12:22:16 +04:00
committed by apn
parent ba06f8bbee
commit e30616a780
3 changed files with 583 additions and 479 deletions

View File

@@ -18,24 +18,31 @@
#include <BOPAlgo_PaveFiller.ixx>
#include <NCollection_IncAllocator.hxx>
//
#include <GeomAPI_ProjectPointOnSurf.hxx>
//
#include <Bnd_Box.hxx>
//
#include <TopoDS_Vertex.hxx>
#include <TopoDS_Edge.hxx>
#include <TopoDS_Face.hxx>
#include <BRep_Tool.hxx>
#include <BRepBndLib.hxx>
#include <BRepAdaptor_Curve.hxx>
#include <BRep_Builder.hxx>
//
#include <IntTools_EdgeFace.hxx>
#include <IntTools_Range.hxx>
#include <IntTools_SequenceOfCommonPrts.hxx>
#include <IntTools_CommonPrt.hxx>
#include <BOPTools_AlgoTools.hxx>
//
#include <BOPCol_MapOfInteger.hxx>
#include <BOPCol_NCVector.hxx>
#include <BOPCol_TBB.hxx>
//
#include <BOPInt_Context.hxx>
#include <BOPInt_Tools.hxx>
//
#include <BOPDS_Interf.hxx>
#include <BOPDS_Iterator.hxx>
#include <BOPDS_PaveBlock.hxx>
@@ -43,44 +50,104 @@
#include <BOPDS_DataMapOfPaveBlockListOfInteger.hxx>
#include <BOPDS_CommonBlock.hxx>
#include <BOPDS_Pave.hxx>
#include <BOPTools_AlgoTools.hxx>
#include <BOPDS_CoupleOfPaveBlocks.hxx>
#include <BRepBndLib.hxx>
//
#include <BOPTools_AlgoTools.hxx>
//
#include <BOPAlgo_Tools.hxx>
#include <BOPInt_Tools.hxx>
#include <BRepAdaptor_Curve.hxx>
#include <BRep_Builder.hxx>
#include <GeomAPI_ProjectPointOnSurf.hxx>
//=======================================================================
//class : BOPAlgo_EdgeFace
//purpose :
//=======================================================================
class BOPAlgo_EdgeFace : public IntTools_EdgeFace {
public:
BOPAlgo_EdgeFace()
: IntTools_EdgeFace(), myIE(-1), myIF(-1) {
};
//
~BOPAlgo_EdgeFace(){
};
//
void SetIndices(const Standard_Integer nE,
const Standard_Integer nF) {
myIE=nE;
myIF=nF;
}
//
void Indices(Standard_Integer& nE,
Standard_Integer& nF) {
nE=myIE;
nF=myIF;
}
//
void SetNewSR(const IntTools_Range& aR){
myNewSR=aR;
}
//
IntTools_Range& NewSR(){
return myNewSR;
}
//
void SetPaveBlock(const Handle(BOPDS_PaveBlock)& aPB) {
myPB=aPB;
}
//
Handle(BOPDS_PaveBlock)& PaveBlock() {
return myPB;
}
//
protected:
Standard_Integer myIE;
Standard_Integer myIF;
IntTools_Range myNewSR;
Handle(BOPDS_PaveBlock) myPB;
};
//
//=======================================================================
typedef BOPCol_NCVector<BOPAlgo_EdgeFace> BOPAlgo_VectorOfEdgeFace;
//
typedef BOPCol_TBBContextFunctor
<BOPAlgo_EdgeFace,
BOPAlgo_VectorOfEdgeFace,
Handle_BOPInt_Context,
BOPInt_Context> BOPAlgo_EdgeFaceFunctor;
//
typedef BOPCol_TBBContextCnt
<BOPAlgo_EdgeFaceFunctor,
BOPAlgo_VectorOfEdgeFace,
Handle_BOPInt_Context> BOPAlgo_EdgeFaceCnt;
//
//=======================================================================
//function : PerformEF
//purpose :
//=======================================================================
void BOPAlgo_PaveFiller::PerformEF()
void BOPAlgo_PaveFiller::PerformEF()
{
Standard_Integer iSize;
//
myErrorStatus=0;
//
FillShrunkData(TopAbs_EDGE, TopAbs_FACE);
//
myIterator->Initialize(TopAbs_EDGE, TopAbs_FACE);
iSize=myIterator->ExpectedLength();
if (!iSize) {
return;
}
//----------------------------------------------------------------------
//
Standard_Boolean bJustAdd, bV[2];
Standard_Integer nE, nF, aDiscretize, i, aNbCPrts, iX, nV[2];
Standard_Integer aNbEdgeFace, k;
Standard_Real aTolE, aTolF, aTS1, aTS2, aT1, aT2, aDeflection;
Handle(NCollection_IncAllocator) aAllocator;
TopAbs_ShapeEnum aType;
BOPDS_ListIteratorOfListOfPaveBlock aIt;
BOPAlgo_VectorOfEdgeFace aVEdgeFace;
BRep_Builder aBB;
//-----------------------------------------------------scope f
//
BRep_Builder aBB;
//
aAllocator=new NCollection_IncAllocator();
////aAllocator=new NCollection_IncAllocator();
BOPCol_MapOfInteger aMIEFC(100, aAllocator);
BOPDS_IndexedDataMapOfShapeCoupleOfPaveBlocks aMVCPB(100, aAllocator);
@@ -111,8 +178,6 @@
//
BOPDS_FaceInfo& aFI=myDS->ChangeFaceInfo(nF);
const BOPDS_IndexedMapOfPaveBlock& aMPBF=aFI.PaveBlocksOn();
const BOPCol_MapOfInteger& aMIFOn=aFI.VerticesOn();
const BOPCol_MapOfInteger& aMIFIn=aFI.VerticesIn();
//
aTolE=BRep_Tool::Tolerance(aE);
aTolF=BRep_Tool::Tolerance(aF);
@@ -128,10 +193,7 @@
}
//
if (!aPB->HasShrunkData()) {
FillShrunkData(aPB);
if (myWarningStatus) {
continue;
}
continue;
}
//
Bnd_Box aBBE;
@@ -141,8 +203,10 @@
continue;
}
//
// -----------f
IntTools_EdgeFace aEdgeFace;
BOPAlgo_EdgeFace& aEdgeFace=aVEdgeFace.Append1();
//
aEdgeFace.SetIndices(nE, nF);
aEdgeFace.SetPaveBlock(aPB);
//
aEdgeFace.SetEdge (aE);
aEdgeFace.SetFace (aF);
@@ -150,45 +214,69 @@
aEdgeFace.SetTolF (aTolF);
aEdgeFace.SetDiscretize (aDiscretize);
aEdgeFace.SetDeflection (aDeflection);
aEdgeFace.SetContext(myContext);
//
IntTools_Range aSR(aTS1, aTS2);
IntTools_Range anewSR=aSR;
BOPTools_AlgoTools::CorrectRange(aE, aF, aSR, anewSR);
aEdgeFace.SetNewSR(anewSR);
//
aPB->Range(aT1, aT2);
IntTools_Range aPBRange(aT1, aT2);
aSR = aPBRange;
BOPTools_AlgoTools::CorrectRange(aE, aF, aSR, aPBRange);
//
aEdgeFace.SetRange (aPBRange);
//
aEdgeFace.Perform();
if (!aEdgeFace.IsDone()) {
continue;
}
//
aPB->Indices(nV[0], nV[1]);
//
const IntTools_SequenceOfCommonPrts& aCPrts=aEdgeFace.CommonParts();
aNbCPrts=aCPrts.Length();
for (i=1; i<=aNbCPrts; ++i) {
const IntTools_CommonPrt& aCPart=aCPrts(i);
aType=aCPart.Type();
switch (aType) {
}//for (; aIt.More(); aIt.Next()) {
}//for (; myIterator->More(); myIterator->Next()) {
//
aNbEdgeFace=aVEdgeFace.Extent();
//=================================================================
BOPAlgo_EdgeFaceCnt::Perform(myRunParallel, aVEdgeFace, myContext);
//=================================================================
//
for (k=0; k < aNbEdgeFace; ++k) {
BOPAlgo_EdgeFace& aEdgeFace=aVEdgeFace(k);
if (!aEdgeFace.IsDone()) {
continue;
}
//~~~
aEdgeFace.Indices(nE, nF);
//
const TopoDS_Edge& aE=aEdgeFace.Edge();
const TopoDS_Face& aF=aEdgeFace.Face();
//
aTolE=aEdgeFace.TolE();
aTolF=aEdgeFace.TolF();
const IntTools_Range& anewSR=aEdgeFace.NewSR();
Handle(BOPDS_PaveBlock)& aPB=aEdgeFace.PaveBlock();
//
aPB->Range(aT1, aT2);
aPB->Indices(nV[0], nV[1]);
//
BOPDS_FaceInfo& aFI=myDS->ChangeFaceInfo(nF);
////const BOPDS_IndexedMapOfPaveBlock& aMPBF=aFI.PaveBlocksOn();
const BOPCol_MapOfInteger& aMIFOn=aFI.VerticesOn();
const BOPCol_MapOfInteger& aMIFIn=aFI.VerticesIn();
//~~~
const IntTools_SequenceOfCommonPrts& aCPrts=aEdgeFace.CommonParts();
aNbCPrts=aCPrts.Length();
for (i=1; i<=aNbCPrts; ++i) {
const IntTools_CommonPrt& aCPart=aCPrts(i);
aType=aCPart.Type();
switch (aType) {
case TopAbs_VERTEX: {
Standard_Boolean bIsOnPave[2];
Standard_Integer j;
Standard_Real aT, aTolToDecide;
TopoDS_Vertex aVnew;
//
BOPInt_Tools::VertexParameter(aCPart, aT);
BOPTools_AlgoTools::MakeNewVertex(aE, aT, aF, aVnew);
//
const IntTools_Range& aR=aCPart.Range1();
aTolToDecide=5.e-8;
//
IntTools_Range aR1(aT1, anewSR.First()), aR2(anewSR.Last(), aT2);
IntTools_Range aR1(aT1,anewSR.First()),aR2(anewSR.Last(), aT2);
//
bIsOnPave[0]=BOPInt_Tools::IsInRange(aR1, aR, aTolToDecide);
bIsOnPave[1]=BOPInt_Tools::IsInRange(aR2, aR, aTolToDecide);
@@ -213,7 +301,8 @@
if (bIsOnPave[j]) {
bV[j]=CheckFacePaves(nV[j], aMIFOn, aMIFIn);
if (bV[j]) {
const TopoDS_Vertex& aV = (*(TopoDS_Vertex *)(&myDS->Shape(nV[j])));
const TopoDS_Vertex& aV=
(*(TopoDS_Vertex *)(&myDS->Shape(nV[j])));
BOPTools_AlgoTools::UpdateVertex(aE, aT, aV);
BOPDS_ShapeInfo& aSIDS=myDS->ChangeShapeInfo(nV[j]);
Bnd_Box& aBoxDS=aSIDS.ChangeBox();
@@ -231,7 +320,9 @@
}
//
const gp_Pnt& aPnew = BRep_Tool::Pnt(aVnew);
if (!myContext->IsValidPointForFace(aPnew, aF, aTolE+aTolF)) {
if (!myContext->IsValidPointForFace(aPnew,
aF,
aTolE+aTolF)) {
continue;
}
//
@@ -283,11 +374,9 @@
break;
default:
break;
}//switch (aType) {
}//for (i=1; i<=aNbCPrts; ++i) {
// -----------t
}//for (; aIt.More(); aIt.Next()) {
}//for (; myIterator->More(); myIterator->Next()) {
}//switch (aType) {
}//for (i=1; i<=aNbCPrts; ++i) {
}// for (k=0; k < aNbEdgeEdge; ++k) {
//
//=========================================
// post treatment
@@ -309,17 +398,15 @@
aMIEFC.Clear();
aMVCPB.Clear();
aMPBLI.Clear();
aAllocator.Nullify();
//
////aAllocator.Nullify();
}
//=======================================================================
//function : PerformVertices1
//purpose :
//=======================================================================
Standard_Integer BOPAlgo_PaveFiller::PerformVerticesEF
(BOPDS_IndexedDataMapOfShapeCoupleOfPaveBlocks& theMVCPB,
Handle(NCollection_BaseAllocator)& theAllocator)
Standard_Integer BOPAlgo_PaveFiller::PerformVerticesEF
(BOPDS_IndexedDataMapOfShapeCoupleOfPaveBlocks& theMVCPB,
Handle(NCollection_BaseAllocator)& theAllocator)
{
Standard_Integer aNbV, iRet;
//
@@ -452,9 +539,10 @@
// function: CheckFacePaves
// purpose:
//=======================================================================
Standard_Boolean BOPAlgo_PaveFiller::CheckFacePaves (const Standard_Integer nVx,
const BOPCol_MapOfInteger& aMIFOn,
const BOPCol_MapOfInteger& aMIFIn)
Standard_Boolean BOPAlgo_PaveFiller::CheckFacePaves
(const Standard_Integer nVx,
const BOPCol_MapOfInteger& aMIFOn,
const BOPCol_MapOfInteger& aMIFIn)
{
Standard_Boolean bRet;
Standard_Integer nV;
@@ -485,8 +573,9 @@
// function: CheckFacePaves
// purpose:
//=======================================================================
Standard_Boolean BOPAlgo_PaveFiller::CheckFacePaves (const TopoDS_Vertex& aVnew,
const BOPCol_MapOfInteger& aMIF)
Standard_Boolean BOPAlgo_PaveFiller::CheckFacePaves
(const TopoDS_Vertex& aVnew,
const BOPCol_MapOfInteger& aMIF)
{
Standard_Boolean bRet;
Standard_Integer nV, iFlag;
@@ -510,8 +599,9 @@
//function : ForceInterfVF
//purpose :
//=======================================================================
Standard_Boolean BOPAlgo_PaveFiller::ForceInterfVF(const Standard_Integer nV,
const Standard_Integer nF)
Standard_Boolean BOPAlgo_PaveFiller::ForceInterfVF
(const Standard_Integer nV,
const Standard_Integer nF)
{
Standard_Boolean bRet;
//

View File

@@ -15,11 +15,10 @@
class EdgeFace from IntTools
---Purpose: The class provides Edge/Face algorithm to determine
--- common parts between edge and face in 3-d space.
-- Common parts can be : Vertices or Edges.
---
---Purpose: The class provides Edge/Face algorithm to determine
--- common parts between edge and face in 3-d space.
-- Common parts can be : Vertices or Edges.
uses
Pnt from gp,
Edge from TopoDS,
@@ -39,215 +38,234 @@ uses
is
Create
returns EdgeFace from IntTools;
---Purpose:
--- Empty Constructor
---
SetEdge (me:out; anEdge:Edge from TopoDS);
---Purpose:
--- Initializes algorithm by the edge anEdge
---
SetTolE (me:out; aTolEdge1:Real from Standard);
---Purpose:
--- Initializes algorithm by edge tolerance
---
SetFace (me:out; aFace:Face from TopoDS);
---Purpose:
--- Initializes algorithm by the face aFace
---
SetTolF (me:out; aTolFace:Real from Standard);
---Purpose:
--- Initializes algorithm by face tolerance
---
SetDiscretize (me:out; aDiscret:Integer from Standard);
---Purpose:
--- Initializes algorithm by discretization value
---
SetDeflection (me:out; aDeflection:Real from Standard);
---Purpose:
--- Initializes algorithm by deflection value
---
SetEpsilonT (me:out; anEpsT:Real from Standard);
---Purpose:
--- Initializes algorithm by parameter tolerance
---
SetEpsilonNull (me:out; anEpsNull:Real from Standard);
---Purpose:
--- Initializes algorithm by distance tolerance
---
returns EdgeFace from IntTools;
---Purpose:
--- Empty Constructor
---
SetRange (me:out; aRange:Range from IntTools);
---Purpose:
--- Sets boundaries for edge.
--- The algorithm processes edge inside these boundaries.
---
SetEdge (me:out;
anEdge:Edge from TopoDS);
---Purpose:
--- Initializes algorithm by the edge anEdge
SetTolE (me:out;
aTolEdge1:Real from Standard);
---Purpose:
--- Initializes algorithm by edge tolerance
SetRange (me:out; aFirst, aLast:Real from Standard);
---Purpose:
--- Sets boundaries for edge.
--- The algorithm processes edge inside these boundaries.
---
SetFace(me:out;
aFace:Face from TopoDS);
---Purpose:
--- Initializes algorithm by the face aFace
SetTolF (me:out;
aTolFace:Real from Standard);
---Purpose:
--- Initializes algorithm by face tolerance
Edge (me)
returns Edge from TopoDS;
---C++: return const &
---Purpose:
--- Returns edge
Face(me)
returns Face from TopoDS;
---C++: return const &
---Purpose:
--- Returns face
TolE (me)
returns Real from Standard;
---Purpose:
--- Returns tolerance of the edge
TolF (me)
returns Real from Standard;
---Purpose:
--- Returns tolerance of the face
SetDiscretize (me:out;
aDiscret:Integer from Standard);
---Purpose:
--- Initializes algorithm by discretization value
SetDeflection (me:out;
aDeflection:Real from Standard);
---Purpose:
--- Initializes algorithm by deflection value
SetEpsilonT(me:out;
anEpsT:Real from Standard);
---Purpose:
--- Initializes algorithm by parameter tolerance
SetEpsilonNull (me:out;
anEpsNull:Real from Standard);
---Purpose:
--- Initializes algorithm by distance tolerance
SetRange (me:out;
aRange:Range from IntTools);
---Purpose:
--- Sets boundaries for edge.
--- The algorithm processes edge inside these boundaries.
SetRange (me:out;
aFirst, aLast:Real from Standard);
---Purpose:
--- Sets boundaries for edge.
--- The algorithm processes edge inside these boundaries.
SetContext (me: in out;
theContext: Context from BOPInt);
---Purpose:
--- Sets the intersecton context
---
theContext: Context from BOPInt);
---Purpose:
--- Sets the intersecton context
Context (me)
returns Context from BOPInt;
---C++:return const &
---Purpose:
--- Gets the intersecton context
---
Perform (me:out);
---Purpose:
--- Launches the process
---
returns Context from BOPInt;
---C++:return const &
---Purpose:
--- Gets the intersecton context
Perform (me:out);
---Purpose:
--- Launches the process
IsDone (me)
returns Boolean from Standard;
---Purpose:
--- Returns true if computation was done
--- successfully, otherwise returns false
---
ErrorStatus(me)
returns Integer from Standard;
---Purpose:
--- Returns code of completion
--- 0 - means successful completion
--- 1 - the process was not started
--- 2,3,4,5 - invalid source data for the algorithm
--- 6 - discretization failed
--- 7 - no projectable ranges found
--- 11 - distance computing error
---
CommonParts(me)
returns SequenceOfCommonPrts from IntTools;
---C++: return const&
---Purpose:
--- Returns results
---
Range (me)
returns Range from IntTools;
---C++: return const&
---Purpose:
--- Returns boundaries for edge
---
--
IsEqDistance(myclass;
aP: Pnt from gp;
aS: Surface from BRepAdaptor;
aT: Real from Standard;
aD:out Real from Standard)
returns Boolean from Standard;
---Purpose:
---
---
--
-----------------------------------------------------
-- Block of private methods of the algorithm --
-----------------------------------------------------
CheckData (me:out) is private;
Prepare (me:out) is private;
IsProjectable (me; t:Real from Standard)
returns Boolean from Standard
is private;
FindProjectableRoot (me:out;
t1,t2:Real from Standard;
f1,f2:Integer from Standard;
tRoot:out Real from Standard)
is private;
DistanceFunction (me:out;t:Real from Standard)
returns Real from Standard
is private;
DerivativeFunction (me:out;t:Real from Standard)
returns Real from Standard
is private;
PrepareArgsFuncArrays (me:out;t1,t2:Real from Standard)
is private;
AddDerivativePoints (me:out; t,f:CArray1OfReal from IntTools)
is private;
FindSimpleRoot (me:out; IP:Integer from Standard;
ta, tb, fA:Real from Standard)
returns Real from Standard
is private;
FindGoldRoot (me:out; ta, tb, coeff:Real from Standard)
returns Real from Standard
is private;
MakeType (me:out;
aCP: out CommonPrt from IntTools)
returns Integer from Standard
is private;
IsDone (me)
returns Boolean from Standard;
---Purpose:
--- Returns true if computation was done
--- successfully, otherwise returns false
IsIntersection (me:out; ta,tb:Real from Standard)
is private;
FindDerivativeRoot (me:out;t,f:CArray1OfReal from IntTools)
is private;
ErrorStatus(me)
returns Integer from Standard;
---Purpose:
--- Returns code of completion
--- 0 - means successful completion
--- 1 - the process was not started
--- 2,3,4,5 - invalid source data for the algorithm
--- 6 - discretization failed
--- 7 - no projectable ranges found
--- 11 - distance computing error
CommonParts (me)
returns SequenceOfCommonPrts from IntTools;
---C++: return const&
---Purpose:
--- Returns results
Range (me)
returns Range from IntTools;
---C++: return const&
---Purpose:
--- Returns boundaries for edge
IsEqDistance(myclass;
aP: Pnt from gp;
aS: Surface from BRepAdaptor;
aT: Real from Standard;
aD:out Real from Standard)
returns Boolean from Standard;
-------------------------------------------------------
-- Block of protected methods of the algorithm --
-------------------------------------------------------
--
RemoveIdenticalRoots(me:out)
is private;
CheckTouch (me: out;
aCP: CommonPrt from IntTools;
aTX:out Real from Standard)
returns Boolean from Standard
is private;
CheckTouchVertex (me:out;
aCP: CommonPrt from IntTools;
aTX:out Real from Standard)
returns Boolean from Standard
is private;
--
CheckData (me:out)
is protected;
Prepare (me:out)
is protected;
IsProjectable (me;
t:Real from Standard)
returns Boolean from Standard
is protected;
FindProjectableRoot (me:out;
t1,t2:Real from Standard;
f1,f2:Integer from Standard;
tRoot:out Real from Standard)
is protected;
DistanceFunction (me:out;
t:Real from Standard)
returns Real from Standard
is protected;
DerivativeFunction (me:out;
t:Real from Standard)
returns Real from Standard
is protected;
PrepareArgsFuncArrays (me:out;
t1,t2:Real from Standard)
is protected;
AddDerivativePoints(me:out;
t,f:CArray1OfReal from IntTools)
is protected;
FindSimpleRoot (me:out;
IP:Integer from Standard;
ta, tb, fA:Real from Standard)
returns Real from Standard
is protected;
FindGoldRoot (me:out;
ta, tb, coeff:Real from Standard)
returns Real from Standard
is protected;
MakeType (me:out;
aCP: out CommonPrt from IntTools)
returns Integer from Standard
is protected;
IsIntersection (me:out;
ta,tb:Real from Standard)
is protected;
FindDerivativeRoot(me:out;
t,f:CArray1OfReal from IntTools)
is protected;
RemoveIdenticalRoots(me:out)
is protected;
CheckTouch (me: out;
aCP: CommonPrt from IntTools;
aTX:out Real from Standard)
returns Boolean from Standard
is protected;
CheckTouchVertex (me:out;
aCP: CommonPrt from IntTools;
aTX:out Real from Standard)
returns Boolean from Standard
is protected;
fields
-- Data
myEdge : Edge from TopoDS;
myFace : Face from TopoDS;
myTolE : Real from Standard;
myTolF : Real from Standard;
myTolF : Real from Standard;
myDiscret : Integer from Standard;
myEpsT : Real from Standard;
myEpsT : Real from Standard;
myEpsNull : Real from Standard;
myDeflection : Real from Standard;
-- data curves
myC : Curve from BRepAdaptor;
myTmin : Real from Standard;
myTmax : Real from Standard;
myTmin : Real from Standard;
myTmax : Real from Standard;
myS : Surface from BRepAdaptor;

View File

@@ -58,7 +58,7 @@
#include <Extrema_POnCurv.hxx>
#include <Extrema_POnSurf.hxx>
// modified by NIZHNY-MKK Thu Jul 21 11:35:59 2005
#include <IntCurveSurface_HInter.hxx>
#include <GeomAdaptor_HCurve.hxx>
#include <GeomAdaptor_HSurface.hxx>
@@ -70,14 +70,14 @@
static
Standard_Boolean IsCoplanar (const BRepAdaptor_Curve& ,
const BRepAdaptor_Surface& );
const BRepAdaptor_Surface& );
static
Standard_Boolean IsRadius (const BRepAdaptor_Curve& aCurve ,
const BRepAdaptor_Surface& aSurface);
const BRepAdaptor_Surface& aSurface);
static
Standard_Integer AdaptiveDiscret (const Standard_Integer iDiscret,
const BRepAdaptor_Curve& aCurve ,
const BRepAdaptor_Surface& aSurface);
const BRepAdaptor_Curve& aCurve ,
const BRepAdaptor_Surface& aSurface);
//=======================================================================
//function : IntTools_EdgeFace::IntTools_EdgeFace
@@ -117,25 +117,23 @@ const Handle(BOPInt_Context)& IntTools_EdgeFace::Context()const
//function : SetEdge
//purpose :
//=======================================================================
void IntTools_EdgeFace::SetEdge(const TopoDS_Edge& anEdge)
void IntTools_EdgeFace::SetEdge(const TopoDS_Edge& anEdge)
{
myEdge=anEdge;
}
//=======================================================================
//function : SetFace
//purpose :
//=======================================================================
void IntTools_EdgeFace::SetFace(const TopoDS_Face& aFace)
void IntTools_EdgeFace::SetFace(const TopoDS_Face& aFace)
{
myFace=aFace;
}
//=======================================================================
//function : SetTolE
//purpose :
//=======================================================================
void IntTools_EdgeFace::SetTolE(const Standard_Real aTol)
void IntTools_EdgeFace::SetTolE(const Standard_Real aTol)
{
myTolE=aTol;
}
@@ -143,16 +141,47 @@ const Handle(BOPInt_Context)& IntTools_EdgeFace::Context()const
//function : SetTolF
//purpose :
//=======================================================================
void IntTools_EdgeFace::SetTolF(const Standard_Real aTol)
void IntTools_EdgeFace::SetTolF(const Standard_Real aTol)
{
myTolF=aTol;
}
//=======================================================================
//function : Edge
//purpose :
//=======================================================================
const TopoDS_Edge& IntTools_EdgeFace::Edge()const
{
return myEdge;
}
//=======================================================================
//function : Face
//purpose :
//=======================================================================
const TopoDS_Face& IntTools_EdgeFace::Face()const
{
return myFace;
}
//=======================================================================
//function : TolE
//purpose :
//=======================================================================
Standard_Real IntTools_EdgeFace::TolE()const
{
return myTolE;
}
//=======================================================================
//function : TolF
//purpose :
//=======================================================================
Standard_Real IntTools_EdgeFace::TolF()const
{
return myTolF;
}
//=======================================================================
//function : SetDiscretize
//purpose :
//=======================================================================
void IntTools_EdgeFace::SetDiscretize(const Standard_Integer aDiscret)
void IntTools_EdgeFace::SetDiscretize(const Standard_Integer aDiscret)
{
myDiscret=aDiscret;
}
@@ -160,7 +189,7 @@ const Handle(BOPInt_Context)& IntTools_EdgeFace::Context()const
//function : SetDeflection
//purpose :
//=======================================================================
void IntTools_EdgeFace::SetDeflection(const Standard_Real aDefl)
void IntTools_EdgeFace::SetDeflection(const Standard_Real aDefl)
{
myDeflection=aDefl;
}
@@ -168,7 +197,7 @@ const Handle(BOPInt_Context)& IntTools_EdgeFace::Context()const
//function : SetEpsilonT
//purpose :
//=======================================================================
void IntTools_EdgeFace::SetEpsilonT(const Standard_Real anEpsT)
void IntTools_EdgeFace::SetEpsilonT(const Standard_Real anEpsT)
{
myEpsT=anEpsT;
}
@@ -176,7 +205,7 @@ const Handle(BOPInt_Context)& IntTools_EdgeFace::Context()const
//function : SetEpsilonNull
//purpose :
//=======================================================================
void IntTools_EdgeFace::SetEpsilonNull(const Standard_Real anEpsNull)
void IntTools_EdgeFace::SetEpsilonNull(const Standard_Real anEpsNull)
{
myEpsNull=anEpsNull;
}
@@ -185,8 +214,8 @@ const Handle(BOPInt_Context)& IntTools_EdgeFace::Context()const
//function : SetRange
//purpose :
//=======================================================================
void IntTools_EdgeFace::SetRange(const Standard_Real aFirst,
const Standard_Real aLast)
void IntTools_EdgeFace::SetRange(const Standard_Real aFirst,
const Standard_Real aLast)
{
myRange.SetFirst (aFirst);
myRange.SetLast (aLast);
@@ -196,7 +225,7 @@ const Handle(BOPInt_Context)& IntTools_EdgeFace::Context()const
//function : SetRange
//purpose :
//=======================================================================
void IntTools_EdgeFace::SetRange(const IntTools_Range& aRange)
void IntTools_EdgeFace::SetRange(const IntTools_Range& aRange)
{
myRange.SetFirst (aRange.First());
myRange.SetLast (aRange.Last());
@@ -251,7 +280,7 @@ void IntTools_EdgeFace::CheckData()
//function : Prepare
//purpose :
//=======================================================================
void IntTools_EdgeFace::Prepare()
void IntTools_EdgeFace::Prepare()
{
Standard_Integer pri;
IntTools_CArray1OfReal aPars;
@@ -264,7 +293,7 @@ void IntTools_EdgeFace::CheckData()
//
// 2.Prepare myCriteria
if (aCurveType==GeomAbs_BSplineCurve||
aCurveType==GeomAbs_BezierCurve) {
aCurveType==GeomAbs_BezierCurve) {
myCriteria=1.5*myTolE+myTolF;
}
else {
@@ -282,7 +311,8 @@ void IntTools_EdgeFace::CheckData()
//
//
// 3.Prepare myPars
pri = IntTools::PrepareArgs(myC, myTmax, myTmin, myDiscret, myDeflection, aPars);
pri = IntTools::PrepareArgs(myC, myTmax, myTmin,
myDiscret, myDeflection, aPars);
if (pri) {
myErrorStatus=6;
return;
@@ -332,20 +362,20 @@ void IntTools_EdgeFace::CheckData()
if (i==(aNb-1)) {
if (ind1 && ind0) {
aRange.SetLast(t1);
myProjectableRanges.Append(aRange);
aRange.SetLast(t1);
myProjectableRanges.Append(aRange);
}
if (ind1 && !ind0) {
FindProjectableRoot(t0, t1, ind0, ind1, tRoot);
aRange.SetFirst(tRoot);
aRange.SetLast(t1);
myProjectableRanges.Append(aRange);
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);
FindProjectableRoot(t0, t1, ind0, ind1, tRoot);
aRange.SetLast(tRoot);
myProjectableRanges.Append(aRange);
}
//
break;
@@ -355,11 +385,11 @@ void IntTools_EdgeFace::CheckData()
FindProjectableRoot(t0, t1, ind0, ind1, tRoot);
if (ind0 && !ind1) {
aRange.SetLast(tRoot);
myProjectableRanges.Append(aRange);
aRange.SetLast(tRoot);
myProjectableRanges.Append(aRange);
}
else {
aRange.SetFirst(tRoot);
aRange.SetFirst(tRoot);
}
} // if (ind0 != ind1)
ind0=ind1;
@@ -370,11 +400,12 @@ void IntTools_EdgeFace::CheckData()
//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)
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, anIsProj2, anIsProjm;
@@ -408,7 +439,8 @@ void IntTools_EdgeFace::CheckData()
//function : IsProjectable
//purpose :
//=======================================================================
Standard_Boolean IntTools_EdgeFace::IsProjectable(const Standard_Real aT) const
Standard_Boolean IntTools_EdgeFace::IsProjectable
(const Standard_Real aT) const
{
Standard_Boolean bFlag;
gp_Pnt aPC;
@@ -422,7 +454,8 @@ Standard_Boolean IntTools_EdgeFace::IsProjectable(const Standard_Real aT) const
//function : DistanceFunction
//purpose :
//=======================================================================
Standard_Real IntTools_EdgeFace::DistanceFunction(const Standard_Real t)
Standard_Real IntTools_EdgeFace::DistanceFunction
(const Standard_Real t)
{
Standard_Real aD;
@@ -466,10 +499,11 @@ Standard_Real IntTools_EdgeFace::DistanceFunction(const Standard_Real t)
//function : IsEqDistance
//purpose :
//=======================================================================
Standard_Boolean IntTools_EdgeFace::IsEqDistance(const gp_Pnt& aP,
const BRepAdaptor_Surface& aBAS,
const Standard_Real aTol,
Standard_Real& aD)
Standard_Boolean IntTools_EdgeFace::IsEqDistance
(const gp_Pnt& aP,
const BRepAdaptor_Surface& aBAS,
const Standard_Real aTol,
Standard_Real& aD)
{
Standard_Boolean bRetFlag=Standard_True;
@@ -525,9 +559,9 @@ Standard_Real IntTools_EdgeFace::DistanceFunction(const Standard_Real t)
//function : PrepareArgsFuncArrays
//purpose : Obtain
// myFuncArray and myArgsArray for the interval [ta, tb]
//=======================================================================
void IntTools_EdgeFace::PrepareArgsFuncArrays(const Standard_Real ta,
const Standard_Real tb)
//=======================================================================
void IntTools_EdgeFace::PrepareArgsFuncArrays(const Standard_Real ta,
const Standard_Real tb)
{
IntTools_CArray1OfReal anArgs, aFunc;
Standard_Integer i, aNb, pri;
@@ -568,14 +602,13 @@ Standard_Real IntTools_EdgeFace::DistanceFunction(const Standard_Real t)
AddDerivativePoints(anArgs, aFunc);
}
//=======================================================================
//function : AddDerivativePoints
//purpose :
//=======================================================================
void IntTools_EdgeFace::AddDerivativePoints(const IntTools_CArray1OfReal& t,
const IntTools_CArray1OfReal& f)
void IntTools_EdgeFace::AddDerivativePoints
(const IntTools_CArray1OfReal& t,
const IntTools_CArray1OfReal& f)
{
Standard_Integer i, j, n, k, nn=100;
Standard_Real fr, tr, tr1, dEpsNull=10.*myEpsNull;
@@ -638,16 +671,16 @@ Standard_Real IntTools_EdgeFace::DistanceFunction(const Standard_Real t)
if (fd1*fd2 < 0.) {
if (fabs(fd1) < myEpsNull) {
tr=t1;
fr=DistanceFunction(tr);//fd1;
tr=t1;
fr=DistanceFunction(tr);//fd1;
}
else if (fabs(fd2) < myEpsNull) {
tr=t2;
fr=DistanceFunction(tr);
tr=t2;
fr=DistanceFunction(tr);
}
else {
tr=FindSimpleRoot(2, t1, t2, fd1);
fr=DistanceFunction(tr);
tr=FindSimpleRoot(2, t1, t2, fd1);
fr=DistanceFunction(tr);
}
aTSeq.Append(tr);
@@ -661,11 +694,11 @@ Standard_Real IntTools_EdgeFace::DistanceFunction(const Standard_Real t)
for (i=1; i<=aTSeq.Length(); i++) {
tr=aTSeq(i);
for (j=0; j<n; j++) {
tr1=t(j);
if (fabs (tr1-tr) < myEpsT) {
aTSeq.Remove(i);
aFSeq.Remove(i);
}
tr1=t(j);
if (fabs (tr1-tr) < myEpsT) {
aTSeq.Remove(i);
aFSeq.Remove(i);
}
}
}
nn=aTSeq.Length();
@@ -711,7 +744,8 @@ Standard_Real IntTools_EdgeFace::DistanceFunction(const Standard_Real t)
//function : DerivativeFunction
//purpose :
//=======================================================================
Standard_Real IntTools_EdgeFace::DerivativeFunction(const Standard_Real t2)
Standard_Real IntTools_EdgeFace::DerivativeFunction
(const Standard_Real t2)
{
Standard_Real t1, t3, aD1, aD2, aD3;
Standard_Real dt=1.e-9;
@@ -728,10 +762,11 @@ Standard_Real IntTools_EdgeFace::DistanceFunction(const Standard_Real t)
//function : FindSimpleRoot
//purpose : [private]
//=======================================================================
Standard_Real IntTools_EdgeFace::FindSimpleRoot (const Standard_Integer IP,
const Standard_Real tA,
const Standard_Real tB,
const Standard_Real fA)
Standard_Real IntTools_EdgeFace::FindSimpleRoot
(const Standard_Integer IP,
const Standard_Real tA,
const Standard_Real tB,
const Standard_Real fA)
{
Standard_Real r, a, b, y, x0, s;
@@ -766,9 +801,10 @@ Standard_Real IntTools_EdgeFace::DistanceFunction(const Standard_Real t)
//function : FindGoldRoot
//purpose : [private]
//=======================================================================
Standard_Real IntTools_EdgeFace::FindGoldRoot (const Standard_Real tA,
const Standard_Real tB,
const Standard_Real coeff)
Standard_Real IntTools_EdgeFace::FindGoldRoot
(const Standard_Real tA,
const Standard_Real tB,
const Standard_Real coeff)
{
Standard_Real gs=0.61803399;
Standard_Real a, b, xp, xl, yp, yl;
@@ -808,7 +844,8 @@ Standard_Real IntTools_EdgeFace::DistanceFunction(const Standard_Real t)
//function : MakeType
//purpose :
//=======================================================================
Standard_Integer IntTools_EdgeFace::MakeType(IntTools_CommonPrt& aCommonPrt)
Standard_Integer IntTools_EdgeFace::MakeType
(IntTools_CommonPrt& aCommonPrt)
{
Standard_Real af1, al1;
Standard_Real df1, tm;
@@ -832,72 +869,30 @@ Standard_Real IntTools_EdgeFace::DistanceFunction(const Standard_Real t)
if((Abs(af1 - myRange.First()) < myC.Resolution(myCriteria)) &&
(Abs(al1 - myRange.Last()) < myC.Resolution(myCriteria)))
isWholeRange = Standard_True;
if ((df1 > myCriteria * 2.) && isWholeRange) {
aCommonPrt.SetType(TopAbs_EDGE);
}
else {
if(isWholeRange) {
tm = (af1 + al1) * 0.5;
if(aPF.Distance(myC.Value(tm)) > myCriteria * 2.) {
aCommonPrt.SetType(TopAbs_EDGE);
return 0;
}
tm = (af1 + al1) * 0.5;
if(aPF.Distance(myC.Value(tm)) > myCriteria * 2.) {
aCommonPrt.SetType(TopAbs_EDGE);
return 0;
}
}
if(!CheckTouch(aCommonPrt, tm)) {
tm = (af1 + al1) * 0.5;
tm = (af1 + al1) * 0.5;
}
aCommonPrt.SetType(TopAbs_VERTEX);
aCommonPrt.SetVertexParameter1(tm);
aCommonPrt.SetRange1 (af1, al1);
}
return 0;
}
/*
dt=al1-af1;
if (dt<1.e-5) {
gp_Pnt aPF, aPL;
myC.D0(af1, aPF);
myC.D0(al1, aPL);
df1=aPF.Distance(aPL);
if (df1<myCriteria) {
//
tm=.5*(af1+al1);
aCommonPrt.SetType(TopAbs_VERTEX);
aCommonPrt.SetVertexParameter1(tm);
aCommonPrt.SetRange1 (af1, al1);
return 0;
}
}
//
IsIntersection (af1, al1);
//
if (!myParallel) {
aCommonPrt.SetType(TopAbs_VERTEX);
aCommonPrt.SetVertexParameter1(myPar1);
aCommonPrt.SetRange1 (af1, al1);
}
else {
dt=al1-af1;
if (dt<1.e-5) {
df1=DistanceFunction(af1);
df2=DistanceFunction(al1);
tm=(df1 < df2) ? af1 : al1;
aCommonPrt.SetType(TopAbs_VERTEX);
aCommonPrt.SetVertexParameter1(tm);
aCommonPrt.SetRange1 (af1, al1);
}
else {
aCommonPrt.SetType(TopAbs_EDGE);
}
}
return 0;*/
return 0;
}
@@ -905,8 +900,8 @@ Standard_Real IntTools_EdgeFace::DistanceFunction(const Standard_Real t)
//function : IsIntersection
//purpose :
//=======================================================================
void IntTools_EdgeFace::IsIntersection (const Standard_Real ta,
const Standard_Real tb)
void IntTools_EdgeFace::IsIntersection (const Standard_Real ta,
const Standard_Real tb)
{
IntTools_CArray1OfReal anArgs, aFunc;
Standard_Integer i, aNb, aCnt=0;
@@ -933,10 +928,10 @@ Standard_Real IntTools_EdgeFace::DistanceFunction(const Standard_Real t)
//
if (i) {
if (aFunc(i)>aFunc(i-1)) {
aCntIncreasing++;
aCntIncreasing++;
}
if (aFunc(i)<aFunc(i-1)) {
aCntDecreasing++;
aCntDecreasing++;
}
}
//
@@ -952,15 +947,15 @@ Standard_Real IntTools_EdgeFace::DistanceFunction(const Standard_Real t)
//
if (myParallel) {
if (!(myC.GetType()==GeomAbs_Line
&&
myS.GetType()==GeomAbs_Cylinder)) {
&&
myS.GetType()==GeomAbs_Cylinder)) {
if (aCntDecreasing==aNb) {
myPar1=anArgs(aNb-1);
myParallel=Standard_False;
myPar1=anArgs(aNb-1);
myParallel=Standard_False;
}
if (aCntIncreasing==aNb) {
myPar1=anArgs(0);
myParallel=Standard_False;
myPar1=anArgs(0);
myParallel=Standard_False;
}
}
}
@@ -972,8 +967,9 @@ Standard_Real IntTools_EdgeFace::DistanceFunction(const Standard_Real t)
//function : FindDerivativeRoot
//purpose :
//=======================================================================
void IntTools_EdgeFace::FindDerivativeRoot(const IntTools_CArray1OfReal& t,
const IntTools_CArray1OfReal& f)
void IntTools_EdgeFace::FindDerivativeRoot
(const IntTools_CArray1OfReal& t,
const IntTools_CArray1OfReal& f)
{
Standard_Integer i, n, k;
Standard_Real tr;
@@ -1049,7 +1045,7 @@ Standard_Real IntTools_EdgeFace::DistanceFunction(const Standard_Real t)
//function : RemoveIdenticalRoots
//purpose :
//=======================================================================
void IntTools_EdgeFace::RemoveIdenticalRoots()
void IntTools_EdgeFace::RemoveIdenticalRoots()
{
Standard_Integer aNbRoots, j, k;
@@ -1070,8 +1066,8 @@ Standard_Real IntTools_EdgeFace::DistanceFunction(const Standard_Real t)
aDistance=aPj.Distance(aPk);
if (aDistance < myCriteria) {
mySequenceOfRoots.Remove(k);
aNbRoots=mySequenceOfRoots.Length();
mySequenceOfRoots.Remove(k);
aNbRoots=mySequenceOfRoots.Length();
}
}
}
@@ -1081,8 +1077,9 @@ Standard_Real IntTools_EdgeFace::DistanceFunction(const Standard_Real t)
//function : CheckTouch
//purpose :
//=======================================================================
Standard_Boolean IntTools_EdgeFace::CheckTouch(const IntTools_CommonPrt& aCP,
Standard_Real& aTx)
Standard_Boolean IntTools_EdgeFace::CheckTouch
(const IntTools_CommonPrt& aCP,
Standard_Real& aTx)
{
Standard_Real aTF, aTL, Tol, U1f, U1l, V1f, V1l, af, al,aDist2, aMinDist2;
Standard_Boolean theflag=Standard_False;
@@ -1111,7 +1108,7 @@ Standard_Real IntTools_EdgeFace::DistanceFunction(const Standard_Real t)
GeomAdaptor_Curve TheCurve (Curve,aTF, aTL);
GeomAdaptor_Surface TheSurface (Surface, U1f, U1l, V1f, V1l);
Extrema_ExtCS anExtrema (TheCurve, TheSurface, Tol, Tol);
aDist2 = 1.e100;
@@ -1123,42 +1120,42 @@ Standard_Real IntTools_EdgeFace::DistanceFunction(const Standard_Real t)
aNbExt=anExtrema.NbExt();
if(aNbExt > 0) {
iLower=1;
for (i=1; i<=aNbExt; i++) {
aDist2=anExtrema.SquareDistance(i);
if (aDist2 < aMinDist2) {
aMinDist2=aDist2;
iLower=i;
}
}
aDist2=anExtrema.SquareDistance(iLower);
Extrema_POnCurv aPOnC;
Extrema_POnSurf aPOnS;
anExtrema.Points(iLower, aPOnC, aPOnS);
aTx=aPOnC.Parameter();
iLower=1;
for (i=1; i<=aNbExt; i++) {
aDist2=anExtrema.SquareDistance(i);
if (aDist2 < aMinDist2) {
aMinDist2=aDist2;
iLower=i;
}
}
aDist2=anExtrema.SquareDistance(iLower);
Extrema_POnCurv aPOnC;
Extrema_POnSurf aPOnS;
anExtrema.Points(iLower, aPOnC, aPOnS);
aTx=aPOnC.Parameter();
}
else {
// modified by NIZHNY-MKK Thu Jul 21 11:35:32 2005.BEGIN
IntCurveSurface_HInter anExactIntersector;
// modified by NIZHNY-MKK Thu Jul 21 11:35:32 2005.BEGIN
IntCurveSurface_HInter anExactIntersector;
Handle(GeomAdaptor_HCurve) aCurve = new GeomAdaptor_HCurve(TheCurve);
Handle(GeomAdaptor_HSurface) aSurface = new GeomAdaptor_HSurface(TheSurface);
anExactIntersector.Perform(aCurve, aSurface);
Handle(GeomAdaptor_HCurve) aCurve = new GeomAdaptor_HCurve(TheCurve);
Handle(GeomAdaptor_HSurface) aSurface = new GeomAdaptor_HSurface(TheSurface);
anExactIntersector.Perform(aCurve, aSurface);
if(anExactIntersector.IsDone()) {
Standard_Integer i = 0;
if(anExactIntersector.IsDone()) {
Standard_Integer i = 0;
for(i = 1; i <= anExactIntersector.NbPoints(); i++) {
const IntCurveSurface_IntersectionPoint& aPoint = anExactIntersector.Point(i);
for(i = 1; i <= anExactIntersector.NbPoints(); i++) {
const IntCurveSurface_IntersectionPoint& aPoint = anExactIntersector.Point(i);
if((aPoint.W() >= aTF) && (aPoint.W() <= aTL)) {
aDist2=0.;
aTx = aPoint.W();
}
}
}
// modified by NIZHNY-MKK Thu Jul 21 11:35:40 2005.END
if((aPoint.W() >= aTF) && (aPoint.W() <= aTL)) {
aDist2=0.;
aTx = aPoint.W();
}
}
}
// modified by NIZHNY-MKK Thu Jul 21 11:35:40 2005.END
}
}
else {
@@ -1205,13 +1202,11 @@ Standard_Real IntTools_EdgeFace::DistanceFunction(const Standard_Real t)
return theflag;
}
//=======================================================================
//function : Perform
//purpose :
//=======================================================================
void IntTools_EdgeFace::Perform()
void IntTools_EdgeFace::Perform()
{
Standard_Integer i, aNb;
IntTools_CommonPrt aCommonPrt;
@@ -1235,7 +1230,7 @@ Standard_Real IntTools_EdgeFace::DistanceFunction(const Standard_Real t)
//
// Prepare myCriteria
if (aCurveType==GeomAbs_BSplineCurve||
aCurveType==GeomAbs_BezierCurve) {
aCurveType==GeomAbs_BezierCurve) {
//--- 5112
Standard_Real diff1 = (myTolE/myTolF);
Standard_Real diff2 = (myTolF/myTolE);
@@ -1248,27 +1243,27 @@ Standard_Real IntTools_EdgeFace::DistanceFunction(const Standard_Real t)
else {
myCriteria=myTolE+myTolF;
}
myTmin=myRange.First();
myTmax=myRange.Last();
myS.Initialize (myFace,Standard_True);
if(myContext.IsNull()) {
myFClass2d.Init(myFace, 1.e-6);
}
IntTools_BeanFaceIntersector anIntersector(myC, myS, myTolE, myTolF);
anIntersector.SetBeanParameters(myRange.First(), myRange.Last());
//
anIntersector.SetContext(myContext);
//
anIntersector.Perform();
if(!anIntersector.IsDone()) {
return;
}
for(Standard_Integer r = 1; r <= anIntersector.Result().Length(); r++) {
const IntTools_Range& aRange = anIntersector.Result().Value(r);
@@ -1300,32 +1295,32 @@ Standard_Real IntTools_EdgeFace::DistanceFunction(const Standard_Real t)
TopAbs_ShapeEnum aType;
Standard_Boolean bIsTouch;
Standard_Real aTx;
aCType=myC.GetType();
aSType=myS.GetType();
if (aCType==GeomAbs_Line && aSType==GeomAbs_Cylinder) {
for (i=1; i<=aNb; i++) {
IntTools_CommonPrt& aCP=mySeqOfCommonPrts(i);
aType=aCP.Type();
if (aType==TopAbs_EDGE) {
bIsTouch=CheckTouch (aCP, aTx);
if (bIsTouch) {
aCP.SetType(TopAbs_VERTEX);
aCP.SetVertexParameter1(aTx);
aCP.SetRange1 (aTx, aTx);
}
}
if (aType==TopAbs_VERTEX) {
bIsTouch=CheckTouchVertex (aCP, aTx);
if (bIsTouch) {
aCP.SetVertexParameter1(aTx);
aCP.SetRange1 (aTx, aTx);
}
}
IntTools_CommonPrt& aCP=mySeqOfCommonPrts(i);
aType=aCP.Type();
if (aType==TopAbs_EDGE) {
bIsTouch=CheckTouch (aCP, aTx);
if (bIsTouch) {
aCP.SetType(TopAbs_VERTEX);
aCP.SetVertexParameter1(aTx);
aCP.SetRange1 (aTx, aTx);
}
}
if (aType==TopAbs_VERTEX) {
bIsTouch=CheckTouchVertex (aCP, aTx);
if (bIsTouch) {
aCP.SetVertexParameter1(aTx);
aCP.SetRange1 (aTx, aTx);
}
}
}
}
// Circle\Plane's Common Parts treatement
if (aCType==GeomAbs_Circle && aSType==GeomAbs_Plane) {
@@ -1333,18 +1328,18 @@ Standard_Real IntTools_EdgeFace::DistanceFunction(const Standard_Real t)
bIsCoplanar=IsCoplanar(myC, myS);
bIsRadius=IsRadius(myC, myS);
if (!bIsCoplanar && !bIsRadius) {
for (i=1; i<=aNb; i++) {
IntTools_CommonPrt& aCP=mySeqOfCommonPrts(i);
aType=aCP.Type();
if (aType==TopAbs_EDGE) {
bIsTouch=CheckTouch (aCP, aTx);
if (bIsTouch) {
aCP.SetType(TopAbs_VERTEX);
aCP.SetVertexParameter1(aTx);
aCP.SetRange1 (aTx, aTx);
}
}
}
for (i=1; i<=aNb; i++) {
IntTools_CommonPrt& aCP=mySeqOfCommonPrts(i);
aType=aCP.Type();
if (aType==TopAbs_EDGE) {
bIsTouch=CheckTouch (aCP, aTx);
if (bIsTouch) {
aCP.SetType(TopAbs_VERTEX);
aCP.SetVertexParameter1(aTx);
aCP.SetRange1 (aTx, aTx);
}
}
}
}
}
}
@@ -1365,8 +1360,9 @@ Standard_Real IntTools_EdgeFace::DistanceFunction(const Standard_Real t)
//function : CheckTouch
//purpose :
//=======================================================================
Standard_Boolean IntTools_EdgeFace::CheckTouchVertex (const IntTools_CommonPrt& aCP,
Standard_Real& aTx)
Standard_Boolean IntTools_EdgeFace::CheckTouchVertex
(const IntTools_CommonPrt& aCP,
Standard_Real& aTx)
{
Standard_Real aTF, aTL, Tol, U1f,U1l,V1f,V1l, af, al,aDist2, aMinDist2, aTm, aDist2New;
Standard_Real aEpsT;
@@ -1388,7 +1384,7 @@ Standard_Real IntTools_EdgeFace::DistanceFunction(const Standard_Real t)
GeomAdaptor_Curve TheCurve (Curve,aTF, aTL);
GeomAdaptor_Surface TheSurface (Surface, U1f, U1l, V1f, V1l);
Extrema_ExtCS anExtrema (TheCurve, TheSurface, Tol, Tol);
if(!anExtrema.IsDone()) {
@@ -1452,7 +1448,7 @@ Standard_Real IntTools_EdgeFace::DistanceFunction(const Standard_Real t)
//purpose :
//=======================================================================
Standard_Boolean IsCoplanar (const BRepAdaptor_Curve& aCurve ,
const BRepAdaptor_Surface& aSurface)
const BRepAdaptor_Surface& aSurface)
{
Standard_Boolean bFlag=Standard_False;
@@ -1480,7 +1476,7 @@ Standard_Boolean IsCoplanar (const BRepAdaptor_Curve& aCurve ,
//purpose :
//=======================================================================
Standard_Boolean IsRadius (const BRepAdaptor_Curve& aCurve ,
const BRepAdaptor_Surface& aSurface)
const BRepAdaptor_Surface& aSurface)
{
Standard_Boolean bFlag=Standard_False;
@@ -1508,8 +1504,8 @@ Standard_Boolean IsRadius (const BRepAdaptor_Curve& aCurve ,
//purpose :
//=======================================================================
Standard_Integer AdaptiveDiscret (const Standard_Integer iDiscret,
const BRepAdaptor_Curve& aCurve ,
const BRepAdaptor_Surface& aSurface)
const BRepAdaptor_Curve& aCurve ,
const BRepAdaptor_Surface& aSurface)
{
Standard_Integer iDiscretNew;