1. Unification of the usage of the BRepAdaptor_Surface in Boolean Operations algorithm.
For each face when it is necessary the Adaptor is initialized only once and stored in Context.
For that purpose the new IntTools_Context::SurfaceAdaptor(const TopoDS_Face&) method has been implemented.
To provide possibility to take the Adaptor from the context, the context has been added as
a parameter in following methods:
BOPTools_AlgoTools::MakePCurve()
BOPTools_AlgoTools::Sence()
BOPTools_AlgoTools2D::BuildPCurveForEdgeOnFace()
BOPTools_AlgoTools2D::PointOnSurface
BOPTools_AlgoTools2D::CurveOnSurface
BOPTools_AlgoTools2D::AdjustPCurveOnFace
BOPTools_AlgoTools2D::Make2D
BOPTools_AlgoTools2D::MakePCurveOnFace
BOPTools_AlgoTools3D::GetNormalToFaceOnEdge
It is also possible now to pass the context into BOPAlgo_WireSplitter algorithm.
Also, the new IntTools_Context::UVBounds(const TopoDS_Face&) method
has been implemented to get the UV bounds of a face.
2. Additional improvement is a calculation of reduced intersection range only for the intersection
type VERTEX during computation of Edge/Face interference.
3. The methods IntTools_EdgeFace::Prepare() and IntTools_EdgeFace::FindProjectableRoot()
and the fields IntTools_EdgeFace::myProjectableRanges and IntTools_EdgeFace::myFClass2d
have been removed as obsolete.
4. Test cases for the issue.
//
aWSp.SetWES(aWES);
aWSp.SetRunParallel(myRunParallel);
+ aWSp.SetContext(myContext);
aWSp.Perform();
iErr=aWSp.ErrorStatus();
if (iErr) {
if (!BRep_Tool::Degenerated(aE)) {
//
aT=BOPTools_AlgoTools2D::IntermediatePoint(aE);
- BOPTools_AlgoTools2D::PointOnSurface(aE, aF2, aT, aU, aV);
+ BOPTools_AlgoTools2D::PointOnSurface(aE, aF2, aT, aU, aV, theContext);
aP2D.SetCoord(aU, aV);
//
IntTools_FClass2d& aClsf=theContext->FClass2d(aF2);
}
else {
aFSD=(*(TopoDS_Face*)(&myShapesSD.Find(aFSp)));
- iSense=BOPTools_AlgoTools::Sense(aFSp, aFSD);
+ iSense=BOPTools_AlgoTools::Sense(aFSp, aFSD, myContext);
if (iSense<0) {
aFSD.Reverse();
}
//function : Context
//purpose :
//=======================================================================
-Handle(IntTools_Context) BOPAlgo_PaveFiller::Context()
+const Handle(IntTools_Context)& BOPAlgo_PaveFiller::Context()
{
return myContext;
}
Standard_EXPORT const BOPCol_ListOfShape& Arguments() const;
- Standard_EXPORT Handle(IntTools_Context) Context();
+ Standard_EXPORT const Handle(IntTools_Context)& Context();
Standard_EXPORT void SetSectionAttribute (const BOPAlgo_SectionAttribute& theSecAttr);
Standard_Boolean bJustAdd;
Standard_Integer iSize, nV, nZ, k, aNbVVS;
TopAbs_State aState;
+ BOPDS_MapOfPassKey aMPK;
//
myErrorStatus=0;
//
continue;
}
//
- const BOPDS_ShapeInfo& aSIV=myDS->ShapeInfo(nV);
- const BOPDS_ShapeInfo& aSIZ=myDS->ShapeInfo(nZ);
+ if (myDS->HasInterfShapeSubShapes(nV, nZ)) {
+ continue;
+ }
+ //
+ Standard_Integer nVSD = nV;
+ myDS->HasShapeSD(nV, nVSD);
+ //
+ BOPDS_PassKey aPK;
+ aPK.SetIds(nVSD, nZ);
+ if (!aMPK.Add(aPK)) {
+ continue;
+ }
//
- const TopoDS_Vertex& aV=*((TopoDS_Vertex*)&aSIV.Shape());
- const TopoDS_Solid& aZ=*((TopoDS_Solid*)&aSIZ.Shape());
+ const TopoDS_Vertex& aV=*((TopoDS_Vertex*)&myDS->Shape(nVSD));
+ const TopoDS_Solid& aZ=*((TopoDS_Solid*)&myDS->Shape(nZ));
//
BOPAlgo_VertexSolid& aVertexSolid=aVVS.Append1();
aVertexSolid.SetIndices(nV, nZ);
continue;
}
//
+ const IntTools_SequenceOfCommonPrts& aCPrts = anEdgeEdge.CommonParts();
+ aNbCPrts = aCPrts.Length();
+ if (!aNbCPrts) {
+ continue;
+ }
//--------------------------------------------
Handle(BOPDS_PaveBlock)& aPB1=anEdgeEdge.PaveBlock1();
nE1=aPB1->OriginalEdge();
IntTools_Range aR11(aT11, aTS11), aR12(aTS12, aT12),
aR21(aT21, aTS21), aR22(aTS22, aT22);
//
- const IntTools_SequenceOfCommonPrts& aCPrts = anEdgeEdge.CommonParts();
- aNbCPrts = aCPrts.Length();
- //
Standard_Boolean bAnalytical = Standard_False;
- if (aNbCPrts) {
+ {
const TopoDS_Edge& aOE1 = *(TopoDS_Edge*)&myDS->Shape(nE1);
const TopoDS_Edge& aOE2 = *(TopoDS_Edge*)&myDS->Shape(nE2);
//
if (!aEdgeFace.IsDone()) {
continue;
}
- //~~~
+ //
+ const IntTools_SequenceOfCommonPrts& aCPrts=aEdgeFace.CommonParts();
+ aNbCPrts = aCPrts.Length();
+ if (!aNbCPrts) {
+ continue;
+ }
+ //
aEdgeFace.Indices(nE, nF);
//
const TopoDS_Edge& aE=aEdgeFace.Edge();
//
anewSR.Range(aTS1, aTS2);
//
- // extend vertices ranges using Edge/Edge intersections
- // between the edge aE and the edges of the face aF.
- // thereby the edge's intersection range is reduced
- ReduceIntersectionRange(nV[0], nV[1], nE, nF, aTS1, aTS2);
+ if (aCPrts(1).Type() == TopAbs_VERTEX) {
+ // for the intersection type VERTEX
+ // extend vertices ranges using Edge/Edge intersections
+ // between the edge aE and the edges of the face aF.
+ // thereby the edge's intersection range is reduced
+ ReduceIntersectionRange(nV[0], nV[1], nE, nF, aTS1, aTS2);
+ }
//
IntTools_Range aR1(aT1, aTS1), aR2(aTS2, aT2);
//
BOPDS_FaceInfo& aFI=myDS->ChangeFaceInfo(nF);
const BOPCol_MapOfInteger& aMIFOn=aFI.VerticesOn();
const BOPCol_MapOfInteger& aMIFIn=aFI.VerticesIn();
- //~~~
- const IntTools_SequenceOfCommonPrts& aCPrts=aEdgeFace.CommonParts();
- aNbCPrts = aCPrts.Length();
//
Standard_Boolean bLinePlane = Standard_False;
if (aNbCPrts) {
BRepAdaptor_Curve aBAC(aE);
- BRepAdaptor_Surface aBAS(aF, Standard_False);
- //
bLinePlane = (aBAC.GetType() == GeomAbs_Line &&
- aBAS.GetType() == GeomAbs_Plane);
+ myContext->SurfaceAdaptor(aF).GetType() == GeomAbs_Plane);
}
-
+ //
for (i=1; i<=aNbCPrts; ++i) {
const IntTools_CommonPrt& aCPart=aCPrts(i);
aType=aCPart.Type();
return;
}
//
+ if (!myDS->HasInterfShapeSubShapes(theE, theF)) {
+ return;
+ }
+ //
BOPDS_VectorOfInterfEE& aEEs = myDS->InterfEE();
Standard_Integer aNbEEs = aEEs.Extent();
if (!aNbEEs) {
Standard_Integer nF1, nF2, aNbCurves, aNbPoints, i, aNbLP;
Standard_Integer aNbFaceFace, k;
Standard_Real aApproxTol, aTolR3D, aTolR2D, aTolFF, aTolReal;
- BRepAdaptor_Surface aBAS1, aBAS2;
BOPCol_MapOfInteger aMI;
BOPAlgo_VectorOfFaceFace aVFaceFace;
//
myDS->UpdateFaceInfoIn(nF2);
}
//
- aBAS1.Initialize(aF1, Standard_False);
- aBAS2.Initialize(aF2, Standard_False);
+ const BRepAdaptor_Surface& aBAS1 = myContext->SurfaceAdaptor(aF1);
+ const BRepAdaptor_Surface& aBAS2 = myContext->SurfaceAdaptor(aF2);
if (aBAS1.GetType() == GeomAbs_Plane &&
aBAS2.GetType() == GeomAbs_Plane) {
Standard_Boolean bToIntersect;
}
}
//
- ToleranceFF(aBAS1, aBAS2, aTolFF);
+ ToleranceFF(aBAS1, aBAS2, aTolFF);
//
if (myGlue == BOPAlgo_GlueOff) {
BOPAlgo_FaceFace& aFaceFace=aVFaceFace.Append1();
// Make p-curves
BOPTools_AlgoTools::MakePCurve(aES, aF1, aF2, aIC,
mySectionAttribute.PCurveOnS1(),
- mySectionAttribute.PCurveOnS2());
+ mySectionAttribute.PCurveOnS2(),
+ myContext);
//
// Append the Pave Block to the Curve j
aLPBC.Append(aPB);
}
//
if (iErr) {
- BOPTools_AlgoTools2D::BuildPCurveForEdgeOnFace(myE, myF);
+ BOPTools_AlgoTools2D::BuildPCurveForEdgeOnFace(myE, myF, myContext);
}
//
if (myFlag) {
return *myWES;
}
//=======================================================================
+//function : SetContext
+//purpose :
+//=======================================================================
+void BOPAlgo_WireSplitter::SetContext(const Handle(IntTools_Context)& theContext)
+{
+ myContext = theContext;
+}
+//=======================================================================
+//function : Context
+//purpose :
+//=======================================================================
+const Handle(IntTools_Context)& BOPAlgo_WireSplitter::Context()
+{
+ return myContext;
+}
+//=======================================================================
// function: CheckData
// purpose:
//=======================================================================
return;
}
//
+ // create a context
+ if (myContext.IsNull()) {
+ myContext = new IntTools_Context;
+ }
+ //
MakeConnexityBlocks();
MakeWires();
}
}
}
/////////////////////////////////////////////////////////////////////////
+class BOPAlgo_WS_ConnexityBlock {
+public:
+ BOPAlgo_WS_ConnexityBlock() {};
+ ~BOPAlgo_WS_ConnexityBlock() {};
-typedef BOPCol_NCVector<BOPTools_ConnexityBlock> \
- BOPTools_VectorOfConnexityBlock;
+ void SetFace(const TopoDS_Face& theF) {
+ myFace = theF;
+ }
-//=======================================================================
-//class : WireSplitterFunctor
-//purpose :
-//=======================================================================
-class BOPAlgo_WireSplitterFunctor
-{
-protected:
- TopoDS_Face myFace;
- BOPTools_VectorOfConnexityBlock* myPVCB;
+ const TopoDS_Face& Face() const {
+ return myFace;
+ }
-public:
- //
- BOPAlgo_WireSplitterFunctor(const TopoDS_Face& aF,
- BOPTools_VectorOfConnexityBlock& aVCB)
- : myFace(aF), myPVCB(&aVCB)
- {
+ void SetConnexityBlock(const BOPTools_ConnexityBlock& theCB) {
+ myCB = theCB;
+ }
+
+ const BOPTools_ConnexityBlock& ConnexityBlock() const {
+ return myCB;
+ }
+
+ void SetContext(const Handle(IntTools_Context)& aContext) {
+ myContext = aContext;
}
//
- void operator()( const Standard_Integer& theIndex ) const
- {
- BOPTools_VectorOfConnexityBlock& aVCB = *myPVCB;
- BOPTools_ConnexityBlock& aCB = aVCB(theIndex);
- BOPAlgo_WireSplitter::SplitBlock(myFace, aCB);
+ const Handle(IntTools_Context)& Context()const {
+ return myContext;
}
-};
-//=======================================================================
-//class : BOPAlgo_WireSplitterCnt
-//purpose :
-//=======================================================================
-class BOPAlgo_WireSplitterCnt
-{
-public:
- //-------------------------------
- // Perform
- Standard_EXPORT
- static void Perform(const Standard_Boolean bRunParallel,
- const TopoDS_Face& aF,
- BOPTools_VectorOfConnexityBlock& aVCB)
- {
- //
- BOPAlgo_WireSplitterFunctor aWSF(aF, aVCB);
- Standard_Integer aNbVCB = aVCB.Extent();
- //
- OSD_Parallel::For(0, aNbVCB, aWSF, !bRunParallel);
+
+ void Perform() {
+ BOPAlgo_WireSplitter::SplitBlock(myFace, myCB, myContext);
}
+
+protected:
+ TopoDS_Face myFace;
+ BOPTools_ConnexityBlock myCB;
+ Handle(IntTools_Context) myContext;
};
+
+typedef BOPCol_NCVector<BOPAlgo_WS_ConnexityBlock> \
+ BOPAlgo_VectorOfConnexityBlock;
+//
+typedef BOPCol_ContextFunctor
+ <BOPAlgo_WS_ConnexityBlock,
+ BOPAlgo_VectorOfConnexityBlock,
+ Handle(IntTools_Context),
+ IntTools_Context> BOPAlgo_SplitBlockFunctor;
+//
+typedef BOPCol_ContextCnt
+ <BOPAlgo_SplitBlockFunctor,
+ BOPAlgo_VectorOfConnexityBlock,
+ Handle(IntTools_Context)> BOPAlgo_SplitBlockCnt;
+
//=======================================================================
//function : MakeWires
//purpose :
TopoDS_Wire aW;
BOPTools_ListIteratorOfListOfConnexityBlock aItCB;
BOPCol_ListIteratorOfListOfShape aIt;
- BOPTools_VectorOfConnexityBlock aVCB;
+ BOPAlgo_VectorOfConnexityBlock aVCB;
+ //
+ const TopoDS_Face& aF=myWES->Face();
//
aItCB.Initialize(myLCB);
for (; aItCB.More(); aItCB.Next()) {
myWES->AddShape(aW);
}
else {
- aVCB.Append(aCB);
+ BOPAlgo_WS_ConnexityBlock& aWSCB = aVCB.Append1();
+ aWSCB.SetFace(aF);
+ aWSCB.SetConnexityBlock(aCB);
}
}
- //
- aNbVCB=aVCB.Extent();
- const TopoDS_Face& aF=myWES->Face();
//===================================================
- BOPAlgo_WireSplitterCnt::Perform(myRunParallel, aF, aVCB);
+ BOPAlgo_SplitBlockCnt::Perform(myRunParallel, aVCB, myContext);
//===================================================
+ aNbVCB=aVCB.Extent();
for (k=0; k<aNbVCB; ++k) {
- const BOPTools_ConnexityBlock& aCB=aVCB(k);
- const BOPCol_ListOfShape& aLW=aCB.Loops();
+ const BOPAlgo_WS_ConnexityBlock& aCB=aVCB(k);
+ const BOPCol_ListOfShape& aLW=aCB.ConnexityBlock().Loops();
aIt.Initialize(aLW);
for (; aIt.More(); aIt.Next()) {
const TopoDS_Shape& aWx=aIt.Value();
#include <BOPCol_BaseAllocator.hxx>
#include <BOPCol_ListOfShape.hxx>
#include <BOPTools_ConnexityBlock.hxx>
+#include <IntTools_Context.hxx>
class BOPAlgo_WireEdgeSet;
class TopoDS_Wire;
class TopoDS_Face;
-
class BOPAlgo_WireSplitter : public BOPAlgo_Algo
{
public:
Standard_EXPORT BOPAlgo_WireSplitter();
-Standard_EXPORT virtual ~BOPAlgo_WireSplitter();
+ Standard_EXPORT virtual ~BOPAlgo_WireSplitter();
Standard_EXPORT BOPAlgo_WireSplitter(const BOPCol_BaseAllocator& theAllocator);
Standard_EXPORT void SetWES (const BOPAlgo_WireEdgeSet& theWES);
Standard_EXPORT BOPAlgo_WireEdgeSet& WES();
-
- Standard_EXPORT virtual void Perform() Standard_OVERRIDE;
-
- static void MakeWire (BOPCol_ListOfShape& theLE, TopoDS_Wire& theW);
-
- Standard_EXPORT static void SplitBlock (const TopoDS_Face& theF, BOPTools_ConnexityBlock& theCB);
+ //! Sets the context for the algorithm
+ Standard_EXPORT void SetContext(const Handle(IntTools_Context)& theContext);
+ //! Returns the context
+ Standard_EXPORT const Handle(IntTools_Context)& Context();
+ Standard_EXPORT virtual void Perform() Standard_OVERRIDE;
+
+ static void MakeWire(BOPCol_ListOfShape& theLE, TopoDS_Wire& theW);
+
+ Standard_EXPORT static void SplitBlock (const TopoDS_Face& theF,
+ BOPTools_ConnexityBlock& theCB,
+ const Handle(IntTools_Context)& theContext);
protected:
-
Standard_EXPORT virtual void CheckData() Standard_OVERRIDE;
Standard_EXPORT void MakeConnexityBlocks();
Standard_EXPORT void MakeWires();
-
BOPAlgo_PWireEdgeSet myWES;
BOPTools_ListOfConnexityBlock myLCB;
-
+ Handle(IntTools_Context) myContext;
private:
-
-
-
-
};
-
#include <BOPAlgo_WireSplitter.lxx>
-
-
-
-
#endif // _BOPAlgo_WireSplitter_HeaderFile
const TopoDS_Edge& anEdge,
const TopoDS_Face& myFace,
const GeomAdaptor_Surface& aGAS,
- const Standard_Boolean aFlag);
+ const Standard_Boolean aFlag,
+ const Handle(IntTools_Context)& theContext);
static
void GetNextVertex(const TopoDS_Vertex& aV,
static
void RefineAngles(const TopoDS_Face& myFace,
const BOPCol_ListOfShape&,
- BOPAlgo_IndexedDataMapOfShapeListOfEdgeInfo&);
+ BOPAlgo_IndexedDataMapOfShapeListOfEdgeInfo&,
+ const Handle(IntTools_Context)&);
static
void RefineAngles(const TopoDS_Vertex& ,
const TopoDS_Face& ,
const BOPCol_MapOfShape& ,
- BOPAlgo_ListOfEdgeInfo& );
+ BOPAlgo_ListOfEdgeInfo&,
+ const Handle(IntTools_Context)&);
static
Standard_Boolean RefineAngle2D(const TopoDS_Vertex& ,
const TopoDS_Face& ,
const Standard_Real ,
const Standard_Real ,
- Standard_Real& );
+ Standard_Real& ,
+ const Handle(IntTools_Context)& );
//=======================================================================
//function : SplitBlock
//purpose :
//=======================================================================
void BOPAlgo_WireSplitter::SplitBlock(const TopoDS_Face& myFace,
- BOPTools_ConnexityBlock& aCB)
+ BOPTools_ConnexityBlock& aCB,
+ const Handle(IntTools_Context)& theContext)
{
Standard_Boolean bNothingToDo, bIsClosed, bIsIN;
Standard_Integer aIx, aNb, i, aCntIn, aCntOut;
}
//
// 3. Angles in mySmartMap
- BRepAdaptor_Surface aBAS(myFace);
+ const BRepAdaptor_Surface& aBAS = theContext->SurfaceAdaptor(myFace);
const GeomAdaptor_Surface& aGAS=aBAS.Surface();
//
for (i=1; i<=aNb; i++) {
bIsIN = aEI.IsIn();
aOr = bIsIN ? TopAbs_REVERSED : TopAbs_FORWARD;
aVV.Orientation(aOr);
- aAngle = Angle2D(aVV, aE, myFace, aGAS, bIsIN);
+ aAngle = Angle2D(aVV, aE, myFace, aGAS, bIsIN, theContext);
aEI.SetAngle(aAngle);
}
}// for (i=1; i<=aNb; i++) {
//
//Theme: The treatment p-curves convergent in node.
//The refining the angles of p-curves taking into account
- //bounging curves if exist.
- RefineAngles(myFace, myEdges, mySmartMap);
+ //bounding curves if exist.
+ RefineAngles(myFace, myEdges, mySmartMap, theContext);
//
// 4. Do
//
const TopoDS_Edge& anEdge,
const TopoDS_Face& myFace,
const GeomAdaptor_Surface& aGAS,
- const Standard_Boolean bIsIN)
+ const Standard_Boolean bIsIN,
+ const Handle(IntTools_Context)& theContext)
{
Standard_Real aFirst, aLast, aToler, dt, aTV, aTV1, anAngle, aTX;
gp_Pnt2d aPV, aPV1;
}
//
BOPTools_AlgoTools2D::CurveOnSurface (anEdge, myFace, aC2D,
- aFirst, aLast, aToler);
+ aFirst, aLast, aToler, theContext);
Standard_Real tol2d =2.*Tolerance2D(aV, aGAS);
//
GeomAbs_CurveType aType;
//=======================================================================
void RefineAngles(const TopoDS_Face& myFace,
const BOPCol_ListOfShape& myEdges,
- BOPAlgo_IndexedDataMapOfShapeListOfEdgeInfo& mySmartMap)
+ BOPAlgo_IndexedDataMapOfShapeListOfEdgeInfo& mySmartMap,
+ const Handle(IntTools_Context)& theContext)
{
Standard_Integer aNb, i;
BOPCol_IndexedDataMapOfShapeInteger aMSI;
const TopoDS_Vertex& aV=*((TopoDS_Vertex*)&mySmartMap.FindKey(i));
BOPAlgo_ListOfEdgeInfo& aLEI=mySmartMap(i);
//
- RefineAngles(aV, myFace, aMBE, aLEI);
+ RefineAngles(aV, myFace, aMBE, aLEI, theContext);
}
}
//=======================================================================
void RefineAngles(const TopoDS_Vertex& aV,
const TopoDS_Face& myFace,
const BOPCol_MapOfShape& aMBE,
- BOPAlgo_ListOfEdgeInfo& aLEI)
+ BOPAlgo_ListOfEdgeInfo& aLEI,
+ const Handle(IntTools_Context)& theContext)
{
Standard_Boolean bIsIn, bIsBoundary, bRefined;
Standard_Integer iCntBnd, iCntInt;
continue;
}
//
- bRefined=RefineAngle2D(aV, aE, myFace, aA1, aA2, aA);
+ bRefined=RefineAngle2D(aV, aE, myFace, aA1, aA2, aA, theContext);
if (bRefined) {
aDMSR.Bind(aE, aA);
}
const TopoDS_Face& myFace,
const Standard_Real aA1,
const Standard_Real aA2,
- Standard_Real& aA)
+ Standard_Real& aA,
+ const Handle(IntTools_Context)& theContext)
{
Standard_Boolean bRet;
Standard_Integer i, j, aNbP;
aCf=0.01;
aTolInt=1.e-10;
//
- BOPTools_AlgoTools2D::CurveOnSurface(aE, myFace, aC2D, aT1, aT2, aTol);
+ BOPTools_AlgoTools2D::CurveOnSurface(aE, myFace, aC2D, aT1, aT2, aTol, theContext);
aGAC1.Load(aC2D, aT1, aT2);
//
aTV=BRep_Tool::Parameter (aV, aE, myFace);
// purpose:
//=======================================================================
Standard_Integer BOPTools_AlgoTools::Sense (const TopoDS_Face& theF1,
- const TopoDS_Face& theF2)
+ const TopoDS_Face& theF2,
+ const Handle(IntTools_Context)& theContext)
{
Standard_Integer iSense=0;
gp_Dir aDNF1, aDNF2;
return iSense;
}
//
- BOPTools_AlgoTools3D::GetNormalToFaceOnEdge(aE1, theF1, aDNF1);
- BOPTools_AlgoTools3D::GetNormalToFaceOnEdge(aE2, theF2, aDNF2);
+ BOPTools_AlgoTools3D::GetNormalToFaceOnEdge(aE1, theF1, aDNF1, theContext);
+ BOPTools_AlgoTools3D::GetNormalToFaceOnEdge(aE2, theF2, aDNF2, theContext);
//
iSense=BOPTools_AlgoTools3D::SenseFlag(aDNF1, aDNF2);
//
const TopoDS_Face& aF2,
const IntTools_Curve& aIC,
const Standard_Boolean bPC1,
- const Standard_Boolean bPC2)
+ const Standard_Boolean bPC2,
+ const Handle(IntTools_Context)& theContext)
{
Standard_Integer i;
//
aC2D=aC2Dx1;
if (aC2D.IsNull()) {
- BOPTools_AlgoTools2D::BuildPCurveForEdgeOnFace(aE, aFFWD);
+ BOPTools_AlgoTools2D::BuildPCurveForEdgeOnFace(aE, aFFWD, theContext);
BOPTools_AlgoTools2D::CurveOnSurface(aE, aFFWD, aC2D,
aOutFirst, aOutLast,
- aOutTol);
+ aOutTol, theContext);
}
//
if (aC3DE->IsPeriodic()) {
BOPTools_AlgoTools2D::AdjustPCurveOnFace(aFFWD, aT1, aT2, aC2D,
- aC2DA);
+ aC2DA, theContext);
}
else {
BOPTools_AlgoTools2D::AdjustPCurveOnFace(aFFWD, aC3DETrim, aC2D,
- aC2DA);
+ aC2DA, theContext);
}
//
aBB.UpdateEdge(aE, aC2DA, aFFWD, aTolE);
Standard_Real aTolE;
gp_Pnt aPx;
//
- BOPTools_AlgoTools3D::GetNormalToFaceOnEdge(aE, aF, aT, aDN);
+ BOPTools_AlgoTools3D::GetNormalToFaceOnEdge(aE, aF, aT, aDN, theContext);
if (aF.Orientation()==TopAbs_REVERSED){
aDN.Reverse();
}
Standard_EXPORT static void MakeEdge (const IntTools_Curve& theCurve, const TopoDS_Vertex& theV1, const Standard_Real theT1, const TopoDS_Vertex& theV2, const Standard_Real theT2, const Standard_Real theTolR3D, TopoDS_Edge& theE);
- Standard_EXPORT static void MakePCurve (const TopoDS_Edge& theE, const TopoDS_Face& theF1, const TopoDS_Face& theF2, const IntTools_Curve& theCurve, const Standard_Boolean thePC1, const Standard_Boolean thePC2);
+ //! Makes 2d curve of the edge <theE> on the faces <theF1> and <theF2>.<br>
+ //! <theContext> - storage for caching the geometrical tools
+ Standard_EXPORT static void MakePCurve (const TopoDS_Edge& theE,
+ const TopoDS_Face& theF1,
+ const TopoDS_Face& theF2,
+ const IntTools_Curve& theCurve,
+ const Standard_Boolean thePC1,
+ const Standard_Boolean thePC2,
+ const Handle(IntTools_Context)& theContext = Handle(IntTools_Context)());
Standard_EXPORT static void MakeContainer (const TopAbs_ShapeEnum theType, TopoDS_Shape& theShape);
Standard_EXPORT static Standard_Boolean CheckSameGeom (const TopoDS_Face& theF1, const TopoDS_Face& theF2, Handle(IntTools_Context)& theContext);
- Standard_EXPORT static Standard_Integer Sense (const TopoDS_Face& theF1, const TopoDS_Face& theF2);
+ //! Basing on the normals directions of the faces the method
+ //! Defines whether to reverse the second face or not.<br>
+ //! <theContext> - storage for caching the geometrical tools
+ Standard_EXPORT static Standard_Integer Sense (const TopoDS_Face& theF1,
+ const TopoDS_Face& theF2,
+ const Handle(IntTools_Context)& theContext = Handle(IntTools_Context)());
//! Returns True if the face theFace contains
//! the edge theEdge but with opposite orientation.
//purpose :
//=======================================================================
void BOPTools_AlgoTools2D::BuildPCurveForEdgeOnFace (const TopoDS_Edge& aE,
- const TopoDS_Face& aF)
+ const TopoDS_Face& aF,
+ const Handle(IntTools_Context)& theContext)
{
BRep_Builder aBB;
Handle(Geom2d_Curve) aC2D;
}
- BOPTools_AlgoTools2D::CurveOnSurface(aE, aF, aC2D, aTolPC);
+ BOPTools_AlgoTools2D::CurveOnSurface(aE, aF, aC2D, aTolPC, theContext);
aTolEdge=BRep_Tool::Tolerance(aE);
const TopoDS_Face& aF,
const Standard_Real aParameter,
Standard_Real& U,
- Standard_Real& V)
+ Standard_Real& V,
+ const Handle(IntTools_Context)& theContext)
{
gp_Pnt2d aP2D;
Handle(Geom2d_Curve) aC2D;
Standard_Real aToler, aFirst, aLast;
- BOPTools_AlgoTools2D::CurveOnSurface (aE, aF, aC2D,
- aFirst, aLast, aToler);
+ BOPTools_AlgoTools2D::CurveOnSurface (aE, aF, aC2D, aFirst, aLast, aToler, theContext);
aC2D->D0(aParameter, aP2D);
U=aP2D.X();
V=aP2D.Y();
void BOPTools_AlgoTools2D::CurveOnSurface (const TopoDS_Edge& aE,
const TopoDS_Face& aF,
Handle(Geom2d_Curve)& aC2D,
- Standard_Real& aToler)
+ Standard_Real& aToler,
+ const Handle(IntTools_Context)& theContext)
{
Standard_Real aFirst, aLast;
//
- BOPTools_AlgoTools2D::CurveOnSurface (aE, aF, aC2D,
- aFirst, aLast, aToler);
+ BOPTools_AlgoTools2D::CurveOnSurface(aE, aF, aC2D, aFirst, aLast, aToler, theContext);
//
return;
}
Handle(Geom2d_Curve)& aC2D,
Standard_Real& aFirst,
Standard_Real& aLast,
- Standard_Real& aToler)
+ Standard_Real& aToler,
+ const Handle(IntTools_Context)& theContext)
{
Standard_Boolean aHasOld;
Handle(Geom2d_Curve) C2D;
return;
}
- BOPTools_AlgoTools2D::Make2D(aE, aF, C2D, aFirst, aLast, aToler);
+ BOPTools_AlgoTools2D::Make2D(aE, aF, C2D, aFirst, aLast, aToler, theContext);
aC2D=C2D;
return;
}
Standard_Boolean BOPTools_AlgoTools2D::HasCurveOnSurface
(const TopoDS_Edge& aE,
const TopoDS_Face& aF)
-
{
Standard_Boolean bHasOld;
Handle(Geom2d_Curve) aC2D;
//function : AdjustPCurveOnFace
//purpose :
//=======================================================================
-void BOPTools_AlgoTools2D::AdjustPCurveOnFace
- (const TopoDS_Face& aF,
- const Handle(Geom_Curve)& aC3D,
- const Handle(Geom2d_Curve)& aC2D,
- Handle(Geom2d_Curve)& aC2DA)
+void BOPTools_AlgoTools2D::AdjustPCurveOnFace
+ (const TopoDS_Face& theF,
+ const Handle(Geom_Curve)& theC3D,
+ const Handle(Geom2d_Curve)& theC2D,
+ Handle(Geom2d_Curve)& theC2DA,
+ const Handle(IntTools_Context)& theContext)
{
- Standard_Real aT1, aT2;
- //
- aT1=aC3D->FirstParameter();
- aT2=aC3D->LastParameter();
+ Standard_Real aT1 = theC3D->FirstParameter();
+ Standard_Real aT2 = theC3D->LastParameter();
//
- BOPTools_AlgoTools2D::AdjustPCurveOnFace (aF, aT1, aT2, aC2D, aC2DA);
+ BOPTools_AlgoTools2D::AdjustPCurveOnFace (theF, aT1, aT2, theC2D, theC2DA, theContext);
}
//=======================================================================
//function : AdjustPCurveOnFace
//purpose :
//=======================================================================
void BOPTools_AlgoTools2D::AdjustPCurveOnFace
- (const TopoDS_Face& aF,
- const Standard_Real aT1,
- const Standard_Real aT2,
- const Handle(Geom2d_Curve)& aC2D,
- Handle(Geom2d_Curve)& aC2DA)
+ (const TopoDS_Face& theF,
+ const Standard_Real theFirst,
+ const Standard_Real theLast,
+ const Handle(Geom2d_Curve)& theC2D,
+ Handle(Geom2d_Curve)& theC2DA,
+ const Handle(IntTools_Context)& theContext)
{
- BRepAdaptor_Surface aBAS(aF, Standard_True);
+ BRepAdaptor_Surface aBASTmp;
+ const BRepAdaptor_Surface* pBAS;
+ if (!theContext.IsNull()) {
+ pBAS = &theContext->SurfaceAdaptor(theF);
+ }
+ else {
+ aBASTmp.Initialize(theF, Standard_True);
+ pBAS = &aBASTmp;
+ }
//
- BOPTools_AlgoTools2D::AdjustPCurveOnFace(aBAS, aT1, aT2,
- aC2D, aC2DA);
+ BOPTools_AlgoTools2D::AdjustPCurveOnSurf(*pBAS, theFirst, theLast, theC2D, theC2DA);
}
-
//=======================================================================
//function : AdjustPCurveOnFace
//purpose :
//=======================================================================
-void BOPTools_AlgoTools2D::AdjustPCurveOnFace
+void BOPTools_AlgoTools2D::AdjustPCurveOnSurf
(const BRepAdaptor_Surface& aBAS,
const Standard_Real aFirst,
const Standard_Real aLast,
- const Handle(Geom2d_Curve)& aC2D,
+ const Handle(Geom2d_Curve)& aC2D,
Handle(Geom2d_Curve)& aC2DA)
{
Standard_Boolean mincond, maxcond;
VMin=aBAS.FirstVParameter();
VMax=aBAS.LastVParameter();
//
- //BRepAdaptor_Surface aBAS(aF, Standard_False);
- //BRepTools::UVBounds(aF, UMin, UMax, VMin, VMax);
- //
aDelta=Precision::PConfusion();
aT =.5*(aFirst+aLast);
Handle(Geom2d_Curve)& aC2D,
Standard_Real& aFirst,
Standard_Real& aLast,
- Standard_Real& aToler)
+ Standard_Real& aToler,
+ const Handle(IntTools_Context)& theContext)
{
Standard_Boolean aLocIdentity;
Standard_Real f3d, l3d;
//
aToler = BRep_Tool::Tolerance(aE);
- BOPTools_AlgoTools2D::MakePCurveOnFace(aF, C3D2, f3d, l3d, aC2D, aToler);
+ BOPTools_AlgoTools2D::MakePCurveOnFace(aF, C3D2, f3d, l3d, aC2D, aToler, theContext);
//
aFirst = f3d;
aLast = l3d;
void BOPTools_AlgoTools2D::MakePCurveOnFace (const TopoDS_Face& aF,
const Handle(Geom_Curve)& aC3D,
Handle(Geom2d_Curve)& aC2D, //->
- Standard_Real& TolReached2d)
+ Standard_Real& TolReached2d,
+ const Handle(IntTools_Context)& theContext)
{
Standard_Real aFirst, aLast;
//
TolReached2d=0.;
//
- BOPTools_AlgoTools2D::MakePCurveOnFace (aF, aC3D, aFirst,
- aLast, aC2D, TolReached2d);
+ BOPTools_AlgoTools2D::MakePCurveOnFace
+ (aF, aC3D, aFirst, aLast, aC2D, TolReached2d, theContext);
}
//=======================================================================
//function : MakePCurveOnFace
//purpose :
//=======================================================================
-void BOPTools_AlgoTools2D::MakePCurveOnFace
+void BOPTools_AlgoTools2D::MakePCurveOnFace
(const TopoDS_Face& aF,
const Handle(Geom_Curve)& aC3D,
const Standard_Real aT1,
const Standard_Real aT2,
- Handle(Geom2d_Curve)& aC2D,
- Standard_Real& TolReached2d)
+ Handle(Geom2d_Curve)& aC2D,
+ Standard_Real& TolReached2d,
+ const Handle(IntTools_Context)& theContext)
{
- Standard_Real aTolR, aT;
- Standard_Real aUMin, aUMax, aVMin, aVMax;
- Handle(Geom2d_Curve) aC2DA;
- Handle(GeomAdaptor_HSurface) aBAHS;
- Handle(GeomAdaptor_HCurve) aBAHC;
- Handle(Geom_Surface) aS;
- //
- BRepAdaptor_Surface aBAS(aF, Standard_True);
- aUMin=aBAS.FirstUParameter();
- aUMax=aBAS.LastUParameter();
- aVMin=aBAS.FirstVParameter();
- aVMax=aBAS.LastVParameter();
- aS=aBAS.Surface().Surface();
- aS=Handle(Geom_Surface)::DownCast(aS->Transformed(aBAS.Trsf()));
- GeomAdaptor_Surface aGAS(aS, aUMin, aUMax, aVMin, aVMax);
- //
- aBAHS=new GeomAdaptor_HSurface(aGAS);
- aBAHC=new GeomAdaptor_HCurve(aC3D, aT1, aT2);
+ BRepAdaptor_Surface aBASTmp;
+ const BRepAdaptor_Surface* pBAS;
+ if (!theContext.IsNull()) {
+ pBAS = &theContext->SurfaceAdaptor(aF);
+ }
+ else {
+ aBASTmp.Initialize(aF, Standard_True);
+ pBAS = &aBASTmp;
+ }
+ //
+ Handle(BRepAdaptor_HSurface) aBAHS = new BRepAdaptor_HSurface(*pBAS);
+ Handle(GeomAdaptor_HCurve) aBAHC = new GeomAdaptor_HCurve(aC3D, aT1, aT2);
//
+ Standard_Real aTolR;
//when the type of surface is GeomAbs_SurfaceOfRevolution
- if (aGAS.GetType() == GeomAbs_SurfaceOfRevolution) {
+ if (pBAS->GetType() == GeomAbs_SurfaceOfRevolution) {
Standard_Real aTR;
//
aTR=Precision::Confusion();//1.e-7;
}
//
TolReached2d=aTolR;
- BOPTools_AlgoTools2D::AdjustPCurveOnFace (aBAS, aT1, aT2,
- aC2D, aC2DA);
+ //
+ Handle(Geom2d_Curve) aC2DA;
+ BOPTools_AlgoTools2D::AdjustPCurveOnSurf (*pBAS, aT1, aT2, aC2D, aC2DA);
//
aC2D=aC2DA;
//
// compute the appropriate tolerance for the edge
+ Handle(Geom_Surface) aS = pBAS->Surface().Surface();
+ aS = Handle(Geom_Surface)::DownCast(aS->Transformed(pBAS->Trsf()));
+ //
+ Standard_Real aT;
if (IntTools_Tools::ComputeTolerance
(aC3D, aC2D, aS, aT1, aT2, aTolR, aT)) {
if (aTolR > TolReached2d) {
- //! Compute P-Curve for the edge <aE> on the face <aF>
- //! Raises exception Standard_ConstructionError if projection algorithm fails
- Standard_EXPORT static void BuildPCurveForEdgeOnFace (const TopoDS_Edge& aE, const TopoDS_Face& aF);
+ //! Compute P-Curve for the edge <aE> on the face <aF>.<br>
+ //! Raises exception Standard_ConstructionError if projection algorithm fails.<br>
+ //! <theContext> - storage for caching the geometrical tools
+ Standard_EXPORT static void BuildPCurveForEdgeOnFace (const TopoDS_Edge& aE,
+ const TopoDS_Face& aF,
+ const Handle(IntTools_Context)& theContext = Handle(IntTools_Context)());
//! Compute tangent for the edge <aE> [in 3D] at parameter <aT>
//! Compute surface parameters <U,V> of the face <aF>
- //! for the point from the edge <aE> at parameter <aT>.
+ //! for the point from the edge <aE> at parameter <aT>.<br>
//! If <aE> has't pcurve on surface, algorithm tries to get it by
//! projection and can
- //! raise exception Standard_ConstructionError if projection algorithm fails
- Standard_EXPORT static void PointOnSurface (const TopoDS_Edge& aE, const TopoDS_Face& aF, const Standard_Real aT, Standard_Real& U, Standard_Real& V);
-
-
- //! Get P-Curve <aC> for the edge <aE> on surface <aF> .
- //! If the P-Curve does not exist, build it using Make2D().
+ //! raise exception Standard_ConstructionError if projection algorithm fails.<br>
+ //! <theContext> - storage for caching the geometrical tools
+ Standard_EXPORT static void PointOnSurface (const TopoDS_Edge& aE,
+ const TopoDS_Face& aF,
+ const Standard_Real aT,
+ Standard_Real& U,
+ Standard_Real& V,
+ const Handle(IntTools_Context)& theContext = Handle(IntTools_Context)());
+
+
+ //! Get P-Curve <aC> for the edge <aE> on surface <aF> .<br>
+ //! If the P-Curve does not exist, build it using Make2D().<br>
//! [aToler] - reached tolerance
- //! Raises exception Standard_ConstructionError if algorithm Make2D() fails
- Standard_EXPORT static void CurveOnSurface (const TopoDS_Edge& aE, const TopoDS_Face& aF, Handle(Geom2d_Curve)& aC, Standard_Real& aToler);
-
-
- //! Get P-Curve <aC> for the edge <aE> on surface <aF> .
- //! If the P-Curve does not exist, build it using Make2D().
- //! [aFirst, aLast] - range of the P-Curve
- //! [aToler] - reached tolerance
- //! Raises exception Standard_ConstructionError if algorithm Make2D() fails
- Standard_EXPORT static void CurveOnSurface (const TopoDS_Edge& aE, const TopoDS_Face& aF, Handle(Geom2d_Curve)& aC, Standard_Real& aFirst, Standard_Real& aLast, Standard_Real& aToler);
+ //! Raises exception Standard_ConstructionError if algorithm Make2D() fails.<br>
+ //! <theContext> - storage for caching the geometrical tools
+ Standard_EXPORT static void CurveOnSurface (const TopoDS_Edge& aE,
+ const TopoDS_Face& aF,
+ Handle(Geom2d_Curve)& aC,
+ Standard_Real& aToler,
+ const Handle(IntTools_Context)& theContext = Handle(IntTools_Context)());
+
+ //! Get P-Curve <aC> for the edge <aE> on surface <aF> .<br>
+ //! If the P-Curve does not exist, build it using Make2D().<br>
+ //! [aFirst, aLast] - range of the P-Curve<br>
+ //! [aToler] - reached tolerance<br>
+ //! Raises exception Standard_ConstructionError if algorithm Make2D() fails.<br>
+ //! <theContext> - storage for caching the geometrical tools
+ Standard_EXPORT static void CurveOnSurface (const TopoDS_Edge& aE,
+ const TopoDS_Face& aF,
+ Handle(Geom2d_Curve)& aC,
+ Standard_Real& aFirst,
+ Standard_Real& aLast,
+ Standard_Real& aToler,
+ const Handle(IntTools_Context)& theContext = Handle(IntTools_Context)());
//! Returns TRUE if the edge <aE> has P-Curve <aC>
Standard_EXPORT static Standard_Boolean HasCurveOnSurface (const TopoDS_Edge& aE, const TopoDS_Face& aF);
- //! Adjust P-Curve <aC2D> (3D-curve <C3D>) on surface <aF> .
- Standard_EXPORT static void AdjustPCurveOnFace (const TopoDS_Face& aF, const Handle(Geom_Curve)& C3D, const Handle(Geom2d_Curve)& aC2D, Handle(Geom2d_Curve)& aC2DA);
+ //! Adjust P-Curve <theC2D> (3D-curve <theC3D>) on surface of the face <theF>.<br>
+ //! <theContext> - storage for caching the geometrical tools
+ Standard_EXPORT static void AdjustPCurveOnFace (const TopoDS_Face& theF,
+ const Handle(Geom_Curve)& theC3D,
+ const Handle(Geom2d_Curve)& theC2D,
+ Handle(Geom2d_Curve)& theC2DA,
+ const Handle(IntTools_Context)& theContext = Handle(IntTools_Context)());
- //! Adjust P-Curve <aC2D> (3D-curve <C3D>) on surface <aF> .
- //! [aT1, aT2] - range to adjust
- Standard_EXPORT static void AdjustPCurveOnFace (const TopoDS_Face& aF, const Standard_Real aT1, const Standard_Real aT2, const Handle(Geom2d_Curve)& aC2D, Handle(Geom2d_Curve)& aC2DA);
-
+ //! Adjust P-Curve <aC2D> (3D-curve <C3D>) on surface <aF> .<br>
+ //! [aT1, aT2] - range to adjust<br>
+ //! <theContext> - storage for caching the geometrical tools
+ Standard_EXPORT static void AdjustPCurveOnFace (const TopoDS_Face& theF,
+ const Standard_Real theFirst,
+ const Standard_Real theLast,
+ const Handle(Geom2d_Curve)& theC2D,
+ Handle(Geom2d_Curve)& theC2DA,
+ const Handle(IntTools_Context)& theContext = Handle(IntTools_Context)());
//! Adjust P-Curve <aC2D> (3D-curve <C3D>) on surface <aF> .
//! [aT1, aT2] - range to adjust
- Standard_EXPORT static void AdjustPCurveOnFace (const BRepAdaptor_Surface& aF, const Standard_Real aT1, const Standard_Real aT2, const Handle(Geom2d_Curve)& aC2D, Handle(Geom2d_Curve)& aC2DA);
+ Standard_EXPORT static void AdjustPCurveOnSurf (const BRepAdaptor_Surface& aF, const Standard_Real aT1, const Standard_Real aT2, const Handle(Geom2d_Curve)& aC2D, Handle(Geom2d_Curve)& aC2DA);
//! Compute intermediate value in between [aFirst, aLast] .
Standard_EXPORT static void BuildPCurveForEdgesOnPlane (const BOPCol_ListOfShape& theLE, const TopoDS_Face& theF);
- //! Make P-Curve <aC> for the edge <aE> on surface <aF> .
- //! [aFirst, aLast] - range of the P-Curve
- //! [aToler] - reached tolerance
- //! Raises exception Standard_ConstructionError if algorithm fails
- Standard_EXPORT static void Make2D (const TopoDS_Edge& aE, const TopoDS_Face& aF, Handle(Geom2d_Curve)& aC, Standard_Real& aFirst, Standard_Real& aLast, Standard_Real& aToler);
-
-
- //! Make P-Curve <aC> for the 3D-curve <C3D> on surface <aF> .
- //! [aToler] - reached tolerance
- //! Raises exception Standard_ConstructionError if projection algorithm fails
- Standard_EXPORT static void MakePCurveOnFace (const TopoDS_Face& aF, const Handle(Geom_Curve)& C3D, Handle(Geom2d_Curve)& aC, Standard_Real& aToler);
-
-
- //! Make P-Curve <aC> for the 3D-curve <C3D> on surface <aF> .
- //! [aT1, aT2] - range to build
- //! [aToler] - reached tolerance
- //! Raises exception Standard_ConstructionError if projection algorithm fails
- Standard_EXPORT static void MakePCurveOnFace (const TopoDS_Face& aF, const Handle(Geom_Curve)& C3D, const Standard_Real aT1, const Standard_Real aT2, Handle(Geom2d_Curve)& aC, Standard_Real& aToler);
+ //! Make P-Curve <aC> for the edge <aE> on surface <aF> .<br>
+ //! [aFirst, aLast] - range of the P-Curve<br>
+ //! [aToler] - reached tolerance<br>
+ //! Raises exception Standard_ConstructionError if algorithm fails.<br>
+ //! <theContext> - storage for caching the geometrical tools
+ Standard_EXPORT static void Make2D (const TopoDS_Edge& aE,
+ const TopoDS_Face& aF,
+ Handle(Geom2d_Curve)& aC,
+ Standard_Real& aFirst,
+ Standard_Real& aLast,
+ Standard_Real& aToler,
+ const Handle(IntTools_Context)& theContext = Handle(IntTools_Context)());
+
+
+ //! Make P-Curve <aC> for the 3D-curve <C3D> on surface <aF> .<br>
+ //! [aToler] - reached tolerance<br>
+ //! Raises exception Standard_ConstructionError if projection algorithm fails.<br>
+ //! <theContext> - storage for caching the geometrical tools
+ Standard_EXPORT static void MakePCurveOnFace (const TopoDS_Face& aF,
+ const Handle(Geom_Curve)& C3D,
+ Handle(Geom2d_Curve)& aC,
+ Standard_Real& aToler,
+ const Handle(IntTools_Context)& theContext = Handle(IntTools_Context)());
+
+
+ //! Make P-Curve <aC> for the 3D-curve <C3D> on surface <aF> .<br>
+ //! [aT1, aT2] - range to build<br>
+ //! [aToler] - reached tolerance<br>
+ //! Raises exception Standard_ConstructionError if projection algorithm fails.<br>
+ //! <theContext> - storage for caching the geometrical tools
+ Standard_EXPORT static void MakePCurveOnFace (const TopoDS_Face& aF,
+ const Handle(Geom_Curve)& C3D,
+ const Standard_Real aT1,
+ const Standard_Real aT2,
+ Handle(Geom2d_Curve)& aC,
+ Standard_Real& aToler,
+ const Handle(IntTools_Context)& theContext = Handle(IntTools_Context)());
//! Make empty P-Curve <aC> of relevant to <PC> type
//=======================================================================
void BOPTools_AlgoTools3D::GetNormalToFaceOnEdge (const TopoDS_Edge& aE,
const TopoDS_Face& aF,
- gp_Dir& aDNF)
+ gp_Dir& aDNF,
+ const Handle(IntTools_Context)& theContext)
{
Standard_Real aT, aT1, aT2;
BRep_Tool::CurveOnSurface(aE, aF, aT1, aT2);
aT=BOPTools_AlgoTools2D::IntermediatePoint(aT1, aT2);
- BOPTools_AlgoTools3D::GetNormalToFaceOnEdge (aE, aF, aT, aDNF);
+ BOPTools_AlgoTools3D::GetNormalToFaceOnEdge (aE, aF, aT, aDNF, theContext);
if (aF.Orientation()==TopAbs_REVERSED){
aDNF.Reverse();
void BOPTools_AlgoTools3D::GetNormalToFaceOnEdge (const TopoDS_Edge& aE,
const TopoDS_Face& aF1,
const Standard_Real aT,
- gp_Dir& aDNF1)
+ gp_Dir& aDNF1,
+ const Handle(IntTools_Context)& theContext)
{
Standard_Real U, V, aTolPC;
gp_Pnt2d aP2D;
Handle(Geom_Surface) aS1=BRep_Tool::Surface(aF1);
Handle(Geom2d_Curve)aC2D1;
- BOPTools_AlgoTools2D::CurveOnSurface(aE, aF1, aC2D1, aTolPC);
+ BOPTools_AlgoTools2D::CurveOnSurface(aE, aF1, aC2D1, aTolPC, theContext);
aC2D1->D0(aT, aP2D);
U=aP2D.X();
gp_Pnt aP;
gp_Pnt2d aP2d;
//
- BRepTools::UVBounds(aF, aU1, aU2, aV1, aV2);
+ if (theContext.IsNull()) {
+ BRepTools::UVBounds(aF, aU1, aU2, aV1, aV2);
+ }
+ else {
+ theContext->UVBounds(aF, aU1, aU2, aV1, aV2);
+ }
//
dU=aU2-aU1;
dV=aV2-aV1;
aFF.Orientation (TopAbs_FORWARD);
//
aS=BRep_Tool::Surface(aFF);
- BRepTools::UVBounds(aFF, aUMin, aUMax, aVMin, aVMax);
+ if (theContext.IsNull()) {
+ BRepTools::UVBounds(aFF, aUMin, aUMax, aVMin, aVMax);
+ }
+ else {
+ theContext->UVBounds(aFF, aUMin, aUMax, aVMin, aVMax);
+ }
//
aUx=IntTools_Tools::IntermediatePoint(aUMin, aUMax);
Standard_Integer i;
//! Computes normal to the face <aF> for the point on the edge <aE>
- //! at parameter <aT>
- Standard_EXPORT static void GetNormalToFaceOnEdge (const TopoDS_Edge& aE, const TopoDS_Face& aF, const Standard_Real aT, gp_Dir& aD);
+ //! at parameter <aT>.<br>
+ //! <theContext> - storage for caching the geometrical tools
+ Standard_EXPORT static void GetNormalToFaceOnEdge (const TopoDS_Edge& aE,
+ const TopoDS_Face& aF,
+ const Standard_Real aT,
+ gp_Dir& aD,
+ const Handle(IntTools_Context)& theContext = Handle(IntTools_Context)());
//! Computes normal to the face <aF> for the point on the edge <aE>
- //! at arbitrary intermediate parameter
- Standard_EXPORT static void GetNormalToFaceOnEdge (const TopoDS_Edge& aE, const TopoDS_Face& aF, gp_Dir& aD);
+ //! at arbitrary intermediate parameter.<br>
+ //! <theContext> - storage for caching the geometrical tools
+ Standard_EXPORT static void GetNormalToFaceOnEdge (const TopoDS_Edge& aE,
+ const TopoDS_Face& aF,
+ gp_Dir& aD,
+ const Handle(IntTools_Context)& theContext = Handle(IntTools_Context)());
//! Returns 1 if scalar product aNF1* aNF2>0.
aV2=(*(TopoDS_Vertex *)(&myDS->Shape(nV2)));
aV2.Orientation(TopAbs_REVERSED);
//
- BOPTools_AlgoTools::MakeSplitEdge(aE, aV1, aT1, aV2, aT2, aSp);
- BOPTools_AlgoTools2D::BuildPCurveForEdgeOnFace(aSp, theF);
+ BOPTools_AlgoTools::MakeSplitEdge(aE, aV1, aT1, aV2, aT2, aSp);
+ BOPTools_AlgoTools2D::BuildPCurveForEdgeOnFace(aSp, theF, myContext);
//
aSI.SetShape(aSp);
//
// Store Result
L1.Clear(); L2.Clear();
TopAbs_Orientation O1,O2;
-
+ //
+ const Handle(IntTools_Context)& aContext = pPF->Context();
+ //
for (i = 0; i < aNb; i++) {
BOPDS_InterfFF& aFFi=aFFs(i);
const BOPDS_VectorOfCurve& aBCurves=aFFi.Curves();
Handle(Geom2d_Curve) aC2dNew;
if(aC3DE->IsPeriodic()) {
- BOPTools_AlgoTools2D::AdjustPCurveOnFace(cpF1, f, l, aC2d, aC2dNew);
+ BOPTools_AlgoTools2D::AdjustPCurveOnFace(cpF1, f, l, aC2d, aC2dNew, aContext);
}
else {
- BOPTools_AlgoTools2D::AdjustPCurveOnFace(cpF1, aC3DETrim, aC2d, aC2dNew);
+ BOPTools_AlgoTools2D::AdjustPCurveOnFace(cpF1, aC3DETrim, aC2d, aC2dNew, aContext);
}
aC2d = aC2dNew;
}
Handle(Geom2d_Curve) aC2dNew;
if(aC3DE->IsPeriodic()) {
- BOPTools_AlgoTools2D::AdjustPCurveOnFace(cpF2, f, l, aC2d, aC2dNew);
+ BOPTools_AlgoTools2D::AdjustPCurveOnFace(cpF2, f, l, aC2d, aC2dNew, aContext);
}
else {
- BOPTools_AlgoTools2D::AdjustPCurveOnFace(cpF2, aC3DETrim, aC2d, aC2dNew);
+ BOPTools_AlgoTools2D::AdjustPCurveOnFace(cpF2, aC3DETrim, aC2d, aC2dNew, aContext);
}
aC2d = aC2dNew;
}
#include <IntTools_Context.hxx>
#include <IntTools_CurveRangeLocalizeData.hxx>
#include <IntTools_CurveRangeSample.hxx>
-#include <IntTools_EdgeFace.hxx>
+#include <IntTools_CArray1OfReal.hxx>
#include <IntTools_ListIteratorOfListOfBox.hxx>
#include <IntTools_ListIteratorOfListOfCurveRangeSample.hxx>
#include <IntTools_ListIteratorOfListOfSurfaceRangeSample.hxx>
void IntTools_BeanFaceIntersector::Init(const TopoDS_Edge& theEdge,
const TopoDS_Face& theFace)
{
+ if (myContext.IsNull()) {
+ myContext = new IntTools_Context;
+ }
+ //
myCurve.Initialize(theEdge);
- mySurface.Initialize(theFace);
+ mySurface = myContext->SurfaceAdaptor(theFace);
myTrsfSurface = Handle(Geom_Surface)::DownCast(mySurface.Surface().Surface()->Transformed(mySurface.Trsf()));
myBeanTolerance = BRep_Tool::Tolerance(theEdge);
myFaceTolerance = BRep_Tool::Tolerance(theFace);
#include <TopoDS_Solid.hxx>
#include <TopoDS_Vertex.hxx>
-IMPLEMENT_STANDARD_RTTIEXT(IntTools_Context,MMgt_TShared)
+IMPLEMENT_STANDARD_RTTIEXT(IntTools_Context,Standard_Transient)
//
//=======================================================================
myHatcherMap(100, myAllocator),
myProjSDataMap(100, myAllocator),
myBndBoxDataMap(100, myAllocator),
+ mySurfAdaptorMap(100, myAllocator),
myCreateFlag(0),
myPOnSTolerance(1.e-12)
{
myHatcherMap(100, myAllocator),
myProjSDataMap(100, myAllocator),
myBndBoxDataMap(100, myAllocator),
+ mySurfAdaptorMap(100, myAllocator),
myCreateFlag(1),
myPOnSTolerance(1.e-12)
{
myAllocator->Free(anAdr);
}
myBndBoxDataMap.Clear();
+ //
+ BRepAdaptor_Surface* pSurfAdaptor;
+ aIt.Initialize(mySurfAdaptorMap);
+ for (; aIt.More(); aIt.Next()) {
+ anAdr=aIt.Value();
+ pSurfAdaptor=(BRepAdaptor_Surface*)anAdr;
+ (*pSurfAdaptor).~BRepAdaptor_Surface();
+ myAllocator->Free(anAdr);
+ }
+ mySurfAdaptorMap.Clear();
}
//=======================================================================
//function : BndBox
if (!myProjPSMap.IsBound(aF)) {
Standard_Real Umin, Usup, Vmin, Vsup;
- BRepAdaptor_Surface aBAS;
- //
+ UVBounds(aF, Umin, Usup, Vmin, Vsup);
const Handle(Geom_Surface)& aS=BRep_Tool::Surface(aF);
- aBAS.Initialize (aF, Standard_True);
- //
- Umin=aBAS.FirstUParameter();
- Usup=aBAS.LastUParameter ();
- Vmin=aBAS.FirstVParameter();
- Vsup=aBAS.LastVParameter ();
//
pProjPS=(GeomAPI_ProjectPointOnSurf*)myAllocator->Allocate(sizeof(GeomAPI_ProjectPointOnSurf));
new (pProjPS) GeomAPI_ProjectPointOnSurf();
return *pSC;
}
+//=======================================================================
+//function : SurfaceAdaptor
+//purpose :
+//=======================================================================
+BRepAdaptor_Surface& IntTools_Context::SurfaceAdaptor
+ (const TopoDS_Face& theFace)
+{
+ Standard_Address anAdr;
+ BRepAdaptor_Surface* pBAS;
+
+ if (!mySurfAdaptorMap.IsBound(theFace)) {
+ //
+ pBAS=(BRepAdaptor_Surface*)myAllocator->Allocate(sizeof(BRepAdaptor_Surface));
+ new (pBAS) BRepAdaptor_Surface(theFace, Standard_True);
+ //
+ anAdr=(Standard_Address)pBAS;
+ mySurfAdaptorMap.Bind(theFace, anAdr);
+ }
+
+ else {
+ anAdr=mySurfAdaptorMap.Find(theFace);
+ pBAS =(BRepAdaptor_Surface*)anAdr;
+ }
+ return *pBAS;
+}
+
//=======================================================================
//function : Hatcher
//purpose :
}
myProjPSMap.Clear();
}
+
+//=======================================================================
+//function : UVBounds
+//purpose :
+//=======================================================================
+void IntTools_Context::UVBounds(const TopoDS_Face& theFace,
+ Standard_Real& UMin,
+ Standard_Real& UMax,
+ Standard_Real& VMin,
+ Standard_Real& VMax)
+{
+ const BRepAdaptor_Surface& aBAS = SurfaceAdaptor(theFace);
+ UMin = aBAS.FirstUParameter();
+ UMax = aBAS.LastUParameter ();
+ VMin = aBAS.FirstVParameter();
+ VMax = aBAS.LastVParameter ();
+}
\ No newline at end of file
#include <MMgt_TShared.hxx>
#include <TopAbs_State.hxx>
#include <Standard_Boolean.hxx>
+#include <BRepAdaptor_Surface.hxx>
class IntTools_FClass2d;
class TopoDS_Face;
class GeomAPI_ProjectPointOnSurf;
class TopoDS_Shape;
-class IntTools_Context;
-DEFINE_STANDARD_HANDLE(IntTools_Context, MMgt_TShared)
-
-
//! The intersection Context contains geometrical
//! and topological toolkit (classifiers, projectors, etc).
//! The intersection Context is for caching the tools
//! to increase the performance.
-class IntTools_Context : public MMgt_TShared
+class IntTools_Context : public Standard_Transient
{
-
public:
//! for given face
Standard_EXPORT Geom2dHatch_Hatcher& Hatcher (const TopoDS_Face& aF);
+ //! Returns a reference to surface adaptor for given face
+ Standard_EXPORT BRepAdaptor_Surface& SurfaceAdaptor (const TopoDS_Face& theFace);
+
+ //! Computes the boundaries of the face using surface adaptor
+ Standard_EXPORT void UVBounds (const TopoDS_Face& theFace,
+ Standard_Real& UMin,
+ Standard_Real& UMax,
+ Standard_Real& VMin,
+ Standard_Real& VMax);
//! Computes parameter of the Point theP on
//! the edge aE.
- DEFINE_STANDARD_RTTIEXT(IntTools_Context,MMgt_TShared)
+ DEFINE_STANDARD_RTTIEXT(IntTools_Context,Standard_Transient)
protected:
BOPCol_DataMapOfShapeAddress myHatcherMap;
BOPCol_DataMapOfShapeAddress myProjSDataMap;
BOPCol_DataMapOfShapeAddress myBndBoxDataMap;
+ BOPCol_DataMapOfShapeAddress mySurfAdaptorMap;
Standard_Integer myCreateFlag;
Standard_Real myPOnSTolerance;
};
+DEFINE_STANDARD_HANDLE(IntTools_Context, Standard_Transient)
+
#endif // _IntTools_Context_HeaderFile
#include <IntCurveSurface_HInter.hxx>
#include <IntCurveSurface_IntersectionPoint.hxx>
#include <IntTools.hxx>
-#include <IntTools_Array1OfRange.hxx>
#include <IntTools_BeanFaceIntersector.hxx>
#include <IntTools_CArray1OfInteger.hxx>
-#include <IntTools_CArray1OfReal.hxx>
#include <IntTools_CommonPrt.hxx>
#include <IntTools_Context.hxx>
#include <IntTools_EdgeFace.hxx>
+#include <IntTools_FClass2d.hxx>
#include <IntTools_Range.hxx>
#include <IntTools_Root.hxx>
#include <IntTools_Tools.hxx>
Standard_Boolean IsRadius (const BRepAdaptor_Curve& aCurve ,
const BRepAdaptor_Surface& aSurface,
const Standard_Real aCriteria);
-static
- Standard_Integer AdaptiveDiscret (const Standard_Integer iDiscret,
- const BRepAdaptor_Curve& aCurve ,
- const BRepAdaptor_Surface& aSurface);
//=======================================================================
//function : IntTools_EdgeFace::IntTools_EdgeFace
myErrorStatus=3;
}
}
-//=======================================================================
-//function : Prepare
-//purpose :
-//=======================================================================
-void IntTools_EdgeFace::Prepare()
-{
- Standard_Integer pri;
- Standard_Real aTmin, aTmax;
- IntTools_CArray1OfReal aPars;
-
- //
- // 1.Prepare Curve's data and Surface's data
- myC.Initialize(myEdge);
- GeomAbs_CurveType aCurveType;
- aCurveType=myC.GetType();
- //
- // 2.Prepare myCriteria
- Standard_Real aFuzz = myFuzzyValue / 2.;
- Standard_Real aTolF = BRep_Tool::Tolerance(myFace) + aFuzz;
- Standard_Real aTolE = BRep_Tool::Tolerance(myEdge) + aFuzz;
- if (aCurveType == GeomAbs_BSplineCurve ||
- aCurveType == GeomAbs_BezierCurve) {
- myCriteria = 1.5*aTolE + aTolF;
- }
- else {
- myCriteria = aTolE + aTolF;
- }
- // 2.a myTmin, myTmax
- aTmin=myRange.First();
- aTmax=myRange.Last();
- // 2.b myFClass2d
- myS.Initialize (myFace,Standard_True);
- myFClass2d.Init(myFace, 1.e-6);
- //
- // 2.c Prepare adaptive myDiscret
- myDiscret=AdaptiveDiscret(myDiscret, myC, myS);
- //
- //
- // 3.Prepare myPars
- pri = IntTools::PrepareArgs(myC, aTmax, aTmin,
- myDiscret, myDeflection, aPars);
- if (pri) {
- myErrorStatus=6;
- return;
- }
- // 4.
- //ProjectableRanges
- Standard_Integer i, iProj, aNb, aNbProj, ind0, ind1;
- Standard_Real t0, t1, tRoot;
-
- //
- // Table of Projection's function values
- aNb=aPars.Length();
- IntTools_CArray1OfInteger anArrProjectability;
- anArrProjectability.Resize(aNb);
-
- for (iProj=0, i=0; i<aNb; i++) {
- t0=aPars(i);
- aNbProj=IsProjectable (t0);
-
- anArrProjectability(i)=0;
- if (aNbProj) {
- anArrProjectability(i)=1;
- iProj++;
- }
- }
- //
- // Checking
- if (!iProj ) {
- myErrorStatus=7;
- return;
- }
-
- //
- // Projectable Ranges
- IntTools_Range aRange;
-
- ind0=anArrProjectability(0);
- if (ind0) {
- t0=aPars(0);
- aRange.SetFirst(t0);
- }
-
- for(i=1; i<aNb; i++) {
- ind1=anArrProjectability(i);
- t0=aPars(i-1);
- t1=aPars(i);
-
- if (i==(aNb-1)) {
- if (ind1 && ind0) {
- aRange.SetLast(t1);
- myProjectableRanges.Append(aRange);
- }
- if (ind1 && !ind0) {
- FindProjectableRoot(t0, t1, ind0, ind1, tRoot);
- aRange.SetFirst(tRoot);
- aRange.SetLast(t1);
- myProjectableRanges.Append(aRange);
- }
- //
- if (ind0 && !ind1) {
- FindProjectableRoot(t0, t1, ind0, ind1, tRoot);
- aRange.SetLast(tRoot);
- myProjectableRanges.Append(aRange);
- }
- //
- break;
- }
-
- if (ind0 != ind1) {
- FindProjectableRoot(t0, t1, ind0, ind1, tRoot);
-
- if (ind0 && !ind1) {
- aRange.SetLast(tRoot);
- myProjectableRanges.Append(aRange);
- }
- else {
- aRange.SetFirst(tRoot);
- }
- } // if (ind0 != ind1)
- ind0=ind1;
- } // for(i=1; i<aNb; i++) {
-}
-
-//=======================================================================
-//function : FindProjectableRoot
-//purpose :
-//=======================================================================
- void IntTools_EdgeFace::FindProjectableRoot (const Standard_Real tt1,
- const Standard_Real tt2,
- const Standard_Integer ff1,
- const Standard_Integer /*ff2*/,
- Standard_Real& tRoot)
-{
- Standard_Real tm, t1, t2, aEpsT;
- Standard_Integer anIsProj1, anIsProjm;
- aEpsT = 0.5 * myEpsT;
-
- // Root is inside [tt1, tt2]
- t1 = tt1;
- t2 = tt2;
- anIsProj1 = ff1;
-
- for(;;)
- {
- if (fabs(t1 - t2) < aEpsT)
- {
- tRoot = (anIsProj1) ? t1 : t2;
- return;
- }
- tm = 0.5 * (t1 + t2);
- anIsProjm = IsProjectable(tm);
- if (anIsProjm != anIsProj1)
- {
- t2 = tm;
- }
- else
- {
- t1 = tm;
- anIsProj1 = anIsProjm;
- }
- } // for(;;)
-}
//=======================================================================
//function : IsProjectable
//purpose :
(const IntTools_CommonPrt& aCP,
Standard_Real& aTx)
{
+ if (myC.GetType() == GeomAbs_Line &&
+ myS.GetType() == GeomAbs_Plane) {
+ return Standard_False;
+ }
+ //
Standard_Real aTF, aTL, Tol, U1f, U1l, V1f, V1l, af, al,aDist2, aMinDist2;
Standard_Boolean theflag=Standard_False;
Standard_Integer aNbExt, iLower;
myCriteria = aTolE + aTolF;
}
- myS.Initialize (myFace,Standard_True);
+ myS = myContext->SurfaceAdaptor(myFace);
- if(myContext.IsNull()) {
- myFClass2d.Init(myFace, 1.e-6);
- }
- //
if (myQuickCoincidenceCheck) {
if (IsCoincident()) {
aCommonPrt.SetType(TopAbs_EDGE);
#include <BRepAdaptor_Surface.hxx>
#include <Standard_Boolean.hxx>
#include <IntTools_SequenceOfRanges.hxx>
-#include <IntTools_FClass2d.hxx>
-#include <IntTools_CArray1OfReal.hxx>
#include <IntTools_SequenceOfCommonPrts.hxx>
#include <IntTools_Range.hxx>
class IntTools_Context;
class IntTools_Range;
class gp_Pnt;
class BRepAdaptor_Surface;
-class IntTools_CArray1OfReal;
class IntTools_CommonPrt;
Standard_EXPORT static Standard_Boolean IsEqDistance (const gp_Pnt& aP, const BRepAdaptor_Surface& aS, const Standard_Real aT, Standard_Real& aD);
Standard_EXPORT void CheckData();
- Standard_EXPORT void Prepare();
-
Standard_EXPORT Standard_Boolean IsProjectable (const Standard_Real t) const;
- Standard_EXPORT void FindProjectableRoot (const Standard_Real t1, const Standard_Real t2, const Standard_Integer f1, const Standard_Integer f2, Standard_Real& tRoot);
-
Standard_EXPORT Standard_Real DistanceFunction (const Standard_Real t);
Standard_EXPORT Standard_Integer MakeType (IntTools_CommonPrt& aCP);
Standard_Boolean myIsDone;
Standard_Integer myErrorStatus;
Handle(IntTools_Context) myContext;
- IntTools_SequenceOfRanges myProjectableRanges;
- IntTools_FClass2d myFClass2d;
IntTools_SequenceOfCommonPrts mySeqOfCommonPrts;
IntTools_Range myRange;
//
static
Standard_Boolean CheckPCurve(const Handle(Geom2d_Curve)& aPC,
- const TopoDS_Face& aFace);
+ const TopoDS_Face& aFace,
+ const Handle(IntTools_Context)& theCtx);
static
Standard_Real MaxDistance(const Handle(Geom_Curve)& theC,
}
-static Standard_Boolean isTreatAnalityc(const TopoDS_Face& theF1,
- const TopoDS_Face& theF2,
+static Standard_Boolean isTreatAnalityc(const BRepAdaptor_Surface& theBAS1,
+ const BRepAdaptor_Surface& theBAS2,
const Standard_Real theTol)
{
const Standard_Real Tolang = 1.e-8;
Standard_Real aHigh = 0.0;
- const BRepAdaptor_Surface aBAS1(theF1), aBAS2(theF2);
- const GeomAbs_SurfaceType aType1=aBAS1.GetType();
- const GeomAbs_SurfaceType aType2=aBAS2.GetType();
+ const GeomAbs_SurfaceType aType1=theBAS1.GetType();
+ const GeomAbs_SurfaceType aType2=theBAS2.GetType();
gp_Pln aS1;
gp_Cylinder aS2;
if(aType1 == GeomAbs_Plane)
{
- aS1=aBAS1.Plane();
+ aS1=theBAS1.Plane();
}
else if(aType2 == GeomAbs_Plane)
{
- aS1=aBAS2.Plane();
+ aS1=theBAS2.Plane();
}
else
{
if(aType1 == GeomAbs_Cylinder)
{
- aS2=aBAS1.Cylinder();
- const Standard_Real VMin = aBAS1.FirstVParameter();
- const Standard_Real VMax = aBAS1.LastVParameter();
+ aS2=theBAS1.Cylinder();
+ const Standard_Real VMin = theBAS1.FirstVParameter();
+ const Standard_Real VMax = theBAS1.LastVParameter();
if( Precision::IsNegativeInfinite(VMin) ||
Precision::IsPositiveInfinite(VMax))
}
else if(aType2 == GeomAbs_Cylinder)
{
- aS2=aBAS2.Cylinder();
+ aS2=theBAS2.Cylinder();
- const Standard_Real VMin = aBAS2.FirstVParameter();
- const Standard_Real VMax = aBAS2.LastVParameter();
+ const Standard_Real VMin = theBAS2.FirstVParameter();
+ const Standard_Real VMax = theBAS2.LastVParameter();
if( Precision::IsNegativeInfinite(VMin) ||
Precision::IsPositiveInfinite(VMax))
myFace1=aF1;
myFace2=aF2;
- const BRepAdaptor_Surface aBAS1(myFace1, Standard_False);
- const BRepAdaptor_Surface aBAS2(myFace2, Standard_False);
+ const BRepAdaptor_Surface& aBAS1 = myContext->SurfaceAdaptor(myFace1);
+ const BRepAdaptor_Surface& aBAS2 = myContext->SurfaceAdaptor(myFace2);
GeomAbs_SurfaceType aType1=aBAS1.GetType();
GeomAbs_SurfaceType aType2=aBAS2.GetType();
if(aType1==GeomAbs_Plane && aType2==GeomAbs_Plane) {
Standard_Real umin, umax, vmin, vmax;
//
- BRepTools::UVBounds(myFace1, umin, umax, vmin, vmax);
+ myContext->UVBounds(myFace1, umin, umax, vmin, vmax);
CorrectPlaneBoundaries(umin, umax, vmin, vmax);
myHS1->ChangeSurface().Load(S1, umin, umax, vmin, vmax);
//
- BRepTools::UVBounds(myFace2, umin, umax, vmin, vmax);
+ myContext->UVBounds(myFace2, umin, umax, vmin, vmax);
CorrectPlaneBoundaries(umin, umax, vmin, vmax);
myHS2->ChangeSurface().Load(S2, umin, umax, vmin, vmax);
//
{
Standard_Real umin, umax, vmin, vmax;
// F1
- BRepTools::UVBounds(myFace1, umin, umax, vmin, vmax);
+ myContext->UVBounds(myFace1, umin, umax, vmin, vmax);
CorrectPlaneBoundaries(umin, umax, vmin, vmax);
myHS1->ChangeSurface().Load(S1, umin, umax, vmin, vmax);
// F2
- BRepTools::UVBounds(myFace2, umin, umax, vmin, vmax);
+ myContext->UVBounds(myFace2, umin, umax, vmin, vmax);
CorrectSurfaceBoundaries(myFace2, myTol * 2., umin, umax, vmin, vmax);
myHS2->ChangeSurface().Load(S2, umin, umax, vmin, vmax);
}
{
Standard_Real umin, umax, vmin, vmax;
//F1
- BRepTools::UVBounds(myFace1, umin, umax, vmin, vmax);
+ myContext->UVBounds(myFace1, umin, umax, vmin, vmax);
CorrectSurfaceBoundaries(myFace1, myTol * 2., umin, umax, vmin, vmax);
myHS1->ChangeSurface().Load(S1, umin, umax, vmin, vmax);
// F2
- BRepTools::UVBounds(myFace2, umin, umax, vmin, vmax);
+ myContext->UVBounds(myFace2, umin, umax, vmin, vmax);
CorrectPlaneBoundaries(umin, umax, vmin, vmax);
myHS2->ChangeSurface().Load(S2, umin, umax, vmin, vmax);
}
else
{
Standard_Real umin, umax, vmin, vmax;
- BRepTools::UVBounds(myFace1, umin, umax, vmin, vmax);
+ myContext->UVBounds(myFace1, umin, umax, vmin, vmax);
CorrectSurfaceBoundaries(myFace1, myTol * 2., umin, umax, vmin, vmax);
myHS1->ChangeSurface().Load(S1, umin, umax, vmin, vmax);
- BRepTools::UVBounds(myFace2, umin, umax, vmin, vmax);
+ myContext->UVBounds(myFace2, umin, umax, vmin, vmax);
CorrectSurfaceBoundaries(myFace2, myTol * 2., umin, umax, vmin, vmax);
myHS2->ChangeSurface().Load(S2, umin, umax, vmin, vmax);
}
}
#endif
- const Standard_Boolean isGeomInt = isTreatAnalityc(aF1, aF2, myTol);
+ const Standard_Boolean isGeomInt = isTreatAnalityc(aBAS1, aBAS2, myTol);
myIntersector.Perform(myHS1, dom1, myHS2, dom2, TolArc, TolTang,
myListOfPnts, RestrictLine, isGeomInt);
}
}
// ###########################################
- bPCurvesOk = CheckPCurve(BS1, myFace2);
+ bPCurvesOk = CheckPCurve(BS1, myFace2, myContext);
aCurve.SetSecondCurve2d(BS1);
}
else {
}
}
// ###########################################
- bPCurvesOk = bPCurvesOk && CheckPCurve(BS2, myFace1);
+ bPCurvesOk = bPCurvesOk && CheckPCurve(BS2, myFace1, myContext);
aCurve.SetFirstCurve2d(BS2);
}
else {
if(myApprox1) {
H1 = GeomInt_IntSS::MakeBSpline2d(WL, ifprm, ilprm, Standard_True);
- bPCurvesOk = CheckPCurve(H1, myFace1);
+ bPCurvesOk = CheckPCurve(H1, myFace1, myContext);
}
if(myApprox2) {
H2 = GeomInt_IntSS::MakeBSpline2d(WL, ifprm, ilprm, Standard_False);
- bPCurvesOk = bPCurvesOk && CheckPCurve(H2, myFace2);
+ bPCurvesOk = bPCurvesOk && CheckPCurve(H2, myFace2, myContext);
}
//
//if pcurves created without approximation are out of the
newCheck.FixTangent(Standard_True,Standard_True);
//
if (!reApprox) {
- bIsValid1=CheckPCurve(BS1, myFace1);
+ bIsValid1=CheckPCurve(BS1, myFace1, myContext);
}
//
aCurve.SetFirstCurve2d(BS1);
newCheck.FixTangent(Standard_True,Standard_True);
//
if (!reApprox) {
- bIsValid2=CheckPCurve(BS2, myFace2);
+ bIsValid2=CheckPCurve(BS2, myFace2, myContext);
}
aCurve.SetSecondCurve2d(BS2);
}
//function : CheckPCurve
//purpose : Checks if points of the pcurve are out of the face bounds.
//=======================================================================
- Standard_Boolean CheckPCurve(const Handle(Geom2d_Curve)& aPC,
- const TopoDS_Face& aFace)
+ Standard_Boolean CheckPCurve(const Handle(Geom2d_Curve)& aPC,
+ const TopoDS_Face& aFace,
+ const Handle(IntTools_Context)& theCtx)
{
const Standard_Integer NPoints = 23;
Standard_Integer i;
Standard_Real umin,umax,vmin,vmax;
- BRepTools::UVBounds(aFace, umin, umax, vmin, vmax);
+ theCtx->UVBounds(aFace, umin, umax, vmin, vmax);
Standard_Real tolU = Max ((umax-umin)*0.01, Precision::Confusion());
Standard_Real tolV = Max ((vmax-vmin)*0.01, Precision::Confusion());
Standard_Real fp = aPC->FirstParameter();
return Standard_True;
}
+ const Handle(IntTools_Context)& aContext = aDSFiller.Context();
+ //
IsCommonFound = Standard_True;
TopExp::MapShapes(aCommon.Shape(), TopAbs_VERTEX, aMapV);
// fill edge history.begin
Standard_Integer nE = aLSE.First();
const TopoDS_Edge& aSpE = *(TopoDS_Edge*)(&pDS->Shape(nE));
- BOPTools_AlgoTools3D::GetNormalToFaceOnEdge (aSpE, aF1, aDNF1);
- BOPTools_AlgoTools3D::GetNormalToFaceOnEdge (aSpE, aF2, aDNF2);
+ BOPTools_AlgoTools3D::GetNormalToFaceOnEdge (aSpE, aF1, aDNF1, aContext);
+ BOPTools_AlgoTools3D::GetNormalToFaceOnEdge (aSpE, aF2, aDNF2, aContext);
iSenseFlag=BOPTools_AlgoTools3D::SenseFlag (aDNF1, aDNF2);
if(iSenseFlag == 1) {
--- /dev/null
+puts "========"
+puts "OCC28165"
+puts "========"
+puts ""
+#################################################
+# Improve performance of Boolean Operations
+#################################################
+
+restore [locate_data_file bug28165_shapes1.brep] c
+
+explode c
+# c_1 is a face
+# c_2 is a set of edges
+
+# split the face with the edges
+bclearobjects
+bcleartools
+baddobjects c_1
+baddctools c_2
+bfillds
+bbuild result
+
+checknbshapes result -face 1600
+
+checkview -display result -2d -path ${imagedir}/${test_image}.png
\ No newline at end of file
--- /dev/null
+puts "========"
+puts "OCC28165"
+puts "========"
+puts ""
+#################################################
+# Improve performance of Boolean Operations
+#################################################
+
+restore [locate_data_file bug28165_shapes1.brep] c
+
+explode c
+# c_1 is a face
+# c_2 is a set of edges
+
+# rotate the shapes to make no intersections at all
+ttranslate c_2 0 0 0.1
+trotate c_1 c_2 0 0 0 1 1 0 45
+
+bclearobjects
+bcleartools
+baddobjects c_1
+baddctools c_2
+bfillds
+bbuild result
+
+checknbshapes result -edge 5074 -face 1
+
+checkview -display result -2d -path ${imagedir}/${test_image}.png
\ No newline at end of file
--- /dev/null
+puts "========"
+puts "OCC28165"
+puts "========"
+puts ""
+#################################################
+# Improve performance of Boolean Operations
+#################################################
+
+restore [locate_data_file bug28165_shapes2.brep] c
+
+# fuse the boxes
+bclearobjects
+bcleartools
+baddobjects {*}[explode c so]
+bfillds
+
+# remove all internal faces to make only one solid
+bcbuild rx
+bcaddall result -m 1 -u
+
+checkshape result
+checknbshapes result -edge 816 -face 378 -solid 1
+checkprops result -v 343
+
+checkview -display result -2d -path ${imagedir}/${test_image}.png
\ No newline at end of file
--- /dev/null
+puts "========"
+puts "OCC28165"
+puts "========"
+puts ""
+#################################################
+# Improve performance of Boolean Operations
+#################################################
+
+restore [locate_data_file bug28165_shapes3.brep] c
+
+# fuse the shapes
+bclearobjects
+bcleartools
+baddobjects {*}[explode c so]
+bfillds
+
+# remove all internal faces to make only one solid
+bcbuild rx
+bcaddall result -m 1 -u
+
+checkshape result
+checknbshapes result -edge 1400 -face 506 -solid 1
+checkprops result -v 4.69342e+007 -s 1.38778e+006
+
+checkview -display result -2d -path ${imagedir}/${test_image}.png
\ No newline at end of file