diff --git a/src/BOP/BOP_ArgumentAnalyzer.cxx b/src/BOP/BOP_ArgumentAnalyzer.cxx index 84e7c49181..961284ab05 100755 --- a/src/BOP/BOP_ArgumentAnalyzer.cxx +++ b/src/BOP/BOP_ArgumentAnalyzer.cxx @@ -817,11 +817,17 @@ Standard_Boolean TestShapeType(const TopoDS_Shape & TheShape) // static function: CheckEdge // purpose: // ---------------------------------------------------------------------- -Standard_Boolean CheckEdge(const TopoDS_Edge& theEdge) { - IntTools_Context aContext; +Standard_Boolean CheckEdge(const TopoDS_Edge& theEdge) +{ + Handle(IntTools_Context) aContext; TopoDS_Vertex aV1, aV2; + // + //modified by NIZNHY-PKV Tue Jan 31 15:07:13 2012f + aContext=new IntTools_Context; + ////modified by NIZNHY-PKV Tue Jan 31 15:07:16 2012t TopExp::Vertices(theEdge, aV1, aV2); + if(aV1.IsNull() || aV2.IsNull() || BRep_Tool::Degenerated(theEdge)) return Standard_True; Standard_Real aFirst = 0., aLast = 0.; diff --git a/src/BOP/BOP_SDFWESFiller.cxx b/src/BOP/BOP_SDFWESFiller.cxx index 111ebd16e1..09874226b8 100755 --- a/src/BOP/BOP_SDFWESFiller.cxx +++ b/src/BOP/BOP_SDFWESFiller.cxx @@ -50,7 +50,7 @@ static Standard_Boolean IsValidSeam(const TopoDS_Edge& aE, const TopoDS_Face& aF, const Standard_Real aT, - IntTools_Context& aContext); + const Handle(IntTools_Context)& aContext); static void CorrespondantSeam(const TopoDS_Edge& aSpE1Seam11, const Standard_Real aT1, @@ -68,7 +68,7 @@ static void TreatSDSeams (const TopoDS_Edge& aSpE1Seam11, const TopoDS_Face& aF2FWD, const Standard_Boolean bIsTakenSp1, BOP_WireEdgeSet& aWES, - IntTools_Context& aContext); + const Handle(IntTools_Context)& aContext); //======================================================================= @@ -428,8 +428,8 @@ static void TreatSDSeams (const TopoDS_Edge& aSpE1Seam11, nSp2=aPB2.Edge(); const TopoDS_Edge& anE2=TopoDS::Edge(aDS.GetShape(nE2)); // - IntTools_Context& aContext=pPaveFiller->ChangeContext(); - aFlag=aContext.ProjectPointOnEdge(aPx1, anE2, aTs); + const Handle(IntTools_Context)& aContext=pPaveFiller->Context(); + aFlag=aContext->ProjectPointOnEdge(aPx1, anE2, aTs); // if (!aFlag) { BOPTColStd_Dump::PrintMessage(" BOP_SDFWESFiller::PrepareOnParts() failed\n"); @@ -688,7 +688,7 @@ static void TreatSDSeams (const TopoDS_Edge& aSpE1Seam11, BOPTools_CommonBlockPool& aCBPool=pPaveFiller->ChangeCommonBlockPool(); BOP_WireEdgeSet& aWES=*myWES; // - IntTools_Context& aContext=pPaveFiller->ChangeContext(); + const Handle(IntTools_Context)& aContext=pPaveFiller->Context(); // Standard_Integer nE1, nE2, aNbSpON, nSp1, aBid, nSpTaken, nSp2, iRankF1, iRankF2; Standard_Real aT1, aT2, aU, aV, aScPr; @@ -1076,7 +1076,7 @@ static void TreatSDSeams (const TopoDS_Edge& aSpE1Seam11, // const BOPTools_ListOfPaveBlock& aSplitEdges=aSplitShapesPool(aDS.RefEdge(nED)); // - IntTools_Context& aContext=pPaveFiller->ChangeContext(); + const Handle(IntTools_Context)& aContext=pPaveFiller->Context(); const TopoDS_Edge& aDE=TopoDS::Edge(aDS.Shape(nED)); const TopoDS_Face& aDF=TopoDS::Face(aDS.Shape(nFD)); const TopoDS_Face& aFaceReference=TopoDS::Face(aDS.Shape(nF2)); @@ -1113,7 +1113,7 @@ static void TreatSDSeams (const TopoDS_Edge& aSpE1Seam11, // aState=TopAbs_OUT; // - bIsValidPoint=aContext.IsValidPointForFace(aPxNear, aFaceReference, 1.e-3); + bIsValidPoint=aContext->IsValidPointForFace(aPxNear, aFaceReference, 1.e-3); // if (bIsValidPoint) { aState=TopAbs_IN; @@ -1170,7 +1170,7 @@ void TreatSDSeams (const TopoDS_Edge& aSpE1Seam11, const Standard_Boolean bIsTakenSp1, BOP_WireEdgeSet& aWES, - IntTools_Context& aContext) + const Handle(IntTools_Context)& aContext) { Standard_Boolean bIsValidSeam11, bIsValidSeam12, bIsValidSeam21, bIsValidSeam22; @@ -1261,7 +1261,7 @@ void TreatSDSeams (const TopoDS_Edge& aSpE1Seam11, Standard_Boolean IsValidSeam(const TopoDS_Edge& aE, const TopoDS_Face& aF, const Standard_Real aT, - IntTools_Context& aContext) + const Handle(IntTools_Context)& aContext) { Standard_Boolean bIsPointInOnFace; gp_Pnt2d aPx2DNear; @@ -1269,7 +1269,7 @@ void TreatSDSeams (const TopoDS_Edge& aSpE1Seam11, BOPTools_Tools3D::PointNearEdge(aE, aF, aT, aPx2DNear, aPxNear); // - bIsPointInOnFace=aContext.IsPointInOnFace(aF, aPx2DNear); + bIsPointInOnFace=aContext->IsPointInOnFace(aF, aPx2DNear); return bIsPointInOnFace; } //======================================================================= diff --git a/src/BOP/BOP_ShellSolid_1.cxx b/src/BOP/BOP_ShellSolid_1.cxx index dda586920f..3a1dc074a4 100755 --- a/src/BOP/BOP_ShellSolid_1.cxx +++ b/src/BOP/BOP_ShellSolid_1.cxx @@ -63,7 +63,7 @@ static const Standard_Integer theFaceIndex, const BOPTools_PDSFiller& theDSFiller, const BOP_Operation& theOperation, - IntTools_Context& theContext); + const Handle(IntTools_Context)& theContext); //======================================================================= // @@ -123,7 +123,7 @@ static BOPTools_PaveFiller* pPaveFiller=(BOPTools_PaveFiller*)&aPaveFiller; BOPTools_CommonBlockPool& aCBPool=pPaveFiller->ChangeCommonBlockPool(); // - IntTools_Context& aContext=pPaveFiller->ChangeContext(); + const Handle(IntTools_Context)& aContext=pPaveFiller->Context(); // Standard_Integer nEF1, nF2, nSpF1, nSpF2, nEF2, nSpTaken, iRankF1; Standard_Boolean bToReverse; @@ -592,7 +592,7 @@ static BOPTools_PaveFiller* pPaveFiller=(BOPTools_PaveFiller*)&aPF; BOPTools_CommonBlockPool& aCBPool=pPaveFiller->ChangeCommonBlockPool(); // - IntTools_Context& aContext=pPaveFiller->ChangeContext(); + const Handle(IntTools_Context)& aContext=pPaveFiller->Context(); // Standard_Integer nEF1, nF2, nSpF1, nSpF2, nEF2, nSpTaken, nF2x, iRankF1; Standard_Boolean bToReverse; @@ -782,7 +782,7 @@ Standard_Boolean CheckSplitToAvoid(const TopoDS_Edge& theSplit, const Standard_Integer theFaceIndex, const BOPTools_PDSFiller& theDSFiller, const BOP_Operation& theOperation, - IntTools_Context& theContext) { + const Handle(IntTools_Context)& theContext) { Standard_Integer anE = -1; @@ -823,7 +823,7 @@ Standard_Boolean CheckSplitToAvoid(const TopoDS_Edge& theSplit, gp_Pnt aPoint3d; Standard_Real aTolerance = BRep_Tool::Tolerance(theSplit); //??? BOPTools_Tools3D::PointNearEdge(theSplit, aFaceCur, amidpar, aTolerance, aPoint2d, aPoint3d); - GeomAPI_ProjectPointOnSurf& aProjector = theContext.ProjPS(aFace); + GeomAPI_ProjectPointOnSurf& aProjector = theContext->ProjPS(aFace); aProjector.Perform(aPoint3d); if(aProjector.IsDone()) { @@ -833,7 +833,7 @@ Standard_Boolean CheckSplitToAvoid(const TopoDS_Edge& theSplit, if(adist < BRep_Tool::Tolerance(aFace)) { aProjector.LowerDistanceParameters(U, V); - if(theContext.IsPointInFace(aFace, gp_Pnt2d(U, V))) { + if(theContext->IsPointInFace(aFace, gp_Pnt2d(U, V))) { avoid = Standard_False; break; } @@ -851,7 +851,7 @@ Standard_Boolean CheckSplitToAvoid(const TopoDS_Edge& theSplit, gp_Pnt aPoint3d; Standard_Real aTolerance = BRep_Tool::Tolerance(theSplit); //??? BOPTools_Tools3D::PointNearEdge(theSplit, aFaceCur, amidpar, aTolerance, aPoint2d, aPoint3d); - GeomAPI_ProjectPointOnSurf& aProjector = theContext.ProjPS(aFace); + GeomAPI_ProjectPointOnSurf& aProjector = theContext->ProjPS(aFace); aProjector.Perform(aPoint3d); if(aProjector.IsDone()) { @@ -861,7 +861,7 @@ Standard_Boolean CheckSplitToAvoid(const TopoDS_Edge& theSplit, if(adist < BRep_Tool::Tolerance(aFace)) { aProjector.LowerDistanceParameters(U, V); - if(theContext.IsPointInFace(aFace, gp_Pnt2d(U, V))) { + if(theContext->IsPointInFace(aFace, gp_Pnt2d(U, V))) { avoid = Standard_False; break; } @@ -879,7 +879,7 @@ Standard_Boolean CheckSplitToAvoid(const TopoDS_Edge& theSplit, gp_Pnt aPoint3d; Standard_Real aTolerance = BRep_Tool::Tolerance(theSplit); //??? BOPTools_Tools3D::PointNearEdge(theSplit, aFaceCur, amidpar, aTolerance, aPoint2d, aPoint3d); - GeomAPI_ProjectPointOnSurf& aProjector = theContext.ProjPS(aFace); + GeomAPI_ProjectPointOnSurf& aProjector = theContext->ProjPS(aFace); aProjector.Perform(aPoint3d); if(aProjector.IsDone()) { @@ -889,7 +889,7 @@ Standard_Boolean CheckSplitToAvoid(const TopoDS_Edge& theSplit, if(adist < BRep_Tool::Tolerance(aFace)) { aProjector.LowerDistanceParameters(U, V); - if(theContext.IsPointInFace(aFace, gp_Pnt2d(U, V))) { + if(theContext->IsPointInFace(aFace, gp_Pnt2d(U, V))) { avoid = Standard_False; break; } diff --git a/src/BOP/BOP_ShellSolid_2.cxx b/src/BOP/BOP_ShellSolid_2.cxx index b2bb120283..3cdd6c0f9f 100755 --- a/src/BOP/BOP_ShellSolid_2.cxx +++ b/src/BOP/BOP_ShellSolid_2.cxx @@ -81,7 +81,7 @@ static const BOP_Operation myOperation, const TopTools_IndexedDataMapOfShapeListOfShape& aMEF, BOP_WireEdgeSet& aWES, - IntTools_Context& aContext); + const Handle(IntTools_Context)& aContext); static void SecondInternal(TopoDS_Edge& aSS, @@ -93,7 +93,7 @@ static const Standard_Integer iRankF1, const BOP_Operation myOperation, BOP_WireEdgeSet& aWES, - IntTools_Context& aContext); + const Handle(IntTools_Context)& aContext); //======================================================================= @@ -168,7 +168,7 @@ static BOPTools_InterferencePool* pIntrPool=(BOPTools_InterferencePool*)&myDSFiller->InterfPool(); BOPTools_CArray1OfSSInterference& aFFs=pIntrPool->SSInterferences(); // - IntTools_Context& aContext=pPaveFiller->ChangeContext(); + const Handle(IntTools_Context)& aContext=pPaveFiller->Context(); // Standard_Boolean bIsToKeep; Standard_Integer nEF1, nF2, nF2x, nSpF1, iRankF1; @@ -248,7 +248,7 @@ static BOPTools_PaveFiller* pPaveFiller=(BOPTools_PaveFiller*)&aPaveFiller; BOPTools_CommonBlockPool& aCBPool=pPaveFiller->ChangeCommonBlockPool(); // - IntTools_Context& aContext=pPaveFiller->ChangeContext(); + const Handle(IntTools_Context)& aContext=pPaveFiller->Context(); // Standard_Integer nEF1, nF2, nSpF1, nSpF2, nEF2, nSpTaken, iRankF1; TopAbs_Orientation anOrEF1, anOrEF2; @@ -928,7 +928,7 @@ static BOPTools_PaveFiller* pPaveFiller=(BOPTools_PaveFiller*)&aPF; BOPTools_CommonBlockPool& aCBPool=pPaveFiller->ChangeCommonBlockPool(); // - IntTools_Context& aContext=pPaveFiller->ChangeContext(); + const Handle(IntTools_Context)& aContext=pPaveFiller->Context(); // Standard_Integer nEF1, nF2, nSpF1, nSpF2, nEF2, nSpTaken, iRankF1, nF2x, iRankF2; TopAbs_Orientation anOrEF1, anOrEF2; @@ -1261,7 +1261,7 @@ void FirstInternal(TopoDS_Edge& aSS, const BOP_Operation myOperation, const TopTools_IndexedDataMapOfShapeListOfShape& aMEF, BOP_WireEdgeSet& aWES, - IntTools_Context& aContext) + const Handle(IntTools_Context)& aContext) { Standard_Boolean bToReverse; TopAbs_Orientation anOrEF2; @@ -1298,7 +1298,7 @@ void SecondInternal(TopoDS_Edge& aSS, const Standard_Integer iRankF1, const BOP_Operation myOperation, BOP_WireEdgeSet& aWES, - IntTools_Context& aContext) + const Handle(IntTools_Context)& aContext) { Standard_Boolean bToReverse, bIsToKeep; if (aSS.Orientation()==TopAbs_INTERNAL) { @@ -1346,7 +1346,7 @@ void SecondInternal(TopoDS_Edge& aSS, BOPTools_PaveFiller* pPaveFiller=(BOPTools_PaveFiller*)&aPF; BOPTools_CommonBlockPool& aCBPool=pPaveFiller->ChangeCommonBlockPool(); // - IntTools_Context& aContext=pPaveFiller->ChangeContext(); + const Handle(IntTools_Context)& aContext=pPaveFiller->Context(); // Standard_Integer nEF1, nF2, nSpF1, nSpF2, nEF2, nSpTaken, iRankF1, nF2x, iRankF2, iSenseFlag; TopAbs_Orientation anOrEF1; diff --git a/src/BOP/BOP_ShellSolid_3.cxx b/src/BOP/BOP_ShellSolid_3.cxx index a7ae2d6d7d..98224277c4 100755 --- a/src/BOP/BOP_ShellSolid_3.cxx +++ b/src/BOP/BOP_ShellSolid_3.cxx @@ -191,7 +191,7 @@ Standard_Boolean BOP_ShellSolid::SplitFace(const Standard_Integer theFaceIndex, TopoDS_Edge aSpF2 = TopoDS::Edge(aSp2); Standard_Boolean bToReverse= - BOPTools_Tools3D::IsSplitToReverse1 (aSpF1, aSpF2, pPaveFiller->ChangeContext()); + BOPTools_Tools3D::IsSplitToReverse1 (aSpF1, aSpF2, pPaveFiller->Context()); if (bToReverse) { aSpF2.Reverse(); diff --git a/src/BOP/BOP_SolidSolid_1.cxx b/src/BOP/BOP_SolidSolid_1.cxx index 08c397036a..175717ed59 100755 --- a/src/BOP/BOP_SolidSolid_1.cxx +++ b/src/BOP/BOP_SolidSolid_1.cxx @@ -298,7 +298,7 @@ Standard_Boolean BOP_SolidSolid::ComputeStateByInsidePoints(const Standard_Integ Standard_Integer nF2 = aFF.OppositeIndex(nF1); const TopoDS_Face& aF2 = TopoDS::Face(aDS.Shape(nF2)); - if(BOPTools_Tools3D::CheckSameDomainFaceInside(aFace, aF2, pPaveFiller->ChangeContext())) { + if(BOPTools_Tools3D::CheckSameDomainFaceInside(aFace, aF2, pPaveFiller->Context())) { theState = TopAbs_ON; return Standard_True; } @@ -322,7 +322,7 @@ Standard_Boolean BOP_SolidSolid::ComputeStateByInsidePoints(const Standard_Integ } } - if(!BOPTools_Tools3D::ComputeFaceState(aFace, aRefSolid, pPaveFiller->ChangeContext(), aState)) { + if(!BOPTools_Tools3D::ComputeFaceState(aFace, aRefSolid, pPaveFiller->Context(), aState)) { return Standard_False; } theState = aState; @@ -598,7 +598,7 @@ Standard_Boolean ComputeStateForAnalyticalSurfaces(const Standard_Integer theFac bAnalytic = BOPTools_Tools3D::TreatedAsAnalytic(aF2, aSp, aFace, aTolTangent, aTolR, - aStPF, pPaveFiller->ChangeContext()); + aStPF, pPaveFiller->Context()); if(bAnalytic) { aState = aStPF; bFound = Standard_True; diff --git a/src/BOPTest/BOPTest_CurveCommands.cxx b/src/BOPTest/BOPTest_CurveCommands.cxx index 6e25c24239..64d4622591 100755 --- a/src/BOPTest/BOPTest_CurveCommands.cxx +++ b/src/BOPTest/BOPTest_CurveCommands.cxx @@ -81,10 +81,12 @@ Standard_Integer bopcurves (Draw_Interpretor& di, const TopoDS_Face& aF2=TopoDS::Face(S2); Standard_Boolean aToApproxC3d, aToApproxC2dOnS1, aToApproxC2dOnS2, anIsDone; + Standard_Boolean bToSplit; Standard_Integer i, aNbCurves; Standard_Real anAppTol, aTolR; TCollection_AsciiString aNm("c_"); - + // + bToSplit=Standard_False; aToApproxC3d=Standard_True; aToApproxC2dOnS1=Standard_False; aToApproxC2dOnS2=Standard_False; @@ -107,7 +109,7 @@ Standard_Integer bopcurves (Draw_Interpretor& di, return 1; } - aFF.PrepareLines3D(); + aFF.PrepareLines3D(bToSplit); const IntTools_SequenceOfCurves& aSCs=aFF.Lines(); // diff --git a/src/BOPTest/BOPTest_LowCommands.cxx b/src/BOPTest/BOPTest_LowCommands.cxx index 8a52e995da..17e2c98549 100755 --- a/src/BOPTest/BOPTest_LowCommands.cxx +++ b/src/BOPTest/BOPTest_LowCommands.cxx @@ -294,7 +294,7 @@ Standard_Integer bremovesim (Draw_Interpretor& di, Standard_Integer n, const cha const TopoDS_Face& aF=TopoDS::Face(S1); // - IntTools_Context aCtx; + Handle(IntTools_Context) aCtx=new IntTools_Context; BOPTools_Tools3D::RemoveSims (aF, aCtx); // di << " Ok\n"; diff --git a/src/BOPTools/BOPTools_Checker.cxx b/src/BOPTools/BOPTools_Checker.cxx index c2a0744f71..a7ed14e323 100755 --- a/src/BOPTools/BOPTools_Checker.cxx +++ b/src/BOPTools/BOPTools_Checker.cxx @@ -60,6 +60,7 @@ #include #include +#include //======================================================================= // function: BOPTools_Checker::BOPTools_Checker @@ -149,6 +150,10 @@ void BOPTools_Checker::Perform() { myCheckResults.Clear(); try { + // + if (myContext.IsNull()) { + myContext=new IntTools_Context; + } // // 0. Prepare the IteratorOfCoupleOfShape myDSIt.SetDataStructure(myDS); @@ -284,7 +289,7 @@ void BOPTools_Checker::PerformVE() continue; } // - aFlag=myContext.ComputeVE (aV1, aE2, aT); + aFlag=myContext->ComputeVE (aV1, aE2, aT); // if (!aFlag) { char buf[512]; @@ -345,7 +350,7 @@ void BOPTools_Checker::PerformVF() continue; } // - aFlag=myContext.ComputeVS (aV1, aF2, aU, aV); + aFlag=myContext->ComputeVS (aV1, aF2, aU, aV); // if (!aFlag) { char buf[512]; @@ -857,7 +862,7 @@ void BOPTools_Checker::PerformEF() aC.Bounds(aT1, aT2, aP1, aP2); // - bValid=myContext.IsValidBlockForFaces(aT1, aT2, aC, aF1, aF2, 1.e-3); + bValid=myContext->IsValidBlockForFaces(aT1, aT2, aC, aF1, aF2, 1.e-3); // if (bValid) { char buf[512]; diff --git a/src/BOPTools/BOPTools_DEProcessor.cxx b/src/BOPTools/BOPTools_DEProcessor.cxx index e46b39587e..426e1c9a95 100755 --- a/src/BOPTools/BOPTools_DEProcessor.cxx +++ b/src/BOPTools/BOPTools_DEProcessor.cxx @@ -293,9 +293,9 @@ if (aTypeReference==TopAbs_SOLID) { // ... \ Solid processing - IntTools_Context& aContext=myFiller->ChangeContext(); + const Handle(IntTools_Context)& aContext=myFiller->Context(); const TopoDS_Solid& aReferenceSolid=TopoDS::Solid(aReference); - BRepClass3d_SolidClassifier& SC=aContext.SolidClassifier(aReferenceSolid); + BRepClass3d_SolidClassifier& SC=aContext->SolidClassifier(aReferenceSolid); // SC.Perform(aPxNear, aTol); // @@ -385,8 +385,8 @@ Standard_Boolean bIsValidPoint; TopAbs_State aState=TopAbs_OUT; // - IntTools_Context& aContext=myFiller->ChangeContext(); - bIsValidPoint=aContext.IsValidPointForFace(aPxNear, aFaceReference, 1.e-3); + const Handle(IntTools_Context)& aContext=myFiller->Context(); + bIsValidPoint=aContext->IsValidPointForFace(aPxNear, aFaceReference, 1.e-3); // if (bIsValidPoint) { aState=TopAbs_IN; diff --git a/src/BOPTools/BOPTools_PaveFiller.cdl b/src/BOPTools/BOPTools_PaveFiller.cdl index 953fee7d82..838baf77f1 100755 --- a/src/BOPTools/BOPTools_PaveFiller.cdl +++ b/src/BOPTools/BOPTools_PaveFiller.cdl @@ -115,16 +115,21 @@ is --- --- Selectors --- - --- + --- + SetContext(me:out; + aContext: Context from IntTools); + ---Purpose: + --- Sets the intersecton context + --- Context(me) returns Context from IntTools; ---C++:return const & ---Purpose: --- Selector --- - ChangeContext(me:out) - returns Context from IntTools; - ---C++:return & +-- ChangeContext(me:out) +-- returns Context from IntTools; + -- C++:return & ---Purpose: --- Selector --- diff --git a/src/BOPTools/BOPTools_PaveFiller.cxx b/src/BOPTools/BOPTools_PaveFiller.cxx index 3f642dadfd..b7088012a4 100755 --- a/src/BOPTools/BOPTools_PaveFiller.cxx +++ b/src/BOPTools/BOPTools_PaveFiller.cxx @@ -151,15 +151,23 @@ { return mySectionAttribute; } - +//======================================================================= +// function: SetContext +// purpose: +//======================================================================= +void BOPTools_PaveFiller::SetContext(const Handle(IntTools_Context)& aContext) +{ + myContext=aContext; +} //======================================================================= // function: Context // purpose: //======================================================================= - const IntTools_Context& BOPTools_PaveFiller::Context() const +const Handle(IntTools_Context)& BOPTools_PaveFiller::Context() const { return myContext; } +/* //======================================================================= // function: ChangeContext // purpose: @@ -168,7 +176,7 @@ { return myContext; } - +*/ //======================================================================= // function: Perform // purpose: @@ -176,6 +184,10 @@ void BOPTools_PaveFiller::Perform() { try { + // + if (myContext.IsNull()) { + myContext=new IntTools_Context; + } // // 0. Prepare the IteratorOfCoupleOfShape myDSIt.SetDataStructure(myDS); @@ -247,6 +259,11 @@ const TColStd_SetOfInteger& aToolSubSet) { try { + // + if (myContext.IsNull()) { + myContext=new IntTools_Context; + } + // // // 0. Prepare the IteratorOfCoupleOfShape myDSIt.SetDataStructure(myDS); @@ -319,6 +336,11 @@ void BOPTools_PaveFiller::ToCompletePerform() { try { + // + if (myContext.IsNull()) { + myContext=new IntTools_Context; + } + // PutPavesOnCurves(); MakeSplitEdges (); @@ -392,7 +414,7 @@ continue; } // - aFlag=myContext.ComputeVE (aV1, aE2, aT); + aFlag=myContext->ComputeVE (aV1, aE2, aT); // if (!aFlag) { // @@ -471,7 +493,7 @@ const TopoDS_Vertex& aV1=TopoDS::Vertex(aS1); const TopoDS_Face& aF2=TopoDS::Face (aS2); // - aFlag=myContext.ComputeVS (aV1, aF2, aU, aV); + aFlag=myContext->ComputeVS (aV1, aF2, aU, aV); // if (!aFlag) { // diff --git a/src/BOPTools/BOPTools_PaveFiller_1.cxx b/src/BOPTools/BOPTools_PaveFiller_1.cxx index cfc132434c..d756553857 100755 --- a/src/BOPTools/BOPTools_PaveFiller_1.cxx +++ b/src/BOPTools/BOPTools_PaveFiller_1.cxx @@ -162,7 +162,7 @@ aEF.SetDiscretize (aDiscretize); aEF.SetDeflection (aDeflection); // - aEF.SetContext((IntTools_PContext)&myContext); + aEF.SetContext(myContext); // BRepAdaptor_Curve aCurve(aE); @@ -350,7 +350,7 @@ Standard_Real aTNew; // - iFlag=myContext.ComputeVE(aVF, aE, aTNew); + iFlag=myContext->ComputeVE(aVF, aE, aTNew); // aT=aTNew; aNewShape=nVF; diff --git a/src/BOPTools/BOPTools_PaveFiller_3.cxx b/src/BOPTools/BOPTools_PaveFiller_3.cxx index 309e082f05..3c8301951f 100755 --- a/src/BOPTools/BOPTools_PaveFiller_3.cxx +++ b/src/BOPTools/BOPTools_PaveFiller_3.cxx @@ -156,7 +156,7 @@ static Standard_Boolean CheckNewVertexAndUpdateData(const TopoDS_Vertex& const Standard_Real theTolerance, const BOPTools_PInterferencePool& theIntrPool, const BooleanOperations_PShapesDataStructure& theDS, - IntTools_Context* theContext, + const Handle(IntTools_Context)& theContext, const BOPTools_PaveSet& theEdgePaveSet, const Standard_Boolean bAddNewVertex, const Standard_Boolean bAddOldVertex, @@ -218,9 +218,7 @@ static aFFs.SetBlockLength(aNbFFs); } // - //modified by NIZNHY-PKV Thu Oct 20 07:09:57 2011f bToSplit=Standard_False; - //modified by NIZNHY-PKV Thu Oct 20 07:09:59 2011t for (; myDSIt.More(); myDSIt.Next()) { Standard_Boolean justaddinterference = Standard_True; @@ -272,8 +270,8 @@ static TopoDS_Face aF2=TopoDS::Face(myDS->GetShape(nF2)); // IntSurf_ListOfPntOn2S aListOfPnts; - GeomAPI_ProjectPointOnSurf& aProj1 = myContext.ProjPS(aF1); - GeomAPI_ProjectPointOnSurf& aProj2 = myContext.ProjPS(aF2); + GeomAPI_ProjectPointOnSurf& aProj1 = myContext->ProjPS(aF1); + GeomAPI_ProjectPointOnSurf& aProj2 = myContext->ProjPS(aF2); BOPTools_CArray1OfESInterference& aEFs=myIntrPool->ESInterferences(); TColStd_MapOfInteger aMapEdgeIndex1, aMapEdgeIndex2; @@ -383,6 +381,9 @@ static anApproxTol=1.e-7; IntTools_FaceFace aFF; + // + aFF.SetContext(myContext); + // aFF.SetParameters (bToApproxC3d, bToApproxC2dOnS1, bToApproxC2dOnS2, @@ -402,10 +403,7 @@ static if (aTolR3D < 1.e-7){ aTolR3D=1.e-7; } - //modified by NIZNHY-PKV Thu Oct 20 07:10:38 2011f aFF.PrepareLines3D(bToSplit); - //aFF.PrepareLines3D(); - //modified by NIZNHY-PKV Thu Oct 20 07:10:41 2011t // anIndexIn=0; Standard_Integer aNbCurves, aNbPoints; @@ -561,7 +559,7 @@ static // Checking of validity in 2D // Standard_Real aTolerance = (aTolR3D < 1.e-3) ? 1.e-3 : aTolR3D; - bValid=myContext.IsValidBlockForFaces(aT1, aT2, aC, aF1, aF2, aTolerance); + bValid=myContext->IsValidBlockForFaces(aT1, aT2, aC, aF1, aF2, aTolerance); // if (!bValid) { continue; @@ -691,7 +689,7 @@ static Standard_Boolean bVF; Standard_Integer aNewShape; // - bVF=myContext.IsValidPointForFaces (aPAlone, aF1, aF2, 1.e-3); + bVF=myContext->IsValidPointForFaces (aPAlone, aF1, aF2, 1.e-3); // if (bVF) { BooleanOperations_AncestorsSeqAndSuccessorsSeq anASSeq; @@ -772,7 +770,7 @@ static // VE if (!iV) { - iVE=myContext.ComputeVE (aV11, aE2, aTE); + iVE=myContext->ComputeVE (aV11, aE2, aTE); if (!iVE) { iCount++; if (iCount>iCountExt) { @@ -803,7 +801,7 @@ static // VE if (!iV) { // - iVE=myContext.ComputeVE (aV12, aE2, aTE); + iVE=myContext->ComputeVE (aV12, aE2, aTE); // if (!iVE) { iCount++; @@ -850,7 +848,7 @@ static nE2=aPBR.Edge(); const TopoDS_Edge& aE2=TopoDS::Edge(myDS->GetShape(nE2)); // VE - iVM=myContext.ComputeVE(aVM, aE2, aTmp); + iVM=myContext->ComputeVE(aVM, aE2, aTmp); // return iVM; } @@ -887,13 +885,13 @@ static TopoDS_Face aF1=TopoDS::Face(myDS->GetShape(nF1)); TopoDS_Face aF2=TopoDS::Face(myDS->GetShape(nF2)); // - bVF=myContext.IsValidPointForFaces (aP1, aF1, aF2, aTolR3D); + bVF=myContext->IsValidPointForFaces (aP1, aF1, aF2, aTolR3D); // if (bVF) { PutBoundPaveOnCurve (aP1, aT1, aBC, aFFi); } // - bVF=myContext.IsValidPointForFaces (aP2, aF1, aF2, aTolR3D); + bVF=myContext->IsValidPointForFaces (aP2, aF1, aF2, aTolR3D); // if (bVF) { PutBoundPaveOnCurve (aP2, aT2, aBC, aFFi); @@ -992,13 +990,13 @@ static TopoDS_Face aF1=TopoDS::Face(myDS->GetShape(nF1)); TopoDS_Face aF2=TopoDS::Face(myDS->GetShape(nF2)); // - bVF=myContext.IsValidPointForFaces (aP1, aF1, aF2, aTolR3D); + bVF=myContext->IsValidPointForFaces (aP1, aF1, aF2, aTolR3D); // if (bVF) { PutBoundPaveOnCurveSpec (aP1, aT1, aBC, aFFi); } // - bVF=myContext.IsValidPointForFaces (aP2, aF1, aF2, aTolR3D); + bVF=myContext->IsValidPointForFaces (aP2, aF1, aF2, aTolR3D); // if (bVF) { PutBoundPaveOnCurveSpec (aP2, aT2, aBC, aFFi); @@ -1068,7 +1066,7 @@ static if(!aMap.Add(anE)) continue; anErrStat = - myContext.ComputeVE(aNewVertex, TopoDS::Edge(anE), aPar); + myContext->ComputeVE(aNewVertex, TopoDS::Edge(anE), aPar); if(anErrStat) continue; // Standard_Real aT1, aT2; @@ -1080,7 +1078,7 @@ static TopoDS_Vertex aNewVertex1; BOPTools_Tools::MakeNewVertex(aP1, aTolV, aNewVertex1); anErrStat = - myContext.ComputeVE(aNewVertex1, TopoDS::Edge(anE), aT1); + myContext->ComputeVE(aNewVertex1, TopoDS::Edge(anE), aT1); if(!anErrStat) continue; //curve and edge seem to be coincide aWhat = nV; @@ -1116,7 +1114,7 @@ static if(!aMap.Add(anE)) continue; anErrStat = - myContext.ComputeVE(aNewVertex, TopoDS::Edge(anE), aPar); + myContext->ComputeVE(aNewVertex, TopoDS::Edge(anE), aPar); if(anErrStat) continue; // Standard_Real aT1, aT2; @@ -1128,7 +1126,7 @@ static TopoDS_Vertex aNewVertex1; BOPTools_Tools::MakeNewVertex(aP1, aTolV, aNewVertex1); anErrStat = - myContext.ComputeVE(aNewVertex1, TopoDS::Edge(anE), aT1); + myContext->ComputeVE(aNewVertex1, TopoDS::Edge(anE), aT1); if(!anErrStat) continue; //curve and edge seem to be coincide aWhat = nV; @@ -1355,7 +1353,7 @@ static // aTolVExt=BRep_Tool::Tolerance(aV); ExtendedTolerance(nV, aTolVExt); - bIsVertexOnLine=myContext.IsVertexOnLine(aV, aTolVExt, aC, aTolR3D, aT); + bIsVertexOnLine=myContext->IsVertexOnLine(aV, aTolVExt, aC, aTolR3D, aT); // if (bIsVertexOnLine) { BOPTools_Pave aPaveNew(nV, aT, BooleanOperations_SurfaceSurface); @@ -1553,13 +1551,11 @@ static } } // - //modified by NIZNHY-PKV Thu Oct 20 07:14:32 2011f // Put closing pave if needded for (j=1; j<=aNbCurves; ++j) { BOPTools_Curve& aBC=aSCvs(j); PutClosingPaveOnCurve (aBC, aFFi); } - //modified by NIZNHY-PKV Thu Oct 20 07:14:34 2011t // // xxx for (j=1; j<=aNbCurves; j++) { @@ -1942,21 +1938,19 @@ void ProcessAloneStickVertices(const Standard_Integer nF1, UnUsedMap(aSCvs, aPSF, aMapUnUsed); aNbVtx=aMapUnUsed.Extent(); if (aNbVtx) { - IntTools_Context& aCtx=aPF.ChangeContext(); + const Handle(IntTools_Context)& aCtx=aPF.Context(); // aNbSCvs=aSCvs.Length(); if (aNbSCvs==1) { BOPTools_Curve& aBC=aSCvs(1); const IntTools_Curve& aIC=aBC.Curve(); Handle (Geom_Curve) aC3D= aIC.Curve(); - //modified by NIZNHY-PKV Wed Nov 02 13:33:42 2011f // bIsClosed=IntTools_Tools::IsClosed(aC3D); if (bIsClosed) { return; } - //modified by NIZNHY-PKV Wed Nov 02 13:33:44 2011t - GeomAPI_ProjectPointOnCurve& aProjPT=aCtx.ProjPT(aC3D); + GeomAPI_ProjectPointOnCurve& aProjPT=aCtx->ProjPT(aC3D); // for (jx=1; jx<=aNbVtx; ++jx) { nV=aMapUnUsed(jx); @@ -2384,8 +2378,8 @@ Standard_Boolean IsPairFound(const Standard_Integer nF1, TopoDS_Face anOtherFace = TopoDS::Face(atmpShape); gp_Pnt aP3d = aCurve->Value(t2); - if(myContext.IsPointInOnFace(TopoDS::Face(aFace), aP2dOnFace) && - myContext.IsValidPointForFace(aP3d, anOtherFace, BRep_Tool::Tolerance(anEdge))) { + if(myContext->IsPointInOnFace(TopoDS::Face(aFace), aP2dOnFace) && + myContext->IsValidPointForFace(aP3d, anOtherFace, BRep_Tool::Tolerance(anEdge))) { BOPTools_Pave aPave1; aPave1.SetParam(t1); aPave1.SetIndex(-1); @@ -2441,7 +2435,7 @@ Standard_Boolean IsPairFound(const Standard_Integer nF1, TopoDS_Shape aOppFace = myDS->Shape(nFOpposite); if(!bHasCBOnFace && !bFaceCBFound && - myContext.IsValidPointForFace(aPMid, TopoDS::Face(aOppFace), + myContext->IsValidPointForFace(aPMid, TopoDS::Face(aOppFace), BRep_Tool::Tolerance(anEdge) + BRep_Tool::Tolerance(TopoDS::Face(aOppFace)))) { bFaceCBFound = Standard_True; @@ -2457,7 +2451,7 @@ Standard_Boolean IsPairFound(const Standard_Integer nF1, TopoDS_Shape aTmpEdge = anExpE.Current(); Standard_Real aParameter = 0.; - if(myContext.ComputeVE(aVMid, TopoDS::Edge(aTmpEdge), aParameter) == 0) { + if(myContext->ComputeVE(aVMid, TopoDS::Edge(aTmpEdge), aParameter) == 0) { bEdgeCBFound = Standard_True; break; } @@ -2516,7 +2510,7 @@ Standard_Boolean IsPairFound(const Standard_Integer nF1, Standard_Boolean bAddNewVertextmp = bAddNewVertex, bAddOldVertextmp = bAddOldVertex; if(!CheckNewVertexAndUpdateData(aNewVertex, aPaveOnEdge.Param(), anEdge, aPaveOnCurve.Param(), - nF1, nF2, theTolerance, myIntrPool, myDS, &myContext, aPS, + nF1, nF2, theTolerance, myIntrPool, myDS, myContext, aPS, bAddNewVertextmp, bAddOldVertextmp, theBC, aPaveToPut, bAddNewVertex, bAddOldVertex)) { bAddNewVertex = Standard_False; @@ -2653,7 +2647,7 @@ Standard_Boolean IsPairFound(const Standard_Integer nF1, TopoDS_Edge anOppEdge = TopoDS::Edge(myDS->Shape(anOppIndex)); Standard_Real aOppParameter = 0.; - if(myContext.ComputeVE(aNewVertex, anOppEdge, aOppParameter) == 0) { + if(myContext->ComputeVE(aNewVertex, anOppEdge, aOppParameter) == 0) { if((aOppParameter > aRange.First()) && (aOppParameter < aRange.Last())) { // put pave on same domain edge. begin @@ -2766,7 +2760,7 @@ Standard_Boolean IsPairFound(const Standard_Integer nF1, BRep_Builder aBB; aBB.MakeVertex(aTestpVertex, aMidPnt, BRep_Tool::Tolerance(anEdge)); - if(myContext.ComputeVE(aTestpVertex, aOppEdge, aProjPar) == 0) { + if(myContext->ComputeVE(aTestpVertex, aOppEdge, aProjPar) == 0) { if(aProjPar > aCurRange2.First() && aProjPar < aCurRange2.Last()) { if(!bReverse) aNewCB.SetPaveBlock2(aPBCurrent2); @@ -2834,7 +2828,7 @@ Standard_Boolean CheckNewVertexAndUpdateData(const TopoDS_Vertex& t const Standard_Real theTolerance, const BOPTools_PInterferencePool& theIntrPool, const BooleanOperations_PShapesDataStructure& theDS, - IntTools_Context* theContext, + const Handle(IntTools_Context)& theContext, const BOPTools_PaveSet& theEdgePaveSet, const Standard_Boolean bAddNewVertex, const Standard_Boolean bAddOldVertex, @@ -2884,7 +2878,7 @@ Standard_Boolean CheckNewVertexAndUpdateData(const TopoDS_Vertex& t Standard_Boolean bUpdateVertex = Standard_True; if(ptest1.Distance(ptest2) > (BRep_Tool::Tolerance(aVertex) + BRep_Tool::Tolerance(theEdge))) { - IntTools_ShrunkRange aSR (theEdge, aV1, aV2, aRange, *theContext); + IntTools_ShrunkRange aSR (theEdge, aV1, aV2, aRange, theContext); bUpdateVertex = !aSR.IsDone() || (aSR.ErrorStatus() != 0); } @@ -3135,21 +3129,11 @@ Standard_Boolean RejectPaveBlock(const IntTools_Curve& theC, aC->D0(p1,pntf); aC->D0(p2,pntl); // - //modified by NIZNHY-PKV Thu Oct 20 09:13:45 2011f - // aRT2=theRT*theRT; d3d2 = pntf.SquareDistance(pntl); if(d3d2 > aRT2) { theRT=sqrt(d3d2); } - // - /* - Standard_Real d3d = pntf.Distance(pntl); - if(d3d > theRT) { - theRT = d3d; - } - */ - //modified by NIZNHY-PKV Thu Oct 20 09:15:20 2011t } return Standard_True; } @@ -3306,7 +3290,7 @@ void CorrectTolR3D(BOPTools_PaveFiller& aPF, TopoDS_Face aF[2]; // BooleanOperations_PShapesDataStructure myDS=aPF.DS(); - IntTools_Context& myContext=aPF.ChangeContext(); + const Handle(IntTools_Context)& myContext=aPF.Context(); // aTolTresh=0.0005; aAmin=0.012;// 0.7-7 deg @@ -3347,7 +3331,7 @@ void CorrectTolR3D(BOPTools_PaveFiller& aPF, aC3D->D0(aT, aP); // for (i=0; i<2; ++i) { - GeomAPI_ProjectPointOnSurf& aPPS=myContext.ProjPS(aF[i]); + GeomAPI_ProjectPointOnSurf& aPPS=myContext->ProjPS(aF[i]); aPPS.Perform(aP); aPPS.LowerDistanceParameters(aU, aV); BOPTools_Tools3D::GetNormalToSurface(aS[i], aU, aV, aDN[i]); @@ -3379,7 +3363,6 @@ void CorrectTolR3D(BOPTools_PaveFiller& aPF, aTolR3D=aTolR; } } -//modified by NIZNHY-PKV Thu Oct 20 07:18:39 2011f //======================================================================= // function: PutClosingPaveOnCurve // purpose: @@ -3441,4 +3424,3 @@ void BOPTools_PaveFiller::PutClosingPaveOnCurve(BOPTools_Curve& aBC, } } } -//modified by NIZNHY-PKV Thu Oct 20 07:18:42 2011t diff --git a/src/BOPTools/BOPTools_StateFiller.cxx b/src/BOPTools/BOPTools_StateFiller.cxx index 47983aca81..27fe9b6cb2 100755 --- a/src/BOPTools/BOPTools_StateFiller.cxx +++ b/src/BOPTools/BOPTools_StateFiller.cxx @@ -204,12 +204,12 @@ gp_Pnt aP3d = aSurf->Value(aParU, aParV); const TopoDS_Solid &aRefSolid = TopoDS::Solid(aRef); - IntTools_Context &aContext = myFiller->ChangeContext(); - BRepClass3d_SolidClassifier &aSC = - aContext.SolidClassifier(aRefSolid); - // + const Handle(IntTools_Context)& aContext = myFiller->Context(); + BRepClass3d_SolidClassifier &aSC = + aContext->SolidClassifier(aRefSolid); + // aSC.Perform(aP3d, 1e-7); - // + // aSt = aSC.State(); } } @@ -264,8 +264,8 @@ } // const TopoDS_Solid& aRefSolid=TopoDS::Solid(Ref); - IntTools_Context& aContext=myFiller->ChangeContext(); - BRepClass3d_SolidClassifier& aSC=aContext.SolidClassifier(aRefSolid); + const Handle(IntTools_Context)& aContext=myFiller->Context(); + BRepClass3d_SolidClassifier& aSC=aContext->SolidClassifier(aRefSolid); // aSC.Perform(aP3d, 1e-7); // diff --git a/src/BOPTools/BOPTools_Tools.cdl b/src/BOPTools/BOPTools_Tools.cdl index 5de910415d..68f03d6602 100755 --- a/src/BOPTools/BOPTools_Tools.cdl +++ b/src/BOPTools/BOPTools_Tools.cdl @@ -130,7 +130,7 @@ is IsBlockInOnFace(myclass; aPB : PaveBlock from BOPTools; aF : Face from TopoDS; - aContext:out Context from IntTools) + aContext: Context from IntTools) returns Boolean from Standard; ---Purpose: --- Returns TRUE if PaveBlock lays on the face , i.e diff --git a/src/BOPTools/BOPTools_Tools.cxx b/src/BOPTools/BOPTools_Tools.cxx index fc8bf78b57..dff8d088d0 100755 --- a/src/BOPTools/BOPTools_Tools.cxx +++ b/src/BOPTools/BOPTools_Tools.cxx @@ -52,7 +52,7 @@ static //======================================================================= Standard_Boolean BOPTools_Tools::IsBlockInOnFace (const BOPTools_PaveBlock& aPB1, const TopoDS_Face& aF, - IntTools_Context& aContext) + const Handle(IntTools_Context)& aContext) { Standard_Boolean bFlag; Standard_Real f1, l1, ULD, VLD; @@ -74,7 +74,7 @@ static // Treatment P11 BOPTools_Tools::PointOnEdge(aE1, f1, aP11); // - GeomAPI_ProjectPointOnSurf& aProjector=aContext.ProjPS(aF); + GeomAPI_ProjectPointOnSurf& aProjector=aContext->ProjPS(aF); aProjector.Perform(aP11); // bFlag=aProjector.IsDone(); @@ -85,7 +85,7 @@ static aProjector.LowerDistanceParameters(ULD, VLD); aP2D.SetCoord(ULD, VLD); // - bFlag=aContext.IsPointInOnFace (aF, aP2D); + bFlag=aContext->IsPointInOnFace (aF, aP2D); // if (!bFlag) { return bFlag; @@ -104,7 +104,7 @@ static aProjector.LowerDistanceParameters(ULD, VLD); aP2D.SetCoord(ULD, VLD); // - bFlag=aContext.IsPointInOnFace (aF, aP2D); + bFlag=aContext->IsPointInOnFace (aF, aP2D); // if (!bFlag) { return bFlag; @@ -133,7 +133,7 @@ static aProjector.LowerDistanceParameters(ULD, VLD); aP2D.SetCoord(ULD, VLD); // - bFlag=aContext.IsPointInOnFace (aF, aP2D); + bFlag=aContext->IsPointInOnFace (aF, aP2D); // if (!bFlag) { return bFlag; diff --git a/src/BOPTools/BOPTools_Tools3D.cdl b/src/BOPTools/BOPTools_Tools3D.cdl index 493fd08ca7..88b03428ad 100755 --- a/src/BOPTools/BOPTools_Tools3D.cdl +++ b/src/BOPTools/BOPTools_Tools3D.cdl @@ -55,13 +55,13 @@ is RemoveSims (myclass; aF: Face from TopoDS; - aContext:out Context from IntTools); + aContext: Context from IntTools); ---Purpose: -- Remove seam edges from face -- RemoveSims (myclass; aS: Shape from TopoDS; - aContext:out Context from IntTools); + aContext: Context from IntTools); ---Purpose: -- Remove seam edges from all faces of shape -- @@ -78,7 +78,7 @@ is IsSplitToReverse1 (myclass; aE1: Edge from TopoDS; aE2: Edge from TopoDS; - aContext:out Context from IntTools) + aContext: Context from IntTools) returns Boolean from Standard; ---Purpose: -- Returns TRUE if direction of the edge is not @@ -225,7 +225,7 @@ is aE1 : Edge from TopoDS; aF1 : Face from TopoDS; aST1:out State from TopAbs; - aContext:out Context from IntTools); + aContext: Context from IntTools); ---Purpose: --- Internal usage --- @@ -308,7 +308,7 @@ is aP2: Pnt from gp; aF: Face from TopoDS; aPx:out Pnt from gp; - aContext:out Context from IntTools); + aContext: Context from IntTools); ---Purpose: --- For 3D-point find projection point on the face . --- If the distance (, ) > TolF => @@ -321,7 +321,7 @@ is aF1 : Face from TopoDS; aF2 : Face from TopoDS; aST:out State from TopAbs; - aContext:out Context from IntTools); + aContext: Context from IntTools); ---Purpose: --- Compute 3D-state for the point on the split edge --- (with base edge and the face ) comparing with @@ -408,7 +408,7 @@ is aEF1 :Edge from TopoDS; aF1 :Face from TopoDS; aF2 :Face from TopoDS; - aContext:out Context from IntTools) + aContext: Context from IntTools) returns State from TopAbs; ---Purpose: --- Used in touch case @@ -419,12 +419,12 @@ is --- CheckSameDomainFaceInside(myclass; theFace1: Face from TopoDS; theFace2: Face from TopoDS; - theContext: in out Context from IntTools) + theContext: Context from IntTools) returns Boolean from Standard; ComputeFaceState(myclass; theFace: Face from TopoDS; theRef : Solid from TopoDS; - theContext: in out Context from IntTools; + theContext: Context from IntTools; theState: out State from TopAbs) returns Boolean from Standard; @@ -437,7 +437,7 @@ is aTolTangent:Real from Standard; aTolRadius :Real from Standard; aState :out State from TopAbs; - aContext:out Context from IntTools) + aContext: Context from IntTools) returns Boolean from Standard; TreatedAsAnalytic (myclass; aFx :Face from TopoDS; @@ -446,7 +446,7 @@ is aTolTangent:Real from Standard; aTolRadius :Real from Standard; aState :out State from TopAbs; - aContext:out Context from IntTools) + aContext: Context from IntTools) returns Boolean from Standard; HasAnalyticSurfaceType (myclass; aF: Face from TopoDS) diff --git a/src/BOPTools/BOPTools_Tools3D.cxx b/src/BOPTools/BOPTools_Tools3D.cxx index a0a33922ea..80b0aa7804 100755 --- a/src/BOPTools/BOPTools_Tools3D.cxx +++ b/src/BOPTools/BOPTools_Tools3D.cxx @@ -72,7 +72,7 @@ static Standard_Boolean CheckKeepArguments(const TopoDS_Face& F1, //purpose : //======================================================================= void BOPTools_Tools3D::RemoveSims (const TopoDS_Shape& aS, - IntTools_Context& aContext) + const Handle(IntTools_Context)& aContext) { TopExp_Explorer anExp(aS, TopAbs_FACE); for (; anExp.More(); anExp.Next()) { @@ -87,7 +87,7 @@ static Standard_Boolean CheckKeepArguments(const TopoDS_Face& F1, //purpose : //======================================================================= void BOPTools_Tools3D::RemoveSims (const TopoDS_Face& aFF, - IntTools_Context& aContext) + const Handle(IntTools_Context)& aContext) { Standard_Boolean anIsClosed, anIsPointInFace1, anIsPointInFace2; Standard_Real aT1, aT2, aT, aX, aY, dt=1.e-7, aTol; @@ -139,12 +139,12 @@ static Standard_Boolean CheckKeepArguments(const TopoDS_Face& F1, aP2Dx.SetX(aP2D.X()+dt*aV2Dx.X()); aP2Dx.SetY(aP2D.Y()+dt*aV2Dx.Y()); // - anIsPointInFace1=aContext.IsPointInFace(aF, aP2Dx); + anIsPointInFace1=aContext->IsPointInFace(aF, aP2Dx); // aP2Dx.SetX(aP2D.X()-dt*aV2Dx.X()); aP2Dx.SetY(aP2D.Y()-dt*aV2Dx.Y()); // - anIsPointInFace2=aContext.IsPointInFace(aF, aP2Dx); + anIsPointInFace2=aContext->IsPointInFace(aF, aP2Dx); // if (anIsPointInFace1 && anIsPointInFace2) { @@ -475,7 +475,7 @@ Standard_Boolean BOPTools_Tools3D::DoSplitSEAMOnFace(const TopoDS_Edge& theSplit //======================================================================= Standard_Boolean BOPTools_Tools3D::IsSplitToReverse1 (const TopoDS_Edge& aEF1, const TopoDS_Edge& aEF2, - IntTools_Context& aContext) + const Handle(IntTools_Context)& aContext) { Standard_Boolean aFlag; Standard_Real aT1, aT2, aScPr, a, b; @@ -494,7 +494,7 @@ Standard_Boolean BOPTools_Tools3D::DoSplitSEAMOnFace(const TopoDS_Edge& theSplit gp_Dir aDT1(aV1); // - aFlag=aContext.ProjectPointOnEdge(aP, aEF2, aT2); + aFlag=aContext->ProjectPointOnEdge(aP, aEF2, aT2); // aFlag=BOPTools_Tools2D::EdgeTangent(aEF2, aT2, aV2); if(!aFlag) { @@ -940,7 +940,7 @@ static void GetApproxNormalToFaceOnEdgeEx(const TopoDS_Edge& aE, const TopoDS_Edge& anE1, const TopoDS_Face& aF1, TopAbs_State& aStPF1, - IntTools_Context& aContext) + const Handle(IntTools_Context)& aContext) { Standard_Boolean bIsAdjExists; @@ -1008,14 +1008,14 @@ static void GetApproxNormalToFaceOnEdgeEx(const TopoDS_Edge& aE, BOPTools_Tools3D::GetApproxNormalToFaceOnEdge (aSpxSimm, aFx1, aT, aPx2, aDNFx2); } - aContext.ProjectPointOnEdge(aPx, anE1, aT1); + aContext->ProjectPointOnEdge(aPx, anE1, aT1); PointNearE (anE1, aF1, aT1, aPF1, aMoreShift); } else {// if (bIsAdjExists) BOPTools_Tools3D::GetApproxNormalToFaceOnEdge (aSpxSimm, aFx2, aT, aPx2, aDNFx2); // - aContext.ProjectPointOnEdge(aPx, anE1, aT1); + aContext->ProjectPointOnEdge(aPx, anE1, aT1); PointNearE (anE1, aF1, aT1, aPF1, aMoreShift); } diff --git a/src/BOPTools/BOPTools_Tools3D_1.cxx b/src/BOPTools/BOPTools_Tools3D_1.cxx index 72f0fcbe73..1e22b5d14b 100755 --- a/src/BOPTools/BOPTools_Tools3D_1.cxx +++ b/src/BOPTools/BOPTools_Tools3D_1.cxx @@ -196,7 +196,7 @@ const gp_Pnt& aP2, const TopoDS_Face& aF, gp_Pnt& aPF, - IntTools_Context& aContext) + const Handle(IntTools_Context)& aContext) { Standard_Boolean bFlag; Standard_Real aD, aTolF, U, V; @@ -205,7 +205,7 @@ aTolF=BRep_Tool::Tolerance(aF); // - GeomAPI_ProjectPointOnSurf& aProjector=aContext.ProjPS(aF); + GeomAPI_ProjectPointOnSurf& aProjector=aContext->ProjPS(aF); // aProjector.Perform(aP1); // @@ -245,7 +245,7 @@ const TopoDS_Face& aF1, const TopoDS_Face& aF2, TopAbs_State& aStPF, - IntTools_Context& aContext) + const Handle(IntTools_Context)& aContext) { Standard_Real aT1, aT2, aT, aTolF2, aDt2D; gp_Pnt2d aPx2DNear; @@ -284,7 +284,7 @@ // //-- EJG - Standard_Boolean isIn = aContext.IsPointInFace(aF1,aPx2DNear); + Standard_Boolean isIn = aContext->IsPointInFace(aF1,aPx2DNear); if( !isIn ) { Standard_Real aEF1Tol = BRep_Tool::Tolerance(aEF1); Standard_Real aF1Tol = BRep_Tool::Tolerance(aF1); @@ -311,7 +311,7 @@ Standard_Boolean bFlag; Standard_Real aD, U, V; // - GeomAPI_ProjectPointOnSurf& aProjector=aContext.ProjPS(aF2); + GeomAPI_ProjectPointOnSurf& aProjector=aContext->ProjPS(aF2); // Handle(Geom_Surface) aS2=BRep_Tool::Surface(aF2); // @@ -784,7 +784,7 @@ void Add(const TopoDS_Shape& aS, const TopoDS_Edge& aEF1, const TopoDS_Face& aF1, const TopoDS_Face& aF2, - IntTools_Context& aContext) + const Handle(IntTools_Context)& aContext) { gp_Dir aDBF1, aDNF2; TopAbs_State aStPF; @@ -836,7 +836,7 @@ void Add(const TopoDS_Shape& aS, // =========================================================================================== Standard_Boolean BOPTools_Tools3D::ComputeFaceState(const TopoDS_Face& theFace, const TopoDS_Solid& theRef, - IntTools_Context& theContext, + const Handle(IntTools_Context)& theContext, TopAbs_State& theState) { TopAbs_State aState = TopAbs_ON; @@ -852,7 +852,7 @@ Standard_Boolean BOPTools_Tools3D::ComputeFaceState(const TopoDS_Face& theFace, Standard_Real U = umin + adeltau; Standard_Boolean bFoundValidPoint = Standard_False; Standard_Boolean bFoundInFacePoint = Standard_False; - BRepClass3d_SolidClassifier& aSolidClassifier = theContext.SolidClassifier(theRef); + BRepClass3d_SolidClassifier& aSolidClassifier = theContext->SolidClassifier(theRef); Standard_Integer i = 0, j = 0; for(i = 1; !bFoundValidPoint && (i <= nbpoints); i++, U+=adeltau) { @@ -861,7 +861,7 @@ Standard_Boolean BOPTools_Tools3D::ComputeFaceState(const TopoDS_Face& theFace, for(j = 1; !bFoundValidPoint && (j <= nbpoints); j++, V+=adeltav) { gp_Pnt2d aPoint(U,V); - if(theContext.IsPointInFace(theFace, aPoint)) { + if(theContext->IsPointInFace(theFace, aPoint)) { bFoundInFacePoint = Standard_True; gp_Pnt aP3d = aSurface->Value(U, V); @@ -896,7 +896,7 @@ Standard_Boolean BOPTools_Tools3D::ComputeFaceState(const TopoDS_Face& theFace, for(j = 1; !bFoundValidPoint && (j <= nbpoints); j++, V+=adeltav) { gp_Pnt2d aPoint(U,V); - if(theContext.IsPointInOnFace(theFace, aPoint)) { + if(theContext->IsPointInOnFace(theFace, aPoint)) { bFoundInFacePoint = Standard_True; gp_Pnt aP3d = aSurface->Value(U, V); @@ -909,7 +909,7 @@ Standard_Boolean BOPTools_Tools3D::ComputeFaceState(const TopoDS_Face& theFace, TopoDS_Face aFace2 = aSolidClassifier.Face(); if(!aFace2.IsNull()) { - GeomAPI_ProjectPointOnSurf& aProjector = theContext.ProjPS(aFace2); + GeomAPI_ProjectPointOnSurf& aProjector = theContext->ProjPS(aFace2); aProjector.Perform(aP3d); if(aProjector.IsDone()) { @@ -918,7 +918,7 @@ Standard_Boolean BOPTools_Tools3D::ComputeFaceState(const TopoDS_Face& theFace, gp_Pnt2d aPoint2(U2, V2); if(aProjector.LowerDistance() < aTolerance) { - if(theContext.IsPointInFace(aFace2, aPoint2)) + if(theContext->IsPointInFace(aFace2, aPoint2)) aState = TopAbs_ON; } } @@ -950,7 +950,7 @@ Standard_Boolean BOPTools_Tools3D::ComputeFaceState(const TopoDS_Face& theFace, // =========================================================================================== Standard_Boolean BOPTools_Tools3D::CheckSameDomainFaceInside(const TopoDS_Face& theFace1, const TopoDS_Face& theFace2, - IntTools_Context& theContext) + const Handle(IntTools_Context)& theContext) { Standard_Boolean bFoundON, bPointInFace; Standard_Integer nbpoints, i, j; @@ -976,14 +976,14 @@ Standard_Boolean BOPTools_Tools3D::CheckSameDomainFaceInside(const TopoDS_Face& adeltav=(vmax - vmin) / (nbpoints + 1); bFoundON = Standard_False; // - GeomAPI_ProjectPointOnSurf& aProjector = theContext.ProjPS(theFace2); + GeomAPI_ProjectPointOnSurf& aProjector = theContext->ProjPS(theFace2); // for(i=1; i<=nbpoints; ++i){ U=umin+i*adeltau; for(j=1; j<=nbpoints; ++j) { V=vmin+j*adeltav; aP2D.SetCoord(U,V); - bPointInFace=theContext.IsPointInFace(theFace1, aP2D); + bPointInFace=theContext->IsPointInFace(theFace1, aP2D); if(bPointInFace) { aP3D=aS1->Value(U, V); aProjector.Perform(aP3D); @@ -996,7 +996,7 @@ Standard_Boolean BOPTools_Tools3D::CheckSameDomainFaceInside(const TopoDS_Face& return Standard_False; } // - bPointInFace=theContext.IsPointInFace(theFace2, aP2D); + bPointInFace=theContext->IsPointInFace(theFace2, aP2D); if (bPointInFace) { bFoundON = Standard_True; } diff --git a/src/BOPTools/BOPTools_Tools3D_2.cxx b/src/BOPTools/BOPTools_Tools3D_2.cxx index d720480e76..c96b817d82 100755 --- a/src/BOPTools/BOPTools_Tools3D_2.cxx +++ b/src/BOPTools/BOPTools_Tools3D_2.cxx @@ -44,7 +44,7 @@ static const Standard_Real aTolTangent, const Standard_Real aTolR, TopAbs_State& aSt, - IntTools_Context& ) + const Handle(IntTools_Context)& ) { Standard_Boolean bFlag, bIsAnalytic, bIsDirsCoinside; Standard_Real aT1, aTb, aTe; @@ -92,7 +92,7 @@ static const Standard_Real aTolTangent, const Standard_Real aTolR, TopAbs_State& aSt, - IntTools_Context& aContext) + const Handle(IntTools_Context)& aContext) { Standard_Boolean bFlag, bIsAnalytic, bIsDirsCoinside; Standard_Real aT1; @@ -110,7 +110,7 @@ static } // BOPTools_Tools3D::GetNormalToFaceOnEdge(anEx, aFx, aTx, aDNSx); - aContext.ProjectPointOnEdge(aPx, anE1, aT1); + aContext->ProjectPointOnEdge(aPx, anE1, aT1); BOPTools_Tools3D::GetNormalToFaceOnEdge(anE1, aF1, aT1, aDNS1); // bIsDirsCoinside=IntTools_Tools::IsDirsCoinside(aDNSx, aDNS1, aTolTangent); diff --git a/src/IntTools/IntTools.cdl b/src/IntTools/IntTools.cdl index 684a01f3f4..488e77fdbd 100755 --- a/src/IntTools/IntTools.cdl +++ b/src/IntTools/IntTools.cdl @@ -32,7 +32,8 @@ uses IntPatch, IntSurf, BRepClass3d, - TColgp + TColgp, + MMgt is @@ -59,7 +60,6 @@ is class MarkedRangeSet; ---Purpose: auxiliary class for range management ---modified by NIZHNY-MKK Wed Oct 5 18:08:38 2005.BEGIN class BaseRangeSample; ---Purpose: base class for range index management @@ -72,7 +72,6 @@ is class CurveRangeLocalizeData; class SurfaceRangeLocalizeData; ---modified by NIZHNY-MKK Wed Oct 5 18:08:43 2005.END class BeanFaceIntersector; ---Purpose: class provides computing ranges of parameters @@ -115,7 +114,7 @@ is --- --- P o i n t e r s --- - pointer PContext to Context from IntTools; + --pointer PContext to Context from IntTools; --- --- I n s t a n t i a t i o n s --- diff --git a/src/IntTools/IntTools_BeanFaceIntersector.cdl b/src/IntTools/IntTools_BeanFaceIntersector.cdl index ff55d15b38..fb3c6df8f0 100755 --- a/src/IntTools/IntTools_BeanFaceIntersector.cdl +++ b/src/IntTools/IntTools_BeanFaceIntersector.cdl @@ -19,7 +19,7 @@ uses SequenceOfRoots from IntTools, MarkedRangeSet from IntTools, SequenceOfRanges from IntTools, - PContext from IntTools, + Context from IntTools, ExtCS from Extrema, ProjectPointOnSurf from GeomAPI, Edge from TopoDS, @@ -113,11 +113,17 @@ is --- optimization purposes --- - SetContext(me: in out; theContext: PContext from IntTools); + SetContext(me: in out; + theContext: Context from IntTools); ---Purpose: - --- Sets the context + --- Sets the intersecton context --- - + Context(me) + returns Context from IntTools; + ---C++: return const & + ---Purpose: + --- Gets the intersecton context + --- SetBeanParameters(me: in out;theFirstParOnCurve : Real from Standard; theLastParOnCurve : Real from Standard); ---Purpose: @@ -227,7 +233,7 @@ fields myProjector : ProjectPointOnSurf from GeomAPI; myRangeManager : MarkedRangeSet from IntTools; myDeflection : Real from Standard; - myContext : PContext from IntTools; + myContext : Context from IntTools; -- results myResults : SequenceOfRanges from IntTools; diff --git a/src/IntTools/IntTools_BeanFaceIntersector.cxx b/src/IntTools/IntTools_BeanFaceIntersector.cxx index 9276e5b1bf..b4a70b26c6 100755 --- a/src/IntTools/IntTools_BeanFaceIntersector.cxx +++ b/src/IntTools/IntTools_BeanFaceIntersector.cxx @@ -120,7 +120,7 @@ myIsDone(Standard_False) { myCriteria = Precision::Confusion(); myCurveResolution = Precision::PConfusion(); - myContext = NULL; + } // ================================================================================== @@ -140,7 +140,6 @@ myFaceTolerance(0.), myDeflection(0.01), myIsDone(Standard_False) { - myContext = NULL; Init(theEdge, theFace); } @@ -161,7 +160,6 @@ myVMaxParameter(0.), myDeflection(0.01), myIsDone(Standard_False) { - myContext = NULL; Init(theCurve, theSurface, theBeanTolerance, theFaceTolerance); } @@ -197,7 +195,6 @@ myIsDone(Standard_False) mySurface = theSurface; myTrsfSurface = Handle(Geom_Surface)::DownCast(mySurface.Surface().Surface()->Transformed(mySurface.Trsf())); - myContext = NULL; } // ================================================================================== @@ -219,7 +216,6 @@ void IntTools_BeanFaceIntersector::Init(const TopoDS_Edge& theEdge, SetSurfaceParameters(mySurface.FirstUParameter(), mySurface.LastUParameter(), mySurface.FirstVParameter(), mySurface.LastVParameter()); myResults.Clear(); - myContext = NULL; } // ================================================================================== @@ -243,7 +239,6 @@ void IntTools_BeanFaceIntersector::Init(const BRepAdaptor_Curve& theCurve, SetSurfaceParameters(mySurface.FirstUParameter(), mySurface.LastUParameter(), mySurface.FirstVParameter(), mySurface.LastVParameter()); myResults.Clear(); - myContext = NULL; } // ================================================================================== @@ -264,17 +259,24 @@ void IntTools_BeanFaceIntersector::Init(const BRepAdaptor_Curve& theCurve, Init(theCurve, theSurface, theBeanTolerance, theFaceTolerance); SetBeanParameters(theFirstParOnCurve, theLastParOnCurve); SetSurfaceParameters(theUMinParameter, theUMaxParameter, theVMinParameter, theVMaxParameter); - myContext = NULL; } // ================================================================================== // function: SetContext // purpose: // ================================================================================== -void IntTools_BeanFaceIntersector::SetContext(const IntTools_PContext& theContext) +void IntTools_BeanFaceIntersector::SetContext(const Handle(IntTools_Context)& theContext) { myContext = theContext; } +// ================================================================================== +// function: Context +// purpose: +// ================================================================================== +const Handle(IntTools_Context)& IntTools_BeanFaceIntersector::Context()const +{ + return myContext; +} // ================================================================================== // function: SetBeanParameters @@ -314,7 +316,11 @@ void IntTools_BeanFaceIntersector::Perform() Standard_Integer aDiscretization = 30; // corresponds to discretization of BSpline usually approximated by 30 points. Standard_Real aRelativeDeflection = 0.01; myDeflection = aRelativeDeflection; - + // + if (myContext.IsNull()) { + myContext=new IntTools_Context; + } + // if(myCurve.GetType()==GeomAbs_Line && mySurface.GetType()==GeomAbs_Plane) { ComputeLinePlane(); return; @@ -455,20 +461,11 @@ Standard_Real IntTools_BeanFaceIntersector::Distance(const Standard_Real theArg) { gp_Pnt aPoint = myCurve.Value(theArg); - if(myContext == NULL) { - myProjector.Init(aPoint, myTrsfSurface, myUMinParameter, myUMaxParameter, - myVMinParameter, myVMaxParameter, 1.e-10); - if(myProjector.IsDone() && myProjector.NbPoints() > 0) { - return myProjector.LowerDistance(); - } - } - else { - GeomAPI_ProjectPointOnSurf& aProjector = myContext->ProjPS(mySurface.Face()); - aProjector.Perform(aPoint); - - if(aProjector.IsDone() && aProjector.NbPoints() > 0) { - return aProjector.LowerDistance(); - } + GeomAPI_ProjectPointOnSurf& aProjector = myContext->ProjPS(mySurface.Face()); + aProjector.Perform(aPoint); + + if(aProjector.IsDone() && aProjector.NbPoints() > 0) { + return aProjector.LowerDistance(); } // Standard_Real aDistance = RealLast(); @@ -530,27 +527,15 @@ Standard_Real IntTools_BeanFaceIntersector::Distance(const Standard_Real theArg, Standard_Real aDistance = RealLast(); Standard_Boolean projectionfound = Standard_False; - if(myContext == NULL) { - myProjector.Init(aPoint, myTrsfSurface, myUMinParameter, myUMaxParameter, - myVMinParameter, myVMaxParameter, 1.e-10); - - if(myProjector.IsDone() && myProjector.NbPoints() > 0) { - myProjector.LowerDistanceParameters(theUParameter, theVParameter); - aDistance = myProjector.LowerDistance(); - projectionfound = Standard_True; - } + GeomAPI_ProjectPointOnSurf& aProjector = myContext->ProjPS(mySurface.Face()); + aProjector.Perform(aPoint); + + if(aProjector.IsDone() && aProjector.NbPoints() > 0) { + aProjector.LowerDistanceParameters(theUParameter, theVParameter); + aDistance = aProjector.LowerDistance(); + projectionfound = Standard_True; } - else { - GeomAPI_ProjectPointOnSurf& aProjector = myContext->ProjPS(mySurface.Face()); - aProjector.Perform(aPoint); - - if(aProjector.IsDone() && aProjector.NbPoints() > 0) { - aProjector.LowerDistanceParameters(theUParameter, theVParameter); - aDistance = aProjector.LowerDistance(); - projectionfound = Standard_True; - } - } - + if(!projectionfound) { // for(Standard_Integer i = 0; i < 4; i++) { @@ -1792,7 +1777,7 @@ Standard_Boolean IntTools_BeanFaceIntersector::ComputeLocalized() { Standard_Real dMinU = 10. * Precision::PConfusion(); Standard_Real dMinV = dMinU; IntTools_SurfaceRangeLocalizeData aSurfaceDataInit(3, 3, dMinU, dMinV); - IntTools_SurfaceRangeLocalizeData& aSurfaceData = (myContext) ? myContext->SurfaceData(mySurface.Face()) : aSurfaceDataInit; + IntTools_SurfaceRangeLocalizeData& aSurfaceData = myContext->SurfaceData(mySurface.Face()); aSurfaceData.RemoveRangeOutAll(); aSurfaceData.ClearGrid(); diff --git a/src/IntTools/IntTools_Context.cdl b/src/IntTools/IntTools_Context.cdl index 4e0fcde04a..6cef5ce5cc 100755 --- a/src/IntTools/IntTools_Context.cdl +++ b/src/IntTools/IntTools_Context.cdl @@ -5,7 +5,8 @@ ---Copyright: Matra Datavision 2002 -class Context from IntTools +class Context from IntTools + inherits TShared from MMgt ---Purpose: --- The class is to provide direct access @@ -38,13 +39,12 @@ uses is Create - returns Context from IntTools; - ---C++: alias "Standard_EXPORT virtual ~IntTools_Context();" + returns mutable Context from IntTools; + ---C++: alias "Standard_EXPORT virtual ~IntTools_Context();" ---Purpose: --- Empty constructor - --- - - FClass2d(me: in out; + + FClass2d(me: mutable; aF: Face from TopoDS) returns FClass2d from IntTools; ---C++: return & @@ -53,7 +53,7 @@ is --- for given face --- - ProjPS (me: in out; + ProjPS (me: mutable; aF: Face from TopoDS) returns ProjectPointOnSurf from GeomAPI; ---C++: return & @@ -62,7 +62,7 @@ is --- for given face --- - ProjPC (me: in out; + ProjPC (me: mutable; aE: Edge from TopoDS) returns ProjectPointOnCurve from GeomAPI; ---C++: return & @@ -71,7 +71,7 @@ is --- for given edge --- - ProjPT (me: in out; + ProjPT (me: mutable; aC: Curve from Geom) returns ProjectPointOnCurve from GeomAPI; ---C++: return & @@ -80,7 +80,7 @@ is --- for given curve --- - SurfaceData(me: in out; + SurfaceData(me: mutable; aF: Face from TopoDS) returns SurfaceRangeLocalizeData from IntTools; ---C++: return & @@ -89,7 +89,7 @@ is --- for given face - SolidClassifier(me: in out; + SolidClassifier(me: mutable; aSolid: Solid from TopoDS) returns SolidClassifier from BRepClass3d; ---C++: return & @@ -100,7 +100,7 @@ is --- API Block --- - ComputeVE (me:out; + ComputeVE (me:mutable; aV : Vertex from TopoDS; aE : Edge from TopoDS; aT :out Real from Standard) @@ -117,8 +117,7 @@ is --- 3. projection algorithm failed (-3) --- - --modified by NIZNHY-PKV Tue Feb 2 08:20:43 2010f - ComputeVE (me:out; + ComputeVE (me:mutable; aV : Vertex from TopoDS; aE : Edge from TopoDS; aT :out Real from Standard; @@ -142,9 +141,8 @@ is --- vertex tolerance should be modified or not --- aDist - the value of the distance between the vertex --- and the edge - --modified by NIZNHY-PKV Tue Feb 2 08:20:55 2010t - ComputeVS (me:out; + ComputeVS (me:mutable; aV : Vertex from TopoDS; aF : Face from TopoDS; U : out Real from Standard; @@ -161,7 +159,7 @@ is --- 3. projection point out or on the boundaries of face (-3) --- - StatePointFace(me:out; + StatePointFace(me:mutable; aF : Face from TopoDS; aP2D : Pnt2d from gp) returns State from TopAbs; @@ -170,7 +168,7 @@ is --- relative to face aF --- - IsPointInFace(me:out; + IsPointInFace(me:mutable; aF : Face from TopoDS; aP2D : Pnt2d from gp) returns Boolean from Standard; @@ -180,7 +178,7 @@ is --- otherwise returns false --- - IsPointInOnFace(me:out; + IsPointInOnFace(me:mutable; aF : Face from TopoDS; aP2D : Pnt2d from gp) returns Boolean from Standard; @@ -189,7 +187,7 @@ is --- inside or on the boundaries of aF --- - IsValidPointForFace(me:out; + IsValidPointForFace(me:mutable ; aP3D : Pnt from gp; aF : Face from TopoDS; aTol : Real from Standard) @@ -201,7 +199,7 @@ is --- of the face aF --- - IsValidPointForFaces(me:out; + IsValidPointForFaces(me:mutable; aP3D : Pnt from gp; aF1 : Face from TopoDS; aF2 : Face from TopoDS; @@ -212,7 +210,7 @@ is --- for both face aF1 and aF2 --- - IsValidBlockForFace (me:out; + IsValidBlockForFace (me:mutable; aT1 : Real from Standard; aT2 : Real from Standard; aIC : Curve from IntTools; @@ -225,7 +223,7 @@ is --- parameters aT1 and aT2 --- - IsValidBlockForFaces (me:out; + IsValidBlockForFaces (me:mutable; aT1 : Real from Standard; aT2 : Real from Standard; aIC : Curve from IntTools; @@ -238,7 +236,7 @@ is --- for both faces aF1 and aF2 --- - IsVertexOnLine(me:out; + IsVertexOnLine(me:mutable; aV : Vertex from TopoDS; aIC : Curve from IntTools; aTolC: Real from Standard; @@ -253,7 +251,7 @@ is --- returns false (in this case aT isn't significant) --- - IsVertexOnLine(me:out; + IsVertexOnLine(me:mutable; aV : Vertex from TopoDS; aTolV: Real from Standard; aIC : Curve from IntTools; @@ -269,7 +267,7 @@ is --- returns false (in this case aT isn't significant) --- - ProjectPointOnEdge (me:out; + ProjectPointOnEdge (me:mutable; aP : Pnt from gp; aE : Edge from TopoDS; aT :out Real from Standard) diff --git a/src/IntTools/IntTools_Context.cxx b/src/IntTools/IntTools_Context.cxx index 6faa98fb01..d0837ef401 100755 --- a/src/IntTools/IntTools_Context.cxx +++ b/src/IntTools/IntTools_Context.cxx @@ -39,7 +39,7 @@ //function : ~ //purpose : //======================================================================= - IntTools_Context::~IntTools_Context() +IntTools_Context::~IntTools_Context() { Standard_Address anAdr; Standard_Integer i, aNb; diff --git a/src/IntTools/IntTools_EdgeFace.cdl b/src/IntTools/IntTools_EdgeFace.cdl index 1551da3cfe..cfb06cc59b 100755 --- a/src/IntTools/IntTools_EdgeFace.cdl +++ b/src/IntTools/IntTools_EdgeFace.cdl @@ -24,8 +24,9 @@ uses FClass2d from IntTools, SequenceOfRoots from IntTools, SequenceOfCommonPrts from IntTools, - PContext from IntTools, - Range from IntTools + Context from IntTools, + Range from IntTools + --raises is @@ -87,11 +88,19 @@ is --- The algorithm processes edge inside these boundaries. --- - SetContext (me: in out; theContext: PContext from IntTools); + SetContext (me: in out; + theContext: Context from IntTools); ---Purpose: - --- Set container of projection algorithms + --- Sets the intersecton context --- - + + Context (me) + returns Context from IntTools; + ---C++:return const & + ---Purpose: + --- Gets the intersecton context + --- + Perform (me:out); ---Purpose: --- Launches the process @@ -241,7 +250,7 @@ fields myErrorStatus : Integer from Standard; --- internal members - myContext : PContext from IntTools; + myContext : Context from IntTools; myProjectableRanges: SequenceOfRanges from IntTools; myFClass2d : FClass2d from IntTools; myFuncArray : CArray1OfReal from IntTools; diff --git a/src/IntTools/IntTools_EdgeFace.cxx b/src/IntTools/IntTools_EdgeFace.cxx index db5d53a065..e6f6eb3521 100755 --- a/src/IntTools/IntTools_EdgeFace.cxx +++ b/src/IntTools/IntTools_EdgeFace.cxx @@ -86,9 +86,24 @@ static myErrorStatus=1; myParallel=Standard_False; myPar1=0.; - myContext = NULL; +} +//======================================================================= +//function : SetContext +//purpose : +//======================================================================= +void IntTools_EdgeFace::SetContext(const Handle(IntTools_Context)& theContext) +{ + myContext = theContext; } +//======================================================================= +//function : Context +//purpose : +//======================================================================= +const Handle(IntTools_Context)& IntTools_EdgeFace::Context()const +{ + return myContext; +} //======================================================================= //function : SetEdge //purpose : @@ -181,7 +196,7 @@ static //function : IsDone //purpose : //======================================================================= - Standard_Boolean IntTools_EdgeFace::IsDone()const +Standard_Boolean IntTools_EdgeFace::IsDone()const { return myIsDone; } @@ -189,7 +204,7 @@ static //function : ErrorStatus //purpose : //======================================================================= - Standard_Integer IntTools_EdgeFace::ErrorStatus()const +Standard_Integer IntTools_EdgeFace::ErrorStatus()const { return myErrorStatus; } @@ -197,7 +212,7 @@ static //function : CommonParts //purpose : //======================================================================= - const IntTools_SequenceOfCommonPrts& IntTools_EdgeFace::CommonParts() const +const IntTools_SequenceOfCommonPrts& IntTools_EdgeFace::CommonParts() const { return mySeqOfCommonPrts; } @@ -205,7 +220,7 @@ static //function : Range //purpose : //======================================================================= - const IntTools_Range& IntTools_EdgeFace::Range() const +const IntTools_Range& IntTools_EdgeFace::Range() const { return myRange; } @@ -214,7 +229,7 @@ static //function : CheckData //purpose : //======================================================================= - void IntTools_EdgeFace::CheckData() +void IntTools_EdgeFace::CheckData() { if (BRep_Tool::Degenerated(myEdge)) { myErrorStatus=2; @@ -223,8 +238,6 @@ static myErrorStatus=3; } } - - //======================================================================= //function : Prepare //purpose : @@ -403,22 +416,12 @@ static // Standard_Real ULD, VLD; - if(myContext == NULL) { - aProjector.Init(P, GS, Umin, Usup, Vmin, Vsup, myEpsT); - bFlag=aProjector.IsDone(); - - if(bFlag) { - aProjector.LowerDistanceParameters(ULD, VLD); - } - } - else { - GeomAPI_ProjectPointOnSurf& aLocProj = myContext->ProjPS(myFace); - aLocProj.Perform(P); - bFlag = aLocProj.IsDone(); - - if(bFlag) { - aLocProj.LowerDistanceParameters(ULD, VLD); - } + GeomAPI_ProjectPointOnSurf& aLocProj = myContext->ProjPS(myFace); + aLocProj.Perform(P); + bFlag = aLocProj.IsDone(); + + if(bFlag) { + aLocProj.LowerDistanceParameters(ULD, VLD); } // @@ -429,12 +432,7 @@ static TopAbs_State aState; gp_Pnt2d aP2d(ULD, VLD); - if(myContext == NULL) { - aState=myFClass2d.Perform(aP2d); - } - else { - aState = myContext->FClass2d(myFace).Perform(aP2d); - } + aState = myContext->FClass2d(myFace).Perform(aP2d); // if (aState==TopAbs_IN || aState==TopAbs_ON) { @@ -473,23 +471,12 @@ static // Standard_Boolean bFlag = Standard_False; - if(myContext == NULL) { - GeomAPI_ProjectPointOnSurf aProjector; - aProjector.Init(P, GS, Umin, Usup, Vmin, Vsup, myEpsT); - bFlag=aProjector.IsDone(); - - if(bFlag) { - aD=aProjector.LowerDistance(); - } - } - else { - GeomAPI_ProjectPointOnSurf& aLocProj = myContext->ProjPS(myFace); - aLocProj.Perform(P); - bFlag = aLocProj.IsDone(); - - if(bFlag) { - aD = aLocProj.LowerDistance(); - } + GeomAPI_ProjectPointOnSurf& aLocProj = myContext->ProjPS(myFace); + aLocProj.Perform(P); + bFlag = aLocProj.IsDone(); + + if(bFlag) { + aD = aLocProj.LowerDistance(); } // @@ -1253,14 +1240,6 @@ static return theflag; } -//======================================================================= -//function : SetContext -//purpose : -//======================================================================= - void IntTools_EdgeFace::SetContext(const IntTools_PContext& theContext) -{ - myContext = theContext; -} //======================================================================= //function : Perform @@ -1270,17 +1249,19 @@ static { Standard_Integer i, aNb; IntTools_CommonPrt aCommonPrt; - //IntTools_Root aRoot; // Wng in Gcc 3.0 - //... - - aCommonPrt.SetEdge1(myEdge); // + aCommonPrt.SetEdge1(myEdge); // myErrorStatus=0; CheckData(); - if (myErrorStatus) + if (myErrorStatus) { return; - + } + // + if (myContext.IsNull()) { + myContext=new IntTools_Context; + } + // myIsDone = Standard_False; myC.Initialize(myEdge); GeomAbs_CurveType aCurveType; @@ -1307,7 +1288,7 @@ static myS.Initialize (myFace,Standard_True); - if(myContext == NULL) { + if(myContext.IsNull()) { myFClass2d.Init(myFace, 1.e-6); } diff --git a/src/IntTools/IntTools_FaceFace.cdl b/src/IntTools/IntTools_FaceFace.cdl index 59b4fd486f..e88f0c9878 100755 --- a/src/IntTools/IntTools_FaceFace.cdl +++ b/src/IntTools/IntTools_FaceFace.cdl @@ -9,23 +9,25 @@ class FaceFace from IntTools ---Purpose: This class provides the intersection of --- face's underlying surfaces. -uses +uses + TopolTool from Adaptor3d, + HSurface from GeomAdaptor, + ListOfPntOn2S from IntSurf , + Intersection from IntPatch, Face from TopoDS, SequenceOfCurves from IntTools, - Intersection from IntPatch, LineConstructor from IntTools, - HSurface from GeomAdaptor, - TopolTool from Adaptor3d, - SequenceOfPntOn2Faces from IntTools, - --amv - ListOfPntOn2S from IntSurf + SequenceOfPntOn2Faces from IntTools, + Context from IntTools + + raises NotDone from StdFail is Create - returns FaceFace from IntTools; + returns FaceFace from IntTools; ---Purpose: --- Empty constructor. --- @@ -102,10 +104,8 @@ is ---Purpose: --- Returns True if faces are tangent --- - --modified by NIZNHY-PKV Fri Sep 16 07:44:22 2011 PrepareLines3D (me:out; bToSplit: Boolean from Standard=Standard_True); - --PrepareLines3D (me:out); ---Purpose: --- Provides post-processing the result lines. --- - the flag. @@ -113,7 +113,8 @@ is -- on parts. -- In case of is false the closed 3D-curves remain untouched. - SetList (me: in out; ListOfPnts: in out ListOfPntOn2S from IntSurf); + SetList (me: in out; + ListOfPnts: in out ListOfPntOn2S from IntSurf); ---------------------------------------------------------- -- private block @@ -125,7 +126,18 @@ is ComputeTolReached3d(me:out) is protected; - + + SetContext(me:out; + aContext : Context from IntTools); + ---Purpose: + --- Sets the intersecton context + + Context(me) + returns Context from IntTools; + ---C++: return const & + ---Purpose: + --- Gets the intersecton context + --- fields myIsDone : Boolean from Standard; @@ -150,8 +162,11 @@ fields myFace2 : Face from TopoDS; myPnts : SequenceOfPntOn2Faces from IntTools; - --amv - myListOfPnts : ListOfPntOn2S from IntSurf; + myListOfPnts : ListOfPntOn2S from IntSurf; + + --modified by NIZNHY-PKV Tue Jan 31 08:27:18 2012f + myContext : Context from IntTools; + --modified by NIZNHY-PKV Tue Jan 31 08:27:21 2012t end FaceFace from IntTools; diff --git a/src/IntTools/IntTools_FaceFace.cxx b/src/IntTools/IntTools_FaceFace.cxx index abeef43832..3156a2c525 100755 --- a/src/IntTools/IntTools_FaceFace.cxx +++ b/src/IntTools/IntTools_FaceFace.cxx @@ -108,10 +108,9 @@ #include #include -//modified by NIZNHY-PKV Mon Dec 26 13:37:52 2011f static void RefineVector(gp_Vec2d& aV2D); -//modified by NIZNHY-PKV Mon Dec 26 13:37:54 2011t + static void DumpWLine(const Handle(IntPatch_WLine)& aWLine); // @@ -179,7 +178,8 @@ static const IntTools_LineConstructor& theLConstructor, const Standard_Boolean theAvoidLConstructor, IntPatch_SequenceOfLine& theNewLines, - Standard_Real& theReachedTol3d); + Standard_Real& theReachedTol3d, + const Handle(IntTools_Context)& ); static Standard_Boolean ParameterOutOfBoundary(const Standard_Real theParameter, @@ -188,7 +188,8 @@ static const TopoDS_Face& theFace2, const Standard_Real theOtherParameter, const Standard_Boolean bIncreasePar, - Standard_Real& theNewParameter); + Standard_Real& theNewParameter, + const Handle(IntTools_Context)& ); static Standard_Boolean IsCurveValid(Handle(Geom2d_Curve)& thePCurve); @@ -216,7 +217,8 @@ static const TopoDS_Face& theFace2, Handle(TColgp_HArray1OfPnt2d)& theResultOnS1, Handle(TColgp_HArray1OfPnt2d)& theResultOnS2, - Handle(TColStd_HArray1OfReal)& theResultRadius); + Handle(TColStd_HArray1OfReal)& theResultRadius, + const Handle(IntTools_Context)& ); static Standard_Boolean FindPoint(const gp_Pnt2d& theFirstPoint, @@ -237,12 +239,12 @@ static Handle(GeomAdaptor_HSurface) theGASurface); static -gp_Pnt2d AdjustByNeighbour(const gp_Pnt2d& theaNeighbourPoint, - const gp_Pnt2d& theOriginalPoint, - Handle(GeomAdaptor_HSurface) theGASurface); + gp_Pnt2d AdjustByNeighbour(const gp_Pnt2d& theaNeighbourPoint, + const gp_Pnt2d& theOriginalPoint, + Handle(GeomAdaptor_HSurface) theGASurface); static -Standard_Boolean ApproxWithPCurves(const gp_Cylinder& theCyl, - const gp_Sphere& theSph); + Standard_Boolean ApproxWithPCurves(const gp_Cylinder& theCyl, + const gp_Sphere& theSph); static void PerformPlanes(const Handle(GeomAdaptor_HSurface)& theS1, const Handle(GeomAdaptor_HSurface)& theS2, @@ -263,6 +265,7 @@ static void ApproxParameters(const Handle(GeomAdaptor_HSurface)& aHS1, const Handle(GeomAdaptor_HSurface)& aHS2, Standard_Integer& iDegMin, + Standard_Integer& iNbIter, Standard_Integer& iDegMax); static @@ -279,12 +282,25 @@ static static Standard_Integer IndexType(const GeomAbs_SurfaceType aType); +// +//modified by NIZNHY-PKV Tue Jan 31 08:02:24 2012f +static + Standard_Real MaxSquareDistance (const Standard_Real aT, + const Handle(Geom_Curve)& aC3D, + const Handle(Geom2d_Curve)& aC2D1, + const Handle(Geom2d_Curve)& aC2D2, + const Handle(GeomAdaptor_HSurface) myHS1, + const Handle(GeomAdaptor_HSurface) myHS2, + const TopoDS_Face& aF1, + const TopoDS_Face& aF2, + const Handle(IntTools_Context)& aCtx); +//modified by NIZNHY-PKV Tue Jan 31 08:02:28 2012t // //======================================================================= //function : //purpose : //======================================================================= - IntTools_FaceFace::IntTools_FaceFace() +IntTools_FaceFace::IntTools_FaceFace() { myTangentFaces=Standard_False; // @@ -293,30 +309,45 @@ static myTolReached2d=0.; myTolReached3d=0.; SetParameters(Standard_True, Standard_True, Standard_True, 1.e-07); + +} +//======================================================================= +//function : SetContext +//purpose : +//======================================================================= +void IntTools_FaceFace::SetContext(const Handle(IntTools_Context)& aContext) +{ + myContext=aContext; +} +//======================================================================= +//function : Context +//purpose : +//======================================================================= +const Handle(IntTools_Context)& IntTools_FaceFace::Context()const +{ + return myContext; } //======================================================================= //function : Face1 //purpose : //======================================================================= - const TopoDS_Face& IntTools_FaceFace::Face1() const +const TopoDS_Face& IntTools_FaceFace::Face1() const { return myFace1; } - //======================================================================= //function : Face2 //purpose : //======================================================================= - const TopoDS_Face& IntTools_FaceFace::Face2() const +const TopoDS_Face& IntTools_FaceFace::Face2() const { return myFace2; } - //======================================================================= //function : TangentFaces //purpose : //======================================================================= - Standard_Boolean IntTools_FaceFace::TangentFaces() const +Standard_Boolean IntTools_FaceFace::TangentFaces() const { return myTangentFaces; } @@ -324,7 +355,7 @@ static //function : Points //purpose : //======================================================================= - const IntTools_SequenceOfPntOn2Faces& IntTools_FaceFace::Points() const +const IntTools_SequenceOfPntOn2Faces& IntTools_FaceFace::Points() const { return myPnts; } @@ -332,7 +363,7 @@ static //function : IsDone //purpose : //======================================================================= - Standard_Boolean IntTools_FaceFace::IsDone() const +Standard_Boolean IntTools_FaceFace::IsDone() const { return myIsDone; } @@ -340,7 +371,7 @@ static //function : TolReached3d //purpose : //======================================================================= - Standard_Real IntTools_FaceFace::TolReached3d() const +Standard_Real IntTools_FaceFace::TolReached3d() const { return myTolReached3d; } @@ -348,18 +379,18 @@ static //function : Lines //purpose : return lines of intersection //======================================================================= - const IntTools_SequenceOfCurves& IntTools_FaceFace::Lines() const +const IntTools_SequenceOfCurves& IntTools_FaceFace::Lines() const { - StdFail_NotDone_Raise_if(!myIsDone, - "IntTools_FaceFace::Lines() => !myIntersector.IsDone()"); + StdFail_NotDone_Raise_if + (!myIsDone, + "IntTools_FaceFace::Lines() => !myIntersector.IsDone()"); return mySeqOfCurve; } - //======================================================================= //function : TolReached2d //purpose : //======================================================================= - Standard_Real IntTools_FaceFace::TolReached2d() const +Standard_Real IntTools_FaceFace::TolReached2d() const { return myTolReached2d; } @@ -367,10 +398,10 @@ static // function: SetParameters // // ======================================================================= - void IntTools_FaceFace::SetParameters(const Standard_Boolean ToApproxC3d, - const Standard_Boolean ToApproxC2dOnS1, - const Standard_Boolean ToApproxC2dOnS2, - const Standard_Real ApproximationTolerance) +void IntTools_FaceFace::SetParameters(const Standard_Boolean ToApproxC3d, + const Standard_Boolean ToApproxC2dOnS1, + const Standard_Boolean ToApproxC2dOnS2, + const Standard_Real ApproximationTolerance) { myApprox = ToApproxC3d; myApprox1 = ToApproxC2dOnS1; @@ -381,12 +412,10 @@ static //function : SetList //purpose : //======================================================================= - void IntTools_FaceFace::SetList(IntSurf_ListOfPntOn2S& aListOfPnts) { myListOfPnts = aListOfPnts; } - //======================================================================= //function : Perform //purpose : intersect surfaces of the faces @@ -404,6 +433,10 @@ void IntTools_FaceFace::SetList(IntSurf_ListOfPntOn2S& aListOfPnts) Handle(IntTools_TopolTool) dom1, dom2; BRepAdaptor_Surface aBAS1, aBAS2; // + if (myContext.IsNull()) { + myContext=new IntTools_Context; + } + // mySeqOfCurve.Clear(); myTolReached2d=0.; myTolReached3d=0.; @@ -463,38 +496,35 @@ void IntTools_FaceFace::SetList(IntSurf_ListOfPntOn2S& aListOfPnts) mySeqOfCurve, myTangentFaces); myIsDone = Standard_True; - - if(myTangentFaces) { - return; - } - // - NbLinPP = mySeqOfCurve.Length(); - if(NbLinPP == 0) { - return; - } - - Standard_Real aTolFMax; - // - myTolReached3d = 1.e-7; - // - aTolFMax=Max(aTolF1, aTolF2); - // - if (aTolFMax>myTolReached3d) { - myTolReached3d=aTolFMax; - } - myTolReached2d = myTolReached3d; - // - if (bReverse) { - Handle(Geom2d_Curve) aC2D1, aC2D2; + + if(!myTangentFaces) { // - aNbLin=mySeqOfCurve.Length(); - for (i=1; i<=aNbLin; ++i) { - IntTools_Curve& aIC=mySeqOfCurve(i); - aC2D1=aIC.FirstCurve2d(); - aC2D2=aIC.SecondCurve2d(); + NbLinPP = mySeqOfCurve.Length(); + if(NbLinPP) { + Standard_Real aTolFMax; // - aIC.SetFirstCurve2d(aC2D2); - aIC.SetSecondCurve2d(aC2D1); + myTolReached3d = 1.e-7; + // + aTolFMax=Max(aTolF1, aTolF2); + // + if (aTolFMax>myTolReached3d) { + myTolReached3d=aTolFMax; + } + myTolReached2d = myTolReached3d; + // + if (bReverse) { + Handle(Geom2d_Curve) aC2D1, aC2D2; + // + aNbLin=mySeqOfCurve.Length(); + for (i=1; i<=aNbLin; ++i) { + IntTools_Curve& aIC=mySeqOfCurve(i); + aC2D1=aIC.FirstCurve2d(); + aC2D2=aIC.SecondCurve2d(); + // + aIC.SetFirstCurve2d(aC2D2); + aIC.SetSecondCurve2d(aC2D1); + } + } } } return; @@ -689,39 +719,85 @@ void IntTools_FaceFace::SetList(IntSurf_ListOfPntOn2S& aListOfPnts) GeomAbs_SurfaceType aType1, aType2; // aNbLin=myIntersector.NbLines(); - // aType1=myHS1->Surface().GetType(); aType2=myHS2->Surface().GetType(); // - if (aNbLin==2 && - aType1==GeomAbs_Cylinder && - aType2==GeomAbs_Cylinder) { - Handle(IntPatch_Line) aIL1, aIL2; - IntPatch_IType aTL1, aTL2; - // - aIL1=myIntersector.Line(1); - aIL2=myIntersector.Line(2); - aTL1=aIL1->ArcType(); - aTL2=aIL2->ArcType(); - if (aTL1==IntPatch_Lin && aTL2==IntPatch_Lin) { - Standard_Real aD, aDTresh, dTol; - gp_Lin aL1, aL2; + if (aType1==GeomAbs_Cylinder && aType2==GeomAbs_Cylinder) { + if (aNbLin==2){ + Handle(IntPatch_Line) aIL1, aIL2; + IntPatch_IType aTL1, aTL2; // - dTol=1.e-8; - aDTresh=1.5e-6; - // - aL1=Handle(IntPatch_GLine)::DownCast(aIL1)->Line(); - aL2=Handle(IntPatch_GLine)::DownCast(aIL2)->Line(); - aD=aL1.Distance(aL2); - aD=0.5*aD; - if (aDArcType(); + aTL2=aIL2->ArcType(); + if (aTL1==IntPatch_Lin && aTL2==IntPatch_Lin) { + Standard_Real aD, aDTresh, dTol; + gp_Lin aL1, aL2; + // + dTol=1.e-8; + aDTresh=1.5e-6; + // + aL1=Handle(IntPatch_GLine)::DownCast(aIL1)->Line(); + aL2=Handle(IntPatch_GLine)::DownCast(aIL2)->Line(); + aD=aL1.Distance(aL2); + aD=0.5*aD; + if (aDFirstParameter(); + aT2=aBC->LastParameter(); + // + dT=(aT2-aT1)/(aNbP-1); + for (j=0; jaD2Max) { + aD2Max=aD2; + } + }//for (j=0; jaTolTresh) { myTolReached3d=aTolFMax; } - } + }//if (aType1==GeomAbs_Plane && aType2==GeomAbs_Plane) { //t //IFV Bug OCC20297 - if((aType1 == GeomAbs_Cylinder && aType2 == GeomAbs_Plane) || - (aType2 == GeomAbs_Cylinder && aType1 == GeomAbs_Plane)) { + else if((aType1 == GeomAbs_Cylinder && aType2 == GeomAbs_Plane) || + (aType2 == GeomAbs_Cylinder && aType1 == GeomAbs_Plane)) { if(aNbLin == 1) { const Handle(IntPatch_Line)& aIL1 = myIntersector.Line(1); if(aIL1->ArcType() == IntPatch_Circle) { @@ -766,11 +842,11 @@ void IntTools_FaceFace::SetList(IntSurf_ListOfPntOn2S& aListOfPnts) } } //aIL1->ArcType() == IntPatch_Circle } //aNbLin == 1 - } // aType1 == GeomAbs_Cylinder && aType2 == GeomAbs_Plane) ... + } // aType1 == GeomAbs_Cylinder && aType2 == GeomAbs_Plane) //End IFV Bug OCC20297 // - if ((aType1==GeomAbs_Plane && aType2==GeomAbs_Torus) || - (aType2==GeomAbs_Plane && aType1==GeomAbs_Torus)) { + else if ((aType1==GeomAbs_Plane && aType2==GeomAbs_Torus) || + (aType2==GeomAbs_Plane && aType1==GeomAbs_Torus)) { aNbLin=mySeqOfCurve.Length(); if (aNbLin!=1) { return; @@ -785,7 +861,8 @@ void IntTools_FaceFace::SetList(IntSurf_ListOfPntOn2S& aListOfPnts) // const IntTools_Curve& aIC=mySeqOfCurve(1); const Handle(Geom_Curve)& aC3D=aIC.Curve(); - const Handle(Geom_BSplineCurve)& aBS=Handle(Geom_BSplineCurve)::DownCast(aC3D); + const Handle(Geom_BSplineCurve)& aBS= + Handle(Geom_BSplineCurve)::DownCast(aC3D); if (aBS.IsNull()) { return; } @@ -828,18 +905,13 @@ void IntTools_FaceFace::SetList(IntSurf_ListOfPntOn2S& aListOfPnts) } }// if ((aType1==GeomAbs_Plane && aType2==GeomAbs_Torus) || // - if ((aType1==GeomAbs_SurfaceOfRevolution && aType2==GeomAbs_Cylinder) || - (aType2==GeomAbs_SurfaceOfRevolution && aType1==GeomAbs_Cylinder)) { - Standard_Boolean bIsDone; + else if ((aType1==GeomAbs_SurfaceOfRevolution && aType2==GeomAbs_Cylinder) || + (aType2==GeomAbs_SurfaceOfRevolution && aType1==GeomAbs_Cylinder)) { Standard_Integer i, j, aNbP; - Standard_Real aT, aT1, aT2, dT, aU1, aV1, aU2, aV2; - Standard_Real aDSmax, aDS1, aDS2, aDS; - gp_Pnt2d aP2D1, aP2D2; - gp_Pnt aP3D, aP3D1, aP3D2; - IntTools_Context aCtx; + Standard_Real aT, aT1, aT2, dT, aD2max, aD2; // aNbLin=mySeqOfCurve.Length(); - aDSmax=-1.; + aD2max=0.; aNbP=11; // for (i=1; i<=aNbLin; ++i) { @@ -851,7 +923,8 @@ void IntTools_FaceFace::SetList(IntSurf_ListOfPntOn2S& aListOfPnts) if (aC3D.IsNull()) { continue; } - const Handle(Geom_BSplineCurve)& aBC=Handle(Geom_BSplineCurve)::DownCast(aC3D); + const Handle(Geom_BSplineCurve)& aBC= + Handle(Geom_BSplineCurve)::DownCast(aC3D); if (aBC.IsNull()) { return; } @@ -866,57 +939,17 @@ void IntTools_FaceFace::SetList(IntSurf_ListOfPntOn2S& aListOfPnts) aT=aT2; } // - aC3D->D0(aT, aP3D); - // 1 - if (!aC2D1.IsNull()) { - aC2D1->D0(aT, aP2D1); - aP2D1.Coord(aU1, aV1); - myHS1->D0(aU1, aV1, aP3D1); - aDS1=aP3D.SquareDistance(aP3D1); - if (aDS1>aDSmax) { - aDSmax=aDS1; - } - } - // 2 - if (!aC2D2.IsNull()) { - aC2D2->D0(aT, aP2D2); - aP2D2.Coord(aU2, aV2); - myHS2->D0(aU2, aV2, aP3D2); - aDS2=aP3D.SquareDistance(aP3D2); - if (aDS2>aDSmax) { - aDSmax=aDS2; - } - } - // 3 - GeomAPI_ProjectPointOnSurf& aPPS1=aCtx.ProjPS(myFace1); - aPPS1.Perform(aP3D); - bIsDone=aPPS1.IsDone(); - if (bIsDone) { - aPPS1.LowerDistanceParameters(aU1, aV1); - myHS1->D0(aU1, aV1, aP3D1); - aDS1=aP3D.SquareDistance(aP3D1); - if (aDS1>aDSmax) { - aDSmax=aDS1; - } - } - // 4 - GeomAPI_ProjectPointOnSurf& aPPS2=aCtx.ProjPS(myFace2); - aPPS2.Perform(aP3D); - bIsDone=aPPS2.IsDone(); - if (bIsDone) { - aPPS2.LowerDistanceParameters(aU2, aV2); - myHS2->D0(aU2, aV2, aP3D2); - aDS2=aP3D.SquareDistance(aP3D2); - if (aDS2>aDSmax) { - aDSmax=aDS2; - } + aD2=MaxSquareDistance(aT, aC3D, aC2D1, aC2D2, + myHS1, myHS2, myFace1, myFace2, myContext); + if (aD2>aD2max) { + aD2max=aD2; } }//for (j=0; j aDS) { - myTolReached3d=sqrt(aDSmax); + aD2=myTolReached3d*myTolReached3d; + if (aD2max > aD2) { + myTolReached3d=sqrt(aD2max); } }//if((aType1==GeomAbs_SurfaceOfRevolution ... } @@ -955,12 +988,22 @@ void IntTools_FaceFace::SetList(IntSurf_ListOfPntOn2S& aListOfPnts) // const Handle(IntPatch_WLine)& aWLine= Handle(IntPatch_WLine)::DownCast(L); - // + //DEBf + //DumpWLine(aWLine); + //DEBt anewL = ComputePurgedWLine(aWLine); if(anewL.IsNull()) { return; } L = anewL; + //DEBf + /* + { const Handle(IntPatch_WLine)& aWLineX= + Handle(IntPatch_WLine)::DownCast(L); + DumpWLine(aWLineX); + } + */ + //DEBt // if(!myListOfPnts.IsEmpty()) { bAvoidLineConstructor = Standard_True; @@ -1158,7 +1201,7 @@ void IntTools_FaceFace::SetList(IntSurf_ListOfPntOn2S& aListOfPnts) if(P1.Distance(P2) > aTolDist) { Standard_Real anewpar = fprm; - if(ParameterOutOfBoundary(fprm, newc, myFace1, myFace2, lprm, Standard_False, anewpar)) { + if(ParameterOutOfBoundary(fprm, newc, myFace1, myFace2, lprm, Standard_False, anewpar, myContext)) { fprm = anewpar; } aSeqFprm.Append(fprm); @@ -1180,7 +1223,7 @@ void IntTools_FaceFace::SetList(IntSurf_ListOfPntOn2S& aListOfPnts) if(P1.Distance(P2) > aTolDist) { Standard_Real anewpar = lprm; - if(ParameterOutOfBoundary(lprm, newc, myFace1, myFace2, fprm, Standard_True, anewpar)) { + if(ParameterOutOfBoundary(lprm, newc, myFace1, myFace2, fprm, Standard_True, anewpar, myContext)) { lprm = anewpar; } aSeqFprm.Append(aNul); @@ -1618,10 +1661,15 @@ void IntTools_FaceFace::SetList(IntSurf_ListOfPntOn2S& aListOfPnts) if(reApprox && !rejectSurface) theapp3d.SetParameters(myTolApprox, tol2d, 4, 8, 0, Standard_False, aParType); else { - Standard_Integer iDegMax, iDegMin; + Standard_Integer iDegMax, iDegMin, iNbIter; // - ApproxParameters(myHS1, myHS2, iDegMin, iDegMax); - theapp3d.SetParameters(myTolApprox, tol2d, iDegMin, iDegMax, 0, Standard_True, aParType); + //modified by NIZNHY-PKV Mon Jan 30 14:19:32 2012f + ApproxParameters(myHS1, myHS2, iDegMin, iDegMax, iNbIter); + theapp3d.SetParameters(myTolApprox, tol2d, iDegMin, iDegMax, iNbIter, Standard_True, aParType); + // + // ApproxParameters(myHS1, myHS2, iDegMin, iDegMax); + // theapp3d.SetParameters(myTolApprox, tol2d, iDegMin, iDegMax, 0, Standard_True, aParType); + //modified by NIZNHY-PKV Mon Jan 30 14:19:35 2012t } } // @@ -1634,7 +1682,8 @@ void IntTools_FaceFace::SetList(IntSurf_ListOfPntOn2S& aListOfPnts) myLConstruct, bAvoidLineConstructor, aSeqOfL, - aReachedTol); + aReachedTol, + myContext); if ( bIsDecomposited && ( myTolReached3d < aReachedTol ) ) myTolReached3d = aReachedTol; @@ -2897,9 +2946,7 @@ Standard_Boolean FindPoint(const gp_Pnt2d& theFirstPoint, } gp_Vec2d anormvec = aVec; anormvec.Normalize(); - //modified by NIZNHY-PKV Mon Dec 19 11:46:06 2011f RefineVector(anormvec); - //modified by NIZNHY-PKV Mon Dec 19 11:46:10 2011t Standard_Real adot1 = anormvec.Dot(anOtherVecNormal); if(fabs(adot1) < Precision::Angular()) @@ -3044,8 +3091,6 @@ Standard_Boolean CheckTangentZonesExist( const Handle(GeomAdaptor_HSurface)& the ( theSurface2->GetType() != GeomAbs_Torus ) ) return Standard_False; - IntTools_Context aContext; - gp_Torus aTor1 = theSurface1->Torus(); gp_Torus aTor2 = theSurface2->Torus(); @@ -3072,12 +3117,13 @@ Standard_Integer ComputeTangentZones( const Handle(GeomAdaptor_HSurface)& theSur const TopoDS_Face& theFace2, Handle(TColgp_HArray1OfPnt2d)& theResultOnS1, Handle(TColgp_HArray1OfPnt2d)& theResultOnS2, - Handle(TColStd_HArray1OfReal)& theResultRadius) { + Handle(TColStd_HArray1OfReal)& theResultRadius, + const Handle(IntTools_Context)& aContext) +{ Standard_Integer aResult = 0; if ( !CheckTangentZonesExist( theSurface1, theSurface2 ) ) return aResult; - IntTools_Context aContext; TColgp_SequenceOfPnt2d aSeqResultS1, aSeqResultS2; TColStd_SequenceOfReal aSeqResultRad; @@ -3151,7 +3197,8 @@ Standard_Integer ComputeTangentZones( const Handle(GeomAdaptor_HSurface)& theSur Standard_Integer surfit = 0; for ( surfit = 0; surfit < 2; surfit++ ) { - GeomAPI_ProjectPointOnSurf& aProjector = (surfit == 0) ? aContext.ProjPS(theFace1) : aContext.ProjPS(theFace2); + GeomAPI_ProjectPointOnSurf& aProjector = + (surfit == 0) ? aContext->ProjPS(theFace1) : aContext->ProjPS(theFace2); gp_Pnt aP3d = (surfit == 0) ? P1.Value() : P2.Value(); aProjector.Perform(aP3d); @@ -3282,7 +3329,9 @@ Standard_Boolean DecompositionOfWLine(const Handle(IntPatch_WLine)& theWLine, const IntTools_LineConstructor& theLConstructor, const Standard_Boolean theAvoidLConstructor, IntPatch_SequenceOfLine& theNewLines, - Standard_Real& theReachedTol3d) { + Standard_Real& theReachedTol3d, + const Handle(IntTools_Context)& aContext) +{ Standard_Boolean bRet, bAvoidLineConstructor; Standard_Integer aNbPnts, aNbParts; @@ -3307,13 +3356,12 @@ Standard_Boolean DecompositionOfWLine(const Handle(IntPatch_WLine)& theWLine, TColStd_Array1OfListOfInteger anArrayOfLines(1, aNbPnts); TColStd_Array1OfInteger anArrayOfLineType(1, aNbPnts); TColStd_ListOfInteger aListOfPointIndex; - IntTools_Context aContext; Handle(TColgp_HArray1OfPnt2d) aTanZoneS1; Handle(TColgp_HArray1OfPnt2d) aTanZoneS2; Handle(TColStd_HArray1OfReal) aTanZoneRadius; Standard_Integer aNbZone = ComputeTangentZones( theSurface1, theSurface2, theFace1, theFace2, - aTanZoneS1, aTanZoneS2, aTanZoneRadius ); + aTanZoneS1, aTanZoneS2, aTanZoneRadius, aContext); // nblines=0; @@ -3751,7 +3799,8 @@ Standard_Boolean DecompositionOfWLine(const Handle(IntPatch_WLine)& theWLine, if(found) { // check point Standard_Real aCriteria = BRep_Tool::Tolerance(theFace1) + BRep_Tool::Tolerance(theFace2); - GeomAPI_ProjectPointOnSurf& aProjector = (surfit == 0) ? aContext.ProjPS(theFace2) : aContext.ProjPS(theFace1); + GeomAPI_ProjectPointOnSurf& aProjector = + (surfit == 0) ? aContext->ProjPS(theFace2) : aContext->ProjPS(theFace1); Handle(GeomAdaptor_HSurface) aSurface = (surfit == 0) ? theSurface1 : theSurface2; Handle(GeomAdaptor_HSurface) aSurfaceOther = (surfit == 0) ? theSurface2 : theSurface1; @@ -3787,7 +3836,8 @@ Standard_Boolean DecompositionOfWLine(const Handle(IntPatch_WLine)& theWLine, foundV = ( foundV < vmin ) ? vmin : foundV; foundV = ( foundV > vmax ) ? vmax : foundV; - GeomAPI_ProjectPointOnSurf& aProjector2 = (surfit == 0) ? aContext.ProjPS(theFace1) : aContext.ProjPS(theFace2); + GeomAPI_ProjectPointOnSurf& aProjector2 = + (surfit == 0) ? aContext->ProjPS(theFace1) : aContext->ProjPS(theFace2); aP3d = aSurfaceOther->Value(foundU, foundV); aProjector2.Perform(aP3d); @@ -4004,11 +4054,12 @@ Standard_Boolean ParameterOutOfBoundary(const Standard_Real theParameter, const TopoDS_Face& theFace2, const Standard_Real theOtherParameter, const Standard_Boolean bIncreasePar, - Standard_Real& theNewParameter) { + Standard_Real& theNewParameter, + const Handle(IntTools_Context)& aContext) +{ Standard_Boolean bIsComputed = Standard_False; theNewParameter = theParameter; - IntTools_Context aContext; Standard_Real acurpar = theParameter; TopAbs_State aState = TopAbs_ON; Standard_Integer iter = 0; @@ -4039,7 +4090,7 @@ Standard_Boolean ParameterOutOfBoundary(const Standard_Real theParameter, if(aPrj1.IsDone()) { aPrj1.LowerDistanceParameters(U, V); - aState = aContext.StatePointFace(theFace1, gp_Pnt2d(U, V)); + aState = aContext->StatePointFace(theFace1, gp_Pnt2d(U, V)); } if(aState != TopAbs_ON) { @@ -4047,7 +4098,7 @@ Standard_Boolean ParameterOutOfBoundary(const Standard_Real theParameter, if(aPrj2.IsDone()) { aPrj2.LowerDistanceParameters(U, V); - aState = aContext.StatePointFace(theFace2, gp_Pnt2d(U, V)); + aState = aContext->StatePointFace(theFace2, gp_Pnt2d(U, V)); } } @@ -4396,11 +4447,14 @@ Standard_Boolean ClassifyLin2d(const Handle(GeomAdaptor_HSurface)& theS, void ApproxParameters(const Handle(GeomAdaptor_HSurface)& aHS1, const Handle(GeomAdaptor_HSurface)& aHS2, Standard_Integer& iDegMin, - Standard_Integer& iDegMax) + Standard_Integer& iDegMax, + Standard_Integer& iNbIter) + { GeomAbs_SurfaceType aTS1, aTS2; // + iNbIter=0; iDegMin=4; iDegMax=8; // @@ -4430,6 +4484,11 @@ void ApproxParameters(const Handle(GeomAdaptor_HSurface)& aHS1, iDegMax=6; } } + //modified by NIZNHY-PKV Mon Jan 30 14:20:08 2012f + if (aTS1==GeomAbs_Cylinder && aTS2==GeomAbs_Cylinder) { + iNbIter=1; //ZZ + } + //modified by NIZNHY-PKV Mon Jan 30 14:20:10 2012t } //======================================================================= //function : Tolerances @@ -4544,6 +4603,7 @@ void DumpWLine(const Handle(IntPatch_WLine)& aWLine) Standard_Integer i, aNbPnts; Standard_Real aX, aY, aZ, aU1, aV1, aU2, aV2; // + printf(" *WLine\n"); aNbPnts=aWLine->NbPnts(); for (i=1; i<=aNbPnts; ++i) { const IntSurf_PntOn2S aPntOn2S=aWLine->Point(i); @@ -4551,12 +4611,11 @@ void DumpWLine(const Handle(IntPatch_WLine)& aWLine) aP3D.Coord(aX, aY, aZ); aPntOn2S.Parameters(aU1, aV1, aU2, aV2); // - //printf("point p_%d %lf %lf %lf\n", i, aX, aY, aZ); - printf("point p_%d %20.15lf %20.15lf %20.15lf %20.15lf %20.15lf %20.15lf %20.15lf\n", - i, aX, aY, aZ, aU1, aV1, aU2, aV2); + printf("point p_%d %lf %lf %lf\n", i, aX, aY, aZ); + //printf("point p_%d %20.15lf %20.15lf %20.15lf %20.15lf %20.15lf %20.15lf %20.15lf\n", + // i, aX, aY, aZ, aU1, aV1, aU2, aV2); } } -//modified by NIZNHY-PKV Wed Dec 14 12:22:48 2011f //======================================================================= //function : RefineVector //purpose : @@ -4588,4 +4647,63 @@ void RefineVector(gp_Vec2d& aV2D) } aV2D.SetCoord(aC[0], aC[1]); } -//modified by NIZNHY-PKV Wed Dec 14 12:22:50 2011t +//modified by NIZNHY-PKV Tue Jan 31 07:38:19 2012f +//======================================================================= +//function : MaxSquareDistance +//purpose : +//======================================================================= +Standard_Real MaxSquareDistance (const Standard_Real aT, + const Handle(Geom_Curve)& aC3D, + const Handle(Geom2d_Curve)& aC2D1, + const Handle(Geom2d_Curve)& aC2D2, + const Handle(GeomAdaptor_HSurface) myHS1, + const Handle(GeomAdaptor_HSurface) myHS2, + const TopoDS_Face& aF1, + const TopoDS_Face& aF2, + const Handle(IntTools_Context)& aCtx) +{ + Standard_Boolean bIsDone; + Standard_Integer i; + Standard_Real aU, aV, aD2Max, aD2; + gp_Pnt2d aP2D; + gp_Pnt aP, aPS; + // + aD2Max=0.; + // + aC3D->D0(aT, aP); + if (aC3D.IsNull()) { + return aD2Max; + } + // + for (i=0; i<2; ++i) { + const Handle(GeomAdaptor_HSurface)& aGHS=(!i) ? myHS1 : myHS2; + const TopoDS_Face &aF=(!i) ? aF1 : aF2; + const Handle(Geom2d_Curve)& aC2D=(!i) ? aC2D1 : aC2D2; + // + if (!aC2D.IsNull()) { + aC2D->D0(aT, aP2D); + aP2D.Coord(aU, aV); + aGHS->D0(aU, aV, aPS); + aD2=aP.SquareDistance(aPS); + if (aD2>aD2Max) { + aD2Max=aD2; + } + } + // + GeomAPI_ProjectPointOnSurf& aProjector=aCtx->ProjPS(aF); + // + aProjector.Perform(aP); + bIsDone=aProjector.IsDone(); + if (bIsDone) { + aProjector.LowerDistanceParameters(aU, aV); + aGHS->D0(aU, aV, aPS); + aD2=aP.SquareDistance(aPS); + if (aD2>aD2Max) { + aD2Max=aD2; + } + } + } + // + return aD2Max; +} +//modified by NIZNHY-PKV Tue Jan 31 07:38:21 2012t diff --git a/src/IntTools/IntTools_ShrunkRange.cdl b/src/IntTools/IntTools_ShrunkRange.cdl index 35f76b273d..a6d8f870e2 100755 --- a/src/IntTools/IntTools_ShrunkRange.cdl +++ b/src/IntTools/IntTools_ShrunkRange.cdl @@ -18,8 +18,7 @@ uses Vertex from TopoDS, Range from IntTools, Box from Bnd, - Context from IntTools, - PContext from IntTools + Context from IntTools --raises @@ -38,7 +37,19 @@ is returns ShrunkRange from IntTools; ---Purpose: --- - + SetContext(me:out; + aContext : Context from IntTools); + ---Purpose: + --- Sets the intersecton context + --- + Context(me) + returns Context from IntTools; + ---C++: return const & + ---Purpose: + --- Gets the intersecton context + --- + + SetShrunkRange(me:out; aR:Range from IntTools); ---Purpose: --- Sets an shrunk range @@ -104,8 +115,8 @@ fields myRange : Range from IntTools; myShrunkRange : Range from IntTools; myBndBox : Box from Bnd; - myCtx : PContext from IntTools; - myIsDone : Boolean from Standard; - myErrorStatus : Integer from Standard; + myContext : Context from IntTools; + myIsDone : Boolean from Standard; + myErrorStatus : Integer from Standard; end ShrunkRange; diff --git a/src/IntTools/IntTools_ShrunkRange.cxx b/src/IntTools/IntTools_ShrunkRange.cxx index 8cb5dc351b..668fc5a939 100755 --- a/src/IntTools/IntTools_ShrunkRange.cxx +++ b/src/IntTools/IntTools_ShrunkRange.cxx @@ -27,7 +27,7 @@ //function : IntTools_ShrunkRange //purpose : //======================================================================= - IntTools_ShrunkRange::IntTools_ShrunkRange () +IntTools_ShrunkRange::IntTools_ShrunkRange () { } @@ -35,26 +35,42 @@ //function : IntTools_ShrunkRange //purpose : //======================================================================= - IntTools_ShrunkRange::IntTools_ShrunkRange (const TopoDS_Edge& aE, +IntTools_ShrunkRange::IntTools_ShrunkRange (const TopoDS_Edge& aE, const TopoDS_Vertex& aV1, const TopoDS_Vertex& aV2, const IntTools_Range& aR, - const IntTools_Context& aCtx) + const Handle(IntTools_Context)& aCtx) { myEdge=aE; myV1=aV1; myV2=aV2; myRange=aR; - myCtx=(IntTools_PContext)&aCtx; + myContext=aCtx; myIsDone=Standard_False; myErrorStatus=1; Perform(); } //======================================================================= +//function : SetContext +//purpose : +//======================================================================= +void IntTools_ShrunkRange::SetContext(const Handle(IntTools_Context)& aContext) +{ + myContext=aContext; +} +//======================================================================= +//function : Context +//purpose : +//======================================================================= +const Handle(IntTools_Context)& IntTools_ShrunkRange::Context()const +{ + return myContext; +} +//======================================================================= //function : Edge //purpose : //======================================================================= - const TopoDS_Edge& IntTools_ShrunkRange::Edge() const +const TopoDS_Edge& IntTools_ShrunkRange::Edge() const { return myEdge; } @@ -62,7 +78,7 @@ //function : ShrunkRange //purpose : //======================================================================= - const IntTools_Range& IntTools_ShrunkRange::ShrunkRange() const +const IntTools_Range& IntTools_ShrunkRange::ShrunkRange() const { return myShrunkRange; } @@ -70,7 +86,7 @@ //function : BndBox //purpose : //======================================================================= - const Bnd_Box& IntTools_ShrunkRange::BndBox() const +const Bnd_Box& IntTools_ShrunkRange::BndBox() const { return myBndBox; } @@ -78,7 +94,7 @@ //function : IsDone //purpose : //======================================================================= - Standard_Boolean IntTools_ShrunkRange::IsDone() const +Standard_Boolean IntTools_ShrunkRange::IsDone() const { return myIsDone; } @@ -86,7 +102,7 @@ //function : ErrorStatus //purpose : //======================================================================= - Standard_Integer IntTools_ShrunkRange::ErrorStatus() const +Standard_Integer IntTools_ShrunkRange::ErrorStatus() const { return myErrorStatus; } @@ -94,7 +110,7 @@ //function : Perform //purpose : //======================================================================= - void IntTools_ShrunkRange::Perform() +void IntTools_ShrunkRange::Perform() { Standard_Real aCF, aCL, aTolE, aTolV1, aTolV2, t1, t11, t1C, t2, t12, t2C; Standard_Real aCoeff, dt1, dt2, aR; @@ -103,13 +119,14 @@ GeomAbs_CurveType aCurveType; Handle(Geom_Curve) aC; // + if (myContext.IsNull()) { + myContext=new IntTools_Context; + } + // aTolE =BRep_Tool::Tolerance(myEdge); aTolV1=BRep_Tool::Tolerance(myV1); aTolV2=BRep_Tool::Tolerance(myV2); - //xf - //dt1=aCoeff*(aTolV1+aTolE); - //dt2=aCoeff*(aTolV2+aTolE); - //xt + // myRange.Range (t1, t2); // BRepAdaptor_Curve aBAC(myEdge); @@ -272,15 +289,10 @@ BRepBuilderAPI_MakeVertex aMV1(aP1L); const TopoDS_Vertex& aV1L=aMV1.Vertex(); // - pri=myCtx->ComputeVE (aV1L, myEdge, t1C); + pri=myContext->ComputeVE (aV1L, myEdge, t1C); // if (pri==-3) { - //modified by NIZNHY-PKV Tue Apr 6 14:06:29 2010 t1C = t1; - //myErrorStatus=4; - //return; - //modified by NIZNHY-PKV Tue Apr 6 14:06:31 2010 - } } } @@ -369,14 +381,10 @@ BRepBuilderAPI_MakeVertex aMV2(aP2L); const TopoDS_Vertex& aV2L=aMV2.Vertex(); // - pri=myCtx->ComputeVE (aV2L, myEdge, t2C); + pri=myContext->ComputeVE (aV2L, myEdge, t2C); // if (pri==-3) { - //modified by NIZNHY-PKV Tue Apr 6 14:07:34 2010f t2C = t2; - //myErrorStatus=5; - //return; - //modified by NIZNHY-PKV Tue Apr 6 14:07:39 2010t } } }