Classes BOPInt_Context, BOPInt_ShrunkRange, BOPInt_Tools have been removed.
Package BOPInt has been removed
Classes IntTools_Context, IntTools_ShrunkRange have been added to replace corresponding BOPInt_ classes.
The classes provide same functionality as corresponding BOPInt_ classes.
Classes :
BOPAlgo_ArgumentAnalyzer
BOPAlgo_Builder
BOPAlgo_BuilderArea
BOPAlgo_BuilderFace
BOPAlgo_BuilderSolid
BOPAlgo_CheckerSI
BOPAlgo_PaveFiller
BOPAlgo_ShellSplitter
BOPTools_AlgoTools3D
BRepFill_TrimShellCorner
IntTools_BeanFaceIntersector
IntTools_EdgeFace
IntTools_FaceFace
IntTools_Tools
have been modified to use new classes IntTools_Context IntTools_ShrunkRange
Class IntTools_Tools has been modofied to provide the functionality that was in BOPInt_Tools.
p BOPAlgo
p BOPDS
p BOPCol
-p BOPInt
IntSurf,
--
BOPDS,
- BOPInt,
BOPCol,
BOPTools
is
#include <IntTools_EdgeEdge.hxx>
#include <IntTools_CommonPrt.hxx>
-#include <BOPInt_Context.hxx>
+#include <IntTools_Context.hxx>
#include <BOPTools_AlgoTools3D.hxx>
#include <BOPTools_AlgoTools.hxx>
myContinuityMode(Standard_False),
myEmpty1(Standard_False),
myEmpty2(Standard_False)
-// myMergeFaceMode(Standard_False)
{
}
{
Standard_Integer i = 0;
BRepExtrema_DistShapeShape aDist;
- Handle(BOPInt_Context) aCtx;
+ Handle(IntTools_Context) aCtx;
//
- aCtx = new BOPInt_Context;
+ aCtx = new IntTools_Context;
for(i = 0; i < 2; i++) {
const TopoDS_Shape& aS = (i == 0) ? myShape1 : myShape2;
}
}
}
-
-// ================================================================================
-// function: TestMergeFace
-// purpose:
-// ================================================================================
-// void BOPAlgo_ArgumentAnalyzer::TestMergeFace()
-// {
- // not implemented
-// }
MapOfShape from BOPCol,
DataMapOfShapeShape from BOPCol,
DataMapOfShapeListOfShape from BOPCol,
- Context from BOPInt,
+ Context from IntTools,
PDS from BOPDS,
PaveFiller from BOPAlgo,
PPaveFiller from BOPAlgo
myMapFence : MapOfShape from BOPCol is protected;
myPaveFiller : PPaveFiller from BOPAlgo is protected;
myDS : PDS from BOPDS is protected;
- myContext : Context from BOPInt is protected;
+ myContext : Context from IntTools is protected;
myEntryPoint : Integer from Standard is protected;
--
myImages : DataMapOfShapeListOfShape from BOPCol is protected;
-- commercial license or contractual agreement.
deferred class BuilderArea from BOPAlgo
- inherits Algo from BOPAlgo
-
- ---Purpose: The root class for algorithms to build
- -- faces/solids from set of edges/faces
+ inherits Algo from BOPAlgo
+
+ ---Purpose: The root class for algorithms to build
+ -- faces/solids from set of edges/faces
uses
Shape from TopoDS,
BaseAllocator from BOPCol,
ListOfShape from BOPCol,
MapOfOrientedShape from BOPCol,
- Context from BOPInt
+ Context from IntTools
--raises
is
Initialize
- returns BuilderArea from BOPAlgo;
+ returns BuilderArea from BOPAlgo;
---C++: alias "Standard_EXPORT virtual ~BOPAlgo_BuilderArea();"
Initialize(theAllocator: BaseAllocator from BOPCol)
- returns BuilderArea from BOPAlgo;
+ returns BuilderArea from BOPAlgo;
SetContext(me:out;
- theContext:Context from BOPInt);
-
+ theContext:Context from IntTools);
+
Shapes(me)
- returns ListOfShape from BOPCol;
+ returns ListOfShape from BOPCol;
---C++: return const &
---C++: alias "Standard_EXPORT void SetShapes(const BOPCol_ListOfShape& theLS);"
Loops(me)
- returns ListOfShape from BOPCol;
+ returns ListOfShape from BOPCol;
---C++: return const &
Areas(me)
- returns ListOfShape from BOPCol;
+ returns ListOfShape from BOPCol;
---C++: return const &
PerformShapesToAvoid(me:out)
- is deferred protected;
-
+ is deferred protected;
+
PerformLoops(me:out)
- is deferred protected;
-
+ is deferred protected;
+
PerformAreas(me:out)
- is deferred protected;
+ is deferred protected;
PerformInternalShapes(me:out)
- is deferred protected;
+ is deferred protected;
fields
- myContext : Context from BOPInt is protected;
+ myContext : Context from IntTools is protected;
myShapes : ListOfShape from BOPCol is protected;
myLoops : ListOfShape from BOPCol is protected;
myLoopsInternal : ListOfShape from BOPCol is protected;
myAreas : ListOfShape from BOPCol is protected;
myShapesToAvoid : MapOfOrientedShape from BOPCol is protected;
- --
-
-
+
end BuilderArea;
//function :
//purpose :
//=======================================================================
- BOPAlgo_BuilderArea::BOPAlgo_BuilderArea()
+BOPAlgo_BuilderArea::BOPAlgo_BuilderArea()
:
BOPAlgo_Algo(),
- //myContext(NULL),
myShapes(myAllocator),
myLoops(myAllocator),
myLoopsInternal(myAllocator),
//function :
//purpose :
//=======================================================================
- BOPAlgo_BuilderArea::BOPAlgo_BuilderArea(const Handle(NCollection_BaseAllocator)& theAllocator)
+BOPAlgo_BuilderArea::BOPAlgo_BuilderArea
+ (const Handle(NCollection_BaseAllocator)& theAllocator)
:
BOPAlgo_Algo(theAllocator),
- //myContext(NULL),
myShapes(myAllocator),
myLoops(myAllocator),
myLoopsInternal(myAllocator),
//function : ~
//purpose :
//=======================================================================
- BOPAlgo_BuilderArea::~BOPAlgo_BuilderArea()
+BOPAlgo_BuilderArea::~BOPAlgo_BuilderArea()
{
}
//=======================================================================
//function : SetContext
//purpose :
//=======================================================================
- void BOPAlgo_BuilderArea::SetContext(const Handle(BOPInt_Context)& theContext)
+void BOPAlgo_BuilderArea::SetContext
+ (const Handle(IntTools_Context)& theContext)
{
myContext=theContext;
}
//function : Shapes
//purpose :
//=======================================================================
- const BOPCol_ListOfShape& BOPAlgo_BuilderArea::Shapes()const
+const BOPCol_ListOfShape& BOPAlgo_BuilderArea::Shapes()const
{
return myShapes;
}
//function : Loops
//purpose :
//=======================================================================
- const BOPCol_ListOfShape& BOPAlgo_BuilderArea::Loops()const
+const BOPCol_ListOfShape& BOPAlgo_BuilderArea::Loops()const
{
return myLoops;
}
{
return myAreas;
}
-/*
-//=======================================================================
-//function :PerformShapesToAvoid
-//purpose :
-//=======================================================================
- void BOPAlgo_BuilderArea::PerformShapesToAvoid()
-{
-}
-//=======================================================================
-//function : PerformLoops
-//purpose :
-//=======================================================================
- void BOPAlgo_BuilderArea::PerformLoops()
-{
-}
-//=======================================================================
-//function : PerformAreas
-//purpose :
-//=======================================================================
- void BOPAlgo_BuilderArea::PerformAreas()
-{
-}
-//=======================================================================
-//function : PerformInternalShapes
-//purpose :
-//=======================================================================
- void BOPAlgo_BuilderArea::PerformInternalShapes()
-{
-}
-*/
#include <TopExp_Explorer.hxx>
#include <IntTools_FClass2d.hxx>
-#include <BOPInt_Context.hxx>
+#include <IntTools_Context.hxx>
//
#include <BOPTools_AlgoTools.hxx>
static
Standard_Boolean IsInside(const TopoDS_Shape& ,
const TopoDS_Shape& ,
- Handle(BOPInt_Context)& );
+ Handle(IntTools_Context)& );
static
void MakeInternalWires(const BOPCol_MapOfShape& ,
BOPCol_ListOfShape& );
static
void GetWire(const TopoDS_Shape& ,
- TopoDS_Shape& );
+ TopoDS_Shape& );
//
#include <NCollection_UBTreeFiller.hxx>
#include <BOPCol_Box2DBndTree.hxx>
return;
}
if (myContext.IsNull()) {
- myContext = new BOPInt_Context;
+ myContext = new IntTools_Context;
}
}
//=======================================================================
if (!myShapesToAvoid.Contains(aE)) {
BOPTools::MapShapesAndAncestors(aE, TopAbs_VERTEX, TopAbs_EDGE, aMVE);
}
- //else {
- //int a=0;
- //}
}
aNbV=aMVE.Extent();
//
aItM.Initialize(myShapesToAvoid);
for (; aItM.More(); aItM.Next()) {
const TopoDS_Shape& aEE=aItM.Key();
- BOPTools::MapShapesAndAncestors(aEE, TopAbs_VERTEX, TopAbs_EDGE, aVEMap);
+ BOPTools::MapShapesAndAncestors(aEE,
+ TopAbs_VERTEX,
+ TopAbs_EDGE,
+ aVEMap);
}
//
bFlag=Standard_True;
bIsHole=aClsf.IsHole();
if (bIsHole) {
BOPTools::MapShapes(aWire, TopAbs_EDGE, aMHE);
- //
- bIsHole=Standard_True;
+ //
+ bIsHole=Standard_True;
}
else {
- bIsHole=Standard_False;
+ bIsHole=Standard_False;
}
}
//
}
//
if (aInOutMap.IsBound (aHole)){
- const TopoDS_Shape& aF2=aInOutMap(aHole);
- if (IsInside(aF, aF2, myContext)) {
+ const TopoDS_Shape& aF2=aInOutMap(aHole);
+ if (IsInside(aF, aF2, myContext)) {
aInOutMap.UnBind(aHole);
aInOutMap.Bind (aHole, aF);
}
//=======================================================================
Standard_Boolean IsInside(const TopoDS_Shape& theHole,
const TopoDS_Shape& theF2,
- Handle(BOPInt_Context)& theContext)
+ Handle(IntTools_Context)& theContext)
{
Standard_Boolean bRet;
Standard_Real aT, aU, aV;
#include <BOPTools_CoupleOfShape.hxx>
#include <BOPTools_AlgoTools.hxx>
//
-#include <BOPInt_Context.hxx>
+#include <IntTools_Context.hxx>
//
#include <BOPAlgo_ShellSplitter.hxx>
const BOPCol_IndexedMapOfShape& );
static
Standard_Boolean IsHole(const TopoDS_Shape& ,
- Handle(BOPInt_Context)& );
+ Handle(IntTools_Context)& );
static
Standard_Boolean IsInside(const TopoDS_Shape& ,
const TopoDS_Shape& ,
- Handle(BOPInt_Context)& );
+ Handle(IntTools_Context)& );
static
void MakeInternalShells(const BOPCol_MapOfShape& ,
BOPCol_ListOfShape& );
myErrorStatus=0;
//
if (myContext.IsNull()) {
- myContext=new BOPInt_Context;
+ myContext=new IntTools_Context;
}
//
TopoDS_Compound aC;
for (; aItM.More(); aItM.Next()) {
const TopoDS_Shape& aFF=aItM.Key();
BOPTools::MapShapesAndAncestors(aFF,
- TopAbs_EDGE, TopAbs_FACE,
- aEFMap);
+ TopAbs_EDGE, TopAbs_FACE,
+ aEFMap);
}
//
aItM.Initialize(myShapesToAvoid);
if (bIsHole) {
aHoleShells.Append(aShell);
BOPTools::MapShapes(aShell, TopAbs_FACE, aMHF);
- aSB.SetShape(aShell);
+ aSB.SetShape(aShell);
}
else {
// make a growth solid from a shell
aBB.Add (aSolid, aShell);
//
aNewSolids.Append (aSolid);
- aSB.SetShape(aSolid);
+ aSB.SetShape(aSolid);
}
}
//
}
//
if (aInOutMap.IsBound (aHole)){
- const TopoDS_Shape& aHole2=aInOutMap(aHole);
- if (IsInside(aHole, aHole2, myContext)) {
+ const TopoDS_Shape& aHole2=aInOutMap(aHole);
+ if (IsInside(aHole, aHole2, myContext)) {
aInOutMap.UnBind(aHole);
aInOutMap.Bind (aHole, aSolid);
}
}
aMEF.Clear();
BOPTools::MapShapesAndAncestors(aSolid,
- TopAbs_EDGE, TopAbs_FACE,
- aMEF);
+ TopAbs_EDGE, TopAbs_FACE,
+ aMEF);
//
// 2.1 Separate faces to process aMFP
aMFP.Clear();
const TopoDS_Face& aF=(*(TopoDS_Face*)(&aItMF.Key()));
if (!aMFx.Contains(aF)) {
if (BOPTools_AlgoTools::IsInternalFace(aF,
- aSolid,
- aMEF,
- 1.e-14,
- myContext)) {
+ aSolid,
+ aMEF,
+ 1.e-14,
+ myContext)) {
aMFP.Add(aF);
}
}
for (; aItM.More(); aItM.Next()) {
const TopoDS_Shape& aF=aItM.Key();
BOPTools::MapShapesAndAncestors(aF,
- TopAbs_EDGE, TopAbs_FACE,
- aMEF);
+ TopAbs_EDGE, TopAbs_FACE,
+ aMEF);
}
//
aItM.Initialize(theMF);
//purpose :
//=======================================================================
Standard_Boolean IsHole(const TopoDS_Shape& theS2,
- Handle(BOPInt_Context)& theContext)
+ Handle(IntTools_Context)& theContext)
{
TopoDS_Solid *pS2=(TopoDS_Solid *)&theS2;
BRepClass3d_SolidClassifier& aClsf=theContext->SolidClassifier(*pS2);
//=======================================================================
Standard_Boolean IsInside(const TopoDS_Shape& theS1,
const TopoDS_Shape& theS2,
- Handle(BOPInt_Context)& theContext)
+ Handle(IntTools_Context)& theContext)
{
TopExp_Explorer aExp;
TopAbs_State aState;
BOPTools::MapShapes(*pS2, TopAbs_EDGE, aBounds);
const TopoDS_Face& aF = (*(TopoDS_Face*)(&aExp.Current()));
aState=BOPTools_AlgoTools::ComputeState(aF, *pS2, 1.e-14,
- aBounds, theContext);
+ aBounds, theContext);
}
return (aState==TopAbs_IN);
}
#include <BOPCol_NCVector.hxx>
#include <BOPCol_TBB.hxx>
//
-#include <BOPInt_Context.hxx>
+#include <IntTools_Context.hxx>
//
#include <BOPDS_PaveBlock.hxx>
#include <BOPDS_ShapeInfo.hxx>
void operator()( const flexible_range<Standard_Integer>& aBR ) const {
Standard_Boolean bFlag;
Standard_Integer i, iBeg, iEnd;
- Handle(BOPInt_Context) aContext;
+ Handle(IntTools_Context) aContext;
//
- aContext=new BOPInt_Context;
+ aContext=new IntTools_Context;
//
BOPAlgo_VectorOfPairOfShapeBoolean& aVPSB=*myPVPSB;
//
return myFlag;
}
//
- void SetContext(const Handle(BOPInt_Context)& aContext) {
+ void SetContext(const Handle(IntTools_Context)& aContext) {
myContext=aContext;
}
//
- const Handle(BOPInt_Context)& Context()const {
+ const Handle(IntTools_Context)& Context()const {
return myContext;
}
//
Standard_Integer myFlag;
TopoDS_Vertex myV;
TopoDS_Face myF;
- Handle(BOPInt_Context) myContext;
+ Handle(IntTools_Context) myContext;
};
//
typedef BOPCol_NCVector<BOPAlgo_VFI> BOPAlgo_VectorOfVFI;
typedef BOPCol_TBBContextFunctor
<BOPAlgo_VFI,
BOPAlgo_VectorOfVFI,
- Handle(BOPInt_Context),
- BOPInt_Context> BOPAlgo_VFIFunctor;
+ Handle(IntTools_Context),
+ IntTools_Context> BOPAlgo_VFIFunctor;
//
typedef BOPCol_TBBContextCnt
<BOPAlgo_VFIFunctor,
BOPAlgo_VectorOfVFI,
- Handle(BOPInt_Context)> BOPAlgo_VFICnt;
+ Handle(IntTools_Context)> BOPAlgo_VFICnt;
//
//=======================================================================
//function : FillImagesFaces
#include <BOPCol_NCVector.hxx>
#include <BOPCol_TBB.hxx>
//
-#include <BOPInt_Context.hxx>
+#include <IntTools_Context.hxx>
//
#include <BOPDS_DS.hxx>
#include <BOPDS_ShapeInfo.hxx>
theLIF.Append(aFSDx);
}
else {
- bToReverse=BOPTools_AlgoTools::IsSplitToReverse(aFSDx,
- aF,
- myContext);
+ bToReverse=BOPTools_AlgoTools::IsSplitToReverse
+ (aFSDx, aF, myContext);
if (bToReverse) {
aFSDx.Reverse();
}
#include <BOPDS_VectorOfInterfEF.hxx>
#include <BOPDS_VectorOfInterfFF.hxx>
-#include <BOPInt_Context.hxx>
+#include <IntTools_Context.hxx>
#include <BOPTools.hxx>
#include <BOPTools_AlgoTools.hxx>
myIterator=theIterSI;
//
// 3 myContext
- myContext=new BOPInt_Context;
+ myContext=new IntTools_Context;
//
myErrorStatus=0;
}
#include <BOPDS_DS.hxx>
#include <BOPDS_IteratorSI.hxx>
-#include <BOPInt_Context.hxx>
+#include <IntTools_Context.hxx>
#include <BOPDS_Interf.hxx>
#include <TopoDS_Solid.hxx>
DataMapOfIntegerReal from BOPCol,
DataMapOfIntegerInteger from BOPCol,
--
- Context from BOPInt,
+ Context from IntTools,
--
SectionAttribute from BOPAlgo,
Create (theAllocator: BaseAllocator from BOPCol)
returns PaveFiller from BOPAlgo;
-
+
DS(me:out)
returns DS from BOPDS;
---C++:return const &
---C++: alias "Standard_EXPORT void SetArguments(const BOPCol_ListOfShape& theLS);"
Context(me:out)
- returns Context from BOPInt;
+ returns Context from IntTools;
SetSectionAttribute(me:out;
theSecAttr : SectionAttribute from BOPAlgo);
PerformVF(me:out)
is virtual protected;
-
+
PerformEE(me:out)
is virtual protected;
-
+
PerformEF(me:out)
is virtual protected;
MakeBlocks(me:out)
is protected;
-
+
MakePCurves(me:out)
is protected;
-
+
ProcessDE(me:out)
is protected;
FillShrunkData(me:out;
theType1: ShapeEnum from TopAbs;
theType2: ShapeEnum from TopAbs)
- is protected;
+ is protected;
PerformVerticesEE(me:out;
theMVCPB:out IndexedDataMapOfShapeCoupleOfPaveBlocks from BOPDS;
theAllocator:out BaseAllocator from BOPCol)
returns Integer from Standard
is protected;
-
+
PerformVerticesEF(me:out;
theMVCPB:out IndexedDataMapOfShapeCoupleOfPaveBlocks from BOPDS;
theAllocator:out BaseAllocator from BOPCol)
theMIF:MapOfInteger from BOPCol)
returns Boolean from Standard
is protected;
-
+
CheckFacePaves(myclass;
theN:Integer from Standard;
theMIFOn:MapOfInteger from BOPCol;
theMIFIn:MapOfInteger from BOPCol)
returns Boolean from Standard
is protected;
-
+
IsExistingVertex(me;
theP:Pnt from gp;
theTol:Real from Standard;
-- 1 - checks only EE;
-- 2 - checks only EF;
-- other - checks both types of intersections.
-
+
PutBoundPaveOnCurve(me:out;
theF1: Face from TopoDS;
theF2: Face from TopoDS;
theLPB: ListOfPaveBlock from BOPDS;
thePB: PaveBlock from BOPDS)
is protected;
-
+
MakeSplitEdge(me:out;
theV:Integer from Standard;
theF:Integer from Standard)
is protected;
-
+
GetEFPnts(me:out;
nF1 : Integer from Standard;
nF2 : Integer from Standard;
theMVB : MapOfInteger from BOPCol;
theMPB : out MapOfPaveBlock from BOPDS)
is protected;
- ---Purpose:
+ ---Purpose:
-- Adds the existing edges from the map <theMPBOnIn> which interfere
-- with the vertices from <theMVB> map to the post treatment of section edges.
myArguments : ListOfShape from BOPCol is protected;
myDS : PDS from BOPDS is protected;
myIterator : PIterator from BOPDS is protected;
- myContext : Context from BOPInt is protected;
+ myContext : Context from IntTools is protected;
mySectionAttribute : SectionAttribute from BOPAlgo is protected;
end PaveFiller;
#include <NCollection_BaseAllocator.hxx>
-#include <BOPInt_Context.hxx>
+#include <IntTools_Context.hxx>
#include <BOPDS_DS.hxx>
#include <BOPDS_Iterator.hxx>
//function : Context
//purpose :
//=======================================================================
-Handle(BOPInt_Context) BOPAlgo_PaveFiller::Context()
+Handle(IntTools_Context) BOPAlgo_PaveFiller::Context()
{
return myContext;
}
myIterator->Prepare();
//
// 3 myContext
- myContext=new BOPInt_Context;
+ myContext=new IntTools_Context;
//
myErrorStatus=0;
}
#include <BOPCol_NCVector.hxx>
#include <BOPCol_TBB.hxx>
-#include <BOPInt_Context.hxx>
+#include <IntTools_Context.hxx>
#include <BOPDS_Iterator.hxx>
#include <BOPDS_VectorOfInterfVE.hxx>
return myT;
}
//
- void SetContext(const Handle(BOPInt_Context)& aContext) {
+ void SetContext(const Handle(IntTools_Context)& aContext) {
myContext=aContext;
}
//
- const Handle(BOPInt_Context)& Context()const {
+ const Handle(IntTools_Context)& Context()const {
return myContext;
}
//
Standard_Real myT;
TopoDS_Vertex myV;
TopoDS_Edge myE;
- Handle(BOPInt_Context) myContext;
+ Handle(IntTools_Context) myContext;
};
//=======================================================================
typedef BOPCol_NCVector
typedef BOPCol_TBBContextFunctor
<BOPAlgo_VertexEdge,
BOPAlgo_VectorOfVertexEdge,
- Handle(BOPInt_Context),
- BOPInt_Context> BOPAlgo_VertexEdgeFunctor;
+ Handle(IntTools_Context),
+ IntTools_Context> BOPAlgo_VertexEdgeFunctor;
//
typedef BOPCol_TBBContextCnt
<BOPAlgo_VertexEdgeFunctor,
BOPAlgo_VectorOfVertexEdge,
- Handle(BOPInt_Context)> BOPAlgo_VertexEdgeCnt;
+ Handle(IntTools_Context)> BOPAlgo_VertexEdgeCnt;
//
//=======================================================================
// function: PerformVE
#include <BOPCol_NCVector.hxx>
#include <BOPCol_TBB.hxx>
//
-#include <BOPInt_Context.hxx>
-#include <BOPInt_ShrunkRange.hxx>
-#include <BOPInt_Tools.hxx>
+#include <IntTools_Context.hxx>
+#include <IntTools_ShrunkRange.hxx>
+#include <IntTools_Tools.hxx>
//
#include <BOPDS_DataMapOfPaveBlockListOfPaveBlock.hxx>
#include <BOPDS_MapOfPaveBlock.hxx>
return myT;
}
//
- void SetContext(const Handle(BOPInt_Context)& aContext) {
+ void SetContext(const Handle(IntTools_Context)& aContext) {
myContext=aContext;
}
//
- const Handle(BOPInt_Context)& Context()const {
+ const Handle(IntTools_Context)& Context()const {
return myContext;
}
//
TopoDS_Vertex myV;
TopoDS_Edge myE;
Handle(BOPDS_PaveBlock) myPB;
- Handle(BOPInt_Context) myContext;
+ Handle(IntTools_Context) myContext;
};
//=======================================================================
typedef BOPCol_NCVector
typedef BOPCol_TBBContextFunctor
<BOPAlgo_PVE,
BOPAlgo_VectorOfPVE,
- Handle(BOPInt_Context),
- BOPInt_Context> BOPAlgo_PVEFunctor;
+ Handle(IntTools_Context),
+ IntTools_Context> BOPAlgo_PVEFunctor;
//
typedef BOPCol_TBBContextCnt
<BOPAlgo_PVEFunctor,
BOPAlgo_VectorOfPVE,
- Handle(BOPInt_Context)> BOPAlgo_PVECnt;
+ Handle(IntTools_Context)> BOPAlgo_PVECnt;
/////////////////////////////////////////////////////////////////////////
//=======================================================================
// function: PerformEE
TopoDS_Vertex aVnew;
IntTools_Range aCR1, aCR2;
//
- BOPInt_Tools::VertexParameters(aCPart, aT1, aT2);
+ IntTools_Tools::VertexParameters(aCPart, aT1, aT2);
aTol = Precision::Confusion();
aCR1 = aCPart.Range1();
aCR2 = aCPart.Ranges2()(1);
//
//decide to keep the pave or not
- bIsOnPave[0] = BOPInt_Tools::IsOnPave1(aT1, aR11, aTol) ||
- BOPInt_Tools::IsOnPave1(aR11.First(), aCR1, aTol);
- bIsOnPave[1] = BOPInt_Tools::IsOnPave1(aT1, aR12, aTol) ||
- BOPInt_Tools::IsOnPave1(aR12.Last(), aCR1, aTol);
- bIsOnPave[2] = BOPInt_Tools::IsOnPave1(aT2, aR21, aTol) ||
- BOPInt_Tools::IsOnPave1(aR21.First(), aCR2, aTol);
- bIsOnPave[3] = BOPInt_Tools::IsOnPave1(aT2, aR22, aTol) ||
- BOPInt_Tools::IsOnPave1(aR22.Last(), aCR2, aTol);
+ bIsOnPave[0] = IntTools_Tools::IsOnPave1(aT1, aR11, aTol) ||
+ IntTools_Tools::IsOnPave1(aR11.First(), aCR1, aTol);
+ bIsOnPave[1] = IntTools_Tools::IsOnPave1(aT1, aR12, aTol) ||
+ IntTools_Tools::IsOnPave1(aR12.Last(), aCR1, aTol);
+ bIsOnPave[2] = IntTools_Tools::IsOnPave1(aT2, aR21, aTol) ||
+ IntTools_Tools::IsOnPave1(aR21.First(), aCR2, aTol);
+ bIsOnPave[3] = IntTools_Tools::IsOnPave1(aT2, aR22, aTol) ||
+ IntTools_Tools::IsOnPave1(aR22.Last(), aCR2, aTol);
//
aPB1->Indices(nV[0], nV[1]);
aPB2->Indices(nV[2], nV[3]);
{
Standard_Integer nE, nV1, nV2, iErr;
Standard_Real aT1, aT2, aTS1, aTS2;
- BOPInt_ShrunkRange aSR;
+ IntTools_ShrunkRange aSR;
//
myErrorStatus=0;
myWarningStatus = 0;
#include <BOPCol_NCVector.hxx>
#include <BOPCol_TBB.hxx>
//
-#include <BOPInt_Context.hxx>
+#include <IntTools_Context.hxx>
//
#include <BOPDS_Iterator.hxx>
#include <BOPDS_VectorOfInterfVF.hxx>
aT2=myT2;
}
//
- void SetContext(const Handle(BOPInt_Context)& aContext) {
+ void SetContext(const Handle(IntTools_Context)& aContext) {
myContext=aContext;
}
//
- const Handle(BOPInt_Context)& Context()const {
+ const Handle(IntTools_Context)& Context()const {
return myContext;
}
//
Standard_Real myT2;
TopoDS_Vertex myV;
TopoDS_Face myF;
- Handle(BOPInt_Context) myContext;
+ Handle(IntTools_Context) myContext;
};
//=======================================================================
typedef BOPCol_NCVector<BOPAlgo_VertexFace>
typedef BOPCol_TBBContextFunctor
<BOPAlgo_VertexFace,
BOPAlgo_VectorOfVertexFace,
- Handle(BOPInt_Context),
- BOPInt_Context> BOPAlgo_VertexFaceFunctor;
+ Handle(IntTools_Context),
+ IntTools_Context> BOPAlgo_VertexFaceFunctor;
//
typedef BOPCol_TBBContextCnt
<BOPAlgo_VertexFaceFunctor,
BOPAlgo_VectorOfVertexFace,
- Handle(BOPInt_Context)> BOPAlgo_VertexFaceCnt;
+ Handle(IntTools_Context)> BOPAlgo_VertexFaceCnt;
//
//=======================================================================
// function: PerformVF
#include <BOPCol_NCVector.hxx>
#include <BOPCol_TBB.hxx>
//
-#include <BOPInt_Context.hxx>
-#include <BOPInt_Tools.hxx>
+#include <IntTools_Context.hxx>
+#include <IntTools_Tools.hxx>
//
#include <BOPDS_Interf.hxx>
#include <BOPDS_Iterator.hxx>
typedef BOPCol_TBBContextFunctor
<BOPAlgo_EdgeFace,
BOPAlgo_VectorOfEdgeFace,
- Handle(BOPInt_Context),
- BOPInt_Context> BOPAlgo_EdgeFaceFunctor;
+ Handle(IntTools_Context),
+ IntTools_Context> BOPAlgo_EdgeFaceFunctor;
//
typedef BOPCol_TBBContextCnt
<BOPAlgo_EdgeFaceFunctor,
BOPAlgo_VectorOfEdgeFace,
- Handle(BOPInt_Context)> BOPAlgo_EdgeFaceCnt;
+ Handle(IntTools_Context)> BOPAlgo_EdgeFaceCnt;
//
//=======================================================================
//function : PerformEF
Standard_Real aT, aTolToDecide;
TopoDS_Vertex aVnew;
//
- BOPInt_Tools::VertexParameter(aCPart, aT);
+ IntTools_Tools::VertexParameter(aCPart, aT);
BOPTools_AlgoTools::MakeNewVertex(aE, aT, aF, aVnew);
//
const IntTools_Range& aR=aCPart.Range1();
//
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);
+ bIsOnPave[0]=IntTools_Tools::IsInRange(aR1, aR, aTolToDecide);
+ bIsOnPave[1]=IntTools_Tools::IsInRange(aR2, aR, aTolToDecide);
//
if (bIsOnPave[0] && bIsOnPave[1]) {
bV[0]=CheckFacePaves(nV[0], aMIFOn, aMIFIn);
#include <BOPCol_NCVector.hxx>
#include <BOPCol_TBB.hxx>
-#include <BOPInt_Context.hxx>
-#include <BOPInt_Tools.hxx>
+#include <IntTools_Context.hxx>
+#include <IntTools_Tools.hxx>
#include <BOPDS_Interf.hxx>
#include <BOPDS_Iterator.hxx>
#include <BOPAlgo_Tools.hxx>
#include <BRepBuilderAPI_MakeVertex.hxx>
#include <TopExp.hxx>
-#include <BOPInt_ShrunkRange.hxx>
+#include <IntTools_ShrunkRange.hxx>
#include <BOPDS_DataMapOfPaveBlockListOfPaveBlock.hxx>
static void ToleranceFF(const BRepAdaptor_Surface& aBAS1,
//
const IntTools_Curve& aIC=aCvsX(i);
const Handle(Geom_Curve)& aC3D= aIC.Curve();
- bValid=BOPInt_Tools::CheckCurve(aC3D, aTolR3D, aBox);
+ bValid=IntTools_Tools::CheckCurve(aC3D, aTolR3D, aBox);
if (bValid) {
iC=aVNC.Append()-1;
BOPDS_Curve& aNC=aVNC(iC);
#include <BOPDS_Iterator.hxx>
#include <BOPDS_ListOfPaveBlock.hxx>
-#include <BOPInt_ShrunkRange.hxx>
+#include <IntTools_ShrunkRange.hxx>
//=======================================================================
//class : BOPAlgo_ShrunkRange
//purpose :
//=======================================================================
-class BOPAlgo_ShrunkRange : public BOPInt_ShrunkRange {
+class BOPAlgo_ShrunkRange : public IntTools_ShrunkRange {
public:
BOPAlgo_ShrunkRange()
- : BOPInt_ShrunkRange(),
+ : IntTools_ShrunkRange(),
myWarningStatus(0) {
}
//
//
myWarningStatus=0;
//
- BOPInt_ShrunkRange::Perform();
+ IntTools_ShrunkRange::Perform();
if (myErrorStatus) {
myWarningStatus=1;
}
typedef BOPCol_TBBContextFunctor
<BOPAlgo_ShrunkRange,
BOPAlgo_VectorOfShrunkRange,
- Handle(BOPInt_Context),
- BOPInt_Context> BOPAlgo_ShrunkRangeFunctor;
+ Handle(IntTools_Context),
+ IntTools_Context> BOPAlgo_ShrunkRangeFunctor;
//
typedef BOPCol_TBBContextCnt
<BOPAlgo_ShrunkRangeFunctor,
BOPAlgo_VectorOfShrunkRange,
- Handle(BOPInt_Context)> BOPAlgo_ShrunkRangeCnt;
+ Handle(IntTools_Context)> BOPAlgo_ShrunkRangeCnt;
//
//=======================================================================
// function: FillShrunkData
#include <BOPCol_NCVector.hxx>
#include <BOPCol_IndexedDataMapOfShapeListOfShape.hxx>
//
-#include <BOPInt_Context.hxx>
+#include <IntTools_Context.hxx>
//
#include <BOPTools.hxx>
#include <BOPTools_AlgoTools.hxx>
BOPCol_MapOfOrientedShape AddedFacesMap;
BOPCol_IndexedDataMapOfShapeListOfShape aEFMap, aMEFP;
//
- Handle (BOPInt_Context) aContext=new BOPInt_Context;
+ Handle (IntTools_Context) aContext=new IntTools_Context;
//
const BOPCol_ListOfShape& myShapes=aCB.Shapes();
//
+++ /dev/null
--- Created by: Peter KURNEV
--- Copyright (c) 1999-2014 OPEN CASCADE SAS
---
--- This file is part of Open CASCADE Technology software library.
---
--- This library is free software; you can redistribute it and/or modify it under
--- the terms of the GNU Lesser General Public License version 2.1 as published
--- by the Free Software Foundation, with special exception defined in the file
--- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
--- distribution for complete text of the license and disclaimer of any warranty.
---
--- Alternatively, this file may be used under the terms of Open CASCADE
--- commercial license or contractual agreement.
-
-package BOPInt
-
- ---Purpose:
-
-uses
-
- gp,
- Bnd,
- TopAbs,
- Geom,
- GeomAPI,
- Geom2dHatch,
- BRepClass3d,
- TopoDS,
- TopTools,
- IntTools,
- --
- BOPCol
-
-is
- --
- -- classes
- --
- class Context;
- --class Range;
- class ShrunkRange;
- class Tools;
- --
- -- pointers
- --
-
-end BOPInt;
+++ /dev/null
--- Created by: Peter KURNEV
--- Copyright (c) 1999-2014 OPEN CASCADE SAS
---
--- This file is part of Open CASCADE Technology software library.
---
--- This library is free software; you can redistribute it and/or modify it under
--- the terms of the GNU Lesser General Public License version 2.1 as published
--- by the Free Software Foundation, with special exception defined in the file
--- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
--- distribution for complete text of the license and disclaimer of any warranty.
---
--- Alternatively, this file may be used under the terms of Open CASCADE
--- commercial license or contractual agreement.
-
-class Context from BOPInt
- inherits TShared from MMgt
-
-
----Purpose:
- -- The intersection Context contains geometrical
- -- and topological toolkit (classifiers, projectors, etc).
- -- The intersection Context is for caching the tools
- -- to increase the performance.
-
-
-uses
-
- Pnt2d from gp,
- Pnt from gp,
- State from TopAbs,
- Curve from Geom,
- ProjectPointOnCurve from GeomAPI,
- ProjectPointOnSurf from GeomAPI,
- Vertex from TopoDS,
- Face from TopoDS,
- Edge from TopoDS,
- Solid from TopoDS,
- SolidClassifier from BRepClass3d,
- FClass2d from IntTools,
- Curve from IntTools,
- BaseAllocator from BOPCol,
- DataMapOfShapeAddress from BOPCol,
- DataMapOfTransientAddress from BOPCol,
- Hatcher from Geom2dHatch,
- SurfaceRangeLocalizeData from IntTools
-
---raises
-
-is
- Create
- returns Context from BOPInt;
- ---C++: alias "Standard_EXPORT virtual ~BOPInt_Context();"
-
- Create (theAllocator: BaseAllocator from BOPCol)
- returns Context from BOPInt;
-
- FClass2d(me:mutable;
- aF: Face from TopoDS)
- returns FClass2d from IntTools;
- ---C++: return &
- ---Purpose:
- --- Returns a reference to point classifier
- --- for given face
- ---
-
- ProjPS (me:mutable;
- aF: Face from TopoDS)
- returns ProjectPointOnSurf from GeomAPI;
- ---C++: return &
- ---Purpose:
- --- Returns a reference to point projector
- --- for given face
- ---
-
- ProjPC (me:mutable;
- aE: Edge from TopoDS)
- returns ProjectPointOnCurve from GeomAPI;
- ---C++: return &
- ---Purpose:
- --- Returns a reference to point projector
- --- for given edge
- ---
-
- ProjPT (me:mutable;
- aC: Curve from Geom)
- returns ProjectPointOnCurve from GeomAPI;
- ---C++: return &
- ---Purpose:
- --- Returns a reference to point projector
- --- for given curve
- ---
-
- SurfaceData(me: mutable;
- aF: Face from TopoDS)
- returns SurfaceRangeLocalizeData from IntTools;
- ---C++: return &
- ---Purpose:
- --- Returns a reference to surface localization data
- --- for given face
-
- SolidClassifier(me:mutable;
- aSolid: Solid from TopoDS)
- returns SolidClassifier from BRepClass3d;
- ---C++: return &
- ---Purpose:
- --- Returns a reference to solid classifier
- --- for given solid
- ---
-
- Hatcher(me: mutable;
- aF: Face from TopoDS)
- returns Hatcher from Geom2dHatch;
- ---C++: return &
- ---Purpose:
- --- Returns a reference to 2D hatcher
- --- for given face
- ---
-
- ComputePE (me:mutable;
- theP : Pnt from gp;
- theTolP: Real from Standard;
- theE : Edge from TopoDS;
- theT :out Real from Standard)
- returns Integer from Standard;
- ---Purpose:
- --- Computes parameter of the Point theP on
- --- the edge aE.
- --- Returns zero if the distance between point
- --- and edge is less than sum of tolerance value of edge and theTopP,
- --- otherwise and for following conditions returns
- --- negative value
- --- 1. the edge is degenerated (-1)
- --- 2. the edge does not contain 3d curve and pcurves (-2)
- --- 3. projection algorithm failed (-3)
- ---
-
- ComputeVE (me:mutable;
- aV : Vertex from TopoDS;
- aE : Edge from TopoDS;
- aT :out Real from Standard)
- returns Integer from Standard;
- ---Purpose:
- --- Computes parameter of the vertex aV on
- --- the edge aE.
- --- Returns zero if the distance between vertex
- --- and edge is less than sum of tolerances,
- --- otherwise and for following conditions returns
- --- negative value
- --- 1. the edge is degenerated (-1)
- --- 2. the edge does not contain 3d curve and pcurves (-2)
- --- 3. projection algorithm failed (-3)
- ---
-
- --ComputeVE (me:mutable;
- --aV : Vertex from TopoDS;
- --aE : Edge from TopoDS;
- --aT :out Real from Standard;
- --bToUpdateVertex:out Boolean from Standard;
- --aDist :out Real from Standard)
- --returns Integer from Standard;
- ---Purpose:
- --- Computes parameter aT of the vertex aV on
- --- the edge aE.
- --- Returns zero if the distance between vertex
- --- and edge is less than sum of tolerances,
- --- otherwise and for following conditions returns
- --- negative value
- --- 1. the edge is degenerated (-1)
- --- 2. the edge does not contain 3d curve and pcurves (-2)
- --- 3. projection algorithm failed (-3)
- ---
- --- Output parameters
- --- bToUpdateVertex - the flag that indicates whether the
- --- vertex tolerance should be modified or not
- --- aDist - the value of the distance between the vertex
- --- and the edge
-
-
-
- ComputeVF (me:mutable;
- aV : Vertex from TopoDS;
- aF : Face from TopoDS;
- U : out Real from Standard;
- V : out Real from Standard)
- returns Integer from Standard;
- ---Purpose:
- --- Computes UV parameters of the vertex aV on face aF
- --- Returns zero if the distance between vertex and face is
- --- less than or equal the sum of tolerances and the projection
- --- point lays inside boundaries of the face.
- --- For following conditions returns negative value
- --- 1. projection algorithm failed (-1)
- --- 2. distance is more than sum of tolerances (-2)
- --- 3. projection point out or on the boundaries of face (-3)
- ---
-
- StatePointFace(me:mutable;
- aF : Face from TopoDS;
- aP2D : Pnt2d from gp)
- returns State from TopAbs;
- ---Purpose:
- --- Returns the state of the point aP2D
- --- relative to face aF
- ---
-
- IsPointInFace(me:mutable;
- aF : Face from TopoDS;
- aP2D : Pnt2d from gp)
- returns Boolean from Standard;
- ---Purpose:
- --- Returns true if the point aP2D is
- --- inside the boundaries of the face aF,
- --- otherwise returns false
- ---
-
-
- IsPointInOnFace(me:mutable;
- aF : Face from TopoDS;
- aP2D : Pnt2d from gp)
- returns Boolean from Standard;
- ---Purpose:
- --- Returns true if the point aP2D is
- --- inside or on the boundaries of aF
- ---
-
- IsValidPointForFace(me:mutable;
- aP3D : Pnt from gp;
- aF : Face from TopoDS;
- aTol : Real from Standard)
- returns Boolean from Standard;
- ---Purpose:
- --- Returns true if the distance between point aP3D
- --- and face aF is less or equal to tolerance aTol
- --- and projection point is inside or on the boundaries
- --- of the face aF
- ---
-
- IsValidPointForFaces(me:mutable;
- aP3D : Pnt from gp;
- aF1 : Face from TopoDS;
- aF2 : Face from TopoDS;
- aTol : Real from Standard)
- returns Boolean from Standard;
- ---Purpose:
- --- Returns true if IsValidPointForFace returns true
- --- for both face aF1 and aF2
- ---
-
- IsValidBlockForFace (me:mutable;
- aT1 : Real from Standard;
- aT2 : Real from Standard;
- aIC : Curve from IntTools;
- aF : Face from TopoDS;
- aTol : Real from Standard)
- returns Boolean from Standard;
- ---Purpose:
- --- Returns true if IsValidPointForFace returns true
- --- for some 3d point that lay on the curve aIC bounded by
- --- parameters aT1 and aT2
- ---
-
- IsValidBlockForFaces (me:mutable;
- aT1 : Real from Standard;
- aT2 : Real from Standard;
- aIC : Curve from IntTools;
- aF1 : Face from TopoDS;
- aF2 : Face from TopoDS;
- aTol : Real from Standard)
- returns Boolean from Standard;
- ---Purpose:
- --- Returns true if IsValidBlockForFace returns true
- --- for both faces aF1 and aF2
- ---
-
- IsVertexOnLine(me:mutable;
- aV : Vertex from TopoDS;
- aIC : Curve from IntTools;
- aTolC: Real from Standard;
- aT :out Real from Standard)
- returns Boolean from Standard;
- ---Purpose:
- --- Computes parameter of the vertex aV on
- --- the curve aIC.
- --- Returns true if the distance between vertex and
- --- curve is less than sum of tolerance of aV and aTolC,
- --- otherwise or if projection algorithm failed
- --- returns false (in this case aT isn't significant)
- ---
-
- IsVertexOnLine(me:mutable;
- aV : Vertex from TopoDS;
- aTolV: Real from Standard;
- aIC : Curve from IntTools;
- aTolC: Real from Standard;
- aT :out Real from Standard)
- returns Boolean from Standard;
- ---Purpose:
- --- Computes parameter of the vertex aV on
- --- the curve aIC.
- --- Returns true if the distance between vertex and
- --- curve is less than sum of tolerance of aV and aTolC,
- --- otherwise or if projection algorithm failed
- --- returns false (in this case aT isn't significant)
- ---
-
- ProjectPointOnEdge (me:mutable;
- aP : Pnt from gp;
- aE : Edge from TopoDS;
- aT :out Real from Standard)
- returns Boolean from Standard;
- ---Purpose:
- --- Computes parameter of the point aP on
- --- the edge aE.
- --- Returns false if projection algorithm failed
- --- other wiese returns true.
- ---
-
-fields
- myAllocator : BaseAllocator from BOPCol is protected;
- myFClass2dMap:DataMapOfShapeAddress from BOPCol is protected;
- myProjPSMap :DataMapOfShapeAddress from BOPCol is protected;
- myProjPCMap :DataMapOfShapeAddress from BOPCol is protected;
- mySClassMap :DataMapOfShapeAddress from BOPCol is protected;
- myProjPTMap :DataMapOfTransientAddress from BOPCol is protected;
- myHatcherMap :DataMapOfShapeAddress from BOPCol is protected;
- myProjSDataMap:DataMapOfShapeAddress from BOPCol is protected;
- myCreateFlag :Integer from Standard is protected;
-
-end Context;
-
+++ /dev/null
-// Created by: Peter KURNEV
-// Copyright (c) 1999-2014 OPEN CASCADE SAS
-//
-// This file is part of Open CASCADE Technology software library.
-//
-// This library is free software; you can redistribute it and/or modify it under
-// the terms of the GNU Lesser General Public License version 2.1 as published
-// by the Free Software Foundation, with special exception defined in the file
-// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-// distribution for complete text of the license and disclaimer of any warranty.
-//
-// Alternatively, this file may be used under the terms of Open CASCADE
-// commercial license or contractual agreement.
-
-#include <BOPInt_Context.ixx>
-
-#include <Precision.hxx>
-
-#include <Geom_Curve.hxx>
-#include <Geom_BoundedCurve.hxx>
-#include <GeomAPI_ProjectPointOnCurve.hxx>
-#include <GeomAPI_ProjectPointOnSurf.hxx>
-#include <GeomAdaptor_Curve.hxx>
-
-#include <Geom2dHatch_Intersector.hxx>
-#include <Geom2d_TrimmedCurve.hxx>
-
-#include <TopAbs_State.hxx>
-#include <TopoDS.hxx>
-#include <TopExp_Explorer.hxx>
-
-#include <BRep_Tool.hxx>
-#include <BRepAdaptor_Surface.hxx>
-
-#include <IntTools_Tools.hxx>
-#include <IntTools_FClass2d.hxx>
-//
-#include <Extrema_LocateExtPC.hxx>
-
-#include <Geom2d_Curve.hxx>
-#include <NCollection_IncAllocator.hxx>
-#include <IntTools_SurfaceRangeLocalizeData.hxx>
-
-
-//=======================================================================
-//function :
-//purpose :
-//=======================================================================
- BOPInt_Context::BOPInt_Context()
-:
- myAllocator(new NCollection_IncAllocator()),
- myFClass2dMap(100, myAllocator),
- myProjPSMap(100, myAllocator),
- myProjPCMap(100, myAllocator),
- mySClassMap(100, myAllocator),
- myProjPTMap(100, myAllocator),
- myHatcherMap(100, myAllocator),
- myProjSDataMap(100, myAllocator),
- myCreateFlag(0)
-{
-}
-//=======================================================================
-//function :
-//purpose :
-//=======================================================================
- BOPInt_Context::BOPInt_Context(const Handle(NCollection_BaseAllocator)& theAllocator)
-:
- myAllocator(theAllocator),
- myFClass2dMap(100, myAllocator),
- myProjPSMap(100, myAllocator),
- myProjPCMap(100, myAllocator),
- mySClassMap(100, myAllocator),
- myProjPTMap(100, myAllocator),
- myHatcherMap(100, myAllocator),
- myProjSDataMap(100, myAllocator),
- myCreateFlag(1)
-{
-}
-//=======================================================================
-//function : ~
-//purpose :
-//=======================================================================
- BOPInt_Context::~BOPInt_Context()
-{
- Standard_Address anAdr;
- BOPCol_DataMapIteratorOfDataMapOfShapeAddress aIt;
- BOPCol_DataMapIteratorOfDataMapOfTransientAddress aIt1;
- //
- IntTools_FClass2d* pFClass2d;
- //
- aIt.Initialize(myFClass2dMap);
- for (; aIt.More(); aIt.Next()) {
- anAdr=aIt.Value();
- pFClass2d=(IntTools_FClass2d*)anAdr;
- (*pFClass2d).~IntTools_FClass2d();
- myAllocator->Free(anAdr);
- }
- 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();
- //
- GeomAPI_ProjectPointOnCurve* pProjPC;
- aIt.Initialize(myProjPCMap);
- for (; aIt.More(); aIt.Next()) {
- anAdr=aIt.Value();
- pProjPC=(GeomAPI_ProjectPointOnCurve*)anAdr;
- (*pProjPC).~GeomAPI_ProjectPointOnCurve();
- myAllocator->Free(anAdr);
- }
- myProjPCMap.Clear();
- //
- //
- BRepClass3d_SolidClassifier* pSC;
- aIt.Initialize(mySClassMap);
- for (; aIt.More(); aIt.Next()) {
- anAdr=aIt.Value();
- pSC=(BRepClass3d_SolidClassifier*)anAdr;
- (*pSC).~BRepClass3d_SolidClassifier();
- myAllocator->Free(anAdr);
- }
- mySClassMap.Clear();
- //
- GeomAPI_ProjectPointOnCurve* pProjPT;
- aIt1.Initialize(myProjPTMap);
- for (; aIt1.More(); aIt1.Next()) {
- anAdr=aIt1.Value();
- pProjPT=(GeomAPI_ProjectPointOnCurve*)anAdr;
- (*pProjPT).~GeomAPI_ProjectPointOnCurve();
- myAllocator->Free(anAdr);
- }
- myProjPTMap.Clear();
- //
- Geom2dHatch_Hatcher* pHatcher;
- aIt.Initialize(myHatcherMap);
- for (; aIt.More(); aIt.Next()) {
- anAdr=aIt.Value();
- pHatcher=(Geom2dHatch_Hatcher*)anAdr;
- (*pHatcher).~Geom2dHatch_Hatcher();
- myAllocator->Free(anAdr);
- }
- myHatcherMap.Clear();
- //
- IntTools_SurfaceRangeLocalizeData* pSData = NULL;
- aIt.Initialize(myProjSDataMap);
- for (; aIt.More(); aIt.Next()) {
- anAdr=aIt.Value();
- pSData = (IntTools_SurfaceRangeLocalizeData*)anAdr;
- (*pSData).~IntTools_SurfaceRangeLocalizeData();
- myAllocator->Free(anAdr);
- }
- myProjSDataMap.Clear();
-}
-//=======================================================================
-//function : FClass2d
-//purpose :
-//=======================================================================
- IntTools_FClass2d& BOPInt_Context::FClass2d(const TopoDS_Face& aF)
-{
- Standard_Address anAdr;
- IntTools_FClass2d* pFClass2d;
- //
- if (!myFClass2dMap.IsBound(aF)) {
- Standard_Real aTolF;
- TopoDS_Face aFF;
- //
- aFF=aF;
- aFF.Orientation(TopAbs_FORWARD);
- aTolF=BRep_Tool::Tolerance(aFF);
- //
- pFClass2d=(IntTools_FClass2d*)myAllocator->Allocate(sizeof(IntTools_FClass2d));
- new (pFClass2d) IntTools_FClass2d(aFF, aTolF);
- //
- anAdr=(Standard_Address)pFClass2d;
- myFClass2dMap.Bind(aFF, anAdr);
- }
- else {
- anAdr=myFClass2dMap.Find(aF);
- pFClass2d=(IntTools_FClass2d*)anAdr;
- }
- return *pFClass2d;
-}
-//=======================================================================
-//function : ProjPS
-//purpose :
-//=======================================================================
- GeomAPI_ProjectPointOnSurf& BOPInt_Context::ProjPS(const TopoDS_Face& aF)
-{
- Standard_Address anAdr;
- GeomAPI_ProjectPointOnSurf* pProjPS;
-
- if (!myProjPSMap.IsBound(aF)) {
- Standard_Real Umin, Usup, Vmin, Vsup, anEpsT=1.e-12 ;
- BRepAdaptor_Surface aBAS;
- //
- 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();
- pProjPS->Init(aS ,Umin, Usup, Vmin, Vsup, anEpsT/*, Extrema_ExtAlgo_Tree*/);
- Extrema_ExtPS& anExtAlgo = const_cast<Extrema_ExtPS&>(pProjPS->Extrema());
- anExtAlgo.SetFlag(Extrema_ExtFlag_MIN);
- //
- anAdr=(Standard_Address)pProjPS;
- myProjPSMap.Bind(aF, anAdr);
- }
-
- else {
- anAdr=myProjPSMap.Find(aF);
- pProjPS=(GeomAPI_ProjectPointOnSurf*)anAdr;
- }
- return *pProjPS;
-}
-//=======================================================================
-//function : ProjPC
-//purpose :
-//=======================================================================
- GeomAPI_ProjectPointOnCurve& BOPInt_Context::ProjPC(const TopoDS_Edge& aE)
-{
- Standard_Address anAdr;
- GeomAPI_ProjectPointOnCurve* pProjPC;
-
- if (!myProjPCMap.IsBound(aE)) {
- Standard_Real f, l;
- //
- Handle(Geom_Curve)aC3D=BRep_Tool::Curve (aE, f, l);
- //
- pProjPC=(GeomAPI_ProjectPointOnCurve*)myAllocator->Allocate(sizeof(GeomAPI_ProjectPointOnCurve));
- new (pProjPC) GeomAPI_ProjectPointOnCurve();
- pProjPC->Init(aC3D, f, l);
- //
- anAdr=(Standard_Address)pProjPC;
- myProjPCMap.Bind(aE, anAdr);
- }
-
- else {
- anAdr=myProjPCMap.Find(aE);
- pProjPC=(GeomAPI_ProjectPointOnCurve*)anAdr;
- }
- return *pProjPC;
-}
-
-//=======================================================================
-//function : ProjPT
-//purpose :
-//=======================================================================
- GeomAPI_ProjectPointOnCurve& BOPInt_Context::ProjPT(const Handle(Geom_Curve)& aC3D)
-
-{
- Standard_Address anAdr;
- GeomAPI_ProjectPointOnCurve* pProjPT;
-
- if (!myProjPTMap.IsBound(aC3D)) {
- Standard_Real f, l;
- f=aC3D->FirstParameter();
- l=aC3D->LastParameter();
- //
- pProjPT=(GeomAPI_ProjectPointOnCurve*)myAllocator->Allocate(sizeof(GeomAPI_ProjectPointOnCurve));
- new (pProjPT) GeomAPI_ProjectPointOnCurve();
- pProjPT->Init(aC3D, f, l);
- //
- anAdr=(Standard_Address)pProjPT;
- myProjPTMap.Bind(aC3D, anAdr);
- }
-
- else {
- anAdr=myProjPTMap.Find(aC3D);
- pProjPT=(GeomAPI_ProjectPointOnCurve*)anAdr;
- }
- return *pProjPT;
-}
-//=======================================================================
-//function : SolidClassifier
-//purpose :
-//=======================================================================
- BRepClass3d_SolidClassifier& BOPInt_Context::SolidClassifier(const TopoDS_Solid& aSolid)
-{
- Standard_Address anAdr;
- BRepClass3d_SolidClassifier* pSC;
-
- if (!mySClassMap.IsBound(aSolid)) {
- //
- pSC=(BRepClass3d_SolidClassifier*)myAllocator->Allocate(sizeof(BRepClass3d_SolidClassifier));
- new (pSC) BRepClass3d_SolidClassifier(aSolid);
- //
- anAdr=(Standard_Address)pSC;
- mySClassMap.Bind(aSolid, anAdr);
- }
-
- else {
- anAdr=mySClassMap.Find(aSolid);
- pSC =(BRepClass3d_SolidClassifier*)anAdr;
- }
- return *pSC;
-}
-
-//=======================================================================
-//function : Hatcher
-//purpose :
-//=======================================================================
- Geom2dHatch_Hatcher& BOPInt_Context::Hatcher(const TopoDS_Face& aF)
-{
- Standard_Address anAdr;
- Geom2dHatch_Hatcher* pHatcher;
- //
- if (!myHatcherMap.IsBound(aF)) {
- Standard_Real aTolArcIntr, aTolTangfIntr, aTolHatch2D, aTolHatch3D;
- Standard_Real aU1, aU2, aEpsT;
- TopAbs_Orientation aOrE;
- Handle(Geom_Surface) aS;
- Handle(Geom2d_Curve) aC2D;
- Handle(Geom2d_TrimmedCurve) aCT2D;
- TopoDS_Face aFF;
- TopExp_Explorer aExp;
- //
- aTolHatch2D=1.e-8;
- aTolHatch3D=1.e-8;
- aTolArcIntr=1.e-10;
- aTolTangfIntr=1.e-10;
- aEpsT=Precision::PConfusion();
- //
- Geom2dHatch_Intersector aIntr(aTolArcIntr, aTolTangfIntr);
- pHatcher=new Geom2dHatch_Hatcher(aIntr,
- aTolHatch2D, aTolHatch3D,
- Standard_True, Standard_False);
-
- //
- aFF=aF;
- aFF.Orientation(TopAbs_FORWARD);
- aS=BRep_Tool::Surface(aFF);
-
- aExp.Init (aFF, TopAbs_EDGE);
- for (; aExp.More() ; aExp.Next()) {
- const TopoDS_Edge& aE=*((TopoDS_Edge*)&aExp.Current());
- aOrE=aE.Orientation();
- //
- aC2D=BRep_Tool::CurveOnSurface (aE, aFF, aU1, aU2);
- if (aC2D.IsNull() ) {
- continue;
- }
- if (fabs(aU1-aU2) < aEpsT) {
- continue;
- }
- //
- aCT2D=new Geom2d_TrimmedCurve(aC2D, aU1, aU2);
- pHatcher->AddElement(aCT2D, aOrE);
- }// for (; aExp.More() ; aExp.Next()) {
- //
- anAdr=(Standard_Address)pHatcher;
- myHatcherMap.Bind(aFF, anAdr);
- }//if (!myHatcherMap.IsBound(aF)) {
- //
- else {
- anAdr=myHatcherMap.Find(aF);
- pHatcher=(Geom2dHatch_Hatcher*)anAdr;
- }
-
- return *pHatcher;
-}
-
-//=======================================================================
-//function : SurfaceData
-//purpose :
-//=======================================================================
- IntTools_SurfaceRangeLocalizeData& BOPInt_Context::SurfaceData(const TopoDS_Face& aF)
-{
- Standard_Address anAdr;
- IntTools_SurfaceRangeLocalizeData* pSData;
- //
- if (!myProjSDataMap.IsBound(aF)) {
- pSData=new IntTools_SurfaceRangeLocalizeData(3,
- 3,
- 10. * Precision::PConfusion(),
- 10. * Precision::PConfusion());
- //
- anAdr=(Standard_Address)pSData;
- myProjSDataMap.Bind(aF, anAdr);
- }
-
- else {
- anAdr=myProjSDataMap.Find(aF);
- pSData=(IntTools_SurfaceRangeLocalizeData*)anAdr;
- }
- return *pSData;
-
-}
-
-//=======================================================================
-//function : ComputePE
-//purpose :
-//=======================================================================
- Standard_Integer BOPInt_Context::ComputePE(const gp_Pnt& aP1,
- const Standard_Real aTolP1,
- const TopoDS_Edge& aE2,
- Standard_Real& aT)
-{
- if (!BRep_Tool::IsGeometric(aE2)) {
- return -2;
- }
- Standard_Real aDist, aTolE2, aTolSum;
- Standard_Integer aNbProj;
- //
- GeomAPI_ProjectPointOnCurve& aProjector=ProjPC(aE2);
- aProjector.Perform(aP1);
-
- aNbProj=aProjector.NbPoints();
- if (!aNbProj) {
- return -3;
- }
- //
- aDist=aProjector.LowerDistance();
- //
- aTolE2=BRep_Tool::Tolerance(aE2);
- aTolSum=aTolP1+aTolE2;
- //
- aT=aProjector.LowerDistanceParameter();
- if (aDist > aTolSum) {
- return -4;
- }
- return 0;
-}
-//=======================================================================
-//function : ComputeVE
-//purpose :
-//=======================================================================
- Standard_Integer BOPInt_Context::ComputeVE(const TopoDS_Vertex& aV1,
- const TopoDS_Edge& aE2,
- Standard_Real& aT)
-{
- if (BRep_Tool::Degenerated(aE2)) {
- return -1;
- }
- if (!BRep_Tool::IsGeometric(aE2)) {
- return -2;
- }
- Standard_Real aDist, aTolV1, aTolE2, aTolSum;
- Standard_Integer aNbProj;
- gp_Pnt aP;
- //
- aP=BRep_Tool::Pnt(aV1);
- //
- GeomAPI_ProjectPointOnCurve& aProjector=ProjPC(aE2);
- aProjector.Perform(aP);
-
- aNbProj=aProjector.NbPoints();
- if (!aNbProj) {
- return -3;
- }
- //
- aDist=aProjector.LowerDistance();
-
- // tolerance of check for coincidence is sum of tolerances of edge and vertex
- // extended by additional Precision::Confusion() to allow for interference where
- // it is very close but not fit to tolerance (see #24108)
- aTolV1=BRep_Tool::Tolerance(aV1);
- aTolE2=BRep_Tool::Tolerance(aE2);
- aTolSum = aTolV1 + aTolE2 + Precision::Confusion();
- //
- aT=aProjector.LowerDistanceParameter();
- if (aDist > aTolSum) {
- return -4;
- }
- return 0;
-}
-//=======================================================================
-//function : ComputeVS
-//purpose :
-//=======================================================================
- Standard_Integer BOPInt_Context::ComputeVF(const TopoDS_Vertex& aV1,
- const TopoDS_Face& aF2,
- Standard_Real& U,
- Standard_Real& V)
-{
- Standard_Real aTolV1, aTolF2, aTolSum, aDist;
- gp_Pnt aP;
-
- aP=BRep_Tool::Pnt(aV1);
- //
- // 1. Check if the point is projectable on the surface
- GeomAPI_ProjectPointOnSurf& aProjector=ProjPS(aF2);
- aProjector.Perform(aP);
- //
- if (!aProjector.IsDone()) { // the point is not projectable on the surface
- return -1;
- }
- //
- // 2. Check the distance between the projection point and
- // the original point
- aDist=aProjector.LowerDistance();
-
- aTolV1=BRep_Tool::Tolerance(aV1);
- aTolF2=BRep_Tool::Tolerance(aF2);
- aTolSum=aTolV1+aTolF2;
- if (aDist > aTolSum) {
- // the distance is too large
- return -2;
- }
- aProjector.LowerDistanceParameters(U, V);
- //
- gp_Pnt2d aP2d(U, V);
- Standard_Boolean pri=IsPointInFace (aF2, aP2d);
- if (!pri) {// the point lays on the surface but out of the face
- return -3;
- }
- return 0;
-}
-//=======================================================================
-//function : StatePointFace
-//purpose :
-//=======================================================================
- TopAbs_State BOPInt_Context::StatePointFace(const TopoDS_Face& aF,
- const gp_Pnt2d& aP2d)
-{
- TopAbs_State aState;
- IntTools_FClass2d& aClass2d=FClass2d(aF);
- aState=aClass2d.Perform(aP2d);
- return aState;
-}
-//=======================================================================
-//function : IsPointInFace
-//purpose :
-//=======================================================================
- Standard_Boolean BOPInt_Context::IsPointInFace(const TopoDS_Face& aF,
- const gp_Pnt2d& aP2d)
-{
- TopAbs_State aState=StatePointFace(aF, aP2d);
- if (aState==TopAbs_OUT || aState==TopAbs_ON) {
- return Standard_False;
- }
- return Standard_True;
-}
-//=======================================================================
-//function : IsPointInOnFace
-//purpose :
-//=======================================================================
- Standard_Boolean BOPInt_Context::IsPointInOnFace(const TopoDS_Face& aF,
- const gp_Pnt2d& aP2d)
-{
- TopAbs_State aState=StatePointFace(aF, aP2d);
- if (aState==TopAbs_OUT) {
- return Standard_False;
- }
- return Standard_True;
-}
-//=======================================================================
-//function : IsValidPointForFace
-//purpose :
-//=======================================================================
- Standard_Boolean BOPInt_Context::IsValidPointForFace(const gp_Pnt& aP,
- const TopoDS_Face& aF,
- const Standard_Real aTol)
-{
- Standard_Boolean bFlag;
- Standard_Real Umin, U, V;
-
- GeomAPI_ProjectPointOnSurf& aProjector=ProjPS(aF);
- aProjector.Perform(aP);
-
- bFlag=aProjector.IsDone();
- if (bFlag) {
-
- Umin=aProjector.LowerDistance();
- //if (Umin > 1.e-3) { // it was
- if (Umin > aTol) {
- return !bFlag;
- }
- //
- aProjector.LowerDistanceParameters(U, V);
- gp_Pnt2d aP2D(U, V);
- bFlag=IsPointInOnFace (aF, aP2D);
- }
- return bFlag;
-}
-//=======================================================================
-//function : IsValidPointForFaces
-//purpose :
-//=======================================================================
- Standard_Boolean BOPInt_Context::IsValidPointForFaces (const gp_Pnt& aP,
- const TopoDS_Face& aF1,
- const TopoDS_Face& aF2,
- const Standard_Real aTol)
-{
- Standard_Boolean bFlag1, bFlag2;
-
- bFlag1=IsValidPointForFace(aP, aF1, aTol);
- if (!bFlag1) {
- return bFlag1;
- }
- bFlag2=IsValidPointForFace(aP, aF2, aTol);
- return bFlag2;
-}
-//=======================================================================
-//function : IsValidBlockForFace
-//purpose :
-//=======================================================================
- Standard_Boolean BOPInt_Context::IsValidBlockForFace (const Standard_Real aT1,
- const Standard_Real aT2,
- const IntTools_Curve& aC,
- const TopoDS_Face& aF,
- const Standard_Real aTol)
-{
- Standard_Boolean bFlag;
- Standard_Real aTInterm;
- gp_Pnt aPInterm;
-
- aTInterm=IntTools_Tools::IntermediatePoint(aT1, aT2);
-
- Handle(Geom_Curve) aC3D=aC.Curve();
- // point 3D
- aC3D->D0(aTInterm, aPInterm);
- //
- bFlag=IsValidPointForFace (aPInterm, aF, aTol);
- return bFlag;
-}
-//=======================================================================
-//function : IsValidBlockForFaces
-//purpose :
-//=======================================================================
- Standard_Boolean BOPInt_Context::IsValidBlockForFaces (const Standard_Real aT1,
- const Standard_Real aT2,
- const IntTools_Curve& aC,
- const TopoDS_Face& aF1,
- const TopoDS_Face& aF2,
- const Standard_Real aTol)
-{
- Standard_Boolean bFlag1, bFlag2;
- //
- Handle(Geom2d_Curve) aPC1 = aC.FirstCurve2d();
- Handle(Geom2d_Curve) aPC2 = aC.SecondCurve2d();
- if( !aPC1.IsNull() && !aPC2.IsNull() ) {
- Standard_Real aMidPar = IntTools_Tools::IntermediatePoint(aT1, aT2);
- gp_Pnt2d aPnt2D;
-
-
- aPC1->D0(aMidPar, aPnt2D);
- bFlag1 = IsPointInOnFace(aF1, aPnt2D);
-
- if( !bFlag1 )
- return bFlag1;
-
- aPC2->D0(aMidPar, aPnt2D);
- bFlag2 = IsPointInOnFace(aF2, aPnt2D);
- return bFlag2;
- }
- //
-
- bFlag1=IsValidBlockForFace (aT1, aT2, aC, aF1, aTol);
- if (!bFlag1) {
- return bFlag1;
- }
- bFlag2=IsValidBlockForFace (aT1, aT2, aC, aF2, aTol);
- return bFlag2;
-}
-//=======================================================================
-//function : IsVertexOnLine
-//purpose :
-//=======================================================================
- Standard_Boolean BOPInt_Context::IsVertexOnLine (const TopoDS_Vertex& aV,
- const IntTools_Curve& aC,
- const Standard_Real aTolC,
- Standard_Real& aT)
-{
- Standard_Boolean bRet;
- Standard_Real aTolV;
- //
- aTolV=BRep_Tool::Tolerance(aV);
- bRet=BOPInt_Context::IsVertexOnLine(aV, aTolV, aC, aTolC , aT);
- //
- return bRet;
-}
-//=======================================================================
-//function : IsVertexOnLine
-//purpose :
-//=======================================================================
- Standard_Boolean BOPInt_Context::IsVertexOnLine (const TopoDS_Vertex& aV,
- const Standard_Real aTolV,
- const IntTools_Curve& aC,
- const Standard_Real aTolC,
- Standard_Real& aT)
-{
- Standard_Real aFirst, aLast, aDist, aTolSum;
- Standard_Integer aNbProj;
- gp_Pnt aPv;
-
- aPv=BRep_Tool::Pnt(aV);
-
- Handle(Geom_Curve) aC3D=aC.Curve();
-
-
- aTolSum=aTolV+aTolC;
- //
- GeomAdaptor_Curve aGAC(aC3D);
- GeomAbs_CurveType aType=aGAC.GetType();
- if (aType==GeomAbs_BSplineCurve ||
- aType==GeomAbs_BezierCurve) {
- aTolSum=2.*aTolSum;
- if (aTolSum<1.e-5) {
- aTolSum=1.e-5;
- }
- }
- else {
- aTolSum=2.*aTolSum;//xft
- if(aTolSum < 1.e-6)
- aTolSum = 1.e-6;
- }
- //
- aFirst=aC3D->FirstParameter();
- aLast =aC3D->LastParameter();
- //
- //Checking extermities first
- if (!Precision::IsInfinite(aFirst)) {
- gp_Pnt aPCFirst=aC3D->Value(aFirst);
- aDist=aPv.Distance(aPCFirst);
- if (aDist < aTolSum) {
- aT=aFirst;
- //
- if(aDist > aTolV) {
- Extrema_LocateExtPC anExt(aPv, aGAC, aFirst, 1.e-10);
-
- if(anExt.IsDone()) {
- Extrema_POnCurv aPOncurve = anExt.Point();
- aT = aPOncurve.Parameter();
-
- if((aT > (aLast + aFirst) * 0.5) ||
- (aPv.Distance(aPOncurve.Value()) > aTolSum) ||
- (aPCFirst.Distance(aPOncurve.Value()) < Precision::Confusion()))
- aT = aFirst;
- }
- }
- //
- return Standard_True;
- }
- }
- //
- //if (!Precision::IsInfinite(aFirst)) {
- if (!Precision::IsInfinite(aLast)) {
- gp_Pnt aPCLast=aC3D->Value(aLast);
- aDist=aPv.Distance(aPCLast);
- if (aDist < aTolSum) {
- aT=aLast;
- //
- if(aDist > aTolV) {
- Extrema_LocateExtPC anExt(aPv, aGAC, aLast, 1.e-10);
-
- if(anExt.IsDone()) {
- Extrema_POnCurv aPOncurve = anExt.Point();
- aT = aPOncurve.Parameter();
-
- if((aT < (aLast + aFirst) * 0.5) ||
- (aPv.Distance(aPOncurve.Value()) > aTolSum) ||
- (aPCLast.Distance(aPOncurve.Value()) < Precision::Confusion()))
- aT = aLast;
- }
- }
- //
- return Standard_True;
- }
- }
- //
- GeomAPI_ProjectPointOnCurve& aProjector=ProjPT(aC3D);
- aProjector.Perform(aPv);
-
- aNbProj=aProjector.NbPoints();
- if (!aNbProj) {
- Handle(Geom_BoundedCurve) aBC=
- Handle(Geom_BoundedCurve)::DownCast(aC3D);
- if (!aBC.IsNull()) {
- gp_Pnt aPStart=aBC->StartPoint();
- gp_Pnt aPEnd =aBC->EndPoint();
-
- aDist=aPv.Distance(aPStart);
- if (aDist < aTolSum) {
- aT=aFirst;
- return Standard_True;
- }
-
- aDist=aPv.Distance(aPEnd);
- if (aDist < aTolSum) {
- aT=aLast;
- return Standard_True;
- }
- }
-
- return Standard_False;
- }
-
- aDist=aProjector.LowerDistance();
-
- if (aDist > aTolSum) {
- return Standard_False;
- }
-
- aT=aProjector.LowerDistanceParameter();
-
- return Standard_True;
-}
-//=======================================================================
-//function : ProjectPointOnEdge
-//purpose :
-//=======================================================================
- Standard_Boolean BOPInt_Context::ProjectPointOnEdge(const gp_Pnt& aP,
- const TopoDS_Edge& anEdge,
- Standard_Real& aT)
-{
- Standard_Integer aNbPoints;
-
- GeomAPI_ProjectPointOnCurve& aProjector=ProjPC(anEdge);
- aProjector.Perform(aP);
-
- aNbPoints=aProjector.NbPoints();
- if (aNbPoints) {
- aT=aProjector.LowerDistanceParameter();
- return Standard_True;
- }
- return Standard_False;
-}
-
+++ /dev/null
--- Created by: Peter KURNEV
--- Copyright (c) 1999-2014 OPEN CASCADE SAS
---
--- This file is part of Open CASCADE Technology software library.
---
--- This library is free software; you can redistribute it and/or modify it under
--- the terms of the GNU Lesser General Public License version 2.1 as published
--- by the Free Software Foundation, with special exception defined in the file
--- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
--- distribution for complete text of the license and disclaimer of any warranty.
---
--- Alternatively, this file may be used under the terms of Open CASCADE
--- commercial license or contractual agreement.
-
-class ShrunkRange from BOPInt
-
- ---Purpose:
- --- The class provides the computation of
- --- a working (shrunk) range [t1, t2] for
- --- the 3D-curve of the edge.
-
-uses
- Box from Bnd,
- Edge from TopoDS,
- Vertex from TopoDS,
- Context from BOPInt
-
---raises
-
-is
- Create
- returns ShrunkRange from BOPInt;
- ---C++: alias "Standard_EXPORT virtual ~BOPInt_ShrunkRange();"
-
- SetData (me:out;
- aE : Edge from TopoDS;
- aT1 : Real from Standard;
- aT2 : Real from Standard;
- aV1 : Vertex from TopoDS;
- aV2 : Vertex from TopoDS);
-
- SetContext(me:out;
- aCtx: Context from BOPInt);
-
- Context(me)
- returns Context from BOPInt;
- ---C++: return const &
-
- SetShrunkRange(me:out;
- aT1 : Real from Standard;
- aT2 : Real from Standard);
-
- ShrunkRange(me;
- aT1 :out Real from Standard;
- aT2 :out Real from Standard);
-
- BndBox (me)
- returns Box from Bnd;
- ---C++: return const &
-
- Edge (me)
- returns Edge from TopoDS;
- ---C++: return const &
-
- Perform(me:out);
-
- ErrorStatus(me)
- returns Integer from Standard;
- ---Purpose:
- --- Returns code of computing shrunk range
- --- completion
- --- 0 - means successful completion
- --- 1 - nothing has been done
- --- 2 - initial range is out of edge's range
- --- 3 - first boundary of initial range is more than
- --- last boundary
- --- 4 - projection of first vertex failed
- --- 5 - projection of second vertex failed
- --- 6 - shrunk range can not be computed
- --- shrunk range is setted to initial range
- ---
-
-fields
- myEdge : Edge from TopoDS is protected;
- myV1 : Vertex from TopoDS is protected;
- myV2 : Vertex from TopoDS is protected;
- myT1 : Real from Standard is protected;
- myT2 : Real from Standard is protected;
- myTS1 : Real from Standard is protected;
- myTS2 : Real from Standard is protected;
- myBndBox : Box from Bnd is protected;
- myCtx : Context from BOPInt is protected;
- myErrorStatus : Integer from Standard is protected;
-
-end ShrunkRange;
+++ /dev/null
-// Created by: Peter KURNEV
-// Copyright (c) 1999-2014 OPEN CASCADE SAS
-//
-// This file is part of Open CASCADE Technology software library.
-//
-// This library is free software; you can redistribute it and/or modify it under
-// the terms of the GNU Lesser General Public License version 2.1 as published
-// by the Free Software Foundation, with special exception defined in the file
-// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-// distribution for complete text of the license and disclaimer of any warranty.
-//
-// Alternatively, this file may be used under the terms of Open CASCADE
-// commercial license or contractual agreement.
-
-#include <BOPInt_ShrunkRange.ixx>
-
-#include <Precision.hxx>
-
-#include <gp.hxx>
-#include <gp_Circ.hxx>
-
-#include <Geom_Curve.hxx>
-
-#include <BRep_Tool.hxx>
-#include <BRepBuilderAPI_MakeVertex.hxx>
-#include <BRepAdaptor_Curve.hxx>
-#include <BndLib_Add3dCurve.hxx>
-#include <BOPInt_Context.hxx>
-#include <gp_Lin.hxx>
-#include <ElCLib.hxx>
-
-//=======================================================================
-//function :
-//purpose :
-//=======================================================================
- BOPInt_ShrunkRange::BOPInt_ShrunkRange ()
-{
- myT1=-99;
- myT2=myT1;
- myTS1=myT1;
- myTS2=myT1;
- myErrorStatus=1;
-}
-//=======================================================================
-//function : ~
-//purpose :
-//=======================================================================
-BOPInt_ShrunkRange::~BOPInt_ShrunkRange ()
-{
-}
-//=======================================================================
-//function : SetData
-//purpose :
-//=======================================================================
-void BOPInt_ShrunkRange::SetData(const TopoDS_Edge& aE,
- const Standard_Real aT1,
- const Standard_Real aT2,
- const TopoDS_Vertex& aV1,
- const TopoDS_Vertex& aV2)
-{
- myEdge=aE;
- myV1=aV1;
- myV2=aV2;
- myT1=aT1;
- myT2=aT2;
- myErrorStatus=1;
-}
-//=======================================================================
-//function : SetContext
-//purpose :
-//=======================================================================
-void BOPInt_ShrunkRange::SetContext(const Handle(BOPInt_Context)& aCtx)
-{
- myCtx=aCtx;
-}
-//=======================================================================
-//function : Context
-//purpose :
-//=======================================================================
-const Handle(BOPInt_Context)& BOPInt_ShrunkRange::Context()const
-{
- return myCtx;
-}
-//=======================================================================
-//function : Edge
-//purpose :
-//=======================================================================
-const TopoDS_Edge& BOPInt_ShrunkRange::Edge() const
-{
- return myEdge;
-}
-//=======================================================================
-//function : ShrunkRange
-//purpose :
-//=======================================================================
-void BOPInt_ShrunkRange::ShrunkRange(Standard_Real& aT1,
- Standard_Real& aT2) const
-{
- aT1=myTS1;
- aT2=myTS2;
-}
-//=======================================================================
-//function : BndBox
-//purpose :
-//=======================================================================
-const Bnd_Box& BOPInt_ShrunkRange::BndBox() const
-{
- return myBndBox;
-}
-//=======================================================================
-//function : ErrorStatus
-//purpose :
-//=======================================================================
-Standard_Integer BOPInt_ShrunkRange::ErrorStatus() const
-{
- return myErrorStatus;
-}
-
-//=======================================================================
-//function : SetShrunkRange
-//purpose :
-//=======================================================================
-void BOPInt_ShrunkRange::SetShrunkRange(const Standard_Real aT1,
- const Standard_Real aT2)
-{
- myTS1=aT1;
- myTS2=aT2;
- //
- BRepAdaptor_Curve aBAC(myEdge);
- BndLib_Add3dCurve::Add (aBAC, aT1, aT2, 0., myBndBox);
-}
-
-//=======================================================================
-//function : Perform
-//purpose :
-//=======================================================================
-void BOPInt_ShrunkRange::Perform()
-{
- Standard_Real aCF, aCL, aTolE, aTolV1;
- Standard_Real aTolV2, t1, t11, t1C, t2, t12, t2C;
- Standard_Real aCoeff1, aCoeff2, aTol1, aTol2, dt1, dt2, aR, anEps;
- Standard_Integer pri;
- Standard_Boolean bInf1, bInf2, bAppr;
- GeomAbs_CurveType aCurveType;
- Handle(Geom_Curve) aC;
- //
- myErrorStatus=0;
- myTS1=-99;
- myTS2=myTS1;
- anEps = 1.e-8;
- //
- aTolE =BRep_Tool::Tolerance(myEdge);
- aTolV1=BRep_Tool::Tolerance(myV1);
- aTolV2=BRep_Tool::Tolerance(myV2);
- //for edges with the tolerance value
- //more than the tolerance value of vertices
- if (aTolV1 < aTolE) {
- aTolV1 = aTolE;
- }
- //
- if (aTolV2 < aTolE) {
- aTolV2 = aTolE;
- }
- //
- t1=myT1;
- t2=myT2;
- //
- BRepAdaptor_Curve aBAC(myEdge);
- aCurveType=aBAC.GetType();
- //
- aC=BRep_Tool::Curve(myEdge, aCF, aCL);
- BRep_Tool::Range(myEdge, aCF, aCL);
- //
- if (t1 < aCF || t2 > aCL) {
- myErrorStatus=2;
- return;
- }
- //
- bAppr = !(fabs(t2 - t1) > 100);
- if (fabs(t2 - t1) < anEps) {
- myErrorStatus=7;
- return;
- }
- //
- if (t1 > t2) {
- myErrorStatus=3;
- return;
- }
- //
- aTol1 = aTolV1+aTolE;
- aTol2 = aTolV2+aTolE;
- //
- aCoeff1 = (aTolE>0.05) ? 1. : 2.;
- aCoeff2 = aCoeff1;
- if (aCoeff1 == 2.) {
- aCoeff1=(aTol1>0.05) ? 1.5 : 2.;
- aCoeff2=(aTol2>0.05) ? 1.5 : 2.;
- }
- // xf
- if (aCurveType==GeomAbs_Line && (aCoeff1 != 1 || aCoeff2 != 1)) {
- Standard_Real aTV1, aTV2, aEps;
- gp_Pnt aPV1, aPV2, aPC1, aPC2;
- gp_Lin aL;
- //
- aEps=Precision::Confusion();
- aEps=aEps*aEps;//1.e-14;
- aL=aBAC.Line();
- //
- aPV1=BRep_Tool::Pnt(myV1);
- aTV1=ElCLib::Parameter(aL, aPV1);
- //
- aPV2=BRep_Tool::Pnt(myV2);
- aTV2=ElCLib::Parameter(aL, aPV2);
- //
- if (fabs(aTV1-aCF)<aEps) {
- aCoeff1=1.;
- }
- if (fabs(aTV2-aCL)<aEps) {
- aCoeff2=1.;
- }
- }
- //
- dt1=aCoeff1*aTol1;
- dt2=aCoeff2*aTol2;
- // xt
- //
- if (aCurveType==GeomAbs_Line) {
- Standard_Real dt1x, dt2x;
-
- dt1x = aBAC.Resolution(dt1);
- t11=t1+dt1x;
-
- dt2x = aBAC.Resolution(dt2);
- t12=t2-dt2x;
-
- if (t11>t2 || t12<t1) {
- t1C=t1;
- t2C=t2;
- myTS1=t1C;
- myTS2=t2C;
- //
- // BndBox
- Standard_Real ddx=aTolE;//1.e-12;
- BndLib_Add3dCurve::Add (aBAC, t1C, t2C, ddx, myBndBox);
-
- myErrorStatus=6;//0
- return;
- }
- }
- //
- if (aCurveType==GeomAbs_Circle) {
- gp_Circ aCrc=aBAC.Circle();
- aR=aCrc.Radius();
- t1C=t1+dt1/aR;
- t2C=t2-dt2/aR;
- }
- else {
- //
- // Vertex1 => t1C
- gp_Pnt aP1,aP11;
- aC->D0 (t1, aP1);
- //
- bInf1=Precision::IsNegativeInfinite(t1);
- if (bInf1) {
- t1C=t1;
- }
- //
- else {
- Standard_Real d1 = aCoeff1*aTol1;
- // dt1 = aBAC.Resolution(d1);
- //
- gp_Vec aD1vec1;
- gp_Pnt aPoint;
- aBAC.D1(t1, aPoint, aD1vec1);
- Standard_Real ad1length1 = aD1vec1.Magnitude();
- Standard_Boolean bTryOtherPoints = Standard_False;
- dt1 = (t2 - t1) * 0.5;
-
- if(ad1length1 > 1.e-12) {
- dt1 = d1 / ad1length1;
-
- if(dt1 > (t2 - t1)) {
- // bad parametrization, big tolerance or too small range
- bTryOtherPoints = Standard_True;
- }
- }
- else {
- bTryOtherPoints = Standard_True;
- }
-
- if(bTryOtherPoints) {
- Standard_Integer nbsamples = 5;
- Standard_Integer ii = 0;
- Standard_Real adelta = (t2 - t1) / (nbsamples + 1);
- Standard_Boolean bFound = Standard_False;
-
- for(ii = 1; ii <= nbsamples; ii++) {
- Standard_Real aparameter = t1 + (adelta * ii);
- gp_Pnt aPoint2;
- aBAC.D1(aparameter, aPoint2, aD1vec1);
-
- if(aPoint.Distance(aPoint2) < d1)
- dt1 = adelta * ii;
- ad1length1 = aD1vec1.Magnitude();
-
- if(ad1length1 > 1.e-12) {
- dt1 = d1 / ad1length1;
-
- if(dt1 < (t2 - t1)) {
- bFound = Standard_True;
- break;
- }
- }
- }
-
- if(!bFound) {
- if(dt1 > (t2 - t1)) {
- dt1 = aBAC.Resolution(d1);
- }
- }
- }
- //
- if (!bAppr) {
- dt1 *= 10;
- }
- t11=t1+dt1;
- aC->D0 (t11, aP11);
-
- gp_Vec aV11(aP1, aP11);
- // avoid exception if aP1 == aP11
- if (aV11.SquareMagnitude() < gp::Resolution())
- t1C = t1;
- else {
- gp_Dir aD11(aV11);
-
- gp_Pnt aP1L;
- //
- aP1L.SetCoord (aP1.X()+d1*aD11.X(),
- aP1.Y()+d1*aD11.Y(),
- aP1.Z()+d1*aD11.Z());
-
- BRepBuilderAPI_MakeVertex aMV1(aP1L);
- const TopoDS_Vertex& aV1L=aMV1.Vertex();
- //
- pri=myCtx->ComputeVE (aV1L, myEdge, t1C);
- //
- if (pri==-3) {
- myErrorStatus=4;
- return;
- }
- }
- }
- //
- // Vertex2 => t2C
- gp_Pnt aP2, aP12;
- aC->D0 (t2, aP2);
- //
- bInf2=Precision::IsPositiveInfinite(t2);
- if (bInf2) {
- t2C=t2;
- }
- //
- else {
- Standard_Real d2 = aCoeff2*aTol2;
- // dt2 = aBAC.Resolution(d2);
-
- //
- gp_Vec aD1vec2;
- gp_Pnt aPoint;
- aBAC.D1(t2, aPoint, aD1vec2);
- Standard_Real ad1length2 = aD1vec2.Magnitude();
- Standard_Boolean bTryOtherPoints = Standard_False;
- dt2 = (t2 - t1) * 0.5;
-
- if(ad1length2 > 1.e-12) {
- dt2 = d2 / ad1length2;
-
- if(dt2 > (t2 - t1)) {
- bTryOtherPoints = Standard_True;
- }
- }
- else {
- bTryOtherPoints = Standard_True;
- }
-
- if(bTryOtherPoints) {
- Standard_Integer nbsamples = 5;
- Standard_Integer ii = 0;
- Standard_Real adelta = (t2 - t1) / (nbsamples + 1);
- Standard_Boolean bFound = Standard_False;
-
- for(ii = 1; ii <= nbsamples; ii++) {
- Standard_Real aparameter = t2 - (adelta * ii);
- gp_Pnt aPoint2;
- aBAC.D1(aparameter, aPoint2, aD1vec2);
-
- if(aPoint.Distance(aPoint2) < d2)
- dt2 = adelta * ii;
- ad1length2 = aD1vec2.Magnitude();
-
- if(ad1length2 > 1.e-12) {
- dt2 = d2 / ad1length2;
-
- if(dt2 < (t2 - t1)) {
- bFound = Standard_True;
- break;
- }
- }
- }
-
- if(!bFound) {
- if(dt2 > (t2 - t1)) {
- dt2 = aBAC.Resolution(d2);
- }
- }
- }
- //
- if (!bAppr) {
- dt2 *= 10;
- }
-
- t12=t2-dt2;
- aC->D0 (t12, aP12);
-
- gp_Vec aV12(aP2, aP12);
- // avoid exception if aP1 == aP11
- if (aV12.SquareMagnitude() < gp::Resolution())
- t2C = t2;
- else {
- gp_Dir aD12(aV12);
-
- gp_Pnt aP2L;
- //
- aP2L.SetCoord (aP2.X()+d2*aD12.X(),
- aP2.Y()+d2*aD12.Y(),
- aP2.Z()+d2*aD12.Z());
-
- BRepBuilderAPI_MakeVertex aMV2(aP2L);
- const TopoDS_Vertex& aV2L=aMV2.Vertex();
- //
- pri=myCtx->ComputeVE (aV2L, myEdge, t2C);
- //
- if (pri==-3) {
- myErrorStatus=5;
- return;
- }
- }
- }
- } // else {
- //
- if (t1C>t2){
- t1C=0.5*(t2+t1);
- t2C=t1C+0.1*(t2-t1C);
- }
-
- if (t1C>t2C) {
- t2C=t1C+0.1*(t2-t1C);
- }
- //
- if (t2C-t1C < anEps) {
- myErrorStatus = 7;
- return;
- }
- //
- myTS1=t1C;
- myTS2=t2C;
- //
- // BndBox
- Standard_Real ddx=aTolE;//1.e-12;
- BndLib_Add3dCurve::Add (aBAC, t1C, t2C, ddx, myBndBox);
-}
-/////////////////////////////////////////////////////////////////////////
-//
-// myErrorStatus :
-//
-// 1- Nothing has been done
-// 2- The source range is out of the edge's range
-// 3- t1 < t2 for source range
-// 4- Can not project V1L to the Edge;
-// 5- Can not project V2L to the Edge;
-// 6- for obtained shrunk range [t11, t12] -> t11>t2 || t12<t1;
-// 7- too small range.
+++ /dev/null
--- Created by: Peter KURNEV
--- Copyright (c) 1999-2014 OPEN CASCADE SAS
---
--- This file is part of Open CASCADE Technology software library.
---
--- This library is free software; you can redistribute it and/or modify it under
--- the terms of the GNU Lesser General Public License version 2.1 as published
--- by the Free Software Foundation, with special exception defined in the file
--- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
--- distribution for complete text of the license and disclaimer of any warranty.
---
--- Alternatively, this file may be used under the terms of Open CASCADE
--- commercial license or contractual agreement.
-
-class Tools from BOPInt
-
----Purpose:
-
-uses
- Box from Bnd,
- Lin from gp,
- Pln from gp,
- Pnt from gp,
- Curve from Geom,
-
- Edge from TopoDS,
- Face from TopoDS,
- Range from IntTools,
- CommonPrt from IntTools
---raises
-
-is
-
-
- CheckCurve(myclass;
- theC:Curve from Geom;
- theTol:Real from Standard;
- theBox:out Box from Bnd)
- returns Boolean from Standard;
-
- IsOnPave(myclass;
- theT:Real from Standard;
- theRange:Range from IntTools;
- theTol: Real from Standard)
- returns Boolean from Standard;
-
- VertexParameters(myclass;
- theCP:CommonPrt from IntTools;
- theT1:out Real from Standard;
- theT2:out Real from Standard);
-
- VertexParameter(myclass;
- theCP:CommonPrt from IntTools;
- theT:out Real from Standard);
-
- IsOnPave1(myclass;
- theT:Real from Standard;
- theRange:Range from IntTools;
- theTol: Real from Standard)
- returns Boolean from Standard;
-
- IsInRange(myclass;
- theRRef : Range from IntTools;
- theR : Range from IntTools;
- theTol : Real from Standard)
- returns Boolean from Standard;
- ---Purpose: Checks if the range <theR> interfere with the range <theRRef>
-
- SegPln(myclass;
- theLin : Lin from gp;
- theTLin1 : Real from Standard;
- theTLin2 : Real from Standard;
- theTolLin: Real from Standard;
- thePln : Pln from gp;
- theTolPln: Real from Standard;
- theP :out Pnt from gp;
- theT :out Real from Standard;
- theTolP :out Real from Standard;
- theTmin :out Real from Standard;
- theTmax :out Real from Standard)
- returns Integer from Standard;
---fields
-
-end Tools;
+++ /dev/null
-// Created by: Peter KURNEV
-// Copyright (c) 1999-2014 OPEN CASCADE SAS
-//
-// This file is part of Open CASCADE Technology software library.
-//
-// This library is free software; you can redistribute it and/or modify it under
-// the terms of the GNU Lesser General Public License version 2.1 as published
-// by the Free Software Foundation, with special exception defined in the file
-// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-// distribution for complete text of the license and disclaimer of any warranty.
-//
-// Alternatively, this file may be used under the terms of Open CASCADE
-// commercial license or contractual agreement.
-
-#include <BOPInt_Tools.ixx>
-
-#include <gp_Pnt.hxx>
-#include <BndLib_Add3dCurve.hxx>
-#include <Bnd_Box.hxx>
-#include <Geom_Curve.hxx>
-#include <GeomAdaptor_Curve.hxx>
-
-//=======================================================================
-//function : CheckCurve
-//purpose :
-//=======================================================================
- Standard_Boolean BOPInt_Tools::CheckCurve(const Handle (Geom_Curve)& aC3D,
- const Standard_Real aTolR3D,
- Bnd_Box& aBox)
-{
- Standard_Boolean bRet;
- Standard_Real aXmin, aYmin, aZmin, aXmax, aYmax, aZmax, dX, dY, dZ;
- Standard_Real dS, aTol;
- GeomAdaptor_Curve aGAC;
- //
- aGAC.Load(aC3D);
- BndLib_Add3dCurve::Add(aGAC, aTolR3D, aBox);
- // 910/B1
- aBox.Get(aXmin, aYmin, aZmin, aXmax, aYmax, aZmax);
- dX=aXmax-aXmin;
- dY=aYmax-aYmin;
- dZ=aZmax-aZmin;
- dS=1.e-12;
- aTol=2.*aTolR3D+dS;
- bRet=(dX>aTol || dY>aTol || dZ>aTol);
- //
- return bRet;
-}
-
-
-//=======================================================================
-//function : IsOnPave
-//purpose :
-//=======================================================================
- Standard_Boolean BOPInt_Tools::IsOnPave(const Standard_Real aT1,
- const IntTools_Range& aRange,
- const Standard_Real aTolerance)
-{
- Standard_Boolean firstisonpave1, firstisonpave2, bIsOnPave;
- //
- firstisonpave1 = (Abs(aRange.First() - aT1) < aTolerance);
- firstisonpave2 = (Abs(aRange.Last() - aT1) < aTolerance);
- bIsOnPave=(firstisonpave1 || firstisonpave2);
- return bIsOnPave;
-}
-//=======================================================================
-// function: VertexParameters
-// purpose:
-//=======================================================================
- void BOPInt_Tools::VertexParameters(const IntTools_CommonPrt& aCPart,
- Standard_Real& aT1,
- Standard_Real& aT2)
-{
- const IntTools_Range& aR1=aCPart.Range1();
- aT1=0.5*(aR1.First()+aR1.Last());
- //
- if((aCPart.VertexParameter1() >= aR1.First()) &&
- (aCPart.VertexParameter1() <= aR1.Last())) {
- aT1 = aCPart.VertexParameter1();
- }
- //
- const IntTools_SequenceOfRanges& aRanges2=aCPart.Ranges2();
- const IntTools_Range& aR2=aRanges2(1);
- aT2=0.5*(aR2.First()+aR2.Last());
- //
- if((aCPart.VertexParameter2() >= aR2.First()) &&
- (aCPart.VertexParameter2() <= aR2.Last())) {
- aT2 = aCPart.VertexParameter2();
- }
-}
-//=======================================================================
-// function: VertexParameter
-// purpose:
-//=======================================================================
- void BOPInt_Tools::VertexParameter(const IntTools_CommonPrt& aCPart,
- Standard_Real& aT)
-{
- const IntTools_Range& aR=aCPart.Range1();
- aT=0.5*(aR.First()+aR.Last());
- if((aCPart.VertexParameter1() >= aR.First()) &&
- (aCPart.VertexParameter1() <= aR.Last())) {
- aT = aCPart.VertexParameter1();
- }
-}
-//=======================================================================
-// function: IsOnPave1
-// purpose:
-//=======================================================================
- Standard_Boolean BOPInt_Tools::IsOnPave1(const Standard_Real aTR,
- const IntTools_Range& aCPRange,
- const Standard_Real aTolerance)
-{
- Standard_Boolean bIsOnPave;
- Standard_Real aT1, aT2, dT1, dT2;
- //
- aT1=aCPRange.First();
- aT2=aCPRange.Last();
- bIsOnPave=(aTR>=aT1 && aTR<=aT1);
- if (bIsOnPave) {
- return bIsOnPave;
- }
- //
- dT1=Abs(aTR-aT1);
- dT2=Abs(aTR-aT2);
- bIsOnPave=(dT1<=aTolerance || dT2<=aTolerance);
- return bIsOnPave;
-}
-
-//=======================================================================
-// function: IsInRange
-// purpose:
-//=======================================================================
- Standard_Boolean BOPInt_Tools::IsInRange(const IntTools_Range& aRRef,
- const IntTools_Range& aR,
- const Standard_Real aTolerance)
-{
- Standard_Boolean bIsIn;
- Standard_Real aT1, aT2, aTRef1, aTRef2;
- //
- aR.Range(aT1, aT2);
- aRRef.Range(aTRef1, aTRef2);
- //
- aTRef1-=aTolerance;
- aTRef2+=aTolerance;
- //
- bIsIn = (aT1>=aTRef1 && aT1<=aTRef2) ||
- (aT2>=aTRef1 && aT2<=aTRef2);
- //
- return bIsIn;
-}
-
-//=======================================================================
-//function : SegPln
-//purpose :
-//=======================================================================
- Standard_Integer BOPInt_Tools::SegPln(const gp_Lin& theLin,
- const Standard_Real theTLin1,
- const Standard_Real theTLin2,
- const Standard_Real theTolLin,
- const gp_Pln& thePln,
- const Standard_Real theTolPln,
- gp_Pnt& theP,
- Standard_Real& theTP,
- Standard_Real& theTolP,
- Standard_Real& theTPmin,
- Standard_Real& theTPmax)
-{
- Standard_Integer iRet;
- Standard_Real aTol, aA, aB, aC, aD, aE, aH, aTP, aDist1, aDist2;
- gp_Pnt aP1, aP2;
- //
- iRet=0;
- aTol=theTolLin+theTolPln;
- //
- const gp_Ax3& aPosPln=thePln.Position();
- const gp_Dir& aDirPln=aPosPln.Direction();
- const gp_Pnt& aLocPln=aPosPln.Location();
- //
- const gp_Dir& aDirLin=theLin.Direction();
- const gp_Pnt& aLocLin=theLin.Location();
- //
- aP1.SetXYZ(aLocLin.XYZ()+theTLin1*aDirLin.XYZ());
- aDist1=aDirPln.X()*(aP1.X()-aLocPln.X())+
- aDirPln.Y()*(aP1.Y()-aLocPln.Y())+
- aDirPln.Z()*(aP1.Z()-aLocPln.Z());
- //
- aP2.SetXYZ(aLocLin.XYZ()+theTLin2*aDirLin.XYZ());
- aDist2=aDirPln.X()*(aP2.X()-aLocPln.X())+
- aDirPln.Y()*(aP2.Y()-aLocPln.Y())+
- aDirPln.Z()*(aP2.Z()-aLocPln.Z());
- //
- if (aDist1<aTol && aDist2<aTol){
- iRet=1; // common block
- return iRet;
- }
- //
- if (aDist1*aDist2 > 0.) {
- iRet=2; // segment lays on one side to the Plane
- return iRet;
- }
- //
- thePln.Coefficients(aA, aB, aC, aD);
- aE=aA*aLocLin.X()+aB*aLocLin.Y()+aC*aLocLin.Z()+aD;
- aH=aA*aDirLin.X()+aB*aDirLin.Y()+aC*aDirLin.Z();
- aTP=-aE/aH;
- if (aTP < theTLin1-aTol || aTP > theTLin2+aTol) {
- iRet=3; // no intersections due to range of the Line
- return iRet;
- }
- //
- theTP=aTP;
- theP.SetXYZ(aLocLin.XYZ()+aTP*aDirLin.XYZ());
- theTolP=aTol;
- theTPmin=theTP-theTolPln;
- theTPmax=theTP+theTolPln;
- iRet=0; // intersection point
- return iRet;
-}
IntTools,
ProjLib,
--
- BOPCol,
- BOPInt
+ BOPCol
is
--
ListOfShape from BOPCol,
IndexedMapOfShape from BOPCol,
IndexedDataMapOfShapeListOfShape from BOPCol,
- Context from BOPInt,
+ Context from IntTools,
ListOfCoupleOfShape from BOPTools,
Range from IntTools
IsSplitToReverse(myclass;
theSplit : Shape from TopoDS;
theShape : Shape from TopoDS;
- theContext:out Context from BOPInt)
+ theContext:out Context from IntTools)
---Purpose: Returns True if the shape theSplit has opposite
-- direction than theShape
-- theContext - cashed geometrical tools
IsSplitToReverse(myclass;
theSplit : Face from TopoDS;
theShape : Face from TopoDS;
- theContext:out Context from BOPInt)
+ theContext:out Context from IntTools)
---Purpose: Returns True if normal direction of the face
-- theShape is not the same as for the face
-- theSplit
IsSplitToReverse (myclass;
aE1: Edge from TopoDS;
aE2: Edge from TopoDS;
- aContext:out Context from BOPInt)
+ aContext:out Context from IntTools)
returns Boolean from Standard;
AreFacesSameDomain(myclass;
theF1: Face from TopoDS;
theF2: Face from TopoDS;
- theContext:out Context from BOPInt)
+ theContext:out Context from IntTools)
returns Boolean from Standard;
CheckSameGeom (myclass;
theF1: Face from TopoDS;
theF2: Face from TopoDS;
- theContext:out Context from BOPInt)
+ theContext:out Context from IntTools)
returns Boolean from Standard;
Sense (myclass;
theFace :Face from TopoDS;
theLCEF :out ListOfCoupleOfShape from BOPTools;
theFaceOff :out Face from TopoDS;
- theContext :out Context from BOPInt)
+ theContext :out Context from IntTools)
returns Boolean from Standard;
---Purpose: For the face theFace and its edge theEdge
theEdge :Edge from TopoDS;
theFace1 :Face from TopoDS;
theFace2 :Face from TopoDS;
- theContext:out Context from BOPInt)
+ theContext:out Context from IntTools)
---Purpose: Returns True if the face theFace is inside of the
-- couple of faces theFace1, theFace2.
-- The faces theFace, theFace1, theFace2 must
theFace :Face from TopoDS;
theEdge :Edge from TopoDS;
theLF :out ListOfShape from BOPCol;
- theContext:out Context from BOPInt)
+ theContext:out Context from IntTools)
---Purpose: Returns True if the face theFace is inside of the
-- appropriate couple of faces (from the set theLF) .
-- The faces of the set theLF and theFace must
theSolid :Solid from TopoDS;
theMEF :out IndexedDataMapOfShapeListOfShape from BOPCol;
theTol :Real from Standard;
- theContext:out Context from BOPInt)
+ theContext:out Context from IntTools)
---Purpose: Returns True if the face theFace is inside the
-- solid theSolid.
-- theMEF - Map Edge/Faces for theSolid
thePoint :Pnt from gp;
theSolid :Solid from TopoDS;
theTol :Real from Standard;
- theContext:out Context from BOPInt)
+ theContext:out Context from IntTools)
---Purpose: Computes the 3-D state of the point thePoint
-- toward solid theSolid.
-- theTol - value of precision of computation
theVertex:Vertex from TopoDS;
theSolid :Solid from TopoDS;
theTol :Real from Standard;
- theContext:out Context from BOPInt)
+ theContext:out Context from IntTools)
---Purpose: Computes the 3-D state of the vertex theVertex
-- toward solid theSolid.
-- theTol - value of precision of computation
theEdge :Edge from TopoDS;
theSolid :Solid from TopoDS;
theTol :Real from Standard;
- theContext:out Context from BOPInt)
+ theContext:out Context from IntTools)
---Purpose: Computes the 3-D state of the edge theEdge
-- toward solid theSolid.
-- theTol - value of precision of computation
theSolid :Solid from TopoDS;
theTol :Real from Standard;
theBounds:out IndexedMapOfShape from BOPCol;
- theContext:out Context from BOPInt)
+ theContext:out Context from IntTools)
---Purpose: Computes the 3-D state of the face theFace
-- toward solid theSolid.
-- theTol - value of precision of computation
theShape :Shape from TopoDS;
theSolid :Solid from TopoDS;
theTol :Real from Standard;
- theContext:out Context from BOPInt)
+ theContext:out Context from IntTools)
---Purpose: Computes the 3-D state of the shape theShape
-- toward solid theSolid.
-- theTol - value of precision of computation
aShR : Range from IntTools;
aF : Face from TopoDS;
aE : Edge from TopoDS;
- aContext:out Context from BOPInt)
+ aContext:out Context from IntTools)
returns Boolean from Standard;
---Purpose:
--- Returns TRUE if PaveBlock <aPB> lays on the face <aF>, i.e
IsMicroEdge(myclass;
theEdge : Edge from TopoDS;
- theContext : Context from BOPInt)
+ theContext : Context from IntTools)
returns Boolean from Standard;
---Purpose:
--- Checks if it is possible to compute shrunk range for the edge <aE>.
#include <BOPCol_IndexedMapOfShape.hxx>
#include <BOPCol_MapOfShape.hxx>
//
-#include <BOPInt_ShrunkRange.hxx>
+#include <IntTools_ShrunkRange.hxx>
//
static
Standard_Boolean FindFacePairs (const TopoDS_Edge& theE,
const BOPCol_ListOfShape& thLF,
BOPTools_ListOfCoupleOfShape& theLCFF,
- Handle(BOPInt_Context)& theContext);
+ Handle(IntTools_Context)& theContext);
static
TopAbs_Orientation Orientation(const TopoDS_Edge& anE,
const TopoDS_Face& aF);
const gp_Dir& aDTgt,
gp_Dir& aDN,
gp_Dir& aDB,
- Handle(BOPInt_Context)& theContext,
+ Handle(IntTools_Context)& theContext,
GeomAPI_ProjectPointOnSurf& aProjPL,
const Standard_Real aDt);
static
const gp_Pnt& aP,
gp_Dir& aDB,
gp_Pnt& aPOut,
- Handle(BOPInt_Context)& theContext,
+ Handle(IntTools_Context)& theContext,
GeomAPI_ProjectPointOnSurf& aProjPL,
const Standard_Real aDt);
static
(const TopoDS_Shape& theS,
const TopoDS_Solid& theRef,
const Standard_Real theTol,
- Handle(BOPInt_Context)& theContext)
+ Handle(IntTools_Context)& theContext)
{
TopAbs_State aState;
TopAbs_ShapeEnum aType;
const TopoDS_Solid& theRef,
const Standard_Real theTol,
BOPCol_IndexedMapOfShape& theBounds,
- Handle(BOPInt_Context)& theContext)
+ Handle(IntTools_Context)& theContext)
{
TopAbs_State aState;
TopExp_Explorer aExp;
(const TopoDS_Vertex& theV,
const TopoDS_Solid& theRef,
const Standard_Real theTol,
- Handle(BOPInt_Context)& theContext)
+ Handle(IntTools_Context)& theContext)
{
TopAbs_State aState;
gp_Pnt aP3D;
(const TopoDS_Edge& theE,
const TopoDS_Solid& theRef,
const Standard_Real theTol,
- Handle(BOPInt_Context)& theContext)
+ Handle(IntTools_Context)& theContext)
{
Standard_Real aT1, aT2, aT = 0.;
TopAbs_State aState;
(const gp_Pnt& theP,
const TopoDS_Solid& theRef,
const Standard_Real theTol,
- Handle(BOPInt_Context)& theContext)
+ Handle(IntTools_Context)& theContext)
{
TopAbs_State aState;
//
const TopoDS_Solid& theSolid,
BOPCol_IndexedDataMapOfShapeListOfShape& theMEF,
const Standard_Real theTol,
- Handle(BOPInt_Context)& theContext)
+ Handle(IntTools_Context)& theContext)
{
Standard_Boolean bDegenerated;
Standard_Integer aNbF, iRet, iFound;
(const TopoDS_Face& theFace,
const TopoDS_Edge& theEdge,
BOPCol_ListOfShape& theLF,
- Handle(BOPInt_Context)& theContext)
+ Handle(IntTools_Context)& theContext)
{
Standard_Integer aNbF, iRet;
//
const TopoDS_Edge& theEdge,
const TopoDS_Face& theFace1,
const TopoDS_Face& theFace2,
- Handle(BOPInt_Context)& theContext)
+ Handle(IntTools_Context)& theContext)
{
Standard_Boolean bRet;
Standard_Integer iRet;
const TopoDS_Face& theF1,
BOPTools_ListOfCoupleOfShape& theLCSOff,
TopoDS_Face& theFOff,
- Handle(BOPInt_Context)& theContext)
+ Handle(IntTools_Context)& theContext)
{
Standard_Boolean bRet;
Standard_Real aT, aT1, aT2, aAngle, aTwoPI, aAngleMin, aDt3D;
Standard_Boolean BOPTools_AlgoTools::AreFacesSameDomain
(const TopoDS_Face& theF1,
const TopoDS_Face& theF2,
- Handle(BOPInt_Context)& theContext)
+ Handle(IntTools_Context)& theContext)
{
Standard_Boolean bFlag;
Standard_Integer iErr;
Standard_Boolean BOPTools_AlgoTools::CheckSameGeom
(const TopoDS_Face& theF1,
const TopoDS_Face& theF2,
- Handle(BOPInt_Context)& theContext)
+ Handle(IntTools_Context)& theContext)
{
Standard_Boolean bRet;
Standard_Real aTolF1, aTolF2, aTol;
Standard_Boolean BOPTools_AlgoTools::IsSplitToReverse
(const TopoDS_Shape& theSp,
const TopoDS_Shape& theSr,
- Handle(BOPInt_Context)& theContext)
+ Handle(IntTools_Context)& theContext)
{
Standard_Boolean bRet;
TopAbs_ShapeEnum aType;
Standard_Boolean BOPTools_AlgoTools::IsSplitToReverse
(const TopoDS_Face& theFSp,
const TopoDS_Face& theFSr,
- Handle(BOPInt_Context)& theContext)
+ Handle(IntTools_Context)& theContext)
{
Standard_Boolean bRet, bFound, bInFace;
Standard_Real aT1, aT2, aT, aU, aV, aScPr;
Standard_Boolean BOPTools_AlgoTools::IsSplitToReverse
(const TopoDS_Edge& aEF1,
const TopoDS_Edge& aEF2,
- Handle(BOPInt_Context)& theContext)
+ Handle(IntTools_Context)& theContext)
{
Standard_Boolean bRet, bIsDegenerated;
//
Standard_Boolean FindFacePairs (const TopoDS_Edge& theE,
const BOPCol_ListOfShape& thLF,
BOPTools_ListOfCoupleOfShape& theLCFF,
- Handle(BOPInt_Context)& theContext)
+ Handle(IntTools_Context)& theContext)
{
Standard_Boolean bFound;
Standard_Integer i, aNbCEF;
(const IntTools_Range& aShrR,
const TopoDS_Face& aF,
const TopoDS_Edge& aE1,
- Handle(BOPInt_Context)& aContext)
+ Handle(IntTools_Context)& aContext)
{
Standard_Boolean bFlag;
Standard_Real f1, l1, ULD, VLD;
//=======================================================================
Standard_Boolean BOPTools_AlgoTools::IsMicroEdge
(const TopoDS_Edge& aE,
- const Handle(BOPInt_Context)& aCtx)
+ const Handle(IntTools_Context)& aCtx)
{
Standard_Boolean bRet;
Standard_Integer iErr;
aT2=aTmp;
}
//
- BOPInt_ShrunkRange aSR;
+ IntTools_ShrunkRange aSR;
aSR.SetContext(aCtx);
aSR.SetData(aE, aT1, aT2, aV1, aV2);
aSR.Perform();
const gp_Dir& aDTgt,
gp_Dir& aDN,
gp_Dir& aDB,
- Handle(BOPInt_Context)& theContext,
+ Handle(IntTools_Context)& theContext,
GeomAPI_ProjectPointOnSurf& aProjPL,
const Standard_Real aDt)
{
const gp_Pnt& aP,
gp_Dir& aDB,
gp_Pnt& aPOut,
- Handle(BOPInt_Context)& theContext,
+ Handle(IntTools_Context)& theContext,
GeomAPI_ProjectPointOnSurf& aProjPL,
const Standard_Real aDt)
{
ListOfShape from BOPCol,
- Context from BOPInt,
+ Context from IntTools,
IndexedDataMapOfShapeListOfShape from BOPCol
aT: Real from Standard;
aPx:out Pnt from gp;
aD:out Dir from gp;
- theContext:out Context from BOPInt);
+ theContext:out Context from IntTools);
---Purpose:
--- Computes normal to the face <aF> for the 3D-point that
--- belonds to the edge <aE> at parameter <aT>.
aT: Real from Standard;
aP2D:out Pnt2d from gp;
aPx:out Pnt from gp;
- theContext:out Context from BOPInt);
+ theContext:out Context from IntTools);
---Purpose:
--- Computes the point <aPx>, (<aP2D>) that is near to
--- the edge <aE> at parameter <aT> towards to the
aF: Face from TopoDS;
aP2D:out Pnt2d from gp;
aPx:out Pnt from gp;
- theContext:out Context from BOPInt);
+ theContext:out Context from IntTools);
---Purpose:
--- Compute the point <aPx>, (<aP2D>) that is near to
--- the edge <aE> at arbitrary parameter towards to the
theF:Face from TopoDS;
theP:out Pnt from gp;
theP2D:out Pnt2d from gp;
- theContext:out Context from BOPInt)
+ theContext:out Context from IntTools)
returns Integer from Standard;
---Purpose: Computes a point <theP> inside the face <theF>. <br>
-- <theP2D> - 2D representation of <theP> <br>
#include <BRep_TFace.hxx>
#include <Poly_Triangulation.hxx>
#include <BRep_Builder.hxx>
-#include <BOPInt_Context.hxx>
+#include <IntTools_Context.hxx>
#include <Geom2dAdaptor_Curve.hxx>
#include <Geom2dHatch_Hatcher.hxx>
#include <HatchGen_Domain.hxx>
const Standard_Real aT,
gp_Pnt& aPNear,
gp_Dir& aDNF,
- Handle(BOPInt_Context)& theContext)
+ Handle(IntTools_Context)& theContext)
{
Standard_Real aFirst, aLast;
Handle(Geom2d_Curve) aC2D=
const Standard_Real aT,
gp_Pnt2d& aPx2DNear,
gp_Pnt& aPxNear,
- Handle(BOPInt_Context)& theContext)
+ Handle(IntTools_Context)& theContext)
{
Standard_Real aTolE, aTolF, dTx, dT2D;
Handle(Geom_Surface) aS;
const TopoDS_Face& aF,
gp_Pnt2d& aPInFace2D,
gp_Pnt& aPInFace,
- Handle(BOPInt_Context)& theContext)
+ Handle(IntTools_Context)& theContext)
{
Standard_Real aT, aT1, aT2;
//
(const TopoDS_Face& aF,
gp_Pnt& theP,
gp_Pnt2d& theP2D,
- Handle(BOPInt_Context)& theContext)
+ Handle(IntTools_Context)& theContext)
{
Standard_Boolean bIsDone, bHasFirstPoint, bHasSecondPoint;
Standard_Integer iErr, aIx, aNbDomains;
#include <TopoDS_Compound.hxx>
#include <IntTools_BeanFaceIntersector.hxx>
-#include <BOPInt_Context.hxx>
+#include <IntTools_Context.hxx>
#include <IntTools_Range.hxx>
#include <Geom_Curve.hxx>
#include <TColgp_SequenceOfPnt.hxx>
#include <gce_MakeLin.hxx>
-#include <BOPInt_Tools.hxx>
+#include <IntTools_Tools.hxx>
#include <BOPAlgo_PaveFiller.hxx>
#include <BOPDS_DS.hxx>
#include <BOPAlgo_BOP.hxx>
if(aCP.Type() == TopAbs_VERTEX) {
theCommonVertex = *(TopoDS_Vertex*)&theDS->Shape(aEE.IndexNew());
if (theEIndex1 == aEE.Index1()) {
- BOPInt_Tools::VertexParameters(aCP, theParamOnE1, theParamOnE2);
+ IntTools_Tools::VertexParameters(aCP, theParamOnE1, theParamOnE2);
} else {
- BOPInt_Tools::VertexParameters(aCP, theParamOnE2, theParamOnE1);
+ IntTools_Tools::VertexParameters(aCP, theParamOnE2, theParamOnE1);
}
//
bvertexfound = Standard_True;
BRep_Tool::Range(anEdge, f, l);
anIntersector.SetBeanParameters(f, l);
//
- Handle(BOPInt_Context) aContext = new BOPInt_Context;
+ Handle(IntTools_Context) aContext = new IntTools_Context;
anIntersector.SetContext(aContext);
//
anIntersector.Perform();
package IntTools
- ---Purpose: Contains classes for intersection and classification
- --- purposes and accompanying classes
+ ---Purpose: Contains classes for intersection and classification
+ --- purposes and accompanying classes
uses
TCollection,
BRepClass3d,
TColgp,
MMgt,
- BOPInt
+ Geom2dHatch,
+
+ BOPCol
is
-
- class Range;
- class CommonPrt;
- class Root;
- class Compare;
- class CompareRange;
+ class Context;
+ class ShrunkRange;
+ --
+ class Range;
+ class CommonPrt;
+ class Root;
+ class Compare;
+ class CompareRange;
class EdgeEdge;
- ---Purpose: class provides the Edge/Edge algorithm
+ ---Purpose: class provides the Edge/Edge algorithm
class EdgeFace;
- ---Purpose: class provides the Edge/Face algorithm
+ ---Purpose: class provides the Edge/Face algorithm
class FClass2d;
- ---Purpose: class provides classification of a point in a face
+ ---Purpose: class provides classification of a point in a face
class LineConstructor;
- ---Purpose: class provides post-processing of results of
- --- surfaces intersection
+ ---Purpose: class provides post-processing of results of
+ --- surfaces intersection
-----
class MarkedRangeSet;
- ---Purpose: auxiliary class for range management
+ ---Purpose: auxiliary class for range management
class BaseRangeSample;
- ---Purpose: base class for range index management
+ ---Purpose: base class for range index management
class CurveRangeSample;
- ---Purpose: class for range index management of curve
+ ---Purpose: class for range index management of curve
class SurfaceRangeSample;
- ---Purpose: class for range index management of surface
+ ---Purpose: class for range index management of surface
class CurveRangeLocalizeData;
class SurfaceRangeLocalizeData;
class BeanFaceIntersector;
- ---Purpose: class provides computing ranges of parameters
- --- of edge/face intersection.
+ ---Purpose: class provides computing ranges of parameters
+ --- of edge/face intersection.
-----
class Curve;
- ---Purpose: class is a container of
- --- one 3d curve
- --- two 2d curves
+ ---Purpose: class is a container of
+ --- one 3d curve
+ --- two 2d curves
-----
class PntOnFace;
class PntOn2Faces;
class TopolTool;
- ---Purpose: class redefines TopolTool from Adaptor3d
+ ---Purpose: class redefines TopolTool from Adaptor3d
class FaceFace;
- ---Purpose: class provides the Face/Face algorithm
+ ---Purpose: class provides the Face/Face algorithm
---
class Tools;
- ---Purpose: class is a container of usefull geometrical and
- --- topological algorithms
+ ---Purpose: class is a container of usefull geometrical and
+ --- topological algorithms
generic class CArray1;
---
--- I n s t a n t i a t i o n s
---
class SequenceOfPntOn2Faces instantiates
- Sequence from TCollection(PntOn2Faces from IntTools);
+ Sequence from TCollection(PntOn2Faces from IntTools);
--
class SequenceOfCurves instantiates
- Sequence from TCollection(Curve from IntTools);
-
+ Sequence from TCollection(Curve from IntTools);
+
class SequenceOfRanges instantiates
- Sequence from TCollection(Range from IntTools);
+ Sequence from TCollection(Range from IntTools);
class CArray1OfInteger instantiates
- CArray1(Integer from Standard);
+ CArray1(Integer from Standard);
class CArray1OfReal instantiates
- CArray1(Real from Standard);
-
+ CArray1(Real from Standard);
+
class SequenceOfRoots instantiates
- Sequence from TCollection(Root from IntTools);
-
+ Sequence from TCollection(Root from IntTools);
+
class Array1OfRoots instantiates
- Array1 from TCollection (Root from IntTools);
+ Array1 from TCollection (Root from IntTools);
class Array1OfRange instantiates
- Array1 from TCollection (Range from IntTools);
-
+ Array1 from TCollection (Range from IntTools);
+
class QuickSort instantiates
- QuickSort from SortTools (Root from IntTools,
- Array1OfRoots from IntTools,
- Compare from IntTools);
-
+ QuickSort from SortTools (Root from IntTools,
+ Array1OfRoots from IntTools,
+ Compare from IntTools);
+
class QuickSortRange instantiates
- QuickSort from SortTools (Range from IntTools,
- Array1OfRange from IntTools,
- CompareRange from IntTools);
+ QuickSort from SortTools (Range from IntTools,
+ Array1OfRange from IntTools,
+ CompareRange from IntTools);
class SequenceOfCommonPrts instantiates
- Sequence from TCollection(CommonPrt from IntTools);
-
+ Sequence from TCollection(CommonPrt from IntTools);
+
class IndexedDataMapOfTransientAddress instantiates
- IndexedDataMap from TCollection(Transient from Standard,
- Address from Standard,
- MapTransientHasher from TColStd);
+ IndexedDataMap from TCollection(Transient from Standard,
+ Address from Standard,
+ MapTransientHasher from TColStd);
---modified by NIZHNY-MKK Wed Oct 5 18:06:39 2005
+
class ListOfCurveRangeSample instantiates
- List from TCollection(CurveRangeSample from IntTools);
+ List from TCollection(CurveRangeSample from IntTools);
class ListOfSurfaceRangeSample instantiates
- List from TCollection(SurfaceRangeSample from IntTools);
+ List from TCollection(SurfaceRangeSample from IntTools);
class ListOfBox instantiates
- List from TCollection(Box from Bnd);
-
+ List from TCollection(Box from Bnd);
+
class CurveRangeSampleMapHasher;
- ---Purpose: class for range index management of curve
+ ---Purpose: class for range index management of curve
class SurfaceRangeSampleMapHasher;
class MapOfCurveSample instantiates
- Map from TCollection(CurveRangeSample from IntTools,
+ Map from TCollection(CurveRangeSample from IntTools,
CurveRangeSampleMapHasher from IntTools);
-
+
class MapOfSurfaceSample instantiates
- Map from TCollection(SurfaceRangeSample from IntTools,
- SurfaceRangeSampleMapHasher from IntTools);
+ Map from TCollection(SurfaceRangeSample from IntTools,
+ SurfaceRangeSampleMapHasher from IntTools);
class DataMapOfCurveSampleBox instantiates
- DataMap from TCollection(CurveRangeSample from IntTools,
- Box from Bnd,
- CurveRangeSampleMapHasher from IntTools);
+ DataMap from TCollection(CurveRangeSample from IntTools,
+ Box from Bnd,
+ CurveRangeSampleMapHasher from IntTools);
class DataMapOfSurfaceSampleBox instantiates
- DataMap from TCollection(SurfaceRangeSample from IntTools,
- Box from Bnd,
- SurfaceRangeSampleMapHasher from IntTools);
+ DataMap from TCollection(SurfaceRangeSample from IntTools,
+ Box from Bnd,
+ SurfaceRangeSampleMapHasher from IntTools);
-----------------------------------------------------
-- Block of static functions
-----------------------------------------------------
Length (E : Edge from TopoDS)
- returns Real from Standard;
- ---Purpose: returns the length of the edge;
+ returns Real from Standard;
+ ---Purpose: returns the length of the edge;
RemoveIdenticalRoots (aSeq :out SequenceOfRoots from IntTools;
- anEpsT: Real from Standard);
+ anEpsT: Real from Standard);
---Purpose: Remove from the sequence aSeq the Roots that have
-- values ti and tj such as |ti-tj] < anEpsT.
SortRoots (aSeq :out SequenceOfRoots from IntTools;
- anEpsT: Real from Standard);
+ anEpsT: Real from Standard);
---Purpose: Sort the sequence aSeq of the Roots to arrange the
- -- Roons in increasing order
+ -- Roons in increasing order
+
FindRootStates (aSeq :out SequenceOfRoots from IntTools;
anEpsNull: Real from Standard);
---Purpose: Find the states (before and after) for each Root
-- from the sequence aSeq
Parameter (P : Pnt from gp;
- Curve : Curve from Geom;
- aParm : out Real from Standard)
- returns Integer from Standard;
+ Curve : Curve from Geom;
+ aParm : out Real from Standard)
+ returns Integer from Standard;
GetRadius(C: Curve from BRepAdaptor;
- t1,t3:Real from Standard;
- R:out Real from Standard)
+ t1,t3:Real from Standard;
+ R:out Real from Standard)
returns Integer from Standard;
-
+
PrepareArgs(C: in out Curve from BRepAdaptor;
tMax,tMin: Real from Standard;
- Discret : Integer from Standard;
- Deflect : Real from Standard;
- anArgs : out CArray1OfReal from IntTools)
+ Discret : Integer from Standard;
+ Deflect : Real from Standard;
+ anArgs : out CArray1OfReal from IntTools)
returns Integer from Standard;
end IntTools;
SequenceOfRoots from IntTools,
MarkedRangeSet from IntTools,
SequenceOfRanges from IntTools,
- Context from BOPInt,
+ Context from IntTools,
ExtCS from Extrema,
ProjectPointOnSurf from GeomAPI,
Edge from TopoDS,
Face from TopoDS,
Curve from BRepAdaptor,
Surface from BRepAdaptor,
- Box from Bnd,
+ Box from Bnd,
CurveRangeSample from IntTools,
SurfaceRangeSample from IntTools,
ListOfCurveRangeSample from IntTools,
Create returns BeanFaceIntersector from IntTools;
Create(theEdge: Edge from TopoDS;
- theFace: Face from TopoDS)
- returns BeanFaceIntersector from IntTools;
- ---Purpose:
- --- Initializes the algorithm
- ---
- -- Warning:
- --- The parts of the edge which are on
- --- the surface of the face and belong to
- --- the whole in the face (if there is)
- --- is considered as result
- ---
+ theFace: Face from TopoDS)
+ returns BeanFaceIntersector from IntTools;
+ ---Purpose:
+ --- Initializes the algorithm
+ ---
+ -- Warning:
+ --- The parts of the edge which are on
+ --- the surface of the face and belong to
+ --- the whole in the face (if there is)
+ --- is considered as result
+ ---
Create(theCurve : Curve from BRepAdaptor;
- theSurface : Surface from BRepAdaptor;
- theBeanTolerance: Real from Standard;
- theFaceTolerance: Real from Standard)
- returns BeanFaceIntersector from IntTools;
- ---Purpose:
- --- Initializes the algorithm
- ---
+ theSurface : Surface from BRepAdaptor;
+ theBeanTolerance: Real from Standard;
+ theFaceTolerance: Real from Standard)
+ returns BeanFaceIntersector from IntTools;
+ ---Purpose:
+ --- Initializes the algorithm
+ ---
Create(theCurve : Curve from BRepAdaptor;
- theSurface : Surface from BRepAdaptor;
- theFirstParOnCurve: Real from Standard;
- theLastParOnCurve : Real from Standard;
- theUMinParameter : Real from Standard;
- theUMaxParameter : Real from Standard;
- theVMinParameter : Real from Standard;
- theVMaxParameter : Real from Standard;
- theBeanTolerance : Real from Standard;
- theFaceTolerance : Real from Standard)
- returns BeanFaceIntersector from IntTools;
- ---Purpose:
- --- Initializes the algorithm
- --- theUMinParameter, ... are used for
- --- optimization purposes
- ---
+ theSurface : Surface from BRepAdaptor;
+ theFirstParOnCurve: Real from Standard;
+ theLastParOnCurve : Real from Standard;
+ theUMinParameter : Real from Standard;
+ theUMaxParameter : Real from Standard;
+ theVMinParameter : Real from Standard;
+ theVMaxParameter : Real from Standard;
+ theBeanTolerance : Real from Standard;
+ theFaceTolerance : Real from Standard)
+ returns BeanFaceIntersector from IntTools;
+ ---Purpose:
+ --- Initializes the algorithm
+ --- theUMinParameter, ... are used for
+ --- optimization purposes
+ ---
Init(me: in out;theEdge: Edge from TopoDS;
- theFace: Face from TopoDS);
- ---Purpose:
- --- Initializes the algorithm
- ---
- -- Warning:
- --- The parts of the edge which are on
- --- the surface of the face and belong to
- --- the whole in the face (if there is)
- --- is considered as result
- ---
+ theFace: Face from TopoDS);
+ ---Purpose:
+ --- Initializes the algorithm
+ ---
+ -- Warning:
+ --- The parts of the edge which are on
+ --- the surface of the face and belong to
+ --- the whole in the face (if there is)
+ --- is considered as result
+ ---
Init(me: in out;theCurve : Curve from BRepAdaptor;
- theSurface : Surface from BRepAdaptor;
- theBeanTolerance: Real from Standard;
- theFaceTolerance: Real from Standard);
- ---Purpose:
- --- Initializes the algorithm
- ---
+ theSurface : Surface from BRepAdaptor;
+ theBeanTolerance: Real from Standard;
+ theFaceTolerance: Real from Standard);
+ ---Purpose:
+ --- Initializes the algorithm
+ ---
Init(me: in out;theCurve : Curve from BRepAdaptor;
- theSurface : Surface from BRepAdaptor;
- theFirstParOnCurve: Real from Standard;
- theLastParOnCurve : Real from Standard;
- theUMinParameter : Real from Standard;
- theUMaxParameter : Real from Standard;
- theVMinParameter : Real from Standard;
- theVMaxParameter : Real from Standard;
- theBeanTolerance : Real from Standard;
- theFaceTolerance : Real from Standard);
- ---Purpose:
- --- Initializes the algorithm
- --- theUMinParameter, ... are used for
- --- optimization purposes
- ---
+ theSurface : Surface from BRepAdaptor;
+ theFirstParOnCurve: Real from Standard;
+ theLastParOnCurve : Real from Standard;
+ theUMinParameter : Real from Standard;
+ theUMaxParameter : Real from Standard;
+ theVMinParameter : Real from Standard;
+ theVMaxParameter : Real from Standard;
+ theBeanTolerance : Real from Standard;
+ theFaceTolerance : Real from Standard);
+ ---Purpose:
+ --- Initializes the algorithm
+ --- theUMinParameter, ... are used for
+ --- optimization purposes
+ ---
SetContext(me: in out;
- theContext: Context from BOPInt);
- ---Purpose:
- --- Sets the intersecton context
- ---
+ theContext: Context from IntTools);
+ ---Purpose:
+ --- Sets the intersecton context
+ ---
Context(me)
- returns Context from BOPInt;
- ---C++: return const &
+ returns Context from IntTools;
+ ---C++: return const &
---Purpose:
- --- Gets the intersecton context
- ---
+ --- Gets the intersecton context
+ ---
SetBeanParameters(me: in out;theFirstParOnCurve : Real from Standard;
- theLastParOnCurve : Real from Standard);
- ---Purpose:
- --- Set restrictions for curve
- ---
+ theLastParOnCurve : Real from Standard);
+ ---Purpose:
+ --- Set restrictions for curve
+ ---
SetSurfaceParameters(me: in out;theUMinParameter : Real from Standard;
- theUMaxParameter : Real from Standard;
- theVMinParameter : Real from Standard;
- theVMaxParameter : Real from Standard);
- ---Purpose:
- --- Set restrictions for surface
- ---
+ theUMaxParameter : Real from Standard;
+ theVMinParameter : Real from Standard;
+ theVMaxParameter : Real from Standard);
+ ---Purpose:
+ --- Set restrictions for surface
+ ---
Perform(me: in out);
- ---Purpose:
- --- Launches the algorithm
- ---
+ ---Purpose:
+ --- Launches the algorithm
+ ---
IsDone(me) returns Boolean from Standard;
- ---C++: inline
+ ---C++: inline
Result(me)
- returns SequenceOfRanges from IntTools;
- ---C++: return const &
+ returns SequenceOfRanges from IntTools;
+ ---C++: return const &
Result(me; theResults: out SequenceOfRanges from IntTools);
-- private
ComputeAroundExactIntersection(me: in out)
- is private;
+ is private;
ComputeLinePlane(me: in out)
- is private;
+ is private;
FastComputeExactIntersection(me: in out)
returns Integer from Standard is private;
ComputeUsingExtremum(me: in out)
- is private;
+ is private;
ComputeNearRangeBoundaries(me: in out)
- is private;
+ is private;
ComputeLocalized(me: in out)
- returns Boolean from Standard is private;
-
+ returns Boolean from Standard is private;
+
ComputeRangeFromStartPoint(me: in out; ToIncreaseParameter : Boolean from Standard;
- theParameter : Real from Standard;
- theUParameter : Real from Standard;
- theVParameter : Real from Standard)
- is private;
+ theParameter : Real from Standard;
+ theUParameter : Real from Standard;
+ theVParameter : Real from Standard)
+ is private;
ComputeRangeFromStartPoint(me: in out; ToIncreaseParameter : Boolean from Standard;
- theParameter : Real from Standard;
- theUParameter : Real from Standard;
- theVParameter : Real from Standard;
- theIndex : Integer from Standard)
- is private;
+ theParameter : Real from Standard;
+ theUParameter : Real from Standard;
+ theVParameter : Real from Standard;
+ theIndex : Integer from Standard)
+ is private;
Distance(me: in out; theArg : Real from Standard;
- theUParameter: out Real from Standard;
- theVParameter: out Real from Standard)
- returns Real from Standard
- is private;
+ theUParameter: out Real from Standard;
+ theVParameter: out Real from Standard)
+ returns Real from Standard
+ is private;
Distance(me: in out; theArg: Real from Standard)
- returns Real from Standard
- is private;
+ returns Real from Standard
+ is private;
LocalizeSolutions(me: in out; theCurveRange : CurveRangeSample from IntTools;
- theBoxCurve : Box from Bnd;
- theSurfaceRange: SurfaceRangeSample from IntTools;
- theBoxSurface : Box from Bnd;
- theCurveData : in out CurveRangeLocalizeData from IntTools;
- theSurfaceData : in out SurfaceRangeLocalizeData from IntTools;
- theListCurveRange: in out ListOfCurveRangeSample from IntTools;
- theListSurfaceRange: in out ListOfSurfaceRangeSample from IntTools)
- returns Boolean from Standard
- is private;
+ theBoxCurve : Box from Bnd;
+ theSurfaceRange: SurfaceRangeSample from IntTools;
+ theBoxSurface : Box from Bnd;
+ theCurveData : in out CurveRangeLocalizeData from IntTools;
+ theSurfaceData : in out SurfaceRangeLocalizeData from IntTools;
+ theListCurveRange: in out ListOfCurveRangeSample from IntTools;
+ theListSurfaceRange: in out ListOfSurfaceRangeSample from IntTools)
+ returns Boolean from Standard
+ is private;
TestComputeCoinside(me: in out)
- returns Boolean from Standard
- is private;
+ returns Boolean from Standard
+ is private;
fields
myProjector : ProjectPointOnSurf from GeomAPI;
myRangeManager : MarkedRangeSet from IntTools;
myDeflection : Real from Standard;
- myContext : Context from BOPInt;
+ myContext : Context from IntTools;
-- results
myResults : SequenceOfRanges from IntTools;
#include <Extrema_ExtCS.hxx>
#include <Extrema_ExtPS.hxx>
#include <IntTools.hxx>
-#include <BOPInt_Context.hxx>
+#include <IntTools_Context.hxx>
#include <IntTools_Tools.hxx>
#include <GeomAPI_ProjectPointOnCurve.hxx>
#include <IntCurveSurface_HInter.hxx>
#include <ElSLib.hxx>
static Standard_Boolean AdjustPeriodic(const Standard_Real U,
- const Standard_Real UFirst,
- const Standard_Real ULast,
- const Standard_Real Period,
- Standard_Real& UResult);
+ const Standard_Real UFirst,
+ const Standard_Real ULast,
+ const Standard_Real Period,
+ Standard_Real& UResult);
static Standard_Boolean SetEmptyResultRange(const Standard_Real theParameter,
- IntTools_MarkedRangeSet& theMarkedRange);
+ IntTools_MarkedRangeSet& theMarkedRange);
+
-// static Standard_Boolean TestCoinside(const BRepAdaptor_Curve& theCurve,
-// const BRepAdaptor_Surface& theSurface);
-// Modified by skv - Wed Nov 2 15:21:11 2005 Optimization Begin
static Bnd_Box GetSurfaceBox
- (const Handle(Geom_BSplineSurface) &theSurf,
- const Standard_Real theFirstU,
- const Standard_Real theLastU,
- const Standard_Real theFirstV,
- const Standard_Real theLastV,
- const Standard_Real theTolerance,
- IntTools_SurfaceRangeLocalizeData &theSurfaceData);
+ (const Handle(Geom_BSplineSurface) &theSurf,
+ const Standard_Real theFirstU,
+ const Standard_Real theLastU,
+ const Standard_Real theFirstV,
+ const Standard_Real theLastV,
+ const Standard_Real theTolerance,
+ IntTools_SurfaceRangeLocalizeData &theSurfaceData);
static void ComputeGridPoints
- (const Handle(Geom_BSplineSurface) &theSurf,
- const Standard_Real theFirstU,
- const Standard_Real theLastU,
- const Standard_Real theFirstV,
- const Standard_Real theLastV,
- const Standard_Real theTolerance,
- IntTools_SurfaceRangeLocalizeData &theSurfaceData);
+ (const Handle(Geom_BSplineSurface) &theSurf,
+ const Standard_Real theFirstU,
+ const Standard_Real theLastU,
+ const Standard_Real theFirstV,
+ const Standard_Real theLastV,
+ const Standard_Real theTolerance,
+ IntTools_SurfaceRangeLocalizeData &theSurfaceData);
static void BuildBox(const Handle(Geom_BSplineSurface) &theSurf,
- const Standard_Real theFirstU,
- const Standard_Real theLastU,
- const Standard_Real theFirstV,
- const Standard_Real theLastV,
- IntTools_SurfaceRangeLocalizeData &theSurfaceData,
- Bnd_Box &theBox);
-// Modified by skv - Wed Nov 2 15:21:11 2005 Optimization End
-
+ const Standard_Real theFirstU,
+ const Standard_Real theLastU,
+ const Standard_Real theFirstV,
+ const Standard_Real theLastV,
+ IntTools_SurfaceRangeLocalizeData &theSurfaceData,
+ Bnd_Box &theBox);
+
static void MergeSolutions(const IntTools_ListOfCurveRangeSample& theListCurveRange,
- const IntTools_ListOfSurfaceRangeSample& theListSurfaceRange,
- IntTools_ListOfCurveRangeSample& theListCurveRangeSort,
- IntTools_ListOfSurfaceRangeSample& theListSurfaceRangeSort);
+ const IntTools_ListOfSurfaceRangeSample& theListSurfaceRange,
+ IntTools_ListOfCurveRangeSample& theListCurveRangeSort,
+ IntTools_ListOfSurfaceRangeSample& theListSurfaceRangeSort);
static void CheckSampling(const IntTools_CurveRangeSample& theCurveRange,
- const IntTools_SurfaceRangeSample& theSurfaceRange,
- const IntTools_CurveRangeLocalizeData& theCurveData,
- const IntTools_SurfaceRangeLocalizeData& theSurfaceData,
- const Standard_Real DiffC,
- const Standard_Real DiffU,
- const Standard_Real DiffV,
- Standard_Boolean& bAllowSamplingC,
- Standard_Boolean& bAllowSamplingU,
- Standard_Boolean& bAllowSamplingV);
+ const IntTools_SurfaceRangeSample& theSurfaceRange,
+ const IntTools_CurveRangeLocalizeData& theCurveData,
+ const IntTools_SurfaceRangeLocalizeData& theSurfaceData,
+ const Standard_Real DiffC,
+ const Standard_Real DiffU,
+ const Standard_Real DiffV,
+ Standard_Boolean& bAllowSamplingC,
+ Standard_Boolean& bAllowSamplingU,
+ Standard_Boolean& bAllowSamplingV);
+
// ==================================================================================
// function: IntTools_BeanFaceIntersector
// purpose:
// purpose:
// ==================================================================================
IntTools_BeanFaceIntersector::IntTools_BeanFaceIntersector(const TopoDS_Edge& theEdge,
- const TopoDS_Face& theFace) :
-myFirstParameter(0.),
-myLastParameter(0.),
-myUMinParameter(0.),
-myUMaxParameter(0.),
-myVMinParameter(0.),
-myVMaxParameter(0.),
-myBeanTolerance(0.),
-myFaceTolerance(0.),
-myDeflection(0.01),
-myIsDone(Standard_False)
+ const TopoDS_Face& theFace) :
+ myFirstParameter(0.),
+ myLastParameter(0.),
+ myUMinParameter(0.),
+ myUMaxParameter(0.),
+ myVMinParameter(0.),
+ myVMaxParameter(0.),
+ myBeanTolerance(0.),
+ myFaceTolerance(0.),
+ myDeflection(0.01),
+ myIsDone(Standard_False)
{
Init(theEdge, theFace);
}
// purpose:
// ==================================================================================
IntTools_BeanFaceIntersector::IntTools_BeanFaceIntersector(const BRepAdaptor_Curve& theCurve,
- const BRepAdaptor_Surface& theSurface,
- const Standard_Real theBeanTolerance,
+ const BRepAdaptor_Surface& theSurface,
+ const Standard_Real theBeanTolerance,
const Standard_Real theFaceTolerance) :
-myFirstParameter(0.),
-myLastParameter(0.),
-myUMinParameter(0.),
-myUMaxParameter(0.),
-myVMinParameter(0.),
-myVMaxParameter(0.),
-myDeflection(0.01),
-myIsDone(Standard_False)
+ myFirstParameter(0.),
+ myLastParameter(0.),
+ myUMinParameter(0.),
+ myUMaxParameter(0.),
+ myVMinParameter(0.),
+ myVMaxParameter(0.),
+ myDeflection(0.01),
+ myIsDone(Standard_False)
{
Init(theCurve, theSurface, theBeanTolerance, theFaceTolerance);
}
// purpose:
// ==================================================================================
IntTools_BeanFaceIntersector::IntTools_BeanFaceIntersector(const BRepAdaptor_Curve& theCurve,
- const BRepAdaptor_Surface& theSurface,
- const Standard_Real theFirstParOnCurve,
- const Standard_Real theLastParOnCurve,
- const Standard_Real theUMinParameter,
- const Standard_Real theUMaxParameter,
- const Standard_Real theVMinParameter,
- const Standard_Real theVMaxParameter,
- const Standard_Real theBeanTolerance,
- const Standard_Real theFaceTolerance) :
-myFirstParameter(theFirstParOnCurve),
-myLastParameter(theLastParOnCurve),
-myUMinParameter(theUMinParameter),
-myUMaxParameter(theUMaxParameter),
-myVMinParameter(theVMinParameter),
-myVMaxParameter(theVMaxParameter),
-myBeanTolerance(theBeanTolerance),
-myFaceTolerance(theFaceTolerance),
-myDeflection(0.01),
-myIsDone(Standard_False)
+ const BRepAdaptor_Surface& theSurface,
+ const Standard_Real theFirstParOnCurve,
+ const Standard_Real theLastParOnCurve,
+ const Standard_Real theUMinParameter,
+ const Standard_Real theUMaxParameter,
+ const Standard_Real theVMinParameter,
+ const Standard_Real theVMaxParameter,
+ const Standard_Real theBeanTolerance,
+ const Standard_Real theFaceTolerance) :
+ myFirstParameter(theFirstParOnCurve),
+ myLastParameter(theLastParOnCurve),
+ myUMinParameter(theUMinParameter),
+ myUMaxParameter(theUMaxParameter),
+ myVMinParameter(theVMinParameter),
+ myVMaxParameter(theVMaxParameter),
+ myBeanTolerance(theBeanTolerance),
+ myFaceTolerance(theFaceTolerance),
+ myDeflection(0.01),
+ myIsDone(Standard_False)
{
myCurve = theCurve;
-
+
myCriteria = myBeanTolerance + myFaceTolerance;
myCurveResolution = myCurve.Resolution(myCriteria);
// purpose:
// ==================================================================================
void IntTools_BeanFaceIntersector::Init(const TopoDS_Edge& theEdge,
- const TopoDS_Face& theFace)
+ const TopoDS_Face& theFace)
{
myCurve.Initialize(theEdge);
mySurface.Initialize(theFace);
myTrsfSurface = Handle(Geom_Surface)::DownCast(mySurface.Surface().Surface()->Transformed(mySurface.Trsf()));
myBeanTolerance = BRep_Tool::Tolerance(theEdge);
myFaceTolerance = BRep_Tool::Tolerance(theFace);
-
+
myCriteria = myBeanTolerance + myFaceTolerance;
myCurveResolution = myCurve.Resolution(myCriteria);
SetSurfaceParameters(mySurface.FirstUParameter(), mySurface.LastUParameter(),
- mySurface.FirstVParameter(), mySurface.LastVParameter());
+ mySurface.FirstVParameter(), mySurface.LastVParameter());
myResults.Clear();
}
// purpose:
// ==================================================================================
void IntTools_BeanFaceIntersector::Init(const BRepAdaptor_Curve& theCurve,
- const BRepAdaptor_Surface& theSurface,
- const Standard_Real theBeanTolerance,
- const Standard_Real theFaceTolerance)
+ const BRepAdaptor_Surface& theSurface,
+ const Standard_Real theBeanTolerance,
+ const Standard_Real theFaceTolerance)
{
myCurve = theCurve;
mySurface = theSurface;
myTrsfSurface = Handle(Geom_Surface)::DownCast(mySurface.Surface().Surface()->Transformed(mySurface.Trsf()));
myBeanTolerance = theBeanTolerance;
myFaceTolerance = theFaceTolerance;
-
+
myCriteria = myBeanTolerance + myFaceTolerance;
myCurveResolution = myCurve.Resolution(myCriteria);
-
+
SetSurfaceParameters(mySurface.FirstUParameter(), mySurface.LastUParameter(),
- mySurface.FirstVParameter(), mySurface.LastVParameter());
+ mySurface.FirstVParameter(), mySurface.LastVParameter());
myResults.Clear();
}
// purpose:
// ==================================================================================
void IntTools_BeanFaceIntersector::Init(const BRepAdaptor_Curve& theCurve,
- const BRepAdaptor_Surface& theSurface,
- const Standard_Real theFirstParOnCurve,
- const Standard_Real theLastParOnCurve,
- const Standard_Real theUMinParameter,
- const Standard_Real theUMaxParameter,
- const Standard_Real theVMinParameter,
- const Standard_Real theVMaxParameter,
- const Standard_Real theBeanTolerance,
- const Standard_Real theFaceTolerance)
+ const BRepAdaptor_Surface& theSurface,
+ const Standard_Real theFirstParOnCurve,
+ const Standard_Real theLastParOnCurve,
+ const Standard_Real theUMinParameter,
+ const Standard_Real theUMaxParameter,
+ const Standard_Real theVMinParameter,
+ const Standard_Real theVMaxParameter,
+ const Standard_Real theBeanTolerance,
+ const Standard_Real theFaceTolerance)
{
Init(theCurve, theSurface, theBeanTolerance, theFaceTolerance);
SetBeanParameters(theFirstParOnCurve, theLastParOnCurve);
// function: SetContext
// purpose:
// ==================================================================================
-void IntTools_BeanFaceIntersector::SetContext(const Handle(BOPInt_Context)& theContext)
+void IntTools_BeanFaceIntersector::SetContext(const Handle(IntTools_Context)& theContext)
{
myContext = theContext;
}
// function: Context
// purpose:
// ==================================================================================
-const Handle(BOPInt_Context)& IntTools_BeanFaceIntersector::Context()const
+const Handle(IntTools_Context)& IntTools_BeanFaceIntersector::Context()const
{
return myContext;
}
// purpose:
// ==================================================================================
void IntTools_BeanFaceIntersector::SetBeanParameters(const Standard_Real theFirstParOnCurve,
- const Standard_Real theLastParOnCurve)
+ const Standard_Real theLastParOnCurve)
{
myFirstParameter = theFirstParOnCurve;
myLastParameter = theLastParOnCurve;
// purpose:
// ==================================================================================
void IntTools_BeanFaceIntersector::SetSurfaceParameters(const Standard_Real theUMinParameter,
- const Standard_Real theUMaxParameter,
- const Standard_Real theVMinParameter,
- const Standard_Real theVMaxParameter)
+ const Standard_Real theUMaxParameter,
+ const Standard_Real theVMinParameter,
+ const Standard_Real theVMaxParameter)
{
myUMinParameter = theUMinParameter;
myUMaxParameter = theUMaxParameter;
myDeflection = aRelativeDeflection;
//
if (myContext.IsNull()) {
- myContext=new BOPInt_Context;
+ myContext=new IntTools_Context;
}
//
if(myCurve.GetType()==GeomAbs_Line && mySurface.GetType()==GeomAbs_Plane) {
IntTools_CArray1OfReal aParams;
if(IntTools::PrepareArgs(myCurve,
- myLastParameter,
- myFirstParameter,
- aDiscretization,
- aRelativeDeflection,
- aParams)) {
+ myLastParameter,
+ myFirstParameter,
+ aDiscretization,
+ aRelativeDeflection,
+ aParams)) {
return;
}
useMinMaxPoints = Standard_False;
if(aDistance > aProjectorOnCurve.LowerDistance())
- aDistance = aProjectorOnCurve.LowerDistance();
+ aDistance = aProjectorOnCurve.LowerDistance();
}
}
// purpose:
// ==================================================================================
Standard_Real IntTools_BeanFaceIntersector::Distance(const Standard_Real theArg,
- Standard_Real& theUParameter,
- Standard_Real& theVParameter)
+ Standard_Real& theUParameter,
+ Standard_Real& theVParameter)
{
gp_Pnt aPoint = myCurve.Value(theArg);
-
+
theUParameter = myUMinParameter;
theVParameter = myVMinParameter;
//
gp_Pnt aPointMin = (i < 2) ? mySurface.Value(anIsoParameter, aMinParameter) : mySurface.Value(aMinParameter, anIsoParameter);
gp_Pnt aPointMax = (i < 2) ? mySurface.Value(anIsoParameter, aMaxParameter) : mySurface.Value(aMaxParameter, anIsoParameter);
gp_Pnt aPointMid = (i < 2) ? mySurface.Value(anIsoParameter, aMidParameter) : mySurface.Value(aMidParameter, anIsoParameter);
-
+
Standard_Boolean useMinMaxPoints = Standard_True;
Standard_Boolean computeisoline = Standard_True;
if(aPointMin.IsEqual(aPointMax, myCriteria) &&
- aPointMin.IsEqual(aPointMid, myCriteria) &&
- aPointMax.IsEqual(aPointMid, myCriteria)) {
- computeisoline = Standard_False;
- }
-
+ aPointMin.IsEqual(aPointMid, myCriteria) &&
+ aPointMax.IsEqual(aPointMid, myCriteria)) {
+ computeisoline = Standard_False;
+ }
+
if(computeisoline) {
- Handle(Geom_Curve) aCurve = (i < 2) ? myTrsfSurface->UIso(anIsoParameter) : myTrsfSurface->VIso(anIsoParameter);
- GeomAPI_ProjectPointOnCurve aProjectorOnCurve(aPoint, aCurve, aMinParameter, aMaxParameter);
-
- if(aProjectorOnCurve.NbPoints() > 0) {
- useMinMaxPoints = Standard_False;
-
- if(aDistance > aProjectorOnCurve.LowerDistance()) {
- theUParameter = (i<=1) ? anIsoParameter : aProjectorOnCurve.LowerDistanceParameter();
- theVParameter = (i>=2) ? anIsoParameter : aProjectorOnCurve.LowerDistanceParameter();
- aDistance = aProjectorOnCurve.LowerDistance();
- }
- }
+ Handle(Geom_Curve) aCurve = (i < 2) ? myTrsfSurface->UIso(anIsoParameter) : myTrsfSurface->VIso(anIsoParameter);
+ GeomAPI_ProjectPointOnCurve aProjectorOnCurve(aPoint, aCurve, aMinParameter, aMaxParameter);
+
+ if(aProjectorOnCurve.NbPoints() > 0) {
+ useMinMaxPoints = Standard_False;
+
+ if(aDistance > aProjectorOnCurve.LowerDistance()) {
+ theUParameter = (i<=1) ? anIsoParameter : aProjectorOnCurve.LowerDistanceParameter();
+ theVParameter = (i>=2) ? anIsoParameter : aProjectorOnCurve.LowerDistanceParameter();
+ aDistance = aProjectorOnCurve.LowerDistance();
+ }
+ }
}
-
+
if(useMinMaxPoints) {
- Standard_Real aPPDistance = aPoint.Distance(aPointMin);
-
- if(aPPDistance < aDistance) {
- theUParameter = (i<=1) ? anIsoParameter : aMinParameter;
- theVParameter = (i>=2) ? anIsoParameter : aMinParameter;
- aDistance = aPPDistance;
- }
- aPPDistance = aPoint.Distance(aPointMax);
-
- if(aPPDistance < aDistance) {
- theUParameter = (i<=1) ? anIsoParameter : aMaxParameter;
- theVParameter = (i>=2) ? anIsoParameter : aMaxParameter;
- aDistance = aPPDistance;
- }
+ Standard_Real aPPDistance = aPoint.Distance(aPointMin);
+
+ if(aPPDistance < aDistance) {
+ theUParameter = (i<=1) ? anIsoParameter : aMinParameter;
+ theVParameter = (i>=2) ? anIsoParameter : aMinParameter;
+ aDistance = aPPDistance;
+ }
+ aPPDistance = aPoint.Distance(aPointMax);
+
+ if(aPPDistance < aDistance) {
+ theUParameter = (i<=1) ? anIsoParameter : aMaxParameter;
+ theVParameter = (i>=2) ? anIsoParameter : aMaxParameter;
+ aDistance = aPPDistance;
+ }
}
}
}
theUParameter = (myUMaxParameter < theUParameter) ? myUMaxParameter : theUParameter;
theVParameter = (myVMinParameter > theVParameter) ? myVMinParameter : theVParameter;
theVParameter = (myVMaxParameter < theVParameter) ? myVMaxParameter : theVParameter;
-
+
return aDistance;
}
Handle(BRepAdaptor_HCurve) aCurve = new BRepAdaptor_HCurve(myCurve);
Handle(BRepAdaptor_HSurface) aSurface = new BRepAdaptor_HSurface(mySurface);
-
+
anExactIntersector.Perform(aCurve, aSurface);
-
+
if(anExactIntersector.IsDone()) {
Standard_Integer i = 0;
-
+
for(i = 1; i <= anExactIntersector.NbPoints(); i++) {
const IntCurveSurface_IntersectionPoint& aPoint = anExactIntersector.Point(i);
if((aPoint.W() >= myFirstParameter) && (aPoint.W() <= myLastParameter)) {
- Standard_Boolean UIsNotValid = ((myUMinParameter > aPoint.U()) || (aPoint.U() > myUMaxParameter));
- Standard_Boolean VIsNotValid = ((myVMinParameter > aPoint.V()) || (aPoint.V() > myVMaxParameter));
- Standard_Boolean solutionIsValid = !UIsNotValid && !VIsNotValid;
- Standard_Real U = aPoint.U();
- Standard_Real V = aPoint.V();
-
- if(UIsNotValid || VIsNotValid) {
-// modified by NIZHNY-MKK Thu Jun 17 12:50:39 2004
- Standard_Boolean bUCorrected = Standard_True;
-
- if(UIsNotValid) {
-// modified by NIZHNY-MKK Thu Jun 17 12:50:37 2004
- bUCorrected = Standard_False;
- solutionIsValid = Standard_False;
-
- if(mySurface.IsUPeriodic()) {
- Standard_Real aNewU = U;
-
- if(AdjustPeriodic(U, myUMinParameter, myUMaxParameter, mySurface.UPeriod(), aNewU)) {
- solutionIsValid = Standard_True;
-// modified by NIZHNY-MKK Thu Jun 17 12:51:01 2004
- bUCorrected = Standard_True;
- U = aNewU;
- }
- }
- }
- // modified by NIZHNY-MKK Thu Jun 17 12:51:03 2004
-// if(solutionIsValid && VIsNotValid) {
- if(bUCorrected && VIsNotValid) {
- solutionIsValid = Standard_False;
-
- if(mySurface.IsVPeriodic()) {
- Standard_Real aNewV = V;
-
- if(AdjustPeriodic(V, myVMinParameter, myVMaxParameter, mySurface.VPeriod(), aNewV)) {
- solutionIsValid = Standard_True;
- V = aNewV;
- }
- }
- }
- }
-
- if(!solutionIsValid)
- continue;
-
- Standard_Integer aNbRanges = myRangeManager.Length();
-
- ComputeRangeFromStartPoint(Standard_False, aPoint.W(), U, V);
- ComputeRangeFromStartPoint(Standard_True, aPoint.W(), U, V);
-
- if(aNbRanges == myRangeManager.Length()) {
- SetEmptyResultRange(aPoint.W(), myRangeManager);
- } // end if(aNbRanges == myRangeManager.Length())
+ Standard_Boolean UIsNotValid = ((myUMinParameter > aPoint.U()) || (aPoint.U() > myUMaxParameter));
+ Standard_Boolean VIsNotValid = ((myVMinParameter > aPoint.V()) || (aPoint.V() > myVMaxParameter));
+ Standard_Boolean solutionIsValid = !UIsNotValid && !VIsNotValid;
+ Standard_Real U = aPoint.U();
+ Standard_Real V = aPoint.V();
+
+ if(UIsNotValid || VIsNotValid) {
+ // modified by NIZHNY-MKK Thu Jun 17 12:50:39 2004
+ Standard_Boolean bUCorrected = Standard_True;
+
+ if(UIsNotValid) {
+ // modified by NIZHNY-MKK Thu Jun 17 12:50:37 2004
+ bUCorrected = Standard_False;
+ solutionIsValid = Standard_False;
+
+ if(mySurface.IsUPeriodic()) {
+ Standard_Real aNewU = U;
+
+ if(AdjustPeriodic(U, myUMinParameter, myUMaxParameter, mySurface.UPeriod(), aNewU)) {
+ solutionIsValid = Standard_True;
+ // modified by NIZHNY-MKK Thu Jun 17 12:51:01 2004
+ bUCorrected = Standard_True;
+ U = aNewU;
+ }
+ }
+ }
+ // modified by NIZHNY-MKK Thu Jun 17 12:51:03 2004
+ // if(solutionIsValid && VIsNotValid) {
+ if(bUCorrected && VIsNotValid) {
+ solutionIsValid = Standard_False;
+
+ if(mySurface.IsVPeriodic()) {
+ Standard_Real aNewV = V;
+
+ if(AdjustPeriodic(V, myVMinParameter, myVMaxParameter, mySurface.VPeriod(), aNewV)) {
+ solutionIsValid = Standard_True;
+ V = aNewV;
+ }
+ }
+ }
+ }
+
+ if(!solutionIsValid)
+ continue;
+
+ Standard_Integer aNbRanges = myRangeManager.Length();
+
+ ComputeRangeFromStartPoint(Standard_False, aPoint.W(), U, V);
+ ComputeRangeFromStartPoint(Standard_True, aPoint.W(), U, V);
+
+ if(aNbRanges == myRangeManager.Length()) {
+ SetEmptyResultRange(aPoint.W(), myRangeManager);
+ } // end if(aNbRanges == myRangeManager.Length())
}
}
-
+
for(i = 1; i <= anExactIntersector.NbSegments(); i++) {
const IntCurveSurface_IntersectionSegment& aSegment = anExactIntersector.Segment(i);
IntCurveSurface_IntersectionPoint aPoint1, aPoint2;
aSegment.Values(aPoint1, aPoint2);
-
+
Standard_Real aFirstParameter = (aPoint1.W() < myFirstParameter) ? myFirstParameter : aPoint1.W();
Standard_Real aLastParameter = (myLastParameter < aPoint2.W()) ? myLastParameter : aPoint2.W();
Tol = Precision::PConfusion();
Handle(Geom_Curve) aCurve = BRep_Tool::Curve (myCurve.Edge(), af, al);
GeomAdaptor_Surface aGASurface (myTrsfSurface,
- myUMinParameter,
- myUMaxParameter,
- myVMinParameter,
- myVMaxParameter);
-
+ myUMinParameter,
+ myUMaxParameter,
+ myVMinParameter,
+ myVMaxParameter);
+
Bnd_Box FBox;
BndLib_AddSurface::Add(mySurface, 0., FBox);
FBox.Enlarge(myFaceTolerance);
if(anarg2 - anarg1 < Precision::PConfusion()) {
if(((i > 1) && (myRangeManager.Flag(i-1) == 2)) ||
- ((i < myRangeManager.Length()) && (myRangeManager.Flag(i+1) == 2))) {
+ ((i < myRangeManager.Length()) && (myRangeManager.Flag(i+1) == 2))) {
myRangeManager.SetFlag(i, 1);
continue;
}
myRangeManager.SetFlag(i, 1);
continue;
}
-
+
GeomAdaptor_Curve aGACurve(aCurve, anarg1, anarg2);
Extrema_ExtCS theExtCS(aGACurve, aGASurface, Tol, Tol);
myExtrema = theExtCS;
if(myExtrema.IsDone() && (myExtrema.NbExt() || myExtrema.IsParallel())) {
Standard_Integer anOldNbRanges = myRangeManager.Length();
-
+
if (myExtrema.IsParallel()) {
-
- if(myExtrema.SquareDistance(1) < myCriteria * myCriteria) {
- Standard_Real U1, V1, U2, V2;
- Standard_Real adistance1 = Distance(anarg1, U1, V1);
- Standard_Real adistance2 = Distance(anarg2, U2, V2);
- Standard_Boolean validdistance1 = (adistance1 < myCriteria);
- Standard_Boolean validdistance2 = (adistance2 < myCriteria);
-
- if (validdistance1 && validdistance2) {
- myRangeManager.InsertRange(anarg1, anarg2, 2);
- continue;
- }
- else {
- if(validdistance1) {
- ComputeRangeFromStartPoint(Standard_True, anarg1, U1, V1);
- }
- else {
- if(validdistance2) {
- ComputeRangeFromStartPoint(Standard_False, anarg2, U2, V2);
- }
- else {
- Standard_Real a = anarg1;
- Standard_Real b = anarg2;
- Standard_Real da = adistance1;
- Standard_Real db = adistance2;
- Standard_Real asolution = a;
- Standard_Boolean found = Standard_False;
-
- while(((b - a) > myCurveResolution) && !found) {
- asolution = (a+b)*0.5;
- Standard_Real adist = Distance(asolution, U1, V1);
-
- if(adist < myCriteria) {
- found = Standard_True;
- }
- else {
- if(da < db) {
- b = asolution;
- db = adist;
- }
- else {
- a = asolution;
- da = adist;
- }
- }
- } // end while
-
- if(found) {
- ComputeRangeFromStartPoint(Standard_False, asolution, U1, V1);
- ComputeRangeFromStartPoint(Standard_True, asolution, U1, V1);
- }
- else {
- myRangeManager.SetFlag(i, 1);
- }
- }
- }
- }
- }
- else {
- myRangeManager.SetFlag(i, 1);
- }
+
+ if(myExtrema.SquareDistance(1) < myCriteria * myCriteria) {
+ Standard_Real U1, V1, U2, V2;
+ Standard_Real adistance1 = Distance(anarg1, U1, V1);
+ Standard_Real adistance2 = Distance(anarg2, U2, V2);
+ Standard_Boolean validdistance1 = (adistance1 < myCriteria);
+ Standard_Boolean validdistance2 = (adistance2 < myCriteria);
+
+ if (validdistance1 && validdistance2) {
+ myRangeManager.InsertRange(anarg1, anarg2, 2);
+ continue;
+ }
+ else {
+ if(validdistance1) {
+ ComputeRangeFromStartPoint(Standard_True, anarg1, U1, V1);
+ }
+ else {
+ if(validdistance2) {
+ ComputeRangeFromStartPoint(Standard_False, anarg2, U2, V2);
+ }
+ else {
+ Standard_Real a = anarg1;
+ Standard_Real b = anarg2;
+ Standard_Real da = adistance1;
+ Standard_Real db = adistance2;
+ Standard_Real asolution = a;
+ Standard_Boolean found = Standard_False;
+
+ while(((b - a) > myCurveResolution) && !found) {
+ asolution = (a+b)*0.5;
+ Standard_Real adist = Distance(asolution, U1, V1);
+
+ if(adist < myCriteria) {
+ found = Standard_True;
+ }
+ else {
+ if(da < db) {
+ b = asolution;
+ db = adist;
+ }
+ else {
+ a = asolution;
+ da = adist;
+ }
+ }
+ } // end while
+
+ if(found) {
+ ComputeRangeFromStartPoint(Standard_False, asolution, U1, V1);
+ ComputeRangeFromStartPoint(Standard_True, asolution, U1, V1);
+ }
+ else {
+ myRangeManager.SetFlag(i, 1);
+ }
+ }
+ }
+ }
+ }
+ else {
+ myRangeManager.SetFlag(i, 1);
+ }
}
else {
- Standard_Boolean solutionfound = Standard_False;
-
- for(Standard_Integer j = 1 ; j <= myExtrema.NbExt(); j++) {
-
- if(myExtrema.SquareDistance(j) < myCriteria * myCriteria) {
- Extrema_POnCurv p1;
- Extrema_POnSurf p2;
- myExtrema.Points(j, p1, p2);
- Standard_Real U, V;
- p2.Parameter(U, V);
-
- Standard_Integer aNbRanges = myRangeManager.Length();
- ComputeRangeFromStartPoint(Standard_False, p1.Parameter(), U, V);
- ComputeRangeFromStartPoint(Standard_True, p1.Parameter(), U, V);
- solutionfound = Standard_True;
-
- if(aNbRanges == myRangeManager.Length()) {
- SetEmptyResultRange(p1.Parameter(), myRangeManager);
- }
- }
- } //end for
-
- if(!solutionfound) {
- myRangeManager.SetFlag(i, 1);
- }
+ Standard_Boolean solutionfound = Standard_False;
+
+ for(Standard_Integer j = 1 ; j <= myExtrema.NbExt(); j++) {
+
+ if(myExtrema.SquareDistance(j) < myCriteria * myCriteria) {
+ Extrema_POnCurv p1;
+ Extrema_POnSurf p2;
+ myExtrema.Points(j, p1, p2);
+ Standard_Real U, V;
+ p2.Parameter(U, V);
+
+ Standard_Integer aNbRanges = myRangeManager.Length();
+ ComputeRangeFromStartPoint(Standard_False, p1.Parameter(), U, V);
+ ComputeRangeFromStartPoint(Standard_True, p1.Parameter(), U, V);
+ solutionfound = Standard_True;
+
+ if(aNbRanges == myRangeManager.Length()) {
+ SetEmptyResultRange(p1.Parameter(), myRangeManager);
+ }
+ }
+ } //end for
+
+ if(!solutionfound) {
+ myRangeManager.SetFlag(i, 1);
+ }
}
Standard_Integer adifference = myRangeManager.Length() - anOldNbRanges;
if(adifference > 0) {
- i+=adifference;
+ i+=adifference;
}
} // end if(myExtrema.IsDone() && (myExtrema.NbExt() || myExtrema.IsParallel()))
}
{
Standard_Real U = myUMinParameter;
Standard_Real V = myVMinParameter;
-
+
for(Standard_Integer i = 1; i <= myRangeManager.Length(); i++) {
if(myRangeManager.Flag(i) > 0)
continue;
-
+
if((i > 1) && (myRangeManager.Flag(i-1) > 0))
continue;
-
+
IntTools_Range aParamRange = myRangeManager.Range(i);
-
+
if(Distance(aParamRange.First(), U, V) < myCriteria) {
Standard_Integer aNbRanges = myRangeManager.Length();
if(i > 1) {
- ComputeRangeFromStartPoint(Standard_False, aParamRange.First(), U, V, i-1);
+ ComputeRangeFromStartPoint(Standard_False, aParamRange.First(), U, V, i-1);
}
ComputeRangeFromStartPoint(Standard_True, aParamRange.First(), U, V, i + (myRangeManager.Length() - aNbRanges));
-
+
if(aNbRanges == myRangeManager.Length()) {
- SetEmptyResultRange(aParamRange.First(), myRangeManager);
+ SetEmptyResultRange(aParamRange.First(), myRangeManager);
}
}
}
-
+
if(myRangeManager.Flag(myRangeManager.Length()) == 0) {
IntTools_Range aParamRange = myRangeManager.Range(myRangeManager.Length());
-
+
if(Distance(aParamRange.Last(), U, V) < myCriteria) {
Standard_Integer aNbRanges = myRangeManager.Length();
ComputeRangeFromStartPoint(Standard_False, aParamRange.Last(), U, V, myRangeManager.Length());
if(aNbRanges == myRangeManager.Length()) {
- SetEmptyResultRange(aParamRange.Last(), myRangeManager);
+ SetEmptyResultRange(aParamRange.Last(), myRangeManager);
}
}
}
// decreasing parameter on curve if ToIncreaseParameter == Standard_False
// ==================================================================================
void IntTools_BeanFaceIntersector::ComputeRangeFromStartPoint(const Standard_Boolean ToIncreaseParameter,
- const Standard_Real theParameter,
- const Standard_Real theUParameter,
- const Standard_Real theVParameter)
+ const Standard_Real theParameter,
+ const Standard_Real theUParameter,
+ const Standard_Real theVParameter)
{
Standard_Integer aFoundIndex = myRangeManager.GetIndex(theParameter, ToIncreaseParameter);
-
+
if(aFoundIndex == 0) {
return;
}
-
+
ComputeRangeFromStartPoint(ToIncreaseParameter, theParameter, theUParameter, theVParameter, aFoundIndex);
}
// theIndex indicate that theParameter belong the range number theIndex.
// ==================================================================================
void IntTools_BeanFaceIntersector::ComputeRangeFromStartPoint(const Standard_Boolean ToIncreaseParameter,
- const Standard_Real theParameter,
- const Standard_Real theUParameter,
- const Standard_Real theVParameter,
- const Standard_Integer theIndex)
+ const Standard_Real theParameter,
+ const Standard_Real theUParameter,
+ const Standard_Real theVParameter,
+ const Standard_Integer theIndex)
{
if(myRangeManager.Flag(theIndex) > 0)
return;
-
- Standard_Integer aValidIndex = theIndex;
-
+
+ Standard_Integer aValidIndex = theIndex;
+
Standard_Real aMinDelta = myCurveResolution * 0.5;
Standard_Real aDeltaRestrictor = myLastParameter - myFirstParameter;
//
gp_Pnt aPoint = myCurve.Value(aCurPar);
Extrema_GenLocateExtPS anExtrema(aPoint, mySurface, U, V, 1.e-10, 1.e-10);
-
+
if(anExtrema.IsDone()) {
if(anExtrema.SquareDistance() < myCriteria * myCriteria) {
- Extrema_POnSurf aPOnSurf = anExtrema.Point();
+ Extrema_POnSurf aPOnSurf = anExtrema.Point();
aPOnSurf.Parameter(U, V);
- pointfound = Standard_True;
+ pointfound = Standard_True;
}
}
else {
if(pointfound) {
aPrevPar = aCurPar;
anotherSolutionFound = Standard_True;
-
+
if(BoundaryCondition && (isboundaryindex || !isvalidindex))
- break;
+ break;
}
else {
aDeltaRestrictor = aDelta;
}
-
+
// if point found decide to increase aDelta using derivative of distance function
//
-
+
aDelta = (pointfound) ? (aDelta * 2.) : (aDelta * 0.5);
aDelta = (aDelta < aDeltaRestrictor) ? aDelta : aDeltaRestrictor;
aCurPar = (ToIncreaseParameter) ? (aPrevPar + aDelta) : (aPrevPar - aDelta);
-
-
+
+
// prevent infinite loop when (aPrevPar +/- aDelta) == aPrevPar == 0.
//
-
+
if( aCurPar == aPrevPar )
break;
-
+
BoundaryCondition = (ToIncreaseParameter) ? (aCurPar > aCurrentRange.Last()) : (aCurPar < aCurrentRange.First());
-
+
isboundaryindex = Standard_False;
isvalidindex = Standard_True;
-
+
if(BoundaryCondition) {
isboundaryindex = ((!ToIncreaseParameter && (aValidIndex == 1)) ||
- (ToIncreaseParameter && (aValidIndex == myRangeManager.Length())));
-
+ (ToIncreaseParameter && (aValidIndex == myRangeManager.Length())));
+
if(!isboundaryindex) {
-
- if(pointfound) {
- Standard_Integer aFlag = (ToIncreaseParameter) ? myRangeManager.Flag(aValidIndex + 1) : myRangeManager.Flag(aValidIndex - 1);
-
- if(aFlag==0) {
- aValidIndex = (ToIncreaseParameter) ? (aValidIndex + 1) : (aValidIndex - 1);
- aCurrentRange = myRangeManager.Range(aValidIndex);
-
- if((ToIncreaseParameter && (aCurPar > aCurrentRange.Last())) ||
- (!ToIncreaseParameter && (aCurPar < aCurrentRange.First()))) {
- aCurPar = (aCurrentRange.First() + aCurrentRange.Last()) * 0.5;
- aDelta*=0.5;
- }
- }
- else {
- isvalidindex = Standard_False;
- aCurPar = (ToIncreaseParameter) ? aCurrentRange.Last() : aCurrentRange.First();
- }
- }
+
+ if(pointfound) {
+ Standard_Integer aFlag = (ToIncreaseParameter) ? myRangeManager.Flag(aValidIndex + 1) : myRangeManager.Flag(aValidIndex - 1);
+
+ if(aFlag==0) {
+ aValidIndex = (ToIncreaseParameter) ? (aValidIndex + 1) : (aValidIndex - 1);
+ aCurrentRange = myRangeManager.Range(aValidIndex);
+
+ if((ToIncreaseParameter && (aCurPar > aCurrentRange.Last())) ||
+ (!ToIncreaseParameter && (aCurPar < aCurrentRange.First()))) {
+ aCurPar = (aCurrentRange.First() + aCurrentRange.Last()) * 0.5;
+ aDelta*=0.5;
+ }
+ }
+ else {
+ isvalidindex = Standard_False;
+ aCurPar = (ToIncreaseParameter) ? aCurrentRange.Last() : aCurrentRange.First();
+ }
+ }
}
else {
- aCurPar = (ToIncreaseParameter) ? aCurrentRange.Last() : aCurrentRange.First();
+ aCurPar = (ToIncreaseParameter) ? aCurrentRange.Last() : aCurrentRange.First();
}
-
+
if(aDelta < tenOfMinDelta) {
- loopcounter++;
+ loopcounter++;
}
else {
- loopcounter = 0;
+ loopcounter = 0;
}
} // if(BoundaryCondition)
}
// purpose:
// ---------------------------------------------------------------------------------
static Standard_Boolean AdjustPeriodic(const Standard_Real U,
- const Standard_Real UFirst,
- const Standard_Real ULast,
- const Standard_Real Period,
- Standard_Real& UResult) {
+ const Standard_Real UFirst,
+ const Standard_Real ULast,
+ const Standard_Real Period,
+ Standard_Real& UResult) {
UResult = U;
Standard_Real u = U;
Standard_Real Eps = Epsilon(Period);
while (Eps > (ULast -u)) u -= Period;
if ( u < UFirst)
return Standard_False;
-
+
UResult = u;
return Standard_True;
}
// purpose:
// ---------------------------------------------------------------------------------
static Standard_Boolean SetEmptyResultRange(const Standard_Real theParameter,
- IntTools_MarkedRangeSet& theMarkedRange) {
-
+ IntTools_MarkedRangeSet& theMarkedRange) {
+
const TColStd_SequenceOfInteger& anIndices = theMarkedRange.GetIndices(theParameter);
Standard_Boolean add = (anIndices.Length() > 0);
// purpose:
// ======================================================================================================================
Standard_Boolean IntTools_BeanFaceIntersector::LocalizeSolutions(const IntTools_CurveRangeSample& theCurveRange,
- const Bnd_Box& theBoxCurve,
- const IntTools_SurfaceRangeSample& theSurfaceRange,
- const Bnd_Box& theBoxSurface,
- IntTools_CurveRangeLocalizeData& theCurveData,
- IntTools_SurfaceRangeLocalizeData& theSurfaceData,
- IntTools_ListOfCurveRangeSample& theListCurveRange,
- IntTools_ListOfSurfaceRangeSample& theListSurfaceRange)
+ const Bnd_Box& theBoxCurve,
+ const IntTools_SurfaceRangeSample& theSurfaceRange,
+ const Bnd_Box& theBoxSurface,
+ IntTools_CurveRangeLocalizeData& theCurveData,
+ IntTools_SurfaceRangeLocalizeData& theSurfaceData,
+ IntTools_ListOfCurveRangeSample& theListCurveRange,
+ IntTools_ListOfSurfaceRangeSample& theListSurfaceRange)
{
Standard_Integer tIt = 0, uIt = 0, vIt = 0;
-
+
//
IntTools_CurveRangeSample aRootRangeC(0);
aRootRangeC.SetDepth(0);
// check
CheckSampling(theCurveRange, theSurfaceRange, theCurveData, theSurfaceData,
- localdiffC, aLocalDiffU, aLocalDiffV,
- bAllowSamplingC, bAllowSamplingU, bAllowSamplingV);
+ localdiffC, aLocalDiffU, aLocalDiffV,
+ bAllowSamplingC, bAllowSamplingU, bAllowSamplingV);
//
-
+
if(!bAllowSamplingC && !bAllowSamplingU && !bAllowSamplingV) {
theListCurveRange.Append(theCurveRange);
theListSurfaceRange.Append(theSurfaceRange);
return Standard_True;
}
// ranges check.end
-
+
// init template. begin
IntTools_CurveRangeSample aNewRangeCTemplate;
IntTools_SurfaceRangeSample aNewRangeS = aNewRangeSTemplate;
if(bAllowSamplingU) {
- aNewRangeS.SetIndexU(aCurIndexU);
+ aNewRangeS.SetIndexU(aCurIndexU);
}
-
+
if(bAllowSamplingV) {
- aNewRangeS.SetIndexV(aCurIndexV);
+ aNewRangeS.SetIndexV(aCurIndexV);
}
-
+
if(theSurfaceData.IsRangeOut(aNewRangeS)) {
- bHasOutV = Standard_True;
- continue;
+ bHasOutV = Standard_True;
+ continue;
}
-
+
// ///////
-
+
Bnd_Box aBoxS;
-
+
if(!theSurfaceData.FindBox(aNewRangeS, aBoxS)) {
-
- if(mySurface.GetType() == GeomAbs_BSplineSurface) {
-// if(Standard_False ) {
- Handle(Geom_BSplineSurface) aSurfBspl = Handle(Geom_BSplineSurface)::DownCast(myTrsfSurface);
- aBoxS = GetSurfaceBox(aSurfBspl, aPrevParU, aCurParU, aPrevParV, aCurParV, myCriteria, theSurfaceData);
- }
- else {
- BndLib_AddSurface::Add(mySurface, aPrevParU, aCurParU, aPrevParV, aCurParV, myCriteria, aBoxS);
- }
-// Bnd_Box aMainBoxC;
-
- if(!bMainBoxFoundC && theCurveData.FindBox(aRootRangeC, aMainBoxC)) {
- bMainBoxFoundC = Standard_True;
- }
-
- if(aBoxS.IsOut(aMainBoxC)) {
- theSurfaceData.AddOutRange(aNewRangeS);
- bHasOutV = Standard_True;
- continue;
- }
-// }
- theSurfaceData.AddBox(aNewRangeS, aBoxS);
+
+ if(mySurface.GetType() == GeomAbs_BSplineSurface) {
+ // if(Standard_False ) {
+ Handle(Geom_BSplineSurface) aSurfBspl = Handle(Geom_BSplineSurface)::DownCast(myTrsfSurface);
+ aBoxS = GetSurfaceBox(aSurfBspl, aPrevParU, aCurParU, aPrevParV, aCurParV, myCriteria, theSurfaceData);
+ }
+ else {
+ BndLib_AddSurface::Add(mySurface, aPrevParU, aCurParU, aPrevParV, aCurParV, myCriteria, aBoxS);
+ }
+ // Bnd_Box aMainBoxC;
+
+ if(!bMainBoxFoundC && theCurveData.FindBox(aRootRangeC, aMainBoxC)) {
+ bMainBoxFoundC = Standard_True;
+ }
+
+ if(aBoxS.IsOut(aMainBoxC)) {
+ theSurfaceData.AddOutRange(aNewRangeS);
+ bHasOutV = Standard_True;
+ continue;
+ }
+ // }
+ theSurfaceData.AddBox(aNewRangeS, aBoxS);
}
-
+
if(aBoxS.IsOut(theBoxCurve)) {
- bHasOutV = Standard_True;
- continue;
+ bHasOutV = Standard_True;
+ continue;
}
-
+
IntTools_ListOfBox aListOfBox;
TColStd_ListOfInteger aListOfIndex;
-
+
Standard_Boolean bHasOutC = Standard_False;
Standard_Integer aCurIndex = aCurIndexInit;
-
+
// ////////////////////////////
aCurPar = aRangeC.First();
aPrevPar = aRangeC.First();
IntTools_CurveRangeSample aCurRangeC = aNewRangeCTemplate;
-
+
for (tIt = 1; tIt <= nbC; tIt++, aCurIndex++, aPrevPar = aCurPar) {
+
+ aCurPar += localdiffC;
+
+ // ignore already computed. begin
+ Standard_Boolean bFound = Standard_False;
+ TColStd_ListIteratorOfListOfInteger anItToAvoid(aListCToAvoid);
- aCurPar += localdiffC;
-
- // ignore already computed. begin
- Standard_Boolean bFound = Standard_False;
- TColStd_ListIteratorOfListOfInteger anItToAvoid(aListCToAvoid);
-
- for(; anItToAvoid.More(); anItToAvoid.Next()) {
- if(tIt == anItToAvoid.Value()) {
- bFound = Standard_True;
- break;
- }
- }
-
- if(!bFound) {
- if(bAllowSamplingC) {
- aCurRangeC.SetRangeIndex(aCurIndex);
- }
- bFound = theCurveData.IsRangeOut(aCurRangeC);
- }
-
- if(bFound) {
- bHasOutC = Standard_True;
- continue;
- }
- // ignore already computed. end
-
- // compute Box
- Bnd_Box aBoxC;
-
- if(!theCurveData.FindBox(aCurRangeC, aBoxC)) {
- BndLib_Add3dCurve::Add(myCurve, aPrevPar, aCurPar, myCriteria, aBoxC);
-
-// Bnd_Box aMainBoxS;
-
- if(!bMainBoxFoundS && theSurfaceData.FindBox(aRootRangeS, aMainBoxS)) {
- bMainBoxFoundS = Standard_True;
- }
- if(aBoxC.IsOut(aMainBoxS)) {
- theCurveData.AddOutRange(aCurRangeC);
- bHasOutC = Standard_True;
- continue;
- }
-// }
- theCurveData.AddBox(aCurRangeC, aBoxC);
- }
-
- if(!bGlobalCheckDone && aBoxC.IsOut(theBoxSurface)) {
- aListCToAvoid.Append(tIt);
- bHasOutC = Standard_True;
- continue;
- }
-
- if(aBoxC.IsOut(aBoxS)) {
- bHasOutV = Standard_True;
- bHasOutC = Standard_True;
- continue;
- }
- //
-
- aListOfIndex.Append(tIt);
- aListOfBox.Append(aBoxC);
+ for(; anItToAvoid.More(); anItToAvoid.Next()) {
+ if(tIt == anItToAvoid.Value()) {
+ bFound = Standard_True;
+ break;
+ }
+ }
+
+ if(!bFound) {
+ if(bAllowSamplingC) {
+ aCurRangeC.SetRangeIndex(aCurIndex);
+ }
+ bFound = theCurveData.IsRangeOut(aCurRangeC);
+ }
+
+ if(bFound) {
+ bHasOutC = Standard_True;
+ continue;
+ }
+ // ignore already computed. end
+
+ // compute Box
+ Bnd_Box aBoxC;
+
+ if(!theCurveData.FindBox(aCurRangeC, aBoxC)) {
+ BndLib_Add3dCurve::Add(myCurve, aPrevPar, aCurPar, myCriteria, aBoxC);
+
+ // Bnd_Box aMainBoxS;
+
+ if(!bMainBoxFoundS && theSurfaceData.FindBox(aRootRangeS, aMainBoxS)) {
+ bMainBoxFoundS = Standard_True;
+ }
+ if(aBoxC.IsOut(aMainBoxS)) {
+ theCurveData.AddOutRange(aCurRangeC);
+ bHasOutC = Standard_True;
+ continue;
+ }
+ // }
+ theCurveData.AddBox(aCurRangeC, aBoxC);
+ }
+
+ if(!bGlobalCheckDone && aBoxC.IsOut(theBoxSurface)) {
+ aListCToAvoid.Append(tIt);
+ bHasOutC = Standard_True;
+ continue;
+ }
+
+ if(aBoxC.IsOut(aBoxS)) {
+ bHasOutV = Standard_True;
+ bHasOutC = Standard_True;
+ continue;
+ }
+ //
+
+ aListOfIndex.Append(tIt);
+ aListOfBox.Append(aBoxC);
} // end for(tIt...)
-
+
bGlobalCheckDone = Standard_True;
-
+
if(bHasOutC) {
- bHasOutV = Standard_True;
+ bHasOutV = Standard_True;
}
-
+
// //////////////
//
-
+
IntTools_CurveRangeSample aNewRangeC = aNewRangeCTemplate;
-
+
aCurIndex = aCurIndexInit;
TColStd_ListIteratorOfListOfInteger anItI(aListOfIndex);
IntTools_ListIteratorOfListOfBox anItBox(aListOfBox);
Standard_Boolean bUseOldC = Standard_False;
Standard_Boolean bUseOldS = Standard_False;
Standard_Boolean bCheckSize = !bHasOutC;
-
+
for(; anItI.More() && anItBox.More(); anItI.Next(), anItBox.Next()) {
- aCurIndex = aCurIndexInit + anItI.Value() - 1;
-
- bUseOldS = Standard_False;
-
- if(bAllowSamplingC) {
- aNewRangeC.SetRangeIndex(aCurIndex);
- }
-
-
- if(bCheckSize) {
-
- if((theCurveRange.GetDepth() == 0) ||
- (theSurfaceRange.GetDepthU() == 0) ||
- (theSurfaceRange.GetDepthV() == 0)) {
- bHasOutC = Standard_True;
- bHasOutV = Standard_True;
- }
- else if((theCurveRange.GetDepth() < 4) &&
- (theSurfaceRange.GetDepthU() < 4) &&
- (theSurfaceRange.GetDepthV() < 4)) {
- Bnd_Box aBoxC = anItBox.Value();
-
- if(!aBoxC.IsWhole() && !aBoxS.IsWhole()) {
- Standard_Real aDiagC = aBoxC.SquareExtent();
- Standard_Real aDiagS = aBoxS.SquareExtent();
-
- if(aDiagC < aDiagS) {
- if((aDiagC * 10.) < aDiagS) {
- bUseOldC = Standard_True;
- bHasOutC = Standard_True;
- bHasOutV = Standard_True;
- break;
- }
- }
- else {
- if((aDiagS * 10.) < aDiagC) {
- bUseOldS = Standard_True;
- bHasOutC = Standard_True;
- bHasOutV = Standard_True;
- }
- }
- }
- }
- }
-
-
- if(!bHasOutC) {
- aListCurveRangeFound.Append(aNewRangeC);
- aListSurfaceRangeFound.Append(aNewRangeS);
- }
- else {
-
-// if(bUseOldS || bAllowSamplingU || bAllowSamplingV) {
-// theSurfaceData.AddBox(aNewRangeS, aBoxS);
-// }
-
- if(bUseOldS && aNewRangeC.IsEqual(theCurveRange)) {
- return Standard_False;
- }
-
- if(!LocalizeSolutions(aNewRangeC, anItBox.Value(),
- ((bUseOldS) ? theSurfaceRange : aNewRangeS),
- ((bUseOldS) ? theBoxSurface : aBoxS),
- theCurveData, theSurfaceData,
- theListCurveRange, theListSurfaceRange))
- return Standard_False;
- }
+ aCurIndex = aCurIndexInit + anItI.Value() - 1;
+
+ bUseOldS = Standard_False;
+
+ if(bAllowSamplingC) {
+ aNewRangeC.SetRangeIndex(aCurIndex);
+ }
+
+
+ if(bCheckSize) {
+
+ if((theCurveRange.GetDepth() == 0) ||
+ (theSurfaceRange.GetDepthU() == 0) ||
+ (theSurfaceRange.GetDepthV() == 0)) {
+ bHasOutC = Standard_True;
+ bHasOutV = Standard_True;
+ }
+ else if((theCurveRange.GetDepth() < 4) &&
+ (theSurfaceRange.GetDepthU() < 4) &&
+ (theSurfaceRange.GetDepthV() < 4)) {
+ Bnd_Box aBoxC = anItBox.Value();
+
+ if(!aBoxC.IsWhole() && !aBoxS.IsWhole()) {
+ Standard_Real aDiagC = aBoxC.SquareExtent();
+ Standard_Real aDiagS = aBoxS.SquareExtent();
+
+ if(aDiagC < aDiagS) {
+ if((aDiagC * 10.) < aDiagS) {
+ bUseOldC = Standard_True;
+ bHasOutC = Standard_True;
+ bHasOutV = Standard_True;
+ break;
+ }
+ }
+ else {
+ if((aDiagS * 10.) < aDiagC) {
+ bUseOldS = Standard_True;
+ bHasOutC = Standard_True;
+ bHasOutV = Standard_True;
+ }
+ }
+ }
+ }
+ }
+
+
+ if(!bHasOutC) {
+ aListCurveRangeFound.Append(aNewRangeC);
+ aListSurfaceRangeFound.Append(aNewRangeS);
+ }
+ else {
+
+ // if(bUseOldS || bAllowSamplingU || bAllowSamplingV) {
+ // theSurfaceData.AddBox(aNewRangeS, aBoxS);
+ // }
+
+ if(bUseOldS && aNewRangeC.IsEqual(theCurveRange)) {
+ return Standard_False;
+ }
+
+ if(!LocalizeSolutions(aNewRangeC, anItBox.Value(),
+ ((bUseOldS) ? theSurfaceRange : aNewRangeS),
+ ((bUseOldS) ? theBoxSurface : aBoxS),
+ theCurveData, theSurfaceData,
+ theListCurveRange, theListSurfaceRange))
+ return Standard_False;
+ }
}
// end (tIt...)
aListOfIndex.Clear();
aListOfBox.Clear();
-
+
if(bHasOutV) {
-// theSurfaceData.AddBox(aNewRangeS, aBoxS);
-
- if(bUseOldC && bAllowSamplingC && (bAllowSamplingU || bAllowSamplingV)) {
- if(!LocalizeSolutions(theCurveRange, theBoxCurve,
- aNewRangeS, aBoxS,
- theCurveData, theSurfaceData,
- theListCurveRange, theListSurfaceRange))
- return Standard_False;
- }
+ // theSurfaceData.AddBox(aNewRangeS, aBoxS);
+
+ if(bUseOldC && bAllowSamplingC && (bAllowSamplingU || bAllowSamplingV)) {
+ if(!LocalizeSolutions(theCurveRange, theBoxCurve,
+ aNewRangeS, aBoxS,
+ theCurveData, theSurfaceData,
+ theListCurveRange, theListSurfaceRange))
+ return Standard_False;
+ }
}
} // end for (vIt...)
-
+
if(bHasOutV) {
bHasOut = Standard_True;
}
// ======================================================================================================================
Standard_Boolean IntTools_BeanFaceIntersector::ComputeLocalized() {
Standard_Real Tol = Precision::PConfusion();
-
+
IntTools_SurfaceRangeSample aSurfaceRange(0, 0, 0, 0);
Standard_Real dMinU = 10. * Precision::PConfusion();
Standard_Real dMinV = dMinU;
IntTools_SurfaceRangeLocalizeData& aSurfaceData = myContext->SurfaceData(mySurface.Face());
aSurfaceData.RemoveRangeOutAll();
aSurfaceData.ClearGrid();
-
+
Bnd_Box FBox;
Standard_Boolean bFBoxFound = aSurfaceData.FindBox(aSurfaceRange, FBox);
-
+
if(mySurface.GetType() == GeomAbs_BSplineSurface) {
Handle(Geom_BSplineSurface) aSurfBspl = Handle(Geom_BSplineSurface)::DownCast(myTrsfSurface);
-
+
ComputeGridPoints(aSurfBspl, myUMinParameter, myUMaxParameter,
- myVMinParameter, myVMaxParameter, myFaceTolerance,
- aSurfaceData);
-
+ myVMinParameter, myVMaxParameter, myFaceTolerance,
+ aSurfaceData);
+
if(!bFBoxFound) {
FBox = GetSurfaceBox(aSurfBspl, myUMinParameter, myUMaxParameter,
- myVMinParameter, myVMaxParameter, myCriteria,
- aSurfaceData);
+ myVMinParameter, myVMaxParameter, myCriteria,
+ aSurfaceData);
aSurfaceData.AddBox(aSurfaceRange, FBox);
}
-
+
} else if(!bFBoxFound) {
BndLib_AddSurface::Add(mySurface, myUMinParameter, myUMaxParameter, myVMinParameter, myVMaxParameter, myFaceTolerance, FBox);
- aSurfaceData.AddBox(aSurfaceRange, FBox);
- }
-
+ aSurfaceData.AddBox(aSurfaceRange, FBox);
+ }
+
Bnd_Box EBox;
-
+
BndLib_Add3dCurve::Add(myCurve.Trim(myFirstParameter, myLastParameter, Precision::PConfusion())->Curve(), myBeanTolerance, EBox);
-
+
if(EBox.IsOut(FBox)) {
for(Standard_Integer i = 1; i <= myRangeManager.Length(); i++) {
myRangeManager.SetFlag(i, 1);
Standard_Integer nbSampleV = aSurfaceData.GetNbSampleV();
Standard_Real dMinC = 10. * myCurveResolution;
IntTools_ListOfCurveRangeSample aListOut;
-
+
// check
Standard_Boolean bAllowSamplingC = Standard_True;
Standard_Boolean bAllowSamplingU = Standard_True;
IntTools_SurfaceRangeLocalizeData aSurfaceDataTmp(nbSampleU, nbSampleV, dMinU, dMinV);
CheckSampling(aCurveRange, aSurfaceRange, aCurveDataTmp, aSurfaceDataTmp,
- myLastParameter - myFirstParameter,
- myUMaxParameter - myUMinParameter,
- myVMaxParameter - myVMinParameter,
- bAllowSamplingC, bAllowSamplingU, bAllowSamplingV);
-
-
+ myLastParameter - myFirstParameter,
+ myUMaxParameter - myUMinParameter,
+ myVMaxParameter - myVMinParameter,
+ bAllowSamplingC, bAllowSamplingU, bAllowSamplingV);
+
+
{
IntTools_CurveRangeLocalizeData aCurveData(nbSampleC, dMinC);
-
+
aCurveData.AddBox(aCurveRange, EBox);
if(!LocalizeSolutions(aCurveRange, EBox, aSurfaceRange, FBox,
- aCurveData, aSurfaceData,
- aListCurveRange, aListSurfaceRange)) {
+ aCurveData, aSurfaceData,
+ aListCurveRange, aListSurfaceRange)) {
aSurfaceData.ClearGrid();
-
+
return Standard_False;
}
-
+
IntTools_ListOfCurveRangeSample aListCurveRangeSort;
IntTools_ListOfSurfaceRangeSample aListSurfaceRangeSort;
-
+
MergeSolutions(aListCurveRange, aListSurfaceRange, aListCurveRangeSort, aListSurfaceRangeSort);
-
+
IntTools_ListIteratorOfListOfCurveRangeSample anItC(aListCurveRangeSort);
IntTools_ListIteratorOfListOfSurfaceRangeSample anItS(aListSurfaceRangeSort);
IntTools_SurfaceRangeSample aRangeSPrev;
-
+
Extrema_GenExtCS anExtremaGen;
-
+
for(; anItC.More() && anItS.More(); anItC.Next(), anItS.Next()) {
-
+
IntTools_Range aRangeC(myFirstParameter, myLastParameter);
if(bAllowSamplingC)
- aRangeC = anItC.Value().GetRange(myFirstParameter, myLastParameter, nbSampleC);
-
+ aRangeC = anItC.Value().GetRange(myFirstParameter, myLastParameter, nbSampleC);
+
IntTools_Range aRangeU(myUMinParameter, myUMaxParameter);
if(bAllowSamplingU)
- aRangeU = anItS.Value().GetRangeU(myUMinParameter, myUMaxParameter, nbSampleU);
-
+ aRangeU = anItS.Value().GetRangeU(myUMinParameter, myUMaxParameter, nbSampleU);
+
IntTools_Range aRangeV(myVMinParameter, myVMaxParameter);
-
+
if(bAllowSamplingV)
- aRangeV = anItS.Value().GetRangeV(myVMinParameter, myVMaxParameter, nbSampleV);
-
+ aRangeV = anItS.Value().GetRangeV(myVMinParameter, myVMaxParameter, nbSampleV);
+
Standard_Real anarg1 = aRangeC.First(), anarg2 = aRangeC.Last();
-
+
Standard_Boolean bFound = Standard_False;
-
+
Standard_Integer nMinIndex = myRangeManager.Length();
Standard_Integer nMaxIndex = -1;
const TColStd_SequenceOfInteger& anInds1 = myRangeManager.GetIndices(anarg1);
Standard_Integer indIt = 1;
for(indIt = 1 ; indIt <= anInds1.Length(); indIt++) {
- Standard_Integer nIndex = anInds1.Value(indIt);
- nMinIndex = (nMinIndex > nIndex) ? nIndex : nMinIndex;
- nMaxIndex = (nMaxIndex < nIndex) ? nIndex : nMaxIndex;
+ Standard_Integer nIndex = anInds1.Value(indIt);
+ nMinIndex = (nMinIndex > nIndex) ? nIndex : nMinIndex;
+ nMaxIndex = (nMaxIndex < nIndex) ? nIndex : nMaxIndex;
}
-
+
for(indIt = nMinIndex ; indIt <= nMaxIndex; indIt++) {
- if(myRangeManager.Flag(indIt) == 2) {
- bFound = Standard_True;
- break;
- }
+ if(myRangeManager.Flag(indIt) == 2) {
+ bFound = Standard_True;
+ break;
+ }
}
-
+
if(bFound)
- continue;
+ continue;
nMinIndex = (nMaxIndex >= 0) ? nMaxIndex : nMinIndex;
const TColStd_SequenceOfInteger& anInds2 = myRangeManager.GetIndices(anarg2);
-
+
for(indIt = 1 ; indIt <= anInds2.Length(); indIt++) {
- Standard_Integer nIndex = anInds2.Value(indIt);
- nMinIndex = (nMinIndex > nIndex) ? nIndex : nMinIndex;
- nMaxIndex = (nMaxIndex < nIndex) ? nIndex : nMaxIndex;
+ Standard_Integer nIndex = anInds2.Value(indIt);
+ nMinIndex = (nMinIndex > nIndex) ? nIndex : nMinIndex;
+ nMaxIndex = (nMaxIndex < nIndex) ? nIndex : nMaxIndex;
}
for(indIt = nMinIndex ; indIt <= nMaxIndex; indIt++) {
- if(myRangeManager.Flag(indIt) == 2) {
- bFound = Standard_True;
- break;
- }
+ if(myRangeManager.Flag(indIt) == 2) {
+ bFound = Standard_True;
+ break;
+ }
}
-
+
if(bFound)
- continue;
-
+ continue;
+
Standard_Real parUF = aRangeU.First(), parUL = aRangeU.Last();
Standard_Real parVF = aRangeV.First(), parVL = aRangeV.Last();
-
+
if(aRangeSPrev.IsEqual(anItS.Value())) {
- anExtremaGen.Perform(myCurve, 10, anarg1, anarg2, Tol);
+ anExtremaGen.Perform(myCurve, 10, anarg1, anarg2, Tol);
}
else {
- anExtremaGen.Initialize(mySurface, 10, 10, parUF, parUL, parVF, parVL, Tol);
- anExtremaGen.Perform(myCurve, 10, anarg1, anarg2, Tol);
+ anExtremaGen.Initialize(mySurface, 10, 10, parUF, parUL, parVF, parVL, Tol);
+ anExtremaGen.Perform(myCurve, 10, anarg1, anarg2, Tol);
}
-
+
if(anExtremaGen.IsDone() && (anExtremaGen.NbExt() > 0)) {
+
+ for(Standard_Integer j = 1 ; j <= anExtremaGen.NbExt(); j++) {
- for(Standard_Integer j = 1 ; j <= anExtremaGen.NbExt(); j++) {
-
- if(anExtremaGen.SquareDistance(j) < myCriteria * myCriteria) {
-
- Extrema_POnCurv p1;
- Extrema_POnSurf p2;
- p1 = anExtremaGen.PointOnCurve(j);
- p2 = anExtremaGen.PointOnSurface(j);
- Standard_Real U, V, T;
- T = p1.Parameter();
- p2.Parameter(U, V);
-
- if (myCurve.IsPeriodic())
- T = ElCLib::InPeriod(T, anarg1, anarg1 + myCurve.Period());
- if (mySurface.IsUPeriodic())
- U = ElCLib::InPeriod(U, parUF, parUF + mySurface.UPeriod());
- if (mySurface.IsVPeriodic())
- V = ElCLib::InPeriod(V, parVF, parVF + mySurface.VPeriod());
-
- //To avoid occasional going out of boundaries because of numerical
- //problem
- if(U < myUMinParameter) U = myUMinParameter;
- if(U > myUMaxParameter) U = myUMaxParameter;
- if(V < myVMinParameter) V = myVMinParameter;
- if(V > myVMaxParameter) V = myVMaxParameter;
-
- Standard_Integer aNbRanges = myRangeManager.Length();
- ComputeRangeFromStartPoint(Standard_False, T, U, V);
- ComputeRangeFromStartPoint(Standard_True, T, U, V);
-
- if(aNbRanges == myRangeManager.Length()) {
- SetEmptyResultRange(T, myRangeManager);
- }
- }
- } //end for
+ if(anExtremaGen.SquareDistance(j) < myCriteria * myCriteria) {
+
+ Extrema_POnCurv p1;
+ Extrema_POnSurf p2;
+ p1 = anExtremaGen.PointOnCurve(j);
+ p2 = anExtremaGen.PointOnSurface(j);
+ Standard_Real U, V, T;
+ T = p1.Parameter();
+ p2.Parameter(U, V);
+
+ if (myCurve.IsPeriodic())
+ T = ElCLib::InPeriod(T, anarg1, anarg1 + myCurve.Period());
+ if (mySurface.IsUPeriodic())
+ U = ElCLib::InPeriod(U, parUF, parUF + mySurface.UPeriod());
+ if (mySurface.IsVPeriodic())
+ V = ElCLib::InPeriod(V, parVF, parVF + mySurface.VPeriod());
+
+ //To avoid occasional going out of boundaries because of numerical
+ //problem
+ if(U < myUMinParameter) U = myUMinParameter;
+ if(U > myUMaxParameter) U = myUMaxParameter;
+ if(V < myVMinParameter) V = myVMinParameter;
+ if(V > myVMaxParameter) V = myVMaxParameter;
+
+ Standard_Integer aNbRanges = myRangeManager.Length();
+ ComputeRangeFromStartPoint(Standard_False, T, U, V);
+ ComputeRangeFromStartPoint(Standard_True, T, U, V);
+
+ if(aNbRanges == myRangeManager.Length()) {
+ SetEmptyResultRange(T, myRangeManager);
+ }
+ }
+ } //end for
}
else {
- myRangeManager.InsertRange(anarg1, anarg2, 0);
+ myRangeManager.InsertRange(anarg1, anarg2, 0);
}
-
+
aRangeSPrev = anItS.Value();
}
-
+
//
aCurveData.ListRangeOut(aListOut);
}
-
+
//
if(bAllowSamplingC) {
IntTools_ListIteratorOfListOfCurveRangeSample anItC(aListOut);
-
+
for(; anItC.More(); anItC.Next()) {
IntTools_Range aRangeC =anItC.Value().GetRange(myFirstParameter, myLastParameter, nbSampleC);
myRangeManager.InsertRange(aRangeC.First(), aRangeC.Last(), 1);
}
}
ComputeNearRangeBoundaries();
-
+
aSurfaceData.ClearGrid();
return Standard_True;
// purpose:
// ---------------------------------------------------------------------------------
Bnd_Box GetSurfaceBox(const Handle(Geom_BSplineSurface) &theSurf,
- const Standard_Real theFirstU,
- const Standard_Real theLastU,
- const Standard_Real theFirstV,
- const Standard_Real theLastV,
- const Standard_Real theTolerance,
- IntTools_SurfaceRangeLocalizeData &theSurfaceData)
+ const Standard_Real theFirstU,
+ const Standard_Real theLastU,
+ const Standard_Real theFirstV,
+ const Standard_Real theLastV,
+ const Standard_Real theTolerance,
+ IntTools_SurfaceRangeLocalizeData &theSurfaceData)
{
Bnd_Box aTotalBox;
-
+
BuildBox(theSurf, theFirstU, theLastU, theFirstV, theLastV,
- theSurfaceData, aTotalBox);
+ theSurfaceData, aTotalBox);
aTotalBox.Enlarge(theTolerance);
return aTotalBox;
// purpose:
// ---------------------------------------------------------------------------------
void ComputeGridPoints
- (const Handle(Geom_BSplineSurface) &theSurf,
- const Standard_Real theFirstU,
- const Standard_Real theLastU,
- const Standard_Real theFirstV,
- const Standard_Real theLastV,
- const Standard_Real theTolerance,
- IntTools_SurfaceRangeLocalizeData &theSurfaceData)
+ (const Handle(Geom_BSplineSurface) &theSurf,
+ const Standard_Real theFirstU,
+ const Standard_Real theLastU,
+ const Standard_Real theFirstV,
+ const Standard_Real theLastV,
+ const Standard_Real theTolerance,
+ IntTools_SurfaceRangeLocalizeData &theSurfaceData)
{
Standard_Integer i;
Standard_Integer j;
aLPar[1] + theTolerance };
Standard_Real aLmTol[2] = { aLPar[0] - theTolerance,
aLPar[1] - theTolerance };
-
+
// Compute number of U and V grid points.
for (j = 0; j < 2; j++) {
const TColStd_Array1OfReal &aKnots = (j == 0) ? aKnotsU : aKnotsV;
-
+
for (i = 1; i <= aNbKnots[j] && (iMin[j] == -1 || iMax[j] == -1); i++) {
if (iMin[j] == -1 && aFpTol[j] < aKnots.Value(i))
- iMin[j] = i - 1;
-
+ iMin[j] = i - 1;
+
iLmI = aNbKnots[j] - i + 1;
-
+
if (iMax[j] == -1 && aLmTol[j] > aKnots.Value(iLmI))
- iMax[j] = iLmI + 1;
+ iMax[j] = iLmI + 1;
}
-
+
// If indices are not found, return.
//if (iMin[j] == -1 || iMax[j] == -1)
//return;
theSurfaceData.SetRangeUGrid(aNbGridPnts[j]);
else // j == 1
theSurfaceData.SetRangeVGrid(aNbGridPnts[j]);
-
+
// Setting the first and last parameters.
Standard_Integer iAbs = 1;
Standard_Real aMinPar;
Standard_Real aMaxPar = (j == 0) ? theLastU : theLastV;
-
+
for (i = iMin[j]; i < iMax[j]; i++) {
// Get the first parameter.
if (i == iMin[j]) {
- // The first knot.
- if (aFmTol[j] > aKnots.Value(iMin[j]))
- aMinPar = aFPar[j];
- else
- aMinPar = aKnots.Value(iMin[j]);
+ // The first knot.
+ if (aFmTol[j] > aKnots.Value(iMin[j]))
+ aMinPar = aFPar[j];
+ else
+ aMinPar = aKnots.Value(iMin[j]);
} else {
- aMinPar = aKnots.Value(i);
+ aMinPar = aKnots.Value(i);
}
-
+
// Get the last parameter.
if (i == iMax[j] - 1) {
- // The last knot.
- if (aLpTol[j] < aKnots.Value(iMax[j]))
- aMaxPar = aLPar[j];
- else
- aMaxPar = aKnots.Value(iMax[j]);
+ // The last knot.
+ if (aLpTol[j] < aKnots.Value(iMax[j]))
+ aMaxPar = aLPar[j];
+ else
+ aMaxPar = aKnots.Value(iMax[j]);
} else {
- aMaxPar = aKnots.Value(i + 1);
+ aMaxPar = aKnots.Value(i + 1);
}
-
+
// Compute grid parameters.
Standard_Real aDelta = (aMaxPar - aMinPar)/aNbSamples[j];
-
+
for (k = 0; k < aNbSamples[j]; k++, aMinPar += aDelta) {
- if (j == 0)
- theSurfaceData.SetUParam(iAbs++, aMinPar);
- else
- theSurfaceData.SetVParam(iAbs++, aMinPar);
+ if (j == 0)
+ theSurfaceData.SetUParam(iAbs++, aMinPar);
+ else
+ theSurfaceData.SetVParam(iAbs++, aMinPar);
}
}
-
+
// Add the last parameter
if (j == 0)
theSurfaceData.SetUParam(iAbs++, aMaxPar);
else
theSurfaceData.SetVParam(iAbs++, aMaxPar);
}
-
+
// Compute of grid points.
gp_Pnt aPnt;
Standard_Real aParU;
Standard_Real aParV;
-
+
for (i = 1; i <= aNbGridPnts[0]; i++) {
aParU = theSurfaceData.GetUParam(i);
-
+
for (j = 1; j <= aNbGridPnts[1]; j++) {
aParV = theSurfaceData.GetVParam(j);
-
+
theSurf->D0(aParU, aParV, aPnt);
theSurfaceData.SetGridPoint(i, j, aPnt);
}
// // Compute DU deflection.
// for (i = 1; i < aNbGridPnts[0]; i++) {
// aParMid = 0.5*(theSurfaceData.GetUParam(i + 1) +
-// theSurfaceData.GetUParam(i));
+// theSurfaceData.GetUParam(i));
// for (j = 1; j <= aNbGridPnts[1]; j++) {
// const gp_Pnt &thePnt1 = theSurfaceData.GetGridPoint(i, j);
// aDefLin = aCoord.Modulus();
// if (aDefLin > aDef)
-// aDef = aDefLin;
+// aDef = aDefLin;
// }
// }
// }
// // Compute DV deflection.
// for (j = 1; j < aNbGridPnts[1]; j++) {
// aParMid = 0.5*(theSurfaceData.GetVParam(j + 1) +
-// theSurfaceData.GetVParam(j));
+// theSurfaceData.GetVParam(j));
// for (i = 1; i <= aNbGridPnts[0]; i++) {
// const gp_Pnt &thePnt1 = theSurfaceData.GetGridPoint(i, j);
// aDefLin = aCoord.Modulus();
// if (aDefLin > aDef)
-// aDef = aDefLin;
+// aDef = aDefLin;
// }
// }
// }
// purpose: Compute bounding box.
// ---------------------------------------------------------------------------------
void BuildBox(const Handle(Geom_BSplineSurface) &theSurf,
- const Standard_Real theFirstU,
- const Standard_Real theLastU,
- const Standard_Real theFirstV,
- const Standard_Real theLastV,
- IntTools_SurfaceRangeLocalizeData &theSurfaceData,
- Bnd_Box &theBox)
+ const Standard_Real theFirstU,
+ const Standard_Real theLastU,
+ const Standard_Real theFirstV,
+ const Standard_Real theLastV,
+ IntTools_SurfaceRangeLocalizeData &theSurfaceData,
+ Bnd_Box &theBox)
{
Standard_Integer i;
Standard_Integer j;
// purpose:
// ---------------------------------------------------------------------------------
static void MergeSolutions(const IntTools_ListOfCurveRangeSample& theListCurveRange,
- const IntTools_ListOfSurfaceRangeSample& theListSurfaceRange,
- IntTools_ListOfCurveRangeSample& theListCurveRangeSort,
- IntTools_ListOfSurfaceRangeSample& theListSurfaceRangeSort) {
-
+ const IntTools_ListOfSurfaceRangeSample& theListSurfaceRange,
+ IntTools_ListOfCurveRangeSample& theListCurveRangeSort,
+ IntTools_ListOfSurfaceRangeSample& theListSurfaceRangeSort) {
+
IntTools_ListIteratorOfListOfCurveRangeSample anItC2;
IntTools_ListIteratorOfListOfSurfaceRangeSample anItS1(theListSurfaceRange), anItS2;
IntTools_MapOfSurfaceSample aMapToAvoid;
for(; anItS2.More() && anItC2.More(); anItS2.Next(), anItC2.Next()) {
if(aRangeS.IsEqual(anItS2.Value())) {
- theListCurveRangeSort.Append(anItC2.Value());
- theListSurfaceRangeSort.Append(anItS2.Value());
+ theListCurveRangeSort.Append(anItC2.Value());
+ theListSurfaceRangeSort.Append(anItS2.Value());
}
}
}
// purpose:
// ---------------------------------------------------------------------------------
static void CheckSampling(const IntTools_CurveRangeSample& theCurveRange,
- const IntTools_SurfaceRangeSample& theSurfaceRange,
- const IntTools_CurveRangeLocalizeData& theCurveData,
- const IntTools_SurfaceRangeLocalizeData& theSurfaceData,
- const Standard_Real DiffC,
- const Standard_Real DiffU,
- const Standard_Real DiffV,
- Standard_Boolean& bAllowSamplingC,
- Standard_Boolean& bAllowSamplingU,
- Standard_Boolean& bAllowSamplingV) {
-
+ const IntTools_SurfaceRangeSample& theSurfaceRange,
+ const IntTools_CurveRangeLocalizeData& theCurveData,
+ const IntTools_SurfaceRangeLocalizeData& theSurfaceData,
+ const Standard_Real DiffC,
+ const Standard_Real DiffU,
+ const Standard_Real DiffV,
+ Standard_Boolean& bAllowSamplingC,
+ Standard_Boolean& bAllowSamplingU,
+ Standard_Boolean& bAllowSamplingV) {
+
const Standard_Real dLimit = 1000;
bAllowSamplingC = Standard_True;
bAllowSamplingU = Standard_True;
--- /dev/null
+-- Created by: Peter KURNEV
+-- Copyright (c) 1999-2014 OPEN CASCADE SAS
+--
+-- This file is part of Open CASCADE Technology software library.
+--
+-- This library is free software; you can redistribute it and/or modify it under
+-- the terms of the GNU Lesser General Public License version 2.1 as published
+-- by the Free Software Foundation, with special exception defined in the file
+-- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+-- distribution for complete text of the license and disclaimer of any warranty.
+--
+-- Alternatively, this file may be used under the terms of Open CASCADE
+-- commercial license or contractual agreement.
+
+
+class Context from IntTools
+ inherits TShared from MMgt
+
+
+---Purpose:
+ -- The intersection Context contains geometrical
+ -- and topological toolkit (classifiers, projectors, etc).
+ -- The intersection Context is for caching the tools
+ -- to increase the performance.
+
+
+uses
+
+ Pnt2d from gp,
+ Pnt from gp,
+ State from TopAbs,
+ Curve from Geom,
+ ProjectPointOnCurve from GeomAPI,
+ ProjectPointOnSurf from GeomAPI,
+ Vertex from TopoDS,
+ Face from TopoDS,
+ Edge from TopoDS,
+ Solid from TopoDS,
+ SolidClassifier from BRepClass3d,
+ FClass2d from IntTools,
+ Curve from IntTools,
+ BaseAllocator from BOPCol,
+ DataMapOfShapeAddress from BOPCol,
+ DataMapOfTransientAddress from BOPCol,
+ Hatcher from Geom2dHatch,
+ SurfaceRangeLocalizeData from IntTools
+
+--raises
+
+is
+ Create
+
+ returns Context from IntTools;
+ ---C++: alias "Standard_EXPORT virtual ~IntTools_Context();"
+ Create (theAllocator: BaseAllocator from BOPCol)
+
+ returns Context from IntTools;
+
+ FClass2d(me:mutable;
+ aF: Face from TopoDS)
+ returns FClass2d from IntTools;
+ ---C++: return &
+ ---Purpose:
+ --- Returns a reference to point classifier
+ --- for given face
+ ---
+
+ ProjPS (me:mutable;
+ aF: Face from TopoDS)
+ returns ProjectPointOnSurf from GeomAPI;
+ ---C++: return &
+ ---Purpose:
+ --- Returns a reference to point projector
+ --- for given face
+ ---
+
+ ProjPC (me:mutable;
+ aE: Edge from TopoDS)
+ returns ProjectPointOnCurve from GeomAPI;
+ ---C++: return &
+ ---Purpose:
+ --- Returns a reference to point projector
+ --- for given edge
+ ---
+
+ ProjPT (me:mutable;
+ aC: Curve from Geom)
+ returns ProjectPointOnCurve from GeomAPI;
+ ---C++: return &
+ ---Purpose:
+ --- Returns a reference to point projector
+ --- for given curve
+ ---
+
+ SurfaceData(me: mutable;
+ aF: Face from TopoDS)
+ returns SurfaceRangeLocalizeData from IntTools;
+ ---C++: return &
+ ---Purpose:
+ --- Returns a reference to surface localization data
+ --- for given face
+
+ SolidClassifier(me:mutable;
+ aSolid: Solid from TopoDS)
+ returns SolidClassifier from BRepClass3d;
+ ---C++: return &
+ ---Purpose:
+ --- Returns a reference to solid classifier
+ --- for given solid
+ ---
+
+ Hatcher(me: mutable;
+ aF: Face from TopoDS)
+ returns Hatcher from Geom2dHatch;
+ ---C++: return &
+ ---Purpose:
+ --- Returns a reference to 2D hatcher
+ --- for given face
+ ---
+
+ ComputePE (me:mutable;
+ theP : Pnt from gp;
+ theTolP: Real from Standard;
+ theE : Edge from TopoDS;
+ theT :out Real from Standard)
+ returns Integer from Standard;
+ ---Purpose:
+ --- Computes parameter of the Point theP on
+ --- the edge aE.
+ --- Returns zero if the distance between point
+ --- and edge is less than sum of tolerance value of edge and theTopP,
+ --- otherwise and for following conditions returns
+ --- negative value
+ --- 1. the edge is degenerated (-1)
+ --- 2. the edge does not contain 3d curve and pcurves (-2)
+ --- 3. projection algorithm failed (-3)
+ ---
+
+ ComputeVE (me:mutable;
+ aV : Vertex from TopoDS;
+ aE : Edge from TopoDS;
+ aT :out Real from Standard)
+ returns Integer from Standard;
+ ---Purpose:
+ --- Computes parameter of the vertex aV on
+ --- the edge aE.
+ --- Returns zero if the distance between vertex
+ --- and edge is less than sum of tolerances,
+ --- otherwise and for following conditions returns
+ --- negative value
+ --- 1. the edge is degenerated (-1)
+ --- 2. the edge does not contain 3d curve and pcurves (-2)
+ --- 3. projection algorithm failed (-3)
+ ---
+
+ ComputeVF (me:mutable;
+ aV : Vertex from TopoDS;
+ aF : Face from TopoDS;
+ U : out Real from Standard;
+ V : out Real from Standard)
+ returns Integer from Standard;
+ ---Purpose:
+ --- Computes UV parameters of the vertex aV on face aF
+ --- Returns zero if the distance between vertex and face is
+ --- less than or equal the sum of tolerances and the projection
+ --- point lays inside boundaries of the face.
+ --- For following conditions returns negative value
+ --- 1. projection algorithm failed (-1)
+ --- 2. distance is more than sum of tolerances (-2)
+ --- 3. projection point out or on the boundaries of face (-3)
+ ---
+
+ StatePointFace(me:mutable;
+ aF : Face from TopoDS;
+ aP2D : Pnt2d from gp)
+ returns State from TopAbs;
+ ---Purpose:
+ --- Returns the state of the point aP2D
+ --- relative to face aF
+ ---
+
+ IsPointInFace(me:mutable;
+ aF : Face from TopoDS;
+ aP2D : Pnt2d from gp)
+ returns Boolean from Standard;
+ ---Purpose:
+ --- Returns true if the point aP2D is
+ --- inside the boundaries of the face aF,
+ --- otherwise returns false
+ ---
+
+
+ IsPointInOnFace(me:mutable;
+ aF : Face from TopoDS;
+ aP2D : Pnt2d from gp)
+ returns Boolean from Standard;
+ ---Purpose:
+ --- Returns true if the point aP2D is
+ --- inside or on the boundaries of aF
+ ---
+
+ IsValidPointForFace(me:mutable;
+ aP3D : Pnt from gp;
+ aF : Face from TopoDS;
+ aTol : Real from Standard)
+ returns Boolean from Standard;
+ ---Purpose:
+ --- Returns true if the distance between point aP3D
+ --- and face aF is less or equal to tolerance aTol
+ --- and projection point is inside or on the boundaries
+ --- of the face aF
+ ---
+
+ IsValidPointForFaces(me:mutable;
+ aP3D : Pnt from gp;
+ aF1 : Face from TopoDS;
+ aF2 : Face from TopoDS;
+ aTol : Real from Standard)
+ returns Boolean from Standard;
+ ---Purpose:
+ --- Returns true if IsValidPointForFace returns true
+ --- for both face aF1 and aF2
+ ---
+
+ IsValidBlockForFace (me:mutable;
+ aT1 : Real from Standard;
+ aT2 : Real from Standard;
+ aIC : Curve from IntTools;
+ aF : Face from TopoDS;
+ aTol : Real from Standard)
+ returns Boolean from Standard;
+ ---Purpose:
+ --- Returns true if IsValidPointForFace returns true
+ --- for some 3d point that lay on the curve aIC bounded by
+ --- parameters aT1 and aT2
+ ---
+
+ IsValidBlockForFaces (me:mutable;
+ aT1 : Real from Standard;
+ aT2 : Real from Standard;
+ aIC : Curve from IntTools;
+ aF1 : Face from TopoDS;
+ aF2 : Face from TopoDS;
+ aTol : Real from Standard)
+ returns Boolean from Standard;
+ ---Purpose:
+ --- Returns true if IsValidBlockForFace returns true
+ --- for both faces aF1 and aF2
+ ---
+
+ IsVertexOnLine(me:mutable;
+ aV : Vertex from TopoDS;
+ aIC : Curve from IntTools;
+ aTolC: Real from Standard;
+ aT :out Real from Standard)
+ returns Boolean from Standard;
+ ---Purpose:
+ --- Computes parameter of the vertex aV on
+ --- the curve aIC.
+ --- Returns true if the distance between vertex and
+ --- curve is less than sum of tolerance of aV and aTolC,
+ --- otherwise or if projection algorithm failed
+ --- returns false (in this case aT isn't significant)
+ ---
+
+ IsVertexOnLine(me:mutable;
+ aV : Vertex from TopoDS;
+ aTolV: Real from Standard;
+ aIC : Curve from IntTools;
+ aTolC: Real from Standard;
+ aT :out Real from Standard)
+ returns Boolean from Standard;
+ ---Purpose:
+ --- Computes parameter of the vertex aV on
+ --- the curve aIC.
+ --- Returns true if the distance between vertex and
+ --- curve is less than sum of tolerance of aV and aTolC,
+ --- otherwise or if projection algorithm failed
+ --- returns false (in this case aT isn't significant)
+ ---
+
+ ProjectPointOnEdge (me:mutable;
+ aP : Pnt from gp;
+ aE : Edge from TopoDS;
+ aT :out Real from Standard)
+ returns Boolean from Standard;
+ ---Purpose:
+ --- Computes parameter of the point aP on
+ --- the edge aE.
+ --- Returns false if projection algorithm failed
+ --- other wiese returns true.
+ ---
+
+fields
+ myAllocator : BaseAllocator from BOPCol is protected;
+ myFClass2dMap:DataMapOfShapeAddress from BOPCol is protected;
+ myProjPSMap :DataMapOfShapeAddress from BOPCol is protected;
+ myProjPCMap :DataMapOfShapeAddress from BOPCol is protected;
+ mySClassMap :DataMapOfShapeAddress from BOPCol is protected;
+ myProjPTMap :DataMapOfTransientAddress from BOPCol is protected;
+ myHatcherMap :DataMapOfShapeAddress from BOPCol is protected;
+ myProjSDataMap:DataMapOfShapeAddress from BOPCol is protected;
+ myCreateFlag :Integer from Standard is protected;
+
+end Context;
+
--- /dev/null
+// Created by: Peter KURNEV
+// Copyright (c) 1999-2014 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+#include <IntTools_Context.ixx>
+
+#include <Precision.hxx>
+
+#include <Geom_Curve.hxx>
+#include <Geom_BoundedCurve.hxx>
+#include <GeomAPI_ProjectPointOnCurve.hxx>
+#include <GeomAPI_ProjectPointOnSurf.hxx>
+#include <GeomAdaptor_Curve.hxx>
+
+#include <Geom2dHatch_Intersector.hxx>
+#include <Geom2d_TrimmedCurve.hxx>
+
+#include <TopAbs_State.hxx>
+#include <TopoDS.hxx>
+#include <TopExp_Explorer.hxx>
+
+#include <BRep_Tool.hxx>
+#include <BRepAdaptor_Surface.hxx>
+
+#include <IntTools_Tools.hxx>
+#include <IntTools_FClass2d.hxx>
+//
+#include <Extrema_LocateExtPC.hxx>
+
+#include <Geom2d_Curve.hxx>
+#include <NCollection_IncAllocator.hxx>
+#include <IntTools_SurfaceRangeLocalizeData.hxx>
+
+
+//=======================================================================
+//function :
+//purpose :
+//=======================================================================
+IntTools_Context::IntTools_Context()
+:
+ myAllocator(new NCollection_IncAllocator()),
+ myFClass2dMap(100, myAllocator),
+ myProjPSMap(100, myAllocator),
+ myProjPCMap(100, myAllocator),
+ mySClassMap(100, myAllocator),
+ myProjPTMap(100, myAllocator),
+ myHatcherMap(100, myAllocator),
+ myProjSDataMap(100, myAllocator),
+ myCreateFlag(0)
+{
+}
+//=======================================================================
+//function :
+//purpose :
+//=======================================================================
+IntTools_Context::IntTools_Context
+ (const Handle(NCollection_BaseAllocator)& theAllocator)
+:
+ myAllocator(theAllocator),
+ myFClass2dMap(100, myAllocator),
+ myProjPSMap(100, myAllocator),
+ myProjPCMap(100, myAllocator),
+ mySClassMap(100, myAllocator),
+ myProjPTMap(100, myAllocator),
+ myHatcherMap(100, myAllocator),
+ myProjSDataMap(100, myAllocator),
+ myCreateFlag(1)
+{
+}
+//=======================================================================
+//function : ~
+//purpose :
+//=======================================================================
+IntTools_Context::~IntTools_Context()
+{
+ Standard_Address anAdr;
+ BOPCol_DataMapIteratorOfDataMapOfShapeAddress aIt;
+ BOPCol_DataMapIteratorOfDataMapOfTransientAddress aIt1;
+ //
+ IntTools_FClass2d* pFClass2d;
+ //
+ aIt.Initialize(myFClass2dMap);
+ for (; aIt.More(); aIt.Next()) {
+ anAdr=aIt.Value();
+ pFClass2d=(IntTools_FClass2d*)anAdr;
+ (*pFClass2d).~IntTools_FClass2d();
+ myAllocator->Free(anAdr);
+ }
+ 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();
+ //
+ GeomAPI_ProjectPointOnCurve* pProjPC;
+ aIt.Initialize(myProjPCMap);
+ for (; aIt.More(); aIt.Next()) {
+ anAdr=aIt.Value();
+ pProjPC=(GeomAPI_ProjectPointOnCurve*)anAdr;
+ (*pProjPC).~GeomAPI_ProjectPointOnCurve();
+ myAllocator->Free(anAdr);
+ }
+ myProjPCMap.Clear();
+ //
+ //
+ BRepClass3d_SolidClassifier* pSC;
+ aIt.Initialize(mySClassMap);
+ for (; aIt.More(); aIt.Next()) {
+ anAdr=aIt.Value();
+ pSC=(BRepClass3d_SolidClassifier*)anAdr;
+ (*pSC).~BRepClass3d_SolidClassifier();
+ myAllocator->Free(anAdr);
+ }
+ mySClassMap.Clear();
+ //
+ GeomAPI_ProjectPointOnCurve* pProjPT;
+ aIt1.Initialize(myProjPTMap);
+ for (; aIt1.More(); aIt1.Next()) {
+ anAdr=aIt1.Value();
+ pProjPT=(GeomAPI_ProjectPointOnCurve*)anAdr;
+ (*pProjPT).~GeomAPI_ProjectPointOnCurve();
+ myAllocator->Free(anAdr);
+ }
+ myProjPTMap.Clear();
+ //
+ Geom2dHatch_Hatcher* pHatcher;
+ aIt.Initialize(myHatcherMap);
+ for (; aIt.More(); aIt.Next()) {
+ anAdr=aIt.Value();
+ pHatcher=(Geom2dHatch_Hatcher*)anAdr;
+ (*pHatcher).~Geom2dHatch_Hatcher();
+ myAllocator->Free(anAdr);
+ }
+ myHatcherMap.Clear();
+ //
+ IntTools_SurfaceRangeLocalizeData* pSData = NULL;
+ aIt.Initialize(myProjSDataMap);
+ for (; aIt.More(); aIt.Next()) {
+ anAdr=aIt.Value();
+ pSData = (IntTools_SurfaceRangeLocalizeData*)anAdr;
+ (*pSData).~IntTools_SurfaceRangeLocalizeData();
+ myAllocator->Free(anAdr);
+ }
+ myProjSDataMap.Clear();
+}
+//=======================================================================
+//function : FClass2d
+//purpose :
+//=======================================================================
+IntTools_FClass2d& IntTools_Context::FClass2d(const TopoDS_Face& aF)
+{
+ Standard_Address anAdr;
+ IntTools_FClass2d* pFClass2d;
+ //
+ if (!myFClass2dMap.IsBound(aF)) {
+ Standard_Real aTolF;
+ TopoDS_Face aFF;
+ //
+ aFF=aF;
+ aFF.Orientation(TopAbs_FORWARD);
+ aTolF=BRep_Tool::Tolerance(aFF);
+ //
+ pFClass2d=(IntTools_FClass2d*)myAllocator->Allocate(sizeof(IntTools_FClass2d));
+ new (pFClass2d) IntTools_FClass2d(aFF, aTolF);
+ //
+ anAdr=(Standard_Address)pFClass2d;
+ myFClass2dMap.Bind(aFF, anAdr);
+ }
+ else {
+ anAdr=myFClass2dMap.Find(aF);
+ pFClass2d=(IntTools_FClass2d*)anAdr;
+ }
+ return *pFClass2d;
+}
+//=======================================================================
+//function : ProjPS
+//purpose :
+//=======================================================================
+GeomAPI_ProjectPointOnSurf& IntTools_Context::ProjPS(const TopoDS_Face& aF)
+{
+ Standard_Address anAdr;
+ GeomAPI_ProjectPointOnSurf* pProjPS;
+
+ if (!myProjPSMap.IsBound(aF)) {
+ Standard_Real Umin, Usup, Vmin, Vsup, anEpsT=1.e-12 ;
+ BRepAdaptor_Surface aBAS;
+ //
+ 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();
+ pProjPS->Init(aS ,Umin, Usup, Vmin, Vsup, anEpsT/*, Extrema_ExtAlgo_Tree*/);
+ Extrema_ExtPS& anExtAlgo = const_cast<Extrema_ExtPS&>(pProjPS->Extrema());
+ anExtAlgo.SetFlag(Extrema_ExtFlag_MIN);
+ //
+ anAdr=(Standard_Address)pProjPS;
+ myProjPSMap.Bind(aF, anAdr);
+ }
+
+ else {
+ anAdr=myProjPSMap.Find(aF);
+ pProjPS=(GeomAPI_ProjectPointOnSurf*)anAdr;
+ }
+ return *pProjPS;
+}
+//=======================================================================
+//function : ProjPC
+//purpose :
+//=======================================================================
+GeomAPI_ProjectPointOnCurve& IntTools_Context::ProjPC(const TopoDS_Edge& aE)
+{
+ Standard_Address anAdr;
+ GeomAPI_ProjectPointOnCurve* pProjPC;
+
+ if (!myProjPCMap.IsBound(aE)) {
+ Standard_Real f, l;
+ //
+ Handle(Geom_Curve)aC3D=BRep_Tool::Curve (aE, f, l);
+ //
+ pProjPC=(GeomAPI_ProjectPointOnCurve*)myAllocator->Allocate(sizeof(GeomAPI_ProjectPointOnCurve));
+ new (pProjPC) GeomAPI_ProjectPointOnCurve();
+ pProjPC->Init(aC3D, f, l);
+ //
+ anAdr=(Standard_Address)pProjPC;
+ myProjPCMap.Bind(aE, anAdr);
+ }
+
+ else {
+ anAdr=myProjPCMap.Find(aE);
+ pProjPC=(GeomAPI_ProjectPointOnCurve*)anAdr;
+ }
+ return *pProjPC;
+}
+
+//=======================================================================
+//function : ProjPT
+//purpose :
+//=======================================================================
+GeomAPI_ProjectPointOnCurve& IntTools_Context::ProjPT
+ (const Handle(Geom_Curve)& aC3D)
+
+{
+ Standard_Address anAdr;
+ GeomAPI_ProjectPointOnCurve* pProjPT;
+
+ if (!myProjPTMap.IsBound(aC3D)) {
+ Standard_Real f, l;
+ f=aC3D->FirstParameter();
+ l=aC3D->LastParameter();
+ //
+ pProjPT=(GeomAPI_ProjectPointOnCurve*)myAllocator->Allocate(sizeof(GeomAPI_ProjectPointOnCurve));
+ new (pProjPT) GeomAPI_ProjectPointOnCurve();
+ pProjPT->Init(aC3D, f, l);
+ //
+ anAdr=(Standard_Address)pProjPT;
+ myProjPTMap.Bind(aC3D, anAdr);
+ }
+
+ else {
+ anAdr=myProjPTMap.Find(aC3D);
+ pProjPT=(GeomAPI_ProjectPointOnCurve*)anAdr;
+ }
+ return *pProjPT;
+}
+//=======================================================================
+//function : SolidClassifier
+//purpose :
+//=======================================================================
+BRepClass3d_SolidClassifier& IntTools_Context::SolidClassifier
+ (const TopoDS_Solid& aSolid)
+{
+ Standard_Address anAdr;
+ BRepClass3d_SolidClassifier* pSC;
+
+ if (!mySClassMap.IsBound(aSolid)) {
+ //
+ pSC=(BRepClass3d_SolidClassifier*)myAllocator->Allocate(sizeof(BRepClass3d_SolidClassifier));
+ new (pSC) BRepClass3d_SolidClassifier(aSolid);
+ //
+ anAdr=(Standard_Address)pSC;
+ mySClassMap.Bind(aSolid, anAdr);
+ }
+
+ else {
+ anAdr=mySClassMap.Find(aSolid);
+ pSC =(BRepClass3d_SolidClassifier*)anAdr;
+ }
+ return *pSC;
+}
+
+//=======================================================================
+//function : Hatcher
+//purpose :
+//=======================================================================
+Geom2dHatch_Hatcher& IntTools_Context::Hatcher(const TopoDS_Face& aF)
+{
+ Standard_Address anAdr;
+ Geom2dHatch_Hatcher* pHatcher;
+ //
+ if (!myHatcherMap.IsBound(aF)) {
+ Standard_Real aTolArcIntr, aTolTangfIntr, aTolHatch2D, aTolHatch3D;
+ Standard_Real aU1, aU2, aEpsT;
+ TopAbs_Orientation aOrE;
+ Handle(Geom_Surface) aS;
+ Handle(Geom2d_Curve) aC2D;
+ Handle(Geom2d_TrimmedCurve) aCT2D;
+ TopoDS_Face aFF;
+ TopExp_Explorer aExp;
+ //
+ aTolHatch2D=1.e-8;
+ aTolHatch3D=1.e-8;
+ aTolArcIntr=1.e-10;
+ aTolTangfIntr=1.e-10;
+ aEpsT=Precision::PConfusion();
+ //
+ Geom2dHatch_Intersector aIntr(aTolArcIntr, aTolTangfIntr);
+ pHatcher=new Geom2dHatch_Hatcher(aIntr,
+ aTolHatch2D, aTolHatch3D,
+ Standard_True, Standard_False);
+
+ //
+ aFF=aF;
+ aFF.Orientation(TopAbs_FORWARD);
+ aS=BRep_Tool::Surface(aFF);
+
+ aExp.Init (aFF, TopAbs_EDGE);
+ for (; aExp.More() ; aExp.Next()) {
+ const TopoDS_Edge& aE=*((TopoDS_Edge*)&aExp.Current());
+ aOrE=aE.Orientation();
+ //
+ aC2D=BRep_Tool::CurveOnSurface (aE, aFF, aU1, aU2);
+ if (aC2D.IsNull() ) {
+ continue;
+ }
+ if (fabs(aU1-aU2) < aEpsT) {
+ continue;
+ }
+ //
+ aCT2D=new Geom2d_TrimmedCurve(aC2D, aU1, aU2);
+ pHatcher->AddElement(aCT2D, aOrE);
+ }// for (; aExp.More() ; aExp.Next()) {
+ //
+ anAdr=(Standard_Address)pHatcher;
+ myHatcherMap.Bind(aFF, anAdr);
+ }//if (!myHatcherMap.IsBound(aF)) {
+ //
+ else {
+ anAdr=myHatcherMap.Find(aF);
+ pHatcher=(Geom2dHatch_Hatcher*)anAdr;
+ }
+
+ return *pHatcher;
+}
+
+//=======================================================================
+//function : SurfaceData
+//purpose :
+//=======================================================================
+IntTools_SurfaceRangeLocalizeData& IntTools_Context::SurfaceData
+ (const TopoDS_Face& aF)
+{
+ Standard_Address anAdr;
+ IntTools_SurfaceRangeLocalizeData* pSData;
+ //
+ if (!myProjSDataMap.IsBound(aF)) {
+ pSData=new IntTools_SurfaceRangeLocalizeData
+ (3,
+ 3,
+ 10. * Precision::PConfusion(),
+ 10. * Precision::PConfusion());
+ //
+ anAdr=(Standard_Address)pSData;
+ myProjSDataMap.Bind(aF, anAdr);
+ }
+
+ else {
+ anAdr=myProjSDataMap.Find(aF);
+ pSData=(IntTools_SurfaceRangeLocalizeData*)anAdr;
+ }
+ return *pSData;
+
+}
+
+//=======================================================================
+//function : ComputePE
+//purpose :
+//=======================================================================
+Standard_Integer IntTools_Context::ComputePE
+ (const gp_Pnt& aP1,
+ const Standard_Real aTolP1,
+ const TopoDS_Edge& aE2,
+ Standard_Real& aT)
+{
+ if (!BRep_Tool::IsGeometric(aE2)) {
+ return -2;
+ }
+ Standard_Real aDist, aTolE2, aTolSum;
+ Standard_Integer aNbProj;
+ //
+ GeomAPI_ProjectPointOnCurve& aProjector=ProjPC(aE2);
+ aProjector.Perform(aP1);
+
+ aNbProj=aProjector.NbPoints();
+ if (!aNbProj) {
+ return -3;
+ }
+ //
+ aDist=aProjector.LowerDistance();
+ //
+ aTolE2=BRep_Tool::Tolerance(aE2);
+ aTolSum=aTolP1+aTolE2;
+ //
+ aT=aProjector.LowerDistanceParameter();
+ if (aDist > aTolSum) {
+ return -4;
+ }
+ return 0;
+}
+//=======================================================================
+//function : ComputeVE
+//purpose :
+//=======================================================================
+Standard_Integer IntTools_Context::ComputeVE
+ (const TopoDS_Vertex& aV1,
+ const TopoDS_Edge& aE2,
+ Standard_Real& aT)
+{
+ if (BRep_Tool::Degenerated(aE2)) {
+ return -1;
+ }
+ if (!BRep_Tool::IsGeometric(aE2)) {
+ return -2;
+ }
+ Standard_Real aDist, aTolV1, aTolE2, aTolSum;
+ Standard_Integer aNbProj;
+ gp_Pnt aP;
+ //
+ aP=BRep_Tool::Pnt(aV1);
+ //
+ GeomAPI_ProjectPointOnCurve& aProjector=ProjPC(aE2);
+ aProjector.Perform(aP);
+
+ aNbProj=aProjector.NbPoints();
+ if (!aNbProj) {
+ return -3;
+ }
+ //
+ aDist=aProjector.LowerDistance();
+
+ // tolerance of check for coincidence is sum of tolerances of edge and vertex
+ // extended by additional Precision::Confusion() to allow for interference where
+ // it is very close but not fit to tolerance (see #24108)
+ aTolV1=BRep_Tool::Tolerance(aV1);
+ aTolE2=BRep_Tool::Tolerance(aE2);
+ aTolSum = aTolV1 + aTolE2 + Precision::Confusion();
+ //
+ aT=aProjector.LowerDistanceParameter();
+ if (aDist > aTolSum) {
+ return -4;
+ }
+ return 0;
+}
+//=======================================================================
+//function : ComputeVS
+//purpose :
+//=======================================================================
+Standard_Integer IntTools_Context::ComputeVF
+ (const TopoDS_Vertex& aV1,
+ const TopoDS_Face& aF2,
+ Standard_Real& U,
+ Standard_Real& V)
+{
+ Standard_Real aTolV1, aTolF2, aTolSum, aDist;
+ gp_Pnt aP;
+
+ aP=BRep_Tool::Pnt(aV1);
+ //
+ // 1. Check if the point is projectable on the surface
+ GeomAPI_ProjectPointOnSurf& aProjector=ProjPS(aF2);
+ aProjector.Perform(aP);
+ //
+ if (!aProjector.IsDone()) { // the point is not projectable on the surface
+ return -1;
+ }
+ //
+ // 2. Check the distance between the projection point and
+ // the original point
+ aDist=aProjector.LowerDistance();
+
+ aTolV1=BRep_Tool::Tolerance(aV1);
+ aTolF2=BRep_Tool::Tolerance(aF2);
+ aTolSum=aTolV1+aTolF2;
+ if (aDist > aTolSum) {
+ // the distance is too large
+ return -2;
+ }
+ aProjector.LowerDistanceParameters(U, V);
+ //
+ gp_Pnt2d aP2d(U, V);
+ Standard_Boolean pri=IsPointInFace (aF2, aP2d);
+ if (!pri) {// the point lays on the surface but out of the face
+ return -3;
+ }
+ return 0;
+}
+//=======================================================================
+//function : StatePointFace
+//purpose :
+//=======================================================================
+TopAbs_State IntTools_Context::StatePointFace
+ (const TopoDS_Face& aF,
+ const gp_Pnt2d& aP2d)
+{
+ TopAbs_State aState;
+ IntTools_FClass2d& aClass2d=FClass2d(aF);
+ aState=aClass2d.Perform(aP2d);
+ return aState;
+}
+//=======================================================================
+//function : IsPointInFace
+//purpose :
+//=======================================================================
+Standard_Boolean IntTools_Context::IsPointInFace
+ (const TopoDS_Face& aF,
+ const gp_Pnt2d& aP2d)
+{
+ TopAbs_State aState=StatePointFace(aF, aP2d);
+ if (aState==TopAbs_OUT || aState==TopAbs_ON) {
+ return Standard_False;
+ }
+ return Standard_True;
+}
+//=======================================================================
+//function : IsPointInOnFace
+//purpose :
+//=======================================================================
+ Standard_Boolean IntTools_Context::IsPointInOnFace(const TopoDS_Face& aF,
+ const gp_Pnt2d& aP2d)
+{
+ TopAbs_State aState=StatePointFace(aF, aP2d);
+ if (aState==TopAbs_OUT) {
+ return Standard_False;
+ }
+ return Standard_True;
+}
+//=======================================================================
+//function : IsValidPointForFace
+//purpose :
+//=======================================================================
+Standard_Boolean IntTools_Context::IsValidPointForFace
+ (const gp_Pnt& aP,
+ const TopoDS_Face& aF,
+ const Standard_Real aTol)
+{
+ Standard_Boolean bFlag;
+ Standard_Real Umin, U, V;
+
+ GeomAPI_ProjectPointOnSurf& aProjector=ProjPS(aF);
+ aProjector.Perform(aP);
+
+ bFlag=aProjector.IsDone();
+ if (bFlag) {
+
+ Umin=aProjector.LowerDistance();
+ //if (Umin > 1.e-3) { // it was
+ if (Umin > aTol) {
+ return !bFlag;
+ }
+ //
+ aProjector.LowerDistanceParameters(U, V);
+ gp_Pnt2d aP2D(U, V);
+ bFlag=IsPointInOnFace (aF, aP2D);
+ }
+ return bFlag;
+}
+//=======================================================================
+//function : IsValidPointForFaces
+//purpose :
+//=======================================================================
+Standard_Boolean IntTools_Context::IsValidPointForFaces
+ (const gp_Pnt& aP,
+ const TopoDS_Face& aF1,
+ const TopoDS_Face& aF2,
+ const Standard_Real aTol)
+{
+ Standard_Boolean bFlag1, bFlag2;
+
+ bFlag1=IsValidPointForFace(aP, aF1, aTol);
+ if (!bFlag1) {
+ return bFlag1;
+ }
+ bFlag2=IsValidPointForFace(aP, aF2, aTol);
+ return bFlag2;
+}
+//=======================================================================
+//function : IsValidBlockForFace
+//purpose :
+//=======================================================================
+Standard_Boolean IntTools_Context::IsValidBlockForFace
+ (const Standard_Real aT1,
+ const Standard_Real aT2,
+ const IntTools_Curve& aC,
+ const TopoDS_Face& aF,
+ const Standard_Real aTol)
+{
+ Standard_Boolean bFlag;
+ Standard_Real aTInterm;
+ gp_Pnt aPInterm;
+
+ aTInterm=IntTools_Tools::IntermediatePoint(aT1, aT2);
+
+ Handle(Geom_Curve) aC3D=aC.Curve();
+ // point 3D
+ aC3D->D0(aTInterm, aPInterm);
+ //
+ bFlag=IsValidPointForFace (aPInterm, aF, aTol);
+ return bFlag;
+}
+//=======================================================================
+//function : IsValidBlockForFaces
+//purpose :
+//=======================================================================
+Standard_Boolean IntTools_Context::IsValidBlockForFaces
+ (const Standard_Real aT1,
+ const Standard_Real aT2,
+ const IntTools_Curve& aC,
+ const TopoDS_Face& aF1,
+ const TopoDS_Face& aF2,
+ const Standard_Real aTol)
+{
+ Standard_Boolean bFlag1, bFlag2;
+ //
+ Handle(Geom2d_Curve) aPC1 = aC.FirstCurve2d();
+ Handle(Geom2d_Curve) aPC2 = aC.SecondCurve2d();
+ if( !aPC1.IsNull() && !aPC2.IsNull() ) {
+ Standard_Real aMidPar = IntTools_Tools::IntermediatePoint(aT1, aT2);
+ gp_Pnt2d aPnt2D;
+
+
+ aPC1->D0(aMidPar, aPnt2D);
+ bFlag1 = IsPointInOnFace(aF1, aPnt2D);
+
+ if( !bFlag1 )
+ return bFlag1;
+
+ aPC2->D0(aMidPar, aPnt2D);
+ bFlag2 = IsPointInOnFace(aF2, aPnt2D);
+ return bFlag2;
+ }
+ //
+
+ bFlag1=IsValidBlockForFace (aT1, aT2, aC, aF1, aTol);
+ if (!bFlag1) {
+ return bFlag1;
+ }
+ bFlag2=IsValidBlockForFace (aT1, aT2, aC, aF2, aTol);
+ return bFlag2;
+}
+//=======================================================================
+//function : IsVertexOnLine
+//purpose :
+//=======================================================================
+Standard_Boolean IntTools_Context::IsVertexOnLine
+ (const TopoDS_Vertex& aV,
+ const IntTools_Curve& aC,
+ const Standard_Real aTolC,
+ Standard_Real& aT)
+{
+ Standard_Boolean bRet;
+ Standard_Real aTolV;
+ //
+ aTolV=BRep_Tool::Tolerance(aV);
+ bRet=IntTools_Context::IsVertexOnLine(aV, aTolV, aC, aTolC , aT);
+ //
+ return bRet;
+}
+//=======================================================================
+//function : IsVertexOnLine
+//purpose :
+//=======================================================================
+Standard_Boolean IntTools_Context::IsVertexOnLine
+ (const TopoDS_Vertex& aV,
+ const Standard_Real aTolV,
+ const IntTools_Curve& aC,
+ const Standard_Real aTolC,
+ Standard_Real& aT)
+{
+ Standard_Real aFirst, aLast, aDist, aTolSum;
+ Standard_Integer aNbProj;
+ gp_Pnt aPv;
+
+ aPv=BRep_Tool::Pnt(aV);
+
+ Handle(Geom_Curve) aC3D=aC.Curve();
+
+
+ aTolSum=aTolV+aTolC;
+ //
+ GeomAdaptor_Curve aGAC(aC3D);
+ GeomAbs_CurveType aType=aGAC.GetType();
+ if (aType==GeomAbs_BSplineCurve ||
+ aType==GeomAbs_BezierCurve) {
+ aTolSum=2.*aTolSum;
+ if (aTolSum<1.e-5) {
+ aTolSum=1.e-5;
+ }
+ }
+ else {
+ aTolSum=2.*aTolSum;//xft
+ if(aTolSum < 1.e-6)
+ aTolSum = 1.e-6;
+ }
+ //
+ aFirst=aC3D->FirstParameter();
+ aLast =aC3D->LastParameter();
+ //
+ //Checking extermities first
+ if (!Precision::IsInfinite(aFirst)) {
+ gp_Pnt aPCFirst=aC3D->Value(aFirst);
+ aDist=aPv.Distance(aPCFirst);
+ if (aDist < aTolSum) {
+ aT=aFirst;
+ //
+ if(aDist > aTolV) {
+ Extrema_LocateExtPC anExt(aPv, aGAC, aFirst, 1.e-10);
+
+ if(anExt.IsDone()) {
+ Extrema_POnCurv aPOncurve = anExt.Point();
+ aT = aPOncurve.Parameter();
+
+ if((aT > (aLast + aFirst) * 0.5) ||
+ (aPv.Distance(aPOncurve.Value()) > aTolSum) ||
+ (aPCFirst.Distance(aPOncurve.Value()) < Precision::Confusion()))
+ aT = aFirst;
+ }
+ }
+ //
+ return Standard_True;
+ }
+ }
+ //
+ //if (!Precision::IsInfinite(aFirst)) {
+ if (!Precision::IsInfinite(aLast)) {
+ gp_Pnt aPCLast=aC3D->Value(aLast);
+ aDist=aPv.Distance(aPCLast);
+ if (aDist < aTolSum) {
+ aT=aLast;
+ //
+ if(aDist > aTolV) {
+ Extrema_LocateExtPC anExt(aPv, aGAC, aLast, 1.e-10);
+
+ if(anExt.IsDone()) {
+ Extrema_POnCurv aPOncurve = anExt.Point();
+ aT = aPOncurve.Parameter();
+
+ if((aT < (aLast + aFirst) * 0.5) ||
+ (aPv.Distance(aPOncurve.Value()) > aTolSum) ||
+ (aPCLast.Distance(aPOncurve.Value()) < Precision::Confusion()))
+ aT = aLast;
+ }
+ }
+ //
+ return Standard_True;
+ }
+ }
+ //
+ GeomAPI_ProjectPointOnCurve& aProjector=ProjPT(aC3D);
+ aProjector.Perform(aPv);
+
+ aNbProj=aProjector.NbPoints();
+ if (!aNbProj) {
+ Handle(Geom_BoundedCurve) aBC=
+ Handle(Geom_BoundedCurve)::DownCast(aC3D);
+ if (!aBC.IsNull()) {
+ gp_Pnt aPStart=aBC->StartPoint();
+ gp_Pnt aPEnd =aBC->EndPoint();
+
+ aDist=aPv.Distance(aPStart);
+ if (aDist < aTolSum) {
+ aT=aFirst;
+ return Standard_True;
+ }
+
+ aDist=aPv.Distance(aPEnd);
+ if (aDist < aTolSum) {
+ aT=aLast;
+ return Standard_True;
+ }
+ }
+
+ return Standard_False;
+ }
+
+ aDist=aProjector.LowerDistance();
+
+ if (aDist > aTolSum) {
+ return Standard_False;
+ }
+
+ aT=aProjector.LowerDistanceParameter();
+
+ return Standard_True;
+}
+//=======================================================================
+//function : ProjectPointOnEdge
+//purpose :
+//=======================================================================
+Standard_Boolean IntTools_Context::ProjectPointOnEdge
+ (const gp_Pnt& aP,
+ const TopoDS_Edge& anEdge,
+ Standard_Real& aT)
+{
+ Standard_Integer aNbPoints;
+
+ GeomAPI_ProjectPointOnCurve& aProjector=ProjPC(anEdge);
+ aProjector.Perform(aP);
+
+ aNbPoints=aProjector.NbPoints();
+ if (aNbPoints) {
+ aT=aProjector.LowerDistanceParameter();
+ return Standard_True;
+ }
+ return Standard_False;
+}
+
FClass2d from IntTools,
SequenceOfRoots from IntTools,
SequenceOfCommonPrts from IntTools,
- Context from BOPInt,
+ Context from IntTools,
Range from IntTools
--raises
--- The algorithm processes edge inside these boundaries.
SetContext (me: in out;
- theContext: Context from BOPInt);
+ theContext: Context from IntTools);
---Purpose:
--- Sets the intersecton context
Context (me)
- returns Context from BOPInt;
+ returns Context from IntTools;
---C++:return const &
---Purpose:
--- Gets the intersecton context
t,f:CArray1OfReal from IntTools)
is protected;
- RemoveIdenticalRoots(me:out)
+ RemoveIdenticalRoots(me:out)
is protected;
CheckTouch (me: out;
myErrorStatus : Integer from Standard;
--- internal members
- myContext : Context from BOPInt;
+ myContext : Context from IntTools;
myProjectableRanges: SequenceOfRanges from IntTools;
myFClass2d : FClass2d from IntTools;
myFuncArray : CArray1OfReal from IntTools;
#include <IntTools_CommonPrt.hxx>
#include <IntTools_Root.hxx>
#include <IntTools_BeanFaceIntersector.hxx>
-#include <BOPInt_Context.hxx>
+#include <IntTools_Context.hxx>
#include <BRep_Tool.hxx>
//function : SetContext
//purpose :
//=======================================================================
-void IntTools_EdgeFace::SetContext(const Handle(BOPInt_Context)& theContext)
+void IntTools_EdgeFace::SetContext(const Handle(IntTools_Context)& theContext)
{
myContext = theContext;
}
//function : Context
//purpose :
//=======================================================================
-const Handle(BOPInt_Context)& IntTools_EdgeFace::Context()const
+const Handle(IntTools_Context)& IntTools_EdgeFace::Context()const
{
return myContext;
}
}
//
if (myContext.IsNull()) {
- myContext=new BOPInt_Context;
+ myContext=new IntTools_Context;
}
//
myIsDone = Standard_False;
class FaceFace from IntTools
- ---Purpose: This class provides the intersection of
- --- face's underlying surfaces.
+ ---Purpose: This class provides the intersection of
+ --- face's underlying surfaces.
uses
SequenceOfCurves from IntTools,
LineConstructor from IntTools,
SequenceOfPntOn2Faces from IntTools,
- Context from BOPInt
+ Context from IntTools
is
Create
- returns FaceFace from IntTools;
- ---Purpose:
- --- Empty constructor.
- ---
-
+ returns FaceFace from IntTools;
+ ---Purpose:
+ --- Empty constructor.
+
SetParameters(me: in out;
- ApproxCurves : Boolean from Standard;
- ComputeCurveOnS1: Boolean from Standard;
- ComputeCurveOnS2: Boolean from Standard;
- ApproximationTolerance: Real from Standard);
- ---Purpose:
- --- Modifier
- ---
+ ApproxCurves : Boolean from Standard;
+ ComputeCurveOnS1: Boolean from Standard;
+ ComputeCurveOnS2: Boolean from Standard;
+ ApproximationTolerance: Real from Standard);
+ ---Purpose:
+ --- Modifier
+ ---
Perform(me: in out;
- F1: Face from TopoDS;
- F2: Face from TopoDS);
- ---Purpose:
- --- Intersects underliing surfaces of F1 and F2
- --- Use sum of tolerance of F1 and F2 as intersection
- --- criteria
- ---
-
+ F1: Face from TopoDS;
+ F2: Face from TopoDS);
+ ---Purpose:
+ --- Intersects underliing surfaces of F1 and F2
+ --- Use sum of tolerance of F1 and F2 as intersection
+ --- criteria
+
IsDone(me)
- returns Boolean from Standard;
- ---Purpose:
- --- Returns True if the intersection was successful
- ---
+ returns Boolean from Standard;
+ ---Purpose:
+ --- Returns True if the intersection was successful
+ ---
Lines(me)
- returns SequenceOfCurves from IntTools;
- ---C++: return const&
- ---Purpose:
- --- Returns sequence of 3d curves as result of intersection
- ---
-
+ returns SequenceOfCurves from IntTools;
+ ---C++: return const&
+ ---Purpose:
+ --- Returns sequence of 3d curves as result of intersection
+ ---
+
Points(me)
- returns SequenceOfPntOn2Faces from IntTools;
- ---C++: return const&
- ---Purpose:
- --- Returns sequence of 3d curves as result of intersection
- ---
+ returns SequenceOfPntOn2Faces from IntTools;
+ ---C++: return const&
+ ---Purpose:
+ --- Returns sequence of 3d curves as result of intersection
+ ---
TolReached3d(me)
- returns Real from Standard;
- ---Purpose:
- --- Returns tolerance reached during approximation.
- --- If approximation was not done, returns zero.
- ---
+ returns Real from Standard;
+ ---Purpose:
+ --- Returns tolerance reached during approximation.
+ --- If approximation was not done, returns zero.
TolReached2d(me)
- returns Real from Standard;
- ---Purpose:
- --- Returns tolerance reached during approximation.
- --- If approximation was not done, returns zero.
- ---
-
+ returns Real from Standard;
+ ---Purpose:
+ --- Returns tolerance reached during approximation.
+ --- If approximation was not done, returns zero.
+ ---
+
Face1 (me)
- returns Face from TopoDS;
- ---C++: return const&
- ---Purpose:
- --- Returns first of processed faces
- ---
-
+ returns Face from TopoDS;
+ ---C++: return const&
+ ---Purpose:
+ --- Returns first of processed faces
+ ---
+
Face2 (me)
- returns Face from TopoDS;
- ---C++: return const&
- ---Purpose:
- --- Returns second of processed faces
- ---
+ returns Face from TopoDS;
+ ---C++: return const&
+ ---Purpose:
+ --- Returns second of processed faces
+ ---
TangentFaces (me)
- returns Boolean from Standard;
- ---Purpose:
- --- Returns True if faces are tangent
- ---
+ returns Boolean from Standard;
+ ---Purpose:
+ --- Returns True if faces are tangent
+ ---
PrepareLines3D (me:out;
- bToSplit: Boolean from Standard=Standard_True);
- ---Purpose:
- --- Provides post-processing the result lines.
- --- <bToSplit> - the flag.
- -- In case of <bToSplit> is true the closed 3D-curves will be splitted
- -- on parts.
- -- In case of <bToSplit> is false the closed 3D-curves remain untouched.
+ bToSplit: Boolean from Standard=Standard_True);
+ ---Purpose:
+ --- Provides post-processing the result lines.
+ --- <bToSplit> - the flag.
+ -- In case of <bToSplit> is true the closed 3D-curves will be splitted
+ -- on parts.
+ -- In case of <bToSplit> is false the closed 3D-curves remain untouched.
SetList (me: in out;
- ListOfPnts: in out ListOfPntOn2S from IntSurf);
+ ListOfPnts: in out ListOfPntOn2S from IntSurf);
----------------------------------------------------------
-- private block
----------------------------------------------------------
MakeCurve(me: in out; Index : Integer from Standard;
- D1 : TopolTool from Adaptor3d;
- D2 : TopolTool from Adaptor3d)
- is protected;
-
+ D1 : TopolTool from Adaptor3d;
+ D2 : TopolTool from Adaptor3d)
+ is protected;
+
ComputeTolReached3d(me:out)
- is protected;
+ is protected;
SetContext(me:out;
- aContext : Context from BOPInt);
- ---Purpose:
- --- Sets the intersecton context
-
+ aContext : Context from IntTools);
+ ---Purpose:
+ --- Sets the intersecton context
+
Context(me)
- returns Context from BOPInt;
- ---C++: return const &
- ---Purpose:
- --- Gets the intersecton context
- ---
+ returns Context from IntTools;
+ ---C++: return const &
+ ---Purpose:
+ --- Gets the intersecton context
+
fields
myIsDone : Boolean from Standard;
myListOfPnts : ListOfPntOn2S from IntSurf;
- myContext : Context from BOPInt;
+ myContext : Context from IntTools;
end FaceFace from IntTools;
#include <IntTools_TopolTool.hxx>
#include <IntTools_PntOnFace.hxx>
#include <IntTools_PntOn2Faces.hxx>
-#include <BOPInt_Context.hxx>
+#include <IntTools_Context.hxx>
#include <IntSurf_ListIteratorOfListOfPntOn2S.hxx>
static
const Standard_Boolean theAvoidLConstructor,
IntPatch_SequenceOfLine& theNewLines,
Standard_Real& theReachedTol3d,
- const Handle(BOPInt_Context)& );
+ const Handle(IntTools_Context)& );
static
Standard_Boolean ParameterOutOfBoundary(const Standard_Real theParameter,
const Standard_Real theOtherParameter,
const Standard_Boolean bIncreasePar,
Standard_Real& theNewParameter,
- const Handle(BOPInt_Context)& );
+ const Handle(IntTools_Context)& );
static
Standard_Boolean IsCurveValid(Handle(Geom2d_Curve)& thePCurve);
Handle(TColgp_HArray1OfPnt2d)& theResultOnS1,
Handle(TColgp_HArray1OfPnt2d)& theResultOnS2,
Handle(TColStd_HArray1OfReal)& theResultRadius,
- const Handle(BOPInt_Context)& );
+ const Handle(IntTools_Context)& );
static
Standard_Boolean FindPoint(const gp_Pnt2d& theFirstPoint,
const Handle(GeomAdaptor_HSurface) myHS2,
const TopoDS_Face& aF1,
const TopoDS_Face& aF2,
- const Handle(BOPInt_Context)& aCtx);
+ const Handle(IntTools_Context)& aCtx);
static
Standard_Boolean CheckPCurve(const Handle(Geom2d_Curve)& aPC,
const Handle(GeomAdaptor_HSurface)& myHS2,
const TopoDS_Face& aF1,
const TopoDS_Face& aF2,
- const Handle(BOPInt_Context)& aCtx);
+ const Handle(IntTools_Context)& aCtx);
//=======================================================================
//function :
//function : SetContext
//purpose :
//=======================================================================
-void IntTools_FaceFace::SetContext(const Handle(BOPInt_Context)& aContext)
+void IntTools_FaceFace::SetContext(const Handle(IntTools_Context)& aContext)
{
myContext=aContext;
}
//function : Context
//purpose :
//=======================================================================
-const Handle(BOPInt_Context)& IntTools_FaceFace::Context()const
+const Handle(IntTools_Context)& IntTools_FaceFace::Context()const
{
return myContext;
}
Standard_Boolean RestrictLine = Standard_False, hasCone = Standard_False;
if (myContext.IsNull()) {
- myContext=new BOPInt_Context;
+ myContext=new IntTools_Context;
}
mySeqOfCurve.Clear();
Handle(TColgp_HArray1OfPnt2d)& theResultOnS1,
Handle(TColgp_HArray1OfPnt2d)& theResultOnS2,
Handle(TColStd_HArray1OfReal)& theResultRadius,
- const Handle(BOPInt_Context)& aContext)
+ const Handle(IntTools_Context)& aContext)
{
Standard_Integer aResult = 0;
if ( !CheckTangentZonesExist( theSurface1, theSurface2 ) )
const Standard_Boolean theAvoidLConstructor,
IntPatch_SequenceOfLine& theNewLines,
Standard_Real& theReachedTol3d,
- const Handle(BOPInt_Context)& aContext)
+ const Handle(IntTools_Context)& aContext)
{
Standard_Boolean bRet, bAvoidLineConstructor;
const Standard_Real theOtherParameter,
const Standard_Boolean bIncreasePar,
Standard_Real& theNewParameter,
- const Handle(BOPInt_Context)& aContext)
+ const Handle(IntTools_Context)& aContext)
{
Standard_Boolean bIsComputed = Standard_False;
theNewParameter = theParameter;
const Handle(GeomAdaptor_HSurface)& myHS2,
const TopoDS_Face& myFace1,
const TopoDS_Face& myFace2,
- const Handle(BOPInt_Context)& myContext)
+ const Handle(IntTools_Context)& myContext)
{
Standard_Real aA, aB, aCf, aX1, aX2, aF1, aF2, aX, aF;
//
const Handle(GeomAdaptor_HSurface) myHS2,
const TopoDS_Face& aF1,
const TopoDS_Face& aF2,
- const Handle(BOPInt_Context)& aCtx)
+ const Handle(IntTools_Context)& aCtx)
{
Standard_Boolean bIsDone;
Standard_Integer i;
--- /dev/null
+-- Created by: Peter KURNEV
+-- Copyright (c) 1999-2014 OPEN CASCADE SAS
+--
+-- This file is part of Open CASCADE Technology software library.
+--
+-- This library is free software; you can redistribute it and/or modify it under
+-- the terms of the GNU Lesser General Public License version 2.1 as published
+-- by the Free Software Foundation, with special exception defined in the file
+-- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+-- distribution for complete text of the license and disclaimer of any warranty.
+--
+-- Alternatively, this file may be used under the terms of Open CASCADE
+-- commercial license or contractual agreement.
+
+class ShrunkRange from IntTools
+
+ ---Purpose:
+ --- The class provides the computation of
+ --- a working (shrunk) range [t1, t2] for
+ --- the 3D-curve of the edge.
+
+uses
+ Box from Bnd,
+ Edge from TopoDS,
+ Vertex from TopoDS,
+ Context from IntTools
+
+--raises
+
+is
+ Create
+ returns ShrunkRange from IntTools;
+ ---C++: alias "Standard_EXPORT virtual ~IntTools_ShrunkRange();"
+
+ SetData (me:out;
+ aE : Edge from TopoDS;
+ aT1 : Real from Standard;
+ aT2 : Real from Standard;
+ aV1 : Vertex from TopoDS;
+ aV2 : Vertex from TopoDS);
+
+ SetContext(me:out;
+ aCtx: Context from IntTools);
+
+ Context(me)
+ returns Context from IntTools;
+ ---C++: return const &
+
+ SetShrunkRange(me:out;
+ aT1 : Real from Standard;
+ aT2 : Real from Standard);
+
+ ShrunkRange(me;
+ aT1 :out Real from Standard;
+ aT2 :out Real from Standard);
+
+ BndBox (me)
+ returns Box from Bnd;
+ ---C++: return const &
+
+ Edge (me)
+ returns Edge from TopoDS;
+ ---C++: return const &
+
+ Perform(me:out);
+
+ ErrorStatus(me)
+ returns Integer from Standard;
+ ---Purpose:
+ --- Returns code of computing shrunk range
+ --- completion
+ --- 0 - means successful completion
+ --- 1 - nothing has been done
+ --- 2 - initial range is out of edge's range
+ --- 3 - first boundary of initial range is more than
+ --- last boundary
+ --- 4 - projection of first vertex failed
+ --- 5 - projection of second vertex failed
+ --- 6 - shrunk range can not be computed
+ --- shrunk range is setted to initial range
+ ---
+
+fields
+ myEdge : Edge from TopoDS is protected;
+ myV1 : Vertex from TopoDS is protected;
+ myV2 : Vertex from TopoDS is protected;
+ myT1 : Real from Standard is protected;
+ myT2 : Real from Standard is protected;
+ myTS1 : Real from Standard is protected;
+ myTS2 : Real from Standard is protected;
+ myBndBox : Box from Bnd is protected;
+ myCtx : Context from IntTools is protected;
+ myErrorStatus : Integer from Standard is protected;
+
+end ShrunkRange;
--- /dev/null
+// Created by: Peter KURNEV
+// Copyright (c) 1999-2014 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+#include <IntTools_ShrunkRange.ixx>
+
+#include <Precision.hxx>
+
+#include <gp.hxx>
+#include <gp_Circ.hxx>
+
+#include <Geom_Curve.hxx>
+
+#include <BRep_Tool.hxx>
+#include <BRepBuilderAPI_MakeVertex.hxx>
+#include <BRepAdaptor_Curve.hxx>
+#include <BndLib_Add3dCurve.hxx>
+#include <IntTools_Context.hxx>
+#include <gp_Lin.hxx>
+#include <ElCLib.hxx>
+
+//=======================================================================
+//function :
+//purpose :
+//=======================================================================
+ IntTools_ShrunkRange::IntTools_ShrunkRange ()
+{
+ myT1=-99;
+ myT2=myT1;
+ myTS1=myT1;
+ myTS2=myT1;
+ myErrorStatus=1;
+}
+//=======================================================================
+//function : ~
+//purpose :
+//=======================================================================
+IntTools_ShrunkRange::~IntTools_ShrunkRange ()
+{
+}
+//=======================================================================
+//function : SetData
+//purpose :
+//=======================================================================
+void IntTools_ShrunkRange::SetData(const TopoDS_Edge& aE,
+ const Standard_Real aT1,
+ const Standard_Real aT2,
+ const TopoDS_Vertex& aV1,
+ const TopoDS_Vertex& aV2)
+{
+ myEdge=aE;
+ myV1=aV1;
+ myV2=aV2;
+ myT1=aT1;
+ myT2=aT2;
+ myErrorStatus=1;
+}
+//=======================================================================
+//function : SetContext
+//purpose :
+//=======================================================================
+void IntTools_ShrunkRange::SetContext(const Handle(IntTools_Context)& aCtx)
+{
+ myCtx=aCtx;
+}
+//=======================================================================
+//function : Context
+//purpose :
+//=======================================================================
+const Handle(IntTools_Context)& IntTools_ShrunkRange::Context()const
+{
+ return myCtx;
+}
+//=======================================================================
+//function : Edge
+//purpose :
+//=======================================================================
+const TopoDS_Edge& IntTools_ShrunkRange::Edge() const
+{
+ return myEdge;
+}
+//=======================================================================
+//function : ShrunkRange
+//purpose :
+//=======================================================================
+void IntTools_ShrunkRange::ShrunkRange(Standard_Real& aT1,
+ Standard_Real& aT2) const
+{
+ aT1=myTS1;
+ aT2=myTS2;
+}
+//=======================================================================
+//function : BndBox
+//purpose :
+//=======================================================================
+const Bnd_Box& IntTools_ShrunkRange::BndBox() const
+{
+ return myBndBox;
+}
+//=======================================================================
+//function : ErrorStatus
+//purpose :
+//=======================================================================
+Standard_Integer IntTools_ShrunkRange::ErrorStatus() const
+{
+ return myErrorStatus;
+}
+
+//=======================================================================
+//function : SetShrunkRange
+//purpose :
+//=======================================================================
+void IntTools_ShrunkRange::SetShrunkRange(const Standard_Real aT1,
+ const Standard_Real aT2)
+{
+ myTS1=aT1;
+ myTS2=aT2;
+ //
+ BRepAdaptor_Curve aBAC(myEdge);
+ BndLib_Add3dCurve::Add (aBAC, aT1, aT2, 0., myBndBox);
+}
+
+//=======================================================================
+//function : Perform
+//purpose :
+//=======================================================================
+void IntTools_ShrunkRange::Perform()
+{
+ Standard_Real aCF, aCL, aTolE, aTolV1;
+ Standard_Real aTolV2, t1, t11, t1C, t2, t12, t2C;
+ Standard_Real aCoeff1, aCoeff2, aTol1, aTol2, dt1, dt2, aR, anEps;
+ Standard_Integer pri;
+ Standard_Boolean bInf1, bInf2, bAppr;
+ GeomAbs_CurveType aCurveType;
+ Handle(Geom_Curve) aC;
+ //
+ myErrorStatus=0;
+ myTS1=-99;
+ myTS2=myTS1;
+ anEps = 1.e-8;
+ //
+ aTolE =BRep_Tool::Tolerance(myEdge);
+ aTolV1=BRep_Tool::Tolerance(myV1);
+ aTolV2=BRep_Tool::Tolerance(myV2);
+ //for edges with the tolerance value
+ //more than the tolerance value of vertices
+ if (aTolV1 < aTolE) {
+ aTolV1 = aTolE;
+ }
+ //
+ if (aTolV2 < aTolE) {
+ aTolV2 = aTolE;
+ }
+ //
+ t1=myT1;
+ t2=myT2;
+ //
+ BRepAdaptor_Curve aBAC(myEdge);
+ aCurveType=aBAC.GetType();
+ //
+ aC=BRep_Tool::Curve(myEdge, aCF, aCL);
+ BRep_Tool::Range(myEdge, aCF, aCL);
+ //
+ if (t1 < aCF || t2 > aCL) {
+ myErrorStatus=2;
+ return;
+ }
+ //
+ bAppr = !(fabs(t2 - t1) > 100);
+ if (fabs(t2 - t1) < anEps) {
+ myErrorStatus=7;
+ return;
+ }
+ //
+ if (t1 > t2) {
+ myErrorStatus=3;
+ return;
+ }
+ //
+ aTol1 = aTolV1+aTolE;
+ aTol2 = aTolV2+aTolE;
+ //
+ aCoeff1 = (aTolE>0.05) ? 1. : 2.;
+ aCoeff2 = aCoeff1;
+ if (aCoeff1 == 2.) {
+ aCoeff1=(aTol1>0.05) ? 1.5 : 2.;
+ aCoeff2=(aTol2>0.05) ? 1.5 : 2.;
+ }
+ // xf
+ if (aCurveType==GeomAbs_Line && (aCoeff1 != 1 || aCoeff2 != 1)) {
+ Standard_Real aTV1, aTV2, aEps;
+ gp_Pnt aPV1, aPV2, aPC1, aPC2;
+ gp_Lin aL;
+ //
+ aEps=Precision::Confusion();
+ aEps=aEps*aEps;//1.e-14;
+ aL=aBAC.Line();
+ //
+ aPV1=BRep_Tool::Pnt(myV1);
+ aTV1=ElCLib::Parameter(aL, aPV1);
+ //
+ aPV2=BRep_Tool::Pnt(myV2);
+ aTV2=ElCLib::Parameter(aL, aPV2);
+ //
+ if (fabs(aTV1-aCF)<aEps) {
+ aCoeff1=1.;
+ }
+ if (fabs(aTV2-aCL)<aEps) {
+ aCoeff2=1.;
+ }
+ }
+ //
+ dt1=aCoeff1*aTol1;
+ dt2=aCoeff2*aTol2;
+ // xt
+ //
+ if (aCurveType==GeomAbs_Line) {
+ Standard_Real dt1x, dt2x;
+
+ dt1x = aBAC.Resolution(dt1);
+ t11=t1+dt1x;
+
+ dt2x = aBAC.Resolution(dt2);
+ t12=t2-dt2x;
+
+ if (t11>t2 || t12<t1) {
+ t1C=t1;
+ t2C=t2;
+ myTS1=t1C;
+ myTS2=t2C;
+ //
+ // BndBox
+ Standard_Real ddx=aTolE;//1.e-12;
+ BndLib_Add3dCurve::Add (aBAC, t1C, t2C, ddx, myBndBox);
+
+ myErrorStatus=6;//0
+ return;
+ }
+ }
+ //
+ if (aCurveType==GeomAbs_Circle) {
+ gp_Circ aCrc=aBAC.Circle();
+ aR=aCrc.Radius();
+ t1C=t1+dt1/aR;
+ t2C=t2-dt2/aR;
+ }
+ else {
+ //
+ // Vertex1 => t1C
+ gp_Pnt aP1,aP11;
+ aC->D0 (t1, aP1);
+ //
+ bInf1=Precision::IsNegativeInfinite(t1);
+ if (bInf1) {
+ t1C=t1;
+ }
+ //
+ else {
+ Standard_Real d1 = aCoeff1*aTol1;
+ // dt1 = aBAC.Resolution(d1);
+ //
+ gp_Vec aD1vec1;
+ gp_Pnt aPoint;
+ aBAC.D1(t1, aPoint, aD1vec1);
+ Standard_Real ad1length1 = aD1vec1.Magnitude();
+ Standard_Boolean bTryOtherPoints = Standard_False;
+ dt1 = (t2 - t1) * 0.5;
+
+ if(ad1length1 > 1.e-12) {
+ dt1 = d1 / ad1length1;
+
+ if(dt1 > (t2 - t1)) {
+ // bad parametrization, big tolerance or too small range
+ bTryOtherPoints = Standard_True;
+ }
+ }
+ else {
+ bTryOtherPoints = Standard_True;
+ }
+
+ if(bTryOtherPoints) {
+ Standard_Integer nbsamples = 5;
+ Standard_Integer ii = 0;
+ Standard_Real adelta = (t2 - t1) / (nbsamples + 1);
+ Standard_Boolean bFound = Standard_False;
+
+ for(ii = 1; ii <= nbsamples; ii++) {
+ Standard_Real aparameter = t1 + (adelta * ii);
+ gp_Pnt aPoint2;
+ aBAC.D1(aparameter, aPoint2, aD1vec1);
+
+ if(aPoint.Distance(aPoint2) < d1)
+ dt1 = adelta * ii;
+ ad1length1 = aD1vec1.Magnitude();
+
+ if(ad1length1 > 1.e-12) {
+ dt1 = d1 / ad1length1;
+
+ if(dt1 < (t2 - t1)) {
+ bFound = Standard_True;
+ break;
+ }
+ }
+ }
+
+ if(!bFound) {
+ if(dt1 > (t2 - t1)) {
+ dt1 = aBAC.Resolution(d1);
+ }
+ }
+ }
+ //
+ if (!bAppr) {
+ dt1 *= 10;
+ }
+ t11=t1+dt1;
+ aC->D0 (t11, aP11);
+
+ gp_Vec aV11(aP1, aP11);
+ // avoid exception if aP1 == aP11
+ if (aV11.SquareMagnitude() < gp::Resolution())
+ t1C = t1;
+ else {
+ gp_Dir aD11(aV11);
+
+ gp_Pnt aP1L;
+ //
+ aP1L.SetCoord (aP1.X()+d1*aD11.X(),
+ aP1.Y()+d1*aD11.Y(),
+ aP1.Z()+d1*aD11.Z());
+
+ BRepBuilderAPI_MakeVertex aMV1(aP1L);
+ const TopoDS_Vertex& aV1L=aMV1.Vertex();
+ //
+ pri=myCtx->ComputeVE (aV1L, myEdge, t1C);
+ //
+ if (pri==-3) {
+ myErrorStatus=4;
+ return;
+ }
+ }
+ }
+ //
+ // Vertex2 => t2C
+ gp_Pnt aP2, aP12;
+ aC->D0 (t2, aP2);
+ //
+ bInf2=Precision::IsPositiveInfinite(t2);
+ if (bInf2) {
+ t2C=t2;
+ }
+ //
+ else {
+ Standard_Real d2 = aCoeff2*aTol2;
+ // dt2 = aBAC.Resolution(d2);
+
+ //
+ gp_Vec aD1vec2;
+ gp_Pnt aPoint;
+ aBAC.D1(t2, aPoint, aD1vec2);
+ Standard_Real ad1length2 = aD1vec2.Magnitude();
+ Standard_Boolean bTryOtherPoints = Standard_False;
+ dt2 = (t2 - t1) * 0.5;
+
+ if(ad1length2 > 1.e-12) {
+ dt2 = d2 / ad1length2;
+
+ if(dt2 > (t2 - t1)) {
+ bTryOtherPoints = Standard_True;
+ }
+ }
+ else {
+ bTryOtherPoints = Standard_True;
+ }
+
+ if(bTryOtherPoints) {
+ Standard_Integer nbsamples = 5;
+ Standard_Integer ii = 0;
+ Standard_Real adelta = (t2 - t1) / (nbsamples + 1);
+ Standard_Boolean bFound = Standard_False;
+
+ for(ii = 1; ii <= nbsamples; ii++) {
+ Standard_Real aparameter = t2 - (adelta * ii);
+ gp_Pnt aPoint2;
+ aBAC.D1(aparameter, aPoint2, aD1vec2);
+
+ if(aPoint.Distance(aPoint2) < d2)
+ dt2 = adelta * ii;
+ ad1length2 = aD1vec2.Magnitude();
+
+ if(ad1length2 > 1.e-12) {
+ dt2 = d2 / ad1length2;
+
+ if(dt2 < (t2 - t1)) {
+ bFound = Standard_True;
+ break;
+ }
+ }
+ }
+
+ if(!bFound) {
+ if(dt2 > (t2 - t1)) {
+ dt2 = aBAC.Resolution(d2);
+ }
+ }
+ }
+ //
+ if (!bAppr) {
+ dt2 *= 10;
+ }
+
+ t12=t2-dt2;
+ aC->D0 (t12, aP12);
+
+ gp_Vec aV12(aP2, aP12);
+ // avoid exception if aP1 == aP11
+ if (aV12.SquareMagnitude() < gp::Resolution())
+ t2C = t2;
+ else {
+ gp_Dir aD12(aV12);
+
+ gp_Pnt aP2L;
+ //
+ aP2L.SetCoord (aP2.X()+d2*aD12.X(),
+ aP2.Y()+d2*aD12.Y(),
+ aP2.Z()+d2*aD12.Z());
+
+ BRepBuilderAPI_MakeVertex aMV2(aP2L);
+ const TopoDS_Vertex& aV2L=aMV2.Vertex();
+ //
+ pri=myCtx->ComputeVE (aV2L, myEdge, t2C);
+ //
+ if (pri==-3) {
+ myErrorStatus=5;
+ return;
+ }
+ }
+ }
+ } // else {
+ //
+ if (t1C>t2){
+ t1C=0.5*(t2+t1);
+ t2C=t1C+0.1*(t2-t1C);
+ }
+
+ if (t1C>t2C) {
+ t2C=t1C+0.1*(t2-t1C);
+ }
+ //
+ if (t2C-t1C < anEps) {
+ myErrorStatus = 7;
+ return;
+ }
+ //
+ myTS1=t1C;
+ myTS2=t2C;
+ //
+ // BndBox
+ Standard_Real ddx=aTolE;//1.e-12;
+ BndLib_Add3dCurve::Add (aBAC, t1C, t2C, ddx, myBndBox);
+}
+/////////////////////////////////////////////////////////////////////////
+//
+// myErrorStatus :
+//
+// 1- Nothing has been done
+// 2- The source range is out of the edge's range
+// 3- t1 < t2 for source range
+// 4- Can not project V1L to the Edge;
+// 5- Can not project V2L to the Edge;
+// 6- for obtained shrunk range [t11, t12] -> t11>t2 || t12<t1;
+// 7- too small range.
class Tools from IntTools
- ---Purpose:
- --- The class contains handy static functions
- --- dealing with the geometry and topology.
+ ---Purpose:
+ --- The class contains handy static functions
+ --- dealing with the geometry and topology.
uses
Shape from TopoDS,
Pnt2d from gp,
Pnt from gp,
Dir from gp,
+ Lin from gp,
+ Pln from gp,
CommonPrt from IntTools,
Curve from IntTools,
+ Range from IntTools,
SequenceOfCurves from IntTools,
Curve from Geom,
- State from TopAbs
-
+ State from TopAbs,
+ Box from Bnd
+
is
ComputeVV (myclass;V1,V2:Vertex from TopoDS)
- returns Integer from Standard;
- ---Purpose:
- --- Computes distance between vertex V1 and vertex V2,
- --- if the distance is less than sum of vertex tolerances
- --- returns zero,
- --- otherwise returns negative value
- ---
+ returns Integer from Standard;
+ ---Purpose:
+ --- Computes distance between vertex V1 and vertex V2,
+ --- if the distance is less than sum of vertex tolerances
+ --- returns zero,
+ --- otherwise returns negative value
+ ---
HasInternalEdge (myclass;
- aW: Wire from TopoDS)
- returns Boolean from Standard;
- ---Purpose:
- --- Returns True if wire aW contains edges
- --- with INTERNAL orientation
- ---
+ aW: Wire from TopoDS)
+ returns Boolean from Standard;
+ ---Purpose:
+ --- Returns True if wire aW contains edges
+ --- with INTERNAL orientation
+ ---
MakeFaceFromWireAndFace (myclass;
- aW: Wire from TopoDS;
- aF: Face from TopoDS;
- aFNew:out Face from TopoDS);
- ---Purpose:
- --- Build a face based on surface of given face aF
- --- and bounded by wire aW
- ---
-
- ClassifyPointByFace (myclass;
- aF: Face from TopoDS;
- P: Pnt2d from gp)
- returns State from TopAbs;
- ---Purpose:
- ---
- ---
-
+ aW: Wire from TopoDS;
+ aF: Face from TopoDS;
+ aFNew:out Face from TopoDS);
+ ---Purpose:
+ --- Build a face based on surface of given face aF
+ --- and bounded by wire aW
+ ---
+
+ ClassifyPointByFace (myclass;
+ aF: Face from TopoDS;
+ P: Pnt2d from gp)
+ returns State from TopAbs;
+ ---Purpose:
+ ---
+ ---
+
IsVertex (myclass; E: Edge from TopoDS;
- t: Real from Standard)
- returns Boolean from Standard;
- ---Purpose:
- --- Computes square distance between a point on the edge E
- --- corresponded to parameter t and vertices of edge E.
- --- Returns True if this distance is less than square
- --- tolerance of vertex, otherwise returns false.
- ---
-
+ t: Real from Standard)
+ returns Boolean from Standard;
+ ---Purpose:
+ --- Computes square distance between a point on the edge E
+ --- corresponded to parameter t and vertices of edge E.
+ --- Returns True if this distance is less than square
+ --- tolerance of vertex, otherwise returns false.
+ ---
+
IsVertex (myclass; E: Edge from TopoDS;
- V: Vertex from TopoDS;
- t: Real from Standard)
- returns Boolean from Standard;
- ---Purpose:
- --- Returns True if square distance between vertex V
- --- and a point on the edge E corresponded to parameter t
- --- is less than square tolerance of V
- ---
-
+ V: Vertex from TopoDS;
+ t: Real from Standard)
+ returns Boolean from Standard;
+ ---Purpose:
+ --- Returns True if square distance between vertex V
+ --- and a point on the edge E corresponded to parameter t
+ --- is less than square tolerance of V
+ ---
+
IsVertex (myclass; aCmnPrt: CommonPrt from IntTools)
- returns Boolean from Standard;
- ---Purpose:
- --- Returns True if IsVertx for middle parameter of fist range
- --- and first edge returns True
- --- and if IsVertex for middle parameter of second range and
- --- second range returns True,
- --- otherwise returns False
- ---
-
+ returns Boolean from Standard;
+ ---Purpose:
+ --- Returns True if IsVertx for middle parameter of fist range
+ --- and first edge returns True
+ --- and if IsVertex for middle parameter of second range and
+ --- second range returns True,
+ --- otherwise returns False
+ ---
+
IsMiddlePointsEqual(myclass;
- E1: Edge from TopoDS;
- E2: Edge from TopoDS)
+ E1: Edge from TopoDS;
+ E2: Edge from TopoDS)
returns Boolean from Standard;
- ---Purpose:
- --- Gets boundary of parameters of E1 and E2.
- --- Computes 3d points on each corresponded to average parameters.
- --- Returns True if distance between computed points is less than
- --- sum of edge tolerance, otherwise returns False.
- ---
+ ---Purpose:
+ --- Gets boundary of parameters of E1 and E2.
+ --- Computes 3d points on each corresponded to average parameters.
+ --- Returns True if distance between computed points is less than
+ --- sum of edge tolerance, otherwise returns False.
+ ---
IsVertex (myclass;
- aP : Pnt from gp;
- aTolPV: Real from Standard;
- aV: Vertex from TopoDS)
- returns Boolean from Standard;
- ---Purpose:
- --- Returns True if the distance between point aP and
- --- vertex aV is less or equal to sum of aTolPV and
- --- vertex tolerance, otherwise returns False
- ---
+ aP : Pnt from gp;
+ aTolPV: Real from Standard;
+ aV: Vertex from TopoDS)
+ returns Boolean from Standard;
+ ---Purpose:
+ --- Returns True if the distance between point aP and
+ --- vertex aV is less or equal to sum of aTolPV and
+ --- vertex tolerance, otherwise returns False
+ ---
IntermediatePoint (myclass;
- aFirst: Real from Standard;
- aLast : Real from Standard)
- returns Real from Standard;
- ---Purpose:
- --- Returns some value between aFirst and aLast
- ---
+ aFirst: Real from Standard;
+ aLast : Real from Standard)
+ returns Real from Standard;
+ ---Purpose:
+ --- Returns some value between aFirst and aLast
+ ---
SplitCurve (myclass;
- aC : Curve from IntTools;
- aS :out SequenceOfCurves from IntTools)
- returns Integer from Standard;
- ---Purpose:
- --- Split aC by average parameter if aC is closed in 3D.
- --- Returns positive value if splitting has been done,
- --- otherwise returns zero.
- ---
-
+ aC : Curve from IntTools;
+ aS :out SequenceOfCurves from IntTools)
+ returns Integer from Standard;
+ ---Purpose:
+ --- Split aC by average parameter if aC is closed in 3D.
+ --- Returns positive value if splitting has been done,
+ --- otherwise returns zero.
+ ---
+
RejectLines(myclass;
- aSIn: SequenceOfCurves from IntTools;
- aSOut:out SequenceOfCurves from IntTools);
- ---Purpose:
- --- Puts curves from aSIn to aSOut except those curves that
- --- are coincide with first curve from aSIn.
- ---
-
+ aSIn: SequenceOfCurves from IntTools;
+ aSOut:out SequenceOfCurves from IntTools);
+ ---Purpose:
+ --- Puts curves from aSIn to aSOut except those curves that
+ --- are coincide with first curve from aSIn.
+ ---
+
IsDirsCoinside (myclass;
- D1:Dir from gp;
- D2:Dir from gp)
- returns Boolean from Standard;
- ---Purpose:
- --- Returns True if D1 and D2 coinside
- ---
+ D1:Dir from gp;
+ D2:Dir from gp)
+ returns Boolean from Standard;
+ ---Purpose:
+ --- Returns True if D1 and D2 coinside
+ ---
IsDirsCoinside (myclass;
- D1 :Dir from gp;
- D2 :Dir from gp;
- aTol:Real from Standard)
- returns Boolean from Standard;
- ---Purpose:
- --- Returns True if D1 and D2 coinside with given tolerance
- ---
+ D1 :Dir from gp;
+ D2 :Dir from gp;
+ aTol:Real from Standard)
+ returns Boolean from Standard;
+ ---Purpose:
+ --- Returns True if D1 and D2 coinside with given tolerance
+ ---
IsClosed (myclass;
- aC : Curve from Geom)
- returns Boolean from Standard;
- ---Purpose:
- --- Returns True if aC is BoundedCurve from Geom and
- --- the distance between first point
- --- of the curve aC and last point
- --- is less than 1.e-12
- ---
-
+ aC : Curve from Geom)
+ returns Boolean from Standard;
+ ---Purpose:
+ --- Returns True if aC is BoundedCurve from Geom and
+ --- the distance between first point
+ --- of the curve aC and last point
+ --- is less than 1.e-12
+ ---
+
CurveTolerance(myclass;
- aC : Curve from Geom;
- aTolBase : Real from Standard)
- returns Real from Standard;
- ---Purpose:
- --- Returns adaptive tolerance for given aTolBase
- --- if aC is trimmed curve and basis curve is parabola,
- --- otherwise returns value of aTolBase
- ---
+ aC : Curve from Geom;
+ aTolBase : Real from Standard)
+ returns Real from Standard;
+ ---Purpose:
+ --- Returns adaptive tolerance for given aTolBase
+ --- if aC is trimmed curve and basis curve is parabola,
+ --- otherwise returns value of aTolBase
+ ---
+--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+ CheckCurve(myclass;
+ theC:Curve from Geom;
+ theTol:Real from Standard;
+ theBox:out Box from Bnd)
+ returns Boolean from Standard;
+
+ IsOnPave(myclass;
+ theT:Real from Standard;
+ theRange:Range from IntTools;
+ theTol: Real from Standard)
+ returns Boolean from Standard;
+
+ VertexParameters(myclass;
+ theCP:CommonPrt from IntTools;
+ theT1:out Real from Standard;
+ theT2:out Real from Standard);
+
+ VertexParameter(myclass;
+ theCP:CommonPrt from IntTools;
+ theT:out Real from Standard);
+
+ IsOnPave1(myclass;
+ theT:Real from Standard;
+ theRange:Range from IntTools;
+ theTol: Real from Standard)
+ returns Boolean from Standard;
+
+ IsInRange(myclass;
+ theRRef : Range from IntTools;
+ theR : Range from IntTools;
+ theTol : Real from Standard)
+ returns Boolean from Standard;
+ ---Purpose: Checks if the range <theR> interfere with the range <theRRef>
+
+ SegPln(myclass;
+ theLin : Lin from gp;
+ theTLin1 : Real from Standard;
+ theTLin2 : Real from Standard;
+ theTolLin: Real from Standard;
+ thePln : Pln from gp;
+ theTolPln: Real from Standard;
+ theP :out Pnt from gp;
+ theT :out Real from Standard;
+ theTolP :out Real from Standard;
+ theTmin :out Real from Standard;
+ theTmax :out Real from Standard)
+ returns Integer from Standard;
+
end Tools;
static
void ParabolaTolerance(const Handle(Geom_Curve)& ,
- const Standard_Real ,
- const Standard_Real ,
- const Standard_Real ,
- Standard_Real& ,
- Standard_Real& );
+ const Standard_Real ,
+ const Standard_Real ,
+ const Standard_Real ,
+ Standard_Real& ,
+ Standard_Real& );
//=======================================================================
//function : HasInternalEdge
//
- //modified by NIZNHY-PKV Mon Jul 04 11:58:23 2011f
aPC=Precision::Confusion();
aPC=aPC*aPC;
aDist=aP1.SquareDistance(aP2);
bRet=aDist<aPC;
return bRet;
- //
- //aDist=aP1.Distance(aP2);
- //return (aDist < Precision::Confusion());
- //modified by NIZNHY-PKV Mon Jul 04 11:59:50 2011t
}
//=======================================================================
//purpose :
//=======================================================================
void IntTools_Tools::RejectLines(const IntTools_SequenceOfCurves& aSIn,
- IntTools_SequenceOfCurves& aSOut)
+ IntTools_SequenceOfCurves& aSOut)
{
Standard_Integer i, j, aNb;
Standard_Boolean bFlag;
if (aGLine.IsNull()) {
aSOut.Clear();
for (j=1; j<=aNb; j++) {
- aSOut.Append(aSIn(j));
+ aSOut.Append(aSIn(j));
}
return;
}
//purpose :
//=======================================================================
Standard_Boolean IntTools_Tools::IsDirsCoinside (const gp_Dir& D1,
- const gp_Dir& D2,
- const Standard_Real dLim)
+ const gp_Dir& D2,
+ const Standard_Real dLim)
{
Standard_Boolean bFlag;
Standard_Real d;
//purpose :
//=======================================================================
Standard_Integer IntTools_Tools::SplitCurve(const IntTools_Curve& IC,
- IntTools_SequenceOfCurves& aCvs)
+ IntTools_SequenceOfCurves& aCvs)
{
Handle (Geom_Curve) aC3D =IC.Curve();
if(aC3D.IsNull())
//purpose :
//=======================================================================
Standard_Real IntTools_Tools::IntermediatePoint (const Standard_Real aFirst,
- const Standard_Real aLast)
+ const Standard_Real aLast)
{
//define parameter division number as 10*e^(-M_PI) = 0.43213918
const Standard_Real PAR_T = 0.43213918;
//purpose :
//=======================================================================
Standard_Boolean IntTools_Tools::IsVertex (const gp_Pnt& aP,
- const Standard_Real aTolPV,
- const TopoDS_Vertex& aV)
+ const Standard_Real aTolPV,
+ const TopoDS_Vertex& aV)
{
Standard_Boolean bRet;
Standard_Real aTolV, aD, dTol;
//
aPv=BRep_Tool::Pnt(aV);
//
- //modified by NIZNHY-PKV Mon Jul 04 12:00:37 2011f
aD=aPv.SquareDistance(aP);
aTolV=aTolV*aTolV;
bRet=(aD<=aTolV);
return bRet;
- //
- //aD=aPv.Distance(aP);
- //return (aD<=aTolV);
- //modified by NIZNHY-PKV Mon Jul 04 12:00:40 2011t
}
//purpose :
//=======================================================================
Standard_Boolean IntTools_Tools::IsVertex (const TopoDS_Edge& aE,
- const TopoDS_Vertex& aV,
- const Standard_Real t)
+ const TopoDS_Vertex& aV,
+ const Standard_Real t)
{
Standard_Real aTolV, aTolV2, d2;
gp_Pnt aPv, aPt;
//purpose :
//=======================================================================
Standard_Boolean IntTools_Tools::IsVertex (const TopoDS_Edge& aE,
- const Standard_Real t)
+ const Standard_Real t)
{
Standard_Real aTolV, aTolV2, d2;
TopoDS_Vertex aV;
//purpose :
//=======================================================================
Standard_Integer IntTools_Tools::ComputeVV(const TopoDS_Vertex& aV1,
- const TopoDS_Vertex& aV2)
+ const TopoDS_Vertex& aV2)
{
Standard_Real aTolV1, aTolV2, aTolSum, d;
gp_Pnt aP1, aP2;
aP1=BRep_Tool::Pnt(aV1);
aP2=BRep_Tool::Pnt(aV2);
- //modified by NIZNHY-PKV Mon Jul 04 11:55:52 2011f
aTolSum=aTolSum*aTolSum;
d=aP1.SquareDistance(aP2);
- //d=aP1.Distance(aP2);
- //modified by NIZNHY-PKV Mon Jul 04 11:55:53 2011t
if (d<aTolSum) {
return 0;
}
//purpose :
//=======================================================================
void IntTools_Tools::MakeFaceFromWireAndFace(const TopoDS_Wire& aW,
- const TopoDS_Face& aF,
- TopoDS_Face& aFNew)
+ const TopoDS_Face& aF,
+ TopoDS_Face& aFNew)
{
TopoDS_Face aFF;
aFF=aF;
//purpose :
//=======================================================================
TopAbs_State IntTools_Tools::ClassifyPointByFace(const TopoDS_Face& aF,
- const gp_Pnt2d& aP2d)
+ const gp_Pnt2d& aP2d)
{
Standard_Real aFaceTolerance;
TopAbs_State aState;
//purpose :
//=======================================================================
Standard_Boolean IntTools_Tools::IsMiddlePointsEqual(const TopoDS_Edge& aE1,
- const TopoDS_Edge& aE2)
-
+ const TopoDS_Edge& aE2)
+
{
Standard_Boolean bRet;
Standard_Real f1, l1, m1, f2, l2, m2, aTol1, aTol2, aSumTol, aD2;
C2->D0(m2, aP2);
aSumTol=aTol1+aTol2;
- //modified by NIZNHY-PKV Mon Jul 04 12:02:20 2011f
aSumTol=aSumTol*aSumTol;
aD2=aP1.SquareDistance(aP2);
bRet=aD2<aSumTol;
return bRet;
- //
- //if (aP1.Distance(aP2) < aSumTol) {
- // return Standard_True;
- //}
- //return Standard_False;
- //modified by NIZNHY-PKV Mon Jul 04 12:02:24 2011t
}
//=======================================================================
//purpose :
//=======================================================================
Standard_Real IntTools_Tools::CurveTolerance(const Handle(Geom_Curve)& aC3D,
- const Standard_Real aTolBase)
+ const Standard_Real aTolBase)
{
Standard_Real aTolReached, aTf, aTl, aTolMin, aTolMax;
#include <Geom_Parabola.hxx>
#include <gp_Parab.hxx>
+#include <BndLib_Add3dCurve.hxx>
//=======================================================================
//function : ParabolaTolerance
//purpose :
//=======================================================================
void ParabolaTolerance(const Handle(Geom_Curve)& aC3D,
- const Standard_Real aTf,
- const Standard_Real aTl,
- const Standard_Real aTol,
- Standard_Real& aTolMin,
- Standard_Real& aTolMax)
+ const Standard_Real aTf,
+ const Standard_Real aTl,
+ const Standard_Real aTol,
+ Standard_Real& aTolMin,
+ Standard_Real& aTolMax)
{
aTolMin=aTol;
aTolMax=(aTol1>aTol2) ? aTol1 : aTol2;
aTolMin=(aTol1<aTol2) ? aTol1 : aTol2;
}
+/////////////////////////////////////////////////////////////////////////
+//=======================================================================
+//function : CheckCurve
+//purpose :
+//=======================================================================
+Standard_Boolean IntTools_Tools::CheckCurve(const Handle (Geom_Curve)& aC3D,
+ const Standard_Real aTolR3D,
+ Bnd_Box& aBox)
+{
+ Standard_Boolean bRet;
+ Standard_Real aXmin, aYmin, aZmin, aXmax, aYmax, aZmax, dX, dY, dZ;
+ Standard_Real dS, aTol;
+ GeomAdaptor_Curve aGAC;
+ //
+ aGAC.Load(aC3D);
+ BndLib_Add3dCurve::Add(aGAC, aTolR3D, aBox);
+ // 910/B1
+ aBox.Get(aXmin, aYmin, aZmin, aXmax, aYmax, aZmax);
+ dX=aXmax-aXmin;
+ dY=aYmax-aYmin;
+ dZ=aZmax-aZmin;
+ dS=1.e-12;
+ aTol=2.*aTolR3D+dS;
+ bRet=(dX>aTol || dY>aTol || dZ>aTol);
+ //
+ return bRet;
+}
+//=======================================================================
+//function : IsOnPave
+//purpose :
+//=======================================================================
+Standard_Boolean IntTools_Tools::IsOnPave(const Standard_Real aT1,
+ const IntTools_Range& aRange,
+ const Standard_Real aTolerance)
+{
+ Standard_Boolean firstisonpave1, firstisonpave2, bIsOnPave;
+ //
+ firstisonpave1 = (Abs(aRange.First() - aT1) < aTolerance);
+ firstisonpave2 = (Abs(aRange.Last() - aT1) < aTolerance);
+ bIsOnPave=(firstisonpave1 || firstisonpave2);
+ return bIsOnPave;
+}
+//=======================================================================
+// function: VertexParameters
+// purpose:
+//=======================================================================
+void IntTools_Tools::VertexParameters(const IntTools_CommonPrt& aCPart,
+ Standard_Real& aT1,
+ Standard_Real& aT2)
+{
+ const IntTools_Range& aR1=aCPart.Range1();
+ aT1=0.5*(aR1.First()+aR1.Last());
+ //
+ if((aCPart.VertexParameter1() >= aR1.First()) &&
+ (aCPart.VertexParameter1() <= aR1.Last())) {
+ aT1 = aCPart.VertexParameter1();
+ }
+ //
+ const IntTools_SequenceOfRanges& aRanges2=aCPart.Ranges2();
+ const IntTools_Range& aR2=aRanges2(1);
+ aT2=0.5*(aR2.First()+aR2.Last());
+ //
+ if((aCPart.VertexParameter2() >= aR2.First()) &&
+ (aCPart.VertexParameter2() <= aR2.Last())) {
+ aT2 = aCPart.VertexParameter2();
+ }
+}
+//=======================================================================
+// function: VertexParameter
+// purpose:
+//=======================================================================
+void IntTools_Tools::VertexParameter(const IntTools_CommonPrt& aCPart,
+ Standard_Real& aT)
+{
+ const IntTools_Range& aR=aCPart.Range1();
+ aT=0.5*(aR.First()+aR.Last());
+ if((aCPart.VertexParameter1() >= aR.First()) &&
+ (aCPart.VertexParameter1() <= aR.Last())) {
+ aT = aCPart.VertexParameter1();
+ }
+}
+//=======================================================================
+// function: IsOnPave1
+// purpose:
+//=======================================================================
+Standard_Boolean IntTools_Tools::IsOnPave1(const Standard_Real aTR,
+ const IntTools_Range& aCPRange,
+ const Standard_Real aTolerance)
+{
+ Standard_Boolean bIsOnPave;
+ Standard_Real aT1, aT2, dT1, dT2;
+ //
+ aT1=aCPRange.First();
+ aT2=aCPRange.Last();
+ bIsOnPave=(aTR>=aT1 && aTR<=aT1);
+ if (bIsOnPave) {
+ return bIsOnPave;
+ }
+ //
+ dT1=Abs(aTR-aT1);
+ dT2=Abs(aTR-aT2);
+ bIsOnPave=(dT1<=aTolerance || dT2<=aTolerance);
+ return bIsOnPave;
+}
+//=======================================================================
+// function: IsInRange
+// purpose:
+//=======================================================================
+Standard_Boolean IntTools_Tools::IsInRange(const IntTools_Range& aRRef,
+ const IntTools_Range& aR,
+ const Standard_Real aTolerance)
+{
+ Standard_Boolean bIsIn;
+ Standard_Real aT1, aT2, aTRef1, aTRef2;
+ //
+ aR.Range(aT1, aT2);
+ aRRef.Range(aTRef1, aTRef2);
+ //
+ aTRef1-=aTolerance;
+ aTRef2+=aTolerance;
+ //
+ bIsIn = (aT1>=aTRef1 && aT1<=aTRef2) ||
+ (aT2>=aTRef1 && aT2<=aTRef2);
+ //
+ return bIsIn;
+}
+//=======================================================================
+//function : SegPln
+//purpose :
+//=======================================================================
+Standard_Integer IntTools_Tools::SegPln(const gp_Lin& theLin,
+ const Standard_Real theTLin1,
+ const Standard_Real theTLin2,
+ const Standard_Real theTolLin,
+ const gp_Pln& thePln,
+ const Standard_Real theTolPln,
+ gp_Pnt& theP,
+ Standard_Real& theTP,
+ Standard_Real& theTolP,
+ Standard_Real& theTPmin,
+ Standard_Real& theTPmax)
+{
+ Standard_Integer iRet;
+ Standard_Real aTol, aA, aB, aC, aD, aE, aH, aTP, aDist1, aDist2;
+ gp_Pnt aP1, aP2;
+ //
+ iRet=0;
+ aTol=theTolLin+theTolPln;
+ //
+ const gp_Ax3& aPosPln=thePln.Position();
+ const gp_Dir& aDirPln=aPosPln.Direction();
+ const gp_Pnt& aLocPln=aPosPln.Location();
+ //
+ const gp_Dir& aDirLin=theLin.Direction();
+ const gp_Pnt& aLocLin=theLin.Location();
+ //
+ aP1.SetXYZ(aLocLin.XYZ()+theTLin1*aDirLin.XYZ());
+ aDist1=aDirPln.X()*(aP1.X()-aLocPln.X())+
+ aDirPln.Y()*(aP1.Y()-aLocPln.Y())+
+ aDirPln.Z()*(aP1.Z()-aLocPln.Z());
+ //
+ aP2.SetXYZ(aLocLin.XYZ()+theTLin2*aDirLin.XYZ());
+ aDist2=aDirPln.X()*(aP2.X()-aLocPln.X())+
+ aDirPln.Y()*(aP2.Y()-aLocPln.Y())+
+ aDirPln.Z()*(aP2.Z()-aLocPln.Z());
+ //
+ if (aDist1<aTol && aDist2<aTol){
+ iRet=1; // common block
+ return iRet;
+ }
+ //
+ if (aDist1*aDist2 > 0.) {
+ iRet=2; // segment lays on one side to the Plane
+ return iRet;
+ }
+ //
+ thePln.Coefficients(aA, aB, aC, aD);
+ aE=aA*aLocLin.X()+aB*aLocLin.Y()+aC*aLocLin.Z()+aD;
+ aH=aA*aDirLin.X()+aB*aDirLin.Y()+aC*aDirLin.Z();
+ aTP=-aE/aH;
+ if (aTP < theTLin1-aTol || aTP > theTLin2+aTol) {
+ iRet=3; // no intersections due to range of the Line
+ return iRet;
+ }
+ //
+ theTP=aTP;
+ theP.SetXYZ(aLocLin.XYZ()+aTP*aDirLin.XYZ());
+ theTolP=aTol;
+ theTPmin=theTP-theTolPln;
+ theTPmax=theTP+theTolPln;
+ iRet=0; // intersection point
+ return iRet;
+}
#include <BRep_Tool.hxx>
#include <BRep_Builder.hxx>
#include <Geom_Surface.hxx>
-#include <BOPInt_Context.hxx>
+#include <IntTools_Context.hxx>
#include <TopExp_Explorer.hxx>
#include <TopExp.hxx>
#include <GeomAPI_ProjectPointOnSurf.hxx>
IntTools
BRepAlgoAPI
BOPCol
-BOPInt
BOPDS
BOPAlgo
BOPTools