1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-04-21 10:13:43 +03:00

0022967: Boolean operations between two cylinders with orthogonal axis generate a shape with big vertex tolerance

This commit is contained in:
PKV 2012-02-10 13:13:27 +00:00 committed by bugmaster
parent 1d37eeb6c1
commit 4f189102e9
32 changed files with 682 additions and 530 deletions

View File

@ -817,11 +817,17 @@ Standard_Boolean TestShapeType(const TopoDS_Shape & TheShape)
// static function: CheckEdge // static function: CheckEdge
// purpose: // purpose:
// ---------------------------------------------------------------------- // ----------------------------------------------------------------------
Standard_Boolean CheckEdge(const TopoDS_Edge& theEdge) { Standard_Boolean CheckEdge(const TopoDS_Edge& theEdge)
IntTools_Context aContext; {
Handle(IntTools_Context) aContext;
TopoDS_Vertex aV1, aV2; 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); TopExp::Vertices(theEdge, aV1, aV2);
if(aV1.IsNull() || aV2.IsNull() || BRep_Tool::Degenerated(theEdge)) if(aV1.IsNull() || aV2.IsNull() || BRep_Tool::Degenerated(theEdge))
return Standard_True; return Standard_True;
Standard_Real aFirst = 0., aLast = 0.; Standard_Real aFirst = 0., aLast = 0.;

View File

@ -50,7 +50,7 @@
static Standard_Boolean IsValidSeam(const TopoDS_Edge& aE, static Standard_Boolean IsValidSeam(const TopoDS_Edge& aE,
const TopoDS_Face& aF, const TopoDS_Face& aF,
const Standard_Real aT, const Standard_Real aT,
IntTools_Context& aContext); const Handle(IntTools_Context)& aContext);
static void CorrespondantSeam(const TopoDS_Edge& aSpE1Seam11, static void CorrespondantSeam(const TopoDS_Edge& aSpE1Seam11,
const Standard_Real aT1, const Standard_Real aT1,
@ -68,7 +68,7 @@ static void TreatSDSeams (const TopoDS_Edge& aSpE1Seam11,
const TopoDS_Face& aF2FWD, const TopoDS_Face& aF2FWD,
const Standard_Boolean bIsTakenSp1, const Standard_Boolean bIsTakenSp1,
BOP_WireEdgeSet& aWES, 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(); nSp2=aPB2.Edge();
const TopoDS_Edge& anE2=TopoDS::Edge(aDS.GetShape(nE2)); const TopoDS_Edge& anE2=TopoDS::Edge(aDS.GetShape(nE2));
// //
IntTools_Context& aContext=pPaveFiller->ChangeContext(); const Handle(IntTools_Context)& aContext=pPaveFiller->Context();
aFlag=aContext.ProjectPointOnEdge(aPx1, anE2, aTs); aFlag=aContext->ProjectPointOnEdge(aPx1, anE2, aTs);
// //
if (!aFlag) { if (!aFlag) {
BOPTColStd_Dump::PrintMessage(" BOP_SDFWESFiller::PrepareOnParts() failed\n"); BOPTColStd_Dump::PrintMessage(" BOP_SDFWESFiller::PrepareOnParts() failed\n");
@ -688,7 +688,7 @@ static void TreatSDSeams (const TopoDS_Edge& aSpE1Seam11,
BOPTools_CommonBlockPool& aCBPool=pPaveFiller->ChangeCommonBlockPool(); BOPTools_CommonBlockPool& aCBPool=pPaveFiller->ChangeCommonBlockPool();
BOP_WireEdgeSet& aWES=*myWES; 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_Integer nE1, nE2, aNbSpON, nSp1, aBid, nSpTaken, nSp2, iRankF1, iRankF2;
Standard_Real aT1, aT2, aU, aV, aScPr; 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)); 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_Edge& aDE=TopoDS::Edge(aDS.Shape(nED));
const TopoDS_Face& aDF=TopoDS::Face(aDS.Shape(nFD)); const TopoDS_Face& aDF=TopoDS::Face(aDS.Shape(nFD));
const TopoDS_Face& aFaceReference=TopoDS::Face(aDS.Shape(nF2)); const TopoDS_Face& aFaceReference=TopoDS::Face(aDS.Shape(nF2));
@ -1113,7 +1113,7 @@ static void TreatSDSeams (const TopoDS_Edge& aSpE1Seam11,
// //
aState=TopAbs_OUT; aState=TopAbs_OUT;
// //
bIsValidPoint=aContext.IsValidPointForFace(aPxNear, aFaceReference, 1.e-3); bIsValidPoint=aContext->IsValidPointForFace(aPxNear, aFaceReference, 1.e-3);
// //
if (bIsValidPoint) { if (bIsValidPoint) {
aState=TopAbs_IN; aState=TopAbs_IN;
@ -1170,7 +1170,7 @@ void TreatSDSeams (const TopoDS_Edge& aSpE1Seam11,
const Standard_Boolean bIsTakenSp1, const Standard_Boolean bIsTakenSp1,
BOP_WireEdgeSet& aWES, BOP_WireEdgeSet& aWES,
IntTools_Context& aContext) const Handle(IntTools_Context)& aContext)
{ {
Standard_Boolean bIsValidSeam11, bIsValidSeam12, Standard_Boolean bIsValidSeam11, bIsValidSeam12,
bIsValidSeam21, bIsValidSeam22; bIsValidSeam21, bIsValidSeam22;
@ -1261,7 +1261,7 @@ void TreatSDSeams (const TopoDS_Edge& aSpE1Seam11,
Standard_Boolean IsValidSeam(const TopoDS_Edge& aE, Standard_Boolean IsValidSeam(const TopoDS_Edge& aE,
const TopoDS_Face& aF, const TopoDS_Face& aF,
const Standard_Real aT, const Standard_Real aT,
IntTools_Context& aContext) const Handle(IntTools_Context)& aContext)
{ {
Standard_Boolean bIsPointInOnFace; Standard_Boolean bIsPointInOnFace;
gp_Pnt2d aPx2DNear; gp_Pnt2d aPx2DNear;
@ -1269,7 +1269,7 @@ void TreatSDSeams (const TopoDS_Edge& aSpE1Seam11,
BOPTools_Tools3D::PointNearEdge(aE, aF, aT, aPx2DNear, aPxNear); BOPTools_Tools3D::PointNearEdge(aE, aF, aT, aPx2DNear, aPxNear);
// //
bIsPointInOnFace=aContext.IsPointInOnFace(aF, aPx2DNear); bIsPointInOnFace=aContext->IsPointInOnFace(aF, aPx2DNear);
return bIsPointInOnFace; return bIsPointInOnFace;
} }
//======================================================================= //=======================================================================

View File

@ -63,7 +63,7 @@ static
const Standard_Integer theFaceIndex, const Standard_Integer theFaceIndex,
const BOPTools_PDSFiller& theDSFiller, const BOPTools_PDSFiller& theDSFiller,
const BOP_Operation& theOperation, const BOP_Operation& theOperation,
IntTools_Context& theContext); const Handle(IntTools_Context)& theContext);
//======================================================================= //=======================================================================
// //
@ -123,7 +123,7 @@ static
BOPTools_PaveFiller* pPaveFiller=(BOPTools_PaveFiller*)&aPaveFiller; BOPTools_PaveFiller* pPaveFiller=(BOPTools_PaveFiller*)&aPaveFiller;
BOPTools_CommonBlockPool& aCBPool=pPaveFiller->ChangeCommonBlockPool(); 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_Integer nEF1, nF2, nSpF1, nSpF2, nEF2, nSpTaken, iRankF1;
Standard_Boolean bToReverse; Standard_Boolean bToReverse;
@ -592,7 +592,7 @@ static
BOPTools_PaveFiller* pPaveFiller=(BOPTools_PaveFiller*)&aPF; BOPTools_PaveFiller* pPaveFiller=(BOPTools_PaveFiller*)&aPF;
BOPTools_CommonBlockPool& aCBPool=pPaveFiller->ChangeCommonBlockPool(); 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_Integer nEF1, nF2, nSpF1, nSpF2, nEF2, nSpTaken, nF2x, iRankF1;
Standard_Boolean bToReverse; Standard_Boolean bToReverse;
@ -782,7 +782,7 @@ Standard_Boolean CheckSplitToAvoid(const TopoDS_Edge& theSplit,
const Standard_Integer theFaceIndex, const Standard_Integer theFaceIndex,
const BOPTools_PDSFiller& theDSFiller, const BOPTools_PDSFiller& theDSFiller,
const BOP_Operation& theOperation, const BOP_Operation& theOperation,
IntTools_Context& theContext) { const Handle(IntTools_Context)& theContext) {
Standard_Integer anE = -1; Standard_Integer anE = -1;
@ -823,7 +823,7 @@ Standard_Boolean CheckSplitToAvoid(const TopoDS_Edge& theSplit,
gp_Pnt aPoint3d; gp_Pnt aPoint3d;
Standard_Real aTolerance = BRep_Tool::Tolerance(theSplit); //??? Standard_Real aTolerance = BRep_Tool::Tolerance(theSplit); //???
BOPTools_Tools3D::PointNearEdge(theSplit, aFaceCur, amidpar, aTolerance, aPoint2d, aPoint3d); BOPTools_Tools3D::PointNearEdge(theSplit, aFaceCur, amidpar, aTolerance, aPoint2d, aPoint3d);
GeomAPI_ProjectPointOnSurf& aProjector = theContext.ProjPS(aFace); GeomAPI_ProjectPointOnSurf& aProjector = theContext->ProjPS(aFace);
aProjector.Perform(aPoint3d); aProjector.Perform(aPoint3d);
if(aProjector.IsDone()) { if(aProjector.IsDone()) {
@ -833,7 +833,7 @@ Standard_Boolean CheckSplitToAvoid(const TopoDS_Edge& theSplit,
if(adist < BRep_Tool::Tolerance(aFace)) { if(adist < BRep_Tool::Tolerance(aFace)) {
aProjector.LowerDistanceParameters(U, V); aProjector.LowerDistanceParameters(U, V);
if(theContext.IsPointInFace(aFace, gp_Pnt2d(U, V))) { if(theContext->IsPointInFace(aFace, gp_Pnt2d(U, V))) {
avoid = Standard_False; avoid = Standard_False;
break; break;
} }
@ -851,7 +851,7 @@ Standard_Boolean CheckSplitToAvoid(const TopoDS_Edge& theSplit,
gp_Pnt aPoint3d; gp_Pnt aPoint3d;
Standard_Real aTolerance = BRep_Tool::Tolerance(theSplit); //??? Standard_Real aTolerance = BRep_Tool::Tolerance(theSplit); //???
BOPTools_Tools3D::PointNearEdge(theSplit, aFaceCur, amidpar, aTolerance, aPoint2d, aPoint3d); BOPTools_Tools3D::PointNearEdge(theSplit, aFaceCur, amidpar, aTolerance, aPoint2d, aPoint3d);
GeomAPI_ProjectPointOnSurf& aProjector = theContext.ProjPS(aFace); GeomAPI_ProjectPointOnSurf& aProjector = theContext->ProjPS(aFace);
aProjector.Perform(aPoint3d); aProjector.Perform(aPoint3d);
if(aProjector.IsDone()) { if(aProjector.IsDone()) {
@ -861,7 +861,7 @@ Standard_Boolean CheckSplitToAvoid(const TopoDS_Edge& theSplit,
if(adist < BRep_Tool::Tolerance(aFace)) { if(adist < BRep_Tool::Tolerance(aFace)) {
aProjector.LowerDistanceParameters(U, V); aProjector.LowerDistanceParameters(U, V);
if(theContext.IsPointInFace(aFace, gp_Pnt2d(U, V))) { if(theContext->IsPointInFace(aFace, gp_Pnt2d(U, V))) {
avoid = Standard_False; avoid = Standard_False;
break; break;
} }
@ -879,7 +879,7 @@ Standard_Boolean CheckSplitToAvoid(const TopoDS_Edge& theSplit,
gp_Pnt aPoint3d; gp_Pnt aPoint3d;
Standard_Real aTolerance = BRep_Tool::Tolerance(theSplit); //??? Standard_Real aTolerance = BRep_Tool::Tolerance(theSplit); //???
BOPTools_Tools3D::PointNearEdge(theSplit, aFaceCur, amidpar, aTolerance, aPoint2d, aPoint3d); BOPTools_Tools3D::PointNearEdge(theSplit, aFaceCur, amidpar, aTolerance, aPoint2d, aPoint3d);
GeomAPI_ProjectPointOnSurf& aProjector = theContext.ProjPS(aFace); GeomAPI_ProjectPointOnSurf& aProjector = theContext->ProjPS(aFace);
aProjector.Perform(aPoint3d); aProjector.Perform(aPoint3d);
if(aProjector.IsDone()) { if(aProjector.IsDone()) {
@ -889,7 +889,7 @@ Standard_Boolean CheckSplitToAvoid(const TopoDS_Edge& theSplit,
if(adist < BRep_Tool::Tolerance(aFace)) { if(adist < BRep_Tool::Tolerance(aFace)) {
aProjector.LowerDistanceParameters(U, V); aProjector.LowerDistanceParameters(U, V);
if(theContext.IsPointInFace(aFace, gp_Pnt2d(U, V))) { if(theContext->IsPointInFace(aFace, gp_Pnt2d(U, V))) {
avoid = Standard_False; avoid = Standard_False;
break; break;
} }

View File

@ -81,7 +81,7 @@ static
const BOP_Operation myOperation, const BOP_Operation myOperation,
const TopTools_IndexedDataMapOfShapeListOfShape& aMEF, const TopTools_IndexedDataMapOfShapeListOfShape& aMEF,
BOP_WireEdgeSet& aWES, BOP_WireEdgeSet& aWES,
IntTools_Context& aContext); const Handle(IntTools_Context)& aContext);
static static
void SecondInternal(TopoDS_Edge& aSS, void SecondInternal(TopoDS_Edge& aSS,
@ -93,7 +93,7 @@ static
const Standard_Integer iRankF1, const Standard_Integer iRankF1,
const BOP_Operation myOperation, const BOP_Operation myOperation,
BOP_WireEdgeSet& aWES, BOP_WireEdgeSet& aWES,
IntTools_Context& aContext); const Handle(IntTools_Context)& aContext);
//======================================================================= //=======================================================================
@ -168,7 +168,7 @@ static
BOPTools_InterferencePool* pIntrPool=(BOPTools_InterferencePool*)&myDSFiller->InterfPool(); BOPTools_InterferencePool* pIntrPool=(BOPTools_InterferencePool*)&myDSFiller->InterfPool();
BOPTools_CArray1OfSSInterference& aFFs=pIntrPool->SSInterferences(); BOPTools_CArray1OfSSInterference& aFFs=pIntrPool->SSInterferences();
// //
IntTools_Context& aContext=pPaveFiller->ChangeContext(); const Handle(IntTools_Context)& aContext=pPaveFiller->Context();
// //
Standard_Boolean bIsToKeep; Standard_Boolean bIsToKeep;
Standard_Integer nEF1, nF2, nF2x, nSpF1, iRankF1; Standard_Integer nEF1, nF2, nF2x, nSpF1, iRankF1;
@ -248,7 +248,7 @@ static
BOPTools_PaveFiller* pPaveFiller=(BOPTools_PaveFiller*)&aPaveFiller; BOPTools_PaveFiller* pPaveFiller=(BOPTools_PaveFiller*)&aPaveFiller;
BOPTools_CommonBlockPool& aCBPool=pPaveFiller->ChangeCommonBlockPool(); 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_Integer nEF1, nF2, nSpF1, nSpF2, nEF2, nSpTaken, iRankF1;
TopAbs_Orientation anOrEF1, anOrEF2; TopAbs_Orientation anOrEF1, anOrEF2;
@ -928,7 +928,7 @@ static
BOPTools_PaveFiller* pPaveFiller=(BOPTools_PaveFiller*)&aPF; BOPTools_PaveFiller* pPaveFiller=(BOPTools_PaveFiller*)&aPF;
BOPTools_CommonBlockPool& aCBPool=pPaveFiller->ChangeCommonBlockPool(); 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; Standard_Integer nEF1, nF2, nSpF1, nSpF2, nEF2, nSpTaken, iRankF1, nF2x, iRankF2;
TopAbs_Orientation anOrEF1, anOrEF2; TopAbs_Orientation anOrEF1, anOrEF2;
@ -1261,7 +1261,7 @@ void FirstInternal(TopoDS_Edge& aSS,
const BOP_Operation myOperation, const BOP_Operation myOperation,
const TopTools_IndexedDataMapOfShapeListOfShape& aMEF, const TopTools_IndexedDataMapOfShapeListOfShape& aMEF,
BOP_WireEdgeSet& aWES, BOP_WireEdgeSet& aWES,
IntTools_Context& aContext) const Handle(IntTools_Context)& aContext)
{ {
Standard_Boolean bToReverse; Standard_Boolean bToReverse;
TopAbs_Orientation anOrEF2; TopAbs_Orientation anOrEF2;
@ -1298,7 +1298,7 @@ void SecondInternal(TopoDS_Edge& aSS,
const Standard_Integer iRankF1, const Standard_Integer iRankF1,
const BOP_Operation myOperation, const BOP_Operation myOperation,
BOP_WireEdgeSet& aWES, BOP_WireEdgeSet& aWES,
IntTools_Context& aContext) const Handle(IntTools_Context)& aContext)
{ {
Standard_Boolean bToReverse, bIsToKeep; Standard_Boolean bToReverse, bIsToKeep;
if (aSS.Orientation()==TopAbs_INTERNAL) { if (aSS.Orientation()==TopAbs_INTERNAL) {
@ -1346,7 +1346,7 @@ void SecondInternal(TopoDS_Edge& aSS,
BOPTools_PaveFiller* pPaveFiller=(BOPTools_PaveFiller*)&aPF; BOPTools_PaveFiller* pPaveFiller=(BOPTools_PaveFiller*)&aPF;
BOPTools_CommonBlockPool& aCBPool=pPaveFiller->ChangeCommonBlockPool(); 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; Standard_Integer nEF1, nF2, nSpF1, nSpF2, nEF2, nSpTaken, iRankF1, nF2x, iRankF2, iSenseFlag;
TopAbs_Orientation anOrEF1; TopAbs_Orientation anOrEF1;

View File

@ -191,7 +191,7 @@ Standard_Boolean BOP_ShellSolid::SplitFace(const Standard_Integer theFaceIndex,
TopoDS_Edge aSpF2 = TopoDS::Edge(aSp2); TopoDS_Edge aSpF2 = TopoDS::Edge(aSp2);
Standard_Boolean bToReverse= Standard_Boolean bToReverse=
BOPTools_Tools3D::IsSplitToReverse1 (aSpF1, aSpF2, pPaveFiller->ChangeContext()); BOPTools_Tools3D::IsSplitToReverse1 (aSpF1, aSpF2, pPaveFiller->Context());
if (bToReverse) { if (bToReverse) {
aSpF2.Reverse(); aSpF2.Reverse();

View File

@ -298,7 +298,7 @@ Standard_Boolean BOP_SolidSolid::ComputeStateByInsidePoints(const Standard_Integ
Standard_Integer nF2 = aFF.OppositeIndex(nF1); Standard_Integer nF2 = aFF.OppositeIndex(nF1);
const TopoDS_Face& aF2 = TopoDS::Face(aDS.Shape(nF2)); 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; theState = TopAbs_ON;
return Standard_True; 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; return Standard_False;
} }
theState = aState; theState = aState;
@ -598,7 +598,7 @@ Standard_Boolean ComputeStateForAnalyticalSurfaces(const Standard_Integer theFac
bAnalytic = BOPTools_Tools3D::TreatedAsAnalytic(aF2, aSp, aFace, bAnalytic = BOPTools_Tools3D::TreatedAsAnalytic(aF2, aSp, aFace,
aTolTangent, aTolR, aTolTangent, aTolR,
aStPF, pPaveFiller->ChangeContext()); aStPF, pPaveFiller->Context());
if(bAnalytic) { if(bAnalytic) {
aState = aStPF; aState = aStPF;
bFound = Standard_True; bFound = Standard_True;

View File

@ -81,10 +81,12 @@ Standard_Integer bopcurves (Draw_Interpretor& di,
const TopoDS_Face& aF2=TopoDS::Face(S2); const TopoDS_Face& aF2=TopoDS::Face(S2);
Standard_Boolean aToApproxC3d, aToApproxC2dOnS1, aToApproxC2dOnS2, anIsDone; Standard_Boolean aToApproxC3d, aToApproxC2dOnS1, aToApproxC2dOnS2, anIsDone;
Standard_Boolean bToSplit;
Standard_Integer i, aNbCurves; Standard_Integer i, aNbCurves;
Standard_Real anAppTol, aTolR; Standard_Real anAppTol, aTolR;
TCollection_AsciiString aNm("c_"); TCollection_AsciiString aNm("c_");
//
bToSplit=Standard_False;
aToApproxC3d=Standard_True; aToApproxC3d=Standard_True;
aToApproxC2dOnS1=Standard_False; aToApproxC2dOnS1=Standard_False;
aToApproxC2dOnS2=Standard_False; aToApproxC2dOnS2=Standard_False;
@ -107,7 +109,7 @@ Standard_Integer bopcurves (Draw_Interpretor& di,
return 1; return 1;
} }
aFF.PrepareLines3D(); aFF.PrepareLines3D(bToSplit);
const IntTools_SequenceOfCurves& aSCs=aFF.Lines(); const IntTools_SequenceOfCurves& aSCs=aFF.Lines();
// //

View File

@ -294,7 +294,7 @@ Standard_Integer bremovesim (Draw_Interpretor& di, Standard_Integer n, const cha
const TopoDS_Face& aF=TopoDS::Face(S1); const TopoDS_Face& aF=TopoDS::Face(S1);
// //
IntTools_Context aCtx; Handle(IntTools_Context) aCtx=new IntTools_Context;
BOPTools_Tools3D::RemoveSims (aF, aCtx); BOPTools_Tools3D::RemoveSims (aF, aCtx);
// //
di << " Ok\n"; di << " Ok\n";

View File

@ -60,6 +60,7 @@
#include <BooleanOperations_AncestorsSeqAndSuccessorsSeq.hxx> #include <BooleanOperations_AncestorsSeqAndSuccessorsSeq.hxx>
#include <BOPTColStd_Failure.hxx> #include <BOPTColStd_Failure.hxx>
#include <IntTools_Context.hxx>
//======================================================================= //=======================================================================
// function: BOPTools_Checker::BOPTools_Checker // function: BOPTools_Checker::BOPTools_Checker
@ -149,6 +150,10 @@ void BOPTools_Checker::Perform()
{ {
myCheckResults.Clear(); myCheckResults.Clear();
try { try {
//
if (myContext.IsNull()) {
myContext=new IntTools_Context;
}
// //
// 0. Prepare the IteratorOfCoupleOfShape // 0. Prepare the IteratorOfCoupleOfShape
myDSIt.SetDataStructure(myDS); myDSIt.SetDataStructure(myDS);
@ -284,7 +289,7 @@ void BOPTools_Checker::PerformVE()
continue; continue;
} }
// //
aFlag=myContext.ComputeVE (aV1, aE2, aT); aFlag=myContext->ComputeVE (aV1, aE2, aT);
// //
if (!aFlag) { if (!aFlag) {
char buf[512]; char buf[512];
@ -345,7 +350,7 @@ void BOPTools_Checker::PerformVF()
continue; continue;
} }
// //
aFlag=myContext.ComputeVS (aV1, aF2, aU, aV); aFlag=myContext->ComputeVS (aV1, aF2, aU, aV);
// //
if (!aFlag) { if (!aFlag) {
char buf[512]; char buf[512];
@ -857,7 +862,7 @@ void BOPTools_Checker::PerformEF()
aC.Bounds(aT1, aT2, aP1, aP2); 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) { if (bValid) {
char buf[512]; char buf[512];

View File

@ -293,9 +293,9 @@
if (aTypeReference==TopAbs_SOLID) { if (aTypeReference==TopAbs_SOLID) {
// ... \ Solid processing // ... \ Solid processing
IntTools_Context& aContext=myFiller->ChangeContext(); const Handle(IntTools_Context)& aContext=myFiller->Context();
const TopoDS_Solid& aReferenceSolid=TopoDS::Solid(aReference); const TopoDS_Solid& aReferenceSolid=TopoDS::Solid(aReference);
BRepClass3d_SolidClassifier& SC=aContext.SolidClassifier(aReferenceSolid); BRepClass3d_SolidClassifier& SC=aContext->SolidClassifier(aReferenceSolid);
// //
SC.Perform(aPxNear, aTol); SC.Perform(aPxNear, aTol);
// //
@ -385,8 +385,8 @@
Standard_Boolean bIsValidPoint; Standard_Boolean bIsValidPoint;
TopAbs_State aState=TopAbs_OUT; TopAbs_State aState=TopAbs_OUT;
// //
IntTools_Context& aContext=myFiller->ChangeContext(); const Handle(IntTools_Context)& aContext=myFiller->Context();
bIsValidPoint=aContext.IsValidPointForFace(aPxNear, aFaceReference, 1.e-3); bIsValidPoint=aContext->IsValidPointForFace(aPxNear, aFaceReference, 1.e-3);
// //
if (bIsValidPoint) { if (bIsValidPoint) {
aState=TopAbs_IN; aState=TopAbs_IN;

View File

@ -116,15 +116,20 @@ is
--- Selectors --- Selectors
--- ---
--- ---
SetContext(me:out;
aContext: Context from IntTools);
---Purpose:
--- Sets the intersecton context
---
Context(me) Context(me)
returns Context from IntTools; returns Context from IntTools;
---C++:return const & ---C++:return const &
---Purpose: ---Purpose:
--- Selector --- Selector
--- ---
ChangeContext(me:out) -- ChangeContext(me:out)
returns Context from IntTools; -- returns Context from IntTools;
---C++:return & -- C++:return &
---Purpose: ---Purpose:
--- Selector --- Selector
--- ---

View File

@ -151,15 +151,23 @@
{ {
return mySectionAttribute; return mySectionAttribute;
} }
//=======================================================================
// function: SetContext
// purpose:
//=======================================================================
void BOPTools_PaveFiller::SetContext(const Handle(IntTools_Context)& aContext)
{
myContext=aContext;
}
//======================================================================= //=======================================================================
// function: Context // function: Context
// purpose: // purpose:
//======================================================================= //=======================================================================
const IntTools_Context& BOPTools_PaveFiller::Context() const const Handle(IntTools_Context)& BOPTools_PaveFiller::Context() const
{ {
return myContext; return myContext;
} }
/*
//======================================================================= //=======================================================================
// function: ChangeContext // function: ChangeContext
// purpose: // purpose:
@ -168,7 +176,7 @@
{ {
return myContext; return myContext;
} }
*/
//======================================================================= //=======================================================================
// function: Perform // function: Perform
// purpose: // purpose:
@ -176,6 +184,10 @@
void BOPTools_PaveFiller::Perform() void BOPTools_PaveFiller::Perform()
{ {
try { try {
//
if (myContext.IsNull()) {
myContext=new IntTools_Context;
}
// //
// 0. Prepare the IteratorOfCoupleOfShape // 0. Prepare the IteratorOfCoupleOfShape
myDSIt.SetDataStructure(myDS); myDSIt.SetDataStructure(myDS);
@ -247,6 +259,11 @@
const TColStd_SetOfInteger& aToolSubSet) const TColStd_SetOfInteger& aToolSubSet)
{ {
try { try {
//
if (myContext.IsNull()) {
myContext=new IntTools_Context;
}
//
// //
// 0. Prepare the IteratorOfCoupleOfShape // 0. Prepare the IteratorOfCoupleOfShape
myDSIt.SetDataStructure(myDS); myDSIt.SetDataStructure(myDS);
@ -319,6 +336,11 @@
void BOPTools_PaveFiller::ToCompletePerform() void BOPTools_PaveFiller::ToCompletePerform()
{ {
try { try {
//
if (myContext.IsNull()) {
myContext=new IntTools_Context;
}
//
PutPavesOnCurves(); PutPavesOnCurves();
MakeSplitEdges (); MakeSplitEdges ();
@ -392,7 +414,7 @@
continue; continue;
} }
// //
aFlag=myContext.ComputeVE (aV1, aE2, aT); aFlag=myContext->ComputeVE (aV1, aE2, aT);
// //
if (!aFlag) { if (!aFlag) {
// //
@ -471,7 +493,7 @@
const TopoDS_Vertex& aV1=TopoDS::Vertex(aS1); const TopoDS_Vertex& aV1=TopoDS::Vertex(aS1);
const TopoDS_Face& aF2=TopoDS::Face (aS2); const TopoDS_Face& aF2=TopoDS::Face (aS2);
// //
aFlag=myContext.ComputeVS (aV1, aF2, aU, aV); aFlag=myContext->ComputeVS (aV1, aF2, aU, aV);
// //
if (!aFlag) { if (!aFlag) {
// //

View File

@ -162,7 +162,7 @@
aEF.SetDiscretize (aDiscretize); aEF.SetDiscretize (aDiscretize);
aEF.SetDeflection (aDeflection); aEF.SetDeflection (aDeflection);
// //
aEF.SetContext((IntTools_PContext)&myContext); aEF.SetContext(myContext);
// //
BRepAdaptor_Curve aCurve(aE); BRepAdaptor_Curve aCurve(aE);
@ -350,7 +350,7 @@
Standard_Real aTNew; Standard_Real aTNew;
// //
iFlag=myContext.ComputeVE(aVF, aE, aTNew); iFlag=myContext->ComputeVE(aVF, aE, aTNew);
// //
aT=aTNew; aT=aTNew;
aNewShape=nVF; aNewShape=nVF;

View File

@ -156,7 +156,7 @@ static Standard_Boolean CheckNewVertexAndUpdateData(const TopoDS_Vertex&
const Standard_Real theTolerance, const Standard_Real theTolerance,
const BOPTools_PInterferencePool& theIntrPool, const BOPTools_PInterferencePool& theIntrPool,
const BooleanOperations_PShapesDataStructure& theDS, const BooleanOperations_PShapesDataStructure& theDS,
IntTools_Context* theContext, const Handle(IntTools_Context)& theContext,
const BOPTools_PaveSet& theEdgePaveSet, const BOPTools_PaveSet& theEdgePaveSet,
const Standard_Boolean bAddNewVertex, const Standard_Boolean bAddNewVertex,
const Standard_Boolean bAddOldVertex, const Standard_Boolean bAddOldVertex,
@ -218,9 +218,7 @@ static
aFFs.SetBlockLength(aNbFFs); aFFs.SetBlockLength(aNbFFs);
} }
// //
//modified by NIZNHY-PKV Thu Oct 20 07:09:57 2011f
bToSplit=Standard_False; bToSplit=Standard_False;
//modified by NIZNHY-PKV Thu Oct 20 07:09:59 2011t
for (; myDSIt.More(); myDSIt.Next()) { for (; myDSIt.More(); myDSIt.Next()) {
Standard_Boolean justaddinterference = Standard_True; Standard_Boolean justaddinterference = Standard_True;
@ -272,8 +270,8 @@ static
TopoDS_Face aF2=TopoDS::Face(myDS->GetShape(nF2)); TopoDS_Face aF2=TopoDS::Face(myDS->GetShape(nF2));
// //
IntSurf_ListOfPntOn2S aListOfPnts; IntSurf_ListOfPntOn2S aListOfPnts;
GeomAPI_ProjectPointOnSurf& aProj1 = myContext.ProjPS(aF1); GeomAPI_ProjectPointOnSurf& aProj1 = myContext->ProjPS(aF1);
GeomAPI_ProjectPointOnSurf& aProj2 = myContext.ProjPS(aF2); GeomAPI_ProjectPointOnSurf& aProj2 = myContext->ProjPS(aF2);
BOPTools_CArray1OfESInterference& aEFs=myIntrPool->ESInterferences(); BOPTools_CArray1OfESInterference& aEFs=myIntrPool->ESInterferences();
TColStd_MapOfInteger aMapEdgeIndex1, aMapEdgeIndex2; TColStd_MapOfInteger aMapEdgeIndex1, aMapEdgeIndex2;
@ -383,6 +381,9 @@ static
anApproxTol=1.e-7; anApproxTol=1.e-7;
IntTools_FaceFace aFF; IntTools_FaceFace aFF;
//
aFF.SetContext(myContext);
//
aFF.SetParameters (bToApproxC3d, aFF.SetParameters (bToApproxC3d,
bToApproxC2dOnS1, bToApproxC2dOnS1,
bToApproxC2dOnS2, bToApproxC2dOnS2,
@ -402,10 +403,7 @@ static
if (aTolR3D < 1.e-7){ if (aTolR3D < 1.e-7){
aTolR3D=1.e-7; aTolR3D=1.e-7;
} }
//modified by NIZNHY-PKV Thu Oct 20 07:10:38 2011f
aFF.PrepareLines3D(bToSplit); aFF.PrepareLines3D(bToSplit);
//aFF.PrepareLines3D();
//modified by NIZNHY-PKV Thu Oct 20 07:10:41 2011t
// //
anIndexIn=0; anIndexIn=0;
Standard_Integer aNbCurves, aNbPoints; Standard_Integer aNbCurves, aNbPoints;
@ -561,7 +559,7 @@ static
// Checking of validity in 2D // Checking of validity in 2D
// //
Standard_Real aTolerance = (aTolR3D < 1.e-3) ? 1.e-3 : aTolR3D; 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) { if (!bValid) {
continue; continue;
@ -691,7 +689,7 @@ static
Standard_Boolean bVF; Standard_Boolean bVF;
Standard_Integer aNewShape; Standard_Integer aNewShape;
// //
bVF=myContext.IsValidPointForFaces (aPAlone, aF1, aF2, 1.e-3); bVF=myContext->IsValidPointForFaces (aPAlone, aF1, aF2, 1.e-3);
// //
if (bVF) { if (bVF) {
BooleanOperations_AncestorsSeqAndSuccessorsSeq anASSeq; BooleanOperations_AncestorsSeqAndSuccessorsSeq anASSeq;
@ -772,7 +770,7 @@ static
// VE // VE
if (!iV) { if (!iV) {
iVE=myContext.ComputeVE (aV11, aE2, aTE); iVE=myContext->ComputeVE (aV11, aE2, aTE);
if (!iVE) { if (!iVE) {
iCount++; iCount++;
if (iCount>iCountExt) { if (iCount>iCountExt) {
@ -803,7 +801,7 @@ static
// VE // VE
if (!iV) { if (!iV) {
// //
iVE=myContext.ComputeVE (aV12, aE2, aTE); iVE=myContext->ComputeVE (aV12, aE2, aTE);
// //
if (!iVE) { if (!iVE) {
iCount++; iCount++;
@ -850,7 +848,7 @@ static
nE2=aPBR.Edge(); nE2=aPBR.Edge();
const TopoDS_Edge& aE2=TopoDS::Edge(myDS->GetShape(nE2)); const TopoDS_Edge& aE2=TopoDS::Edge(myDS->GetShape(nE2));
// VE // VE
iVM=myContext.ComputeVE(aVM, aE2, aTmp); iVM=myContext->ComputeVE(aVM, aE2, aTmp);
// //
return iVM; return iVM;
} }
@ -887,13 +885,13 @@ static
TopoDS_Face aF1=TopoDS::Face(myDS->GetShape(nF1)); TopoDS_Face aF1=TopoDS::Face(myDS->GetShape(nF1));
TopoDS_Face aF2=TopoDS::Face(myDS->GetShape(nF2)); TopoDS_Face aF2=TopoDS::Face(myDS->GetShape(nF2));
// //
bVF=myContext.IsValidPointForFaces (aP1, aF1, aF2, aTolR3D); bVF=myContext->IsValidPointForFaces (aP1, aF1, aF2, aTolR3D);
// //
if (bVF) { if (bVF) {
PutBoundPaveOnCurve (aP1, aT1, aBC, aFFi); PutBoundPaveOnCurve (aP1, aT1, aBC, aFFi);
} }
// //
bVF=myContext.IsValidPointForFaces (aP2, aF1, aF2, aTolR3D); bVF=myContext->IsValidPointForFaces (aP2, aF1, aF2, aTolR3D);
// //
if (bVF) { if (bVF) {
PutBoundPaveOnCurve (aP2, aT2, aBC, aFFi); PutBoundPaveOnCurve (aP2, aT2, aBC, aFFi);
@ -992,13 +990,13 @@ static
TopoDS_Face aF1=TopoDS::Face(myDS->GetShape(nF1)); TopoDS_Face aF1=TopoDS::Face(myDS->GetShape(nF1));
TopoDS_Face aF2=TopoDS::Face(myDS->GetShape(nF2)); TopoDS_Face aF2=TopoDS::Face(myDS->GetShape(nF2));
// //
bVF=myContext.IsValidPointForFaces (aP1, aF1, aF2, aTolR3D); bVF=myContext->IsValidPointForFaces (aP1, aF1, aF2, aTolR3D);
// //
if (bVF) { if (bVF) {
PutBoundPaveOnCurveSpec (aP1, aT1, aBC, aFFi); PutBoundPaveOnCurveSpec (aP1, aT1, aBC, aFFi);
} }
// //
bVF=myContext.IsValidPointForFaces (aP2, aF1, aF2, aTolR3D); bVF=myContext->IsValidPointForFaces (aP2, aF1, aF2, aTolR3D);
// //
if (bVF) { if (bVF) {
PutBoundPaveOnCurveSpec (aP2, aT2, aBC, aFFi); PutBoundPaveOnCurveSpec (aP2, aT2, aBC, aFFi);
@ -1068,7 +1066,7 @@ static
if(!aMap.Add(anE)) continue; if(!aMap.Add(anE)) continue;
anErrStat = anErrStat =
myContext.ComputeVE(aNewVertex, TopoDS::Edge(anE), aPar); myContext->ComputeVE(aNewVertex, TopoDS::Edge(anE), aPar);
if(anErrStat) continue; if(anErrStat) continue;
// //
Standard_Real aT1, aT2; Standard_Real aT1, aT2;
@ -1080,7 +1078,7 @@ static
TopoDS_Vertex aNewVertex1; TopoDS_Vertex aNewVertex1;
BOPTools_Tools::MakeNewVertex(aP1, aTolV, aNewVertex1); BOPTools_Tools::MakeNewVertex(aP1, aTolV, aNewVertex1);
anErrStat = 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 if(!anErrStat) continue; //curve and edge seem to be coincide
aWhat = nV; aWhat = nV;
@ -1116,7 +1114,7 @@ static
if(!aMap.Add(anE)) continue; if(!aMap.Add(anE)) continue;
anErrStat = anErrStat =
myContext.ComputeVE(aNewVertex, TopoDS::Edge(anE), aPar); myContext->ComputeVE(aNewVertex, TopoDS::Edge(anE), aPar);
if(anErrStat) continue; if(anErrStat) continue;
// //
Standard_Real aT1, aT2; Standard_Real aT1, aT2;
@ -1128,7 +1126,7 @@ static
TopoDS_Vertex aNewVertex1; TopoDS_Vertex aNewVertex1;
BOPTools_Tools::MakeNewVertex(aP1, aTolV, aNewVertex1); BOPTools_Tools::MakeNewVertex(aP1, aTolV, aNewVertex1);
anErrStat = 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 if(!anErrStat) continue; //curve and edge seem to be coincide
aWhat = nV; aWhat = nV;
@ -1355,7 +1353,7 @@ static
// //
aTolVExt=BRep_Tool::Tolerance(aV); aTolVExt=BRep_Tool::Tolerance(aV);
ExtendedTolerance(nV, aTolVExt); ExtendedTolerance(nV, aTolVExt);
bIsVertexOnLine=myContext.IsVertexOnLine(aV, aTolVExt, aC, aTolR3D, aT); bIsVertexOnLine=myContext->IsVertexOnLine(aV, aTolVExt, aC, aTolR3D, aT);
// //
if (bIsVertexOnLine) { if (bIsVertexOnLine) {
BOPTools_Pave aPaveNew(nV, aT, BooleanOperations_SurfaceSurface); 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 // Put closing pave if needded
for (j=1; j<=aNbCurves; ++j) { for (j=1; j<=aNbCurves; ++j) {
BOPTools_Curve& aBC=aSCvs(j); BOPTools_Curve& aBC=aSCvs(j);
PutClosingPaveOnCurve (aBC, aFFi); PutClosingPaveOnCurve (aBC, aFFi);
} }
//modified by NIZNHY-PKV Thu Oct 20 07:14:34 2011t
// //
// xxx // xxx
for (j=1; j<=aNbCurves; j++) { for (j=1; j<=aNbCurves; j++) {
@ -1942,21 +1938,19 @@ void ProcessAloneStickVertices(const Standard_Integer nF1,
UnUsedMap(aSCvs, aPSF, aMapUnUsed); UnUsedMap(aSCvs, aPSF, aMapUnUsed);
aNbVtx=aMapUnUsed.Extent(); aNbVtx=aMapUnUsed.Extent();
if (aNbVtx) { if (aNbVtx) {
IntTools_Context& aCtx=aPF.ChangeContext(); const Handle(IntTools_Context)& aCtx=aPF.Context();
// //
aNbSCvs=aSCvs.Length(); aNbSCvs=aSCvs.Length();
if (aNbSCvs==1) { if (aNbSCvs==1) {
BOPTools_Curve& aBC=aSCvs(1); BOPTools_Curve& aBC=aSCvs(1);
const IntTools_Curve& aIC=aBC.Curve(); const IntTools_Curve& aIC=aBC.Curve();
Handle (Geom_Curve) aC3D= aIC.Curve(); Handle (Geom_Curve) aC3D= aIC.Curve();
//modified by NIZNHY-PKV Wed Nov 02 13:33:42 2011f
// //
bIsClosed=IntTools_Tools::IsClosed(aC3D); bIsClosed=IntTools_Tools::IsClosed(aC3D);
if (bIsClosed) { if (bIsClosed) {
return; 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) { for (jx=1; jx<=aNbVtx; ++jx) {
nV=aMapUnUsed(jx); nV=aMapUnUsed(jx);
@ -2384,8 +2378,8 @@ Standard_Boolean IsPairFound(const Standard_Integer nF1,
TopoDS_Face anOtherFace = TopoDS::Face(atmpShape); TopoDS_Face anOtherFace = TopoDS::Face(atmpShape);
gp_Pnt aP3d = aCurve->Value(t2); gp_Pnt aP3d = aCurve->Value(t2);
if(myContext.IsPointInOnFace(TopoDS::Face(aFace), aP2dOnFace) && if(myContext->IsPointInOnFace(TopoDS::Face(aFace), aP2dOnFace) &&
myContext.IsValidPointForFace(aP3d, anOtherFace, BRep_Tool::Tolerance(anEdge))) { myContext->IsValidPointForFace(aP3d, anOtherFace, BRep_Tool::Tolerance(anEdge))) {
BOPTools_Pave aPave1; BOPTools_Pave aPave1;
aPave1.SetParam(t1); aPave1.SetParam(t1);
aPave1.SetIndex(-1); aPave1.SetIndex(-1);
@ -2441,7 +2435,7 @@ Standard_Boolean IsPairFound(const Standard_Integer nF1,
TopoDS_Shape aOppFace = myDS->Shape(nFOpposite); TopoDS_Shape aOppFace = myDS->Shape(nFOpposite);
if(!bHasCBOnFace && !bFaceCBFound && if(!bHasCBOnFace && !bFaceCBFound &&
myContext.IsValidPointForFace(aPMid, TopoDS::Face(aOppFace), myContext->IsValidPointForFace(aPMid, TopoDS::Face(aOppFace),
BRep_Tool::Tolerance(anEdge) + BRep_Tool::Tolerance(anEdge) +
BRep_Tool::Tolerance(TopoDS::Face(aOppFace)))) { BRep_Tool::Tolerance(TopoDS::Face(aOppFace)))) {
bFaceCBFound = Standard_True; bFaceCBFound = Standard_True;
@ -2457,7 +2451,7 @@ Standard_Boolean IsPairFound(const Standard_Integer nF1,
TopoDS_Shape aTmpEdge = anExpE.Current(); TopoDS_Shape aTmpEdge = anExpE.Current();
Standard_Real aParameter = 0.; 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; bEdgeCBFound = Standard_True;
break; break;
} }
@ -2516,7 +2510,7 @@ Standard_Boolean IsPairFound(const Standard_Integer nF1,
Standard_Boolean bAddNewVertextmp = bAddNewVertex, bAddOldVertextmp = bAddOldVertex; Standard_Boolean bAddNewVertextmp = bAddNewVertex, bAddOldVertextmp = bAddOldVertex;
if(!CheckNewVertexAndUpdateData(aNewVertex, aPaveOnEdge.Param(), anEdge, aPaveOnCurve.Param(), 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, bAddNewVertextmp, bAddOldVertextmp, theBC, aPaveToPut,
bAddNewVertex, bAddOldVertex)) { bAddNewVertex, bAddOldVertex)) {
bAddNewVertex = Standard_False; bAddNewVertex = Standard_False;
@ -2653,7 +2647,7 @@ Standard_Boolean IsPairFound(const Standard_Integer nF1,
TopoDS_Edge anOppEdge = TopoDS::Edge(myDS->Shape(anOppIndex)); TopoDS_Edge anOppEdge = TopoDS::Edge(myDS->Shape(anOppIndex));
Standard_Real aOppParameter = 0.; 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())) { if((aOppParameter > aRange.First()) && (aOppParameter < aRange.Last())) {
// put pave on same domain edge. begin // put pave on same domain edge. begin
@ -2766,7 +2760,7 @@ Standard_Boolean IsPairFound(const Standard_Integer nF1,
BRep_Builder aBB; BRep_Builder aBB;
aBB.MakeVertex(aTestpVertex, aMidPnt, BRep_Tool::Tolerance(anEdge)); 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(aProjPar > aCurRange2.First() && aProjPar < aCurRange2.Last()) {
if(!bReverse) if(!bReverse)
aNewCB.SetPaveBlock2(aPBCurrent2); aNewCB.SetPaveBlock2(aPBCurrent2);
@ -2834,7 +2828,7 @@ Standard_Boolean CheckNewVertexAndUpdateData(const TopoDS_Vertex& t
const Standard_Real theTolerance, const Standard_Real theTolerance,
const BOPTools_PInterferencePool& theIntrPool, const BOPTools_PInterferencePool& theIntrPool,
const BooleanOperations_PShapesDataStructure& theDS, const BooleanOperations_PShapesDataStructure& theDS,
IntTools_Context* theContext, const Handle(IntTools_Context)& theContext,
const BOPTools_PaveSet& theEdgePaveSet, const BOPTools_PaveSet& theEdgePaveSet,
const Standard_Boolean bAddNewVertex, const Standard_Boolean bAddNewVertex,
const Standard_Boolean bAddOldVertex, const Standard_Boolean bAddOldVertex,
@ -2884,7 +2878,7 @@ Standard_Boolean CheckNewVertexAndUpdateData(const TopoDS_Vertex& t
Standard_Boolean bUpdateVertex = Standard_True; Standard_Boolean bUpdateVertex = Standard_True;
if(ptest1.Distance(ptest2) > (BRep_Tool::Tolerance(aVertex) + BRep_Tool::Tolerance(theEdge))) { 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); bUpdateVertex = !aSR.IsDone() || (aSR.ErrorStatus() != 0);
} }
@ -3135,21 +3129,11 @@ Standard_Boolean RejectPaveBlock(const IntTools_Curve& theC,
aC->D0(p1,pntf); aC->D0(p1,pntf);
aC->D0(p2,pntl); aC->D0(p2,pntl);
// //
//modified by NIZNHY-PKV Thu Oct 20 09:13:45 2011f
//
aRT2=theRT*theRT; aRT2=theRT*theRT;
d3d2 = pntf.SquareDistance(pntl); d3d2 = pntf.SquareDistance(pntl);
if(d3d2 > aRT2) { if(d3d2 > aRT2) {
theRT=sqrt(d3d2); 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; return Standard_True;
} }
@ -3306,7 +3290,7 @@ void CorrectTolR3D(BOPTools_PaveFiller& aPF,
TopoDS_Face aF[2]; TopoDS_Face aF[2];
// //
BooleanOperations_PShapesDataStructure myDS=aPF.DS(); BooleanOperations_PShapesDataStructure myDS=aPF.DS();
IntTools_Context& myContext=aPF.ChangeContext(); const Handle(IntTools_Context)& myContext=aPF.Context();
// //
aTolTresh=0.0005; aTolTresh=0.0005;
aAmin=0.012;// 0.7-7 deg aAmin=0.012;// 0.7-7 deg
@ -3347,7 +3331,7 @@ void CorrectTolR3D(BOPTools_PaveFiller& aPF,
aC3D->D0(aT, aP); aC3D->D0(aT, aP);
// //
for (i=0; i<2; ++i) { for (i=0; i<2; ++i) {
GeomAPI_ProjectPointOnSurf& aPPS=myContext.ProjPS(aF[i]); GeomAPI_ProjectPointOnSurf& aPPS=myContext->ProjPS(aF[i]);
aPPS.Perform(aP); aPPS.Perform(aP);
aPPS.LowerDistanceParameters(aU, aV); aPPS.LowerDistanceParameters(aU, aV);
BOPTools_Tools3D::GetNormalToSurface(aS[i], aU, aV, aDN[i]); BOPTools_Tools3D::GetNormalToSurface(aS[i], aU, aV, aDN[i]);
@ -3379,7 +3363,6 @@ void CorrectTolR3D(BOPTools_PaveFiller& aPF,
aTolR3D=aTolR; aTolR3D=aTolR;
} }
} }
//modified by NIZNHY-PKV Thu Oct 20 07:18:39 2011f
//======================================================================= //=======================================================================
// function: PutClosingPaveOnCurve // function: PutClosingPaveOnCurve
// purpose: // purpose:
@ -3441,4 +3424,3 @@ void BOPTools_PaveFiller::PutClosingPaveOnCurve(BOPTools_Curve& aBC,
} }
} }
} }
//modified by NIZNHY-PKV Thu Oct 20 07:18:42 2011t

View File

@ -204,9 +204,9 @@
gp_Pnt aP3d = aSurf->Value(aParU, aParV); gp_Pnt aP3d = aSurf->Value(aParU, aParV);
const TopoDS_Solid &aRefSolid = TopoDS::Solid(aRef); const TopoDS_Solid &aRefSolid = TopoDS::Solid(aRef);
IntTools_Context &aContext = myFiller->ChangeContext(); const Handle(IntTools_Context)& aContext = myFiller->Context();
BRepClass3d_SolidClassifier &aSC = BRepClass3d_SolidClassifier &aSC =
aContext.SolidClassifier(aRefSolid); aContext->SolidClassifier(aRefSolid);
// //
aSC.Perform(aP3d, 1e-7); aSC.Perform(aP3d, 1e-7);
// //
@ -264,8 +264,8 @@
} }
// //
const TopoDS_Solid& aRefSolid=TopoDS::Solid(Ref); const TopoDS_Solid& aRefSolid=TopoDS::Solid(Ref);
IntTools_Context& aContext=myFiller->ChangeContext(); const Handle(IntTools_Context)& aContext=myFiller->Context();
BRepClass3d_SolidClassifier& aSC=aContext.SolidClassifier(aRefSolid); BRepClass3d_SolidClassifier& aSC=aContext->SolidClassifier(aRefSolid);
// //
aSC.Perform(aP3d, 1e-7); aSC.Perform(aP3d, 1e-7);
// //

View File

@ -130,7 +130,7 @@ is
IsBlockInOnFace(myclass; IsBlockInOnFace(myclass;
aPB : PaveBlock from BOPTools; aPB : PaveBlock from BOPTools;
aF : Face from TopoDS; aF : Face from TopoDS;
aContext:out Context from IntTools) aContext: Context from IntTools)
returns Boolean from Standard; returns Boolean from Standard;
---Purpose: ---Purpose:
--- Returns TRUE if PaveBlock <aPB> lays on the face <aF>, i.e --- Returns TRUE if PaveBlock <aPB> lays on the face <aF>, i.e

View File

@ -52,7 +52,7 @@ static
//======================================================================= //=======================================================================
Standard_Boolean BOPTools_Tools::IsBlockInOnFace (const BOPTools_PaveBlock& aPB1, Standard_Boolean BOPTools_Tools::IsBlockInOnFace (const BOPTools_PaveBlock& aPB1,
const TopoDS_Face& aF, const TopoDS_Face& aF,
IntTools_Context& aContext) const Handle(IntTools_Context)& aContext)
{ {
Standard_Boolean bFlag; Standard_Boolean bFlag;
Standard_Real f1, l1, ULD, VLD; Standard_Real f1, l1, ULD, VLD;
@ -74,7 +74,7 @@ static
// Treatment P11 // Treatment P11
BOPTools_Tools::PointOnEdge(aE1, f1, aP11); BOPTools_Tools::PointOnEdge(aE1, f1, aP11);
// //
GeomAPI_ProjectPointOnSurf& aProjector=aContext.ProjPS(aF); GeomAPI_ProjectPointOnSurf& aProjector=aContext->ProjPS(aF);
aProjector.Perform(aP11); aProjector.Perform(aP11);
// //
bFlag=aProjector.IsDone(); bFlag=aProjector.IsDone();
@ -85,7 +85,7 @@ static
aProjector.LowerDistanceParameters(ULD, VLD); aProjector.LowerDistanceParameters(ULD, VLD);
aP2D.SetCoord(ULD, VLD); aP2D.SetCoord(ULD, VLD);
// //
bFlag=aContext.IsPointInOnFace (aF, aP2D); bFlag=aContext->IsPointInOnFace (aF, aP2D);
// //
if (!bFlag) { if (!bFlag) {
return bFlag; return bFlag;
@ -104,7 +104,7 @@ static
aProjector.LowerDistanceParameters(ULD, VLD); aProjector.LowerDistanceParameters(ULD, VLD);
aP2D.SetCoord(ULD, VLD); aP2D.SetCoord(ULD, VLD);
// //
bFlag=aContext.IsPointInOnFace (aF, aP2D); bFlag=aContext->IsPointInOnFace (aF, aP2D);
// //
if (!bFlag) { if (!bFlag) {
return bFlag; return bFlag;
@ -133,7 +133,7 @@ static
aProjector.LowerDistanceParameters(ULD, VLD); aProjector.LowerDistanceParameters(ULD, VLD);
aP2D.SetCoord(ULD, VLD); aP2D.SetCoord(ULD, VLD);
// //
bFlag=aContext.IsPointInOnFace (aF, aP2D); bFlag=aContext->IsPointInOnFace (aF, aP2D);
// //
if (!bFlag) { if (!bFlag) {
return bFlag; return bFlag;

View File

@ -55,13 +55,13 @@ is
RemoveSims (myclass; RemoveSims (myclass;
aF: Face from TopoDS; aF: Face from TopoDS;
aContext:out Context from IntTools); aContext: Context from IntTools);
---Purpose: ---Purpose:
-- Remove seam edges from face <aF> -- Remove seam edges from face <aF>
-- --
RemoveSims (myclass; RemoveSims (myclass;
aS: Shape from TopoDS; aS: Shape from TopoDS;
aContext:out Context from IntTools); aContext: Context from IntTools);
---Purpose: ---Purpose:
-- Remove seam edges from all faces of shape <aS> -- Remove seam edges from all faces of shape <aS>
-- --
@ -78,7 +78,7 @@ is
IsSplitToReverse1 (myclass; IsSplitToReverse1 (myclass;
aE1: Edge from TopoDS; aE1: Edge from TopoDS;
aE2: Edge from TopoDS; aE2: Edge from TopoDS;
aContext:out Context from IntTools) aContext: Context from IntTools)
returns Boolean from Standard; returns Boolean from Standard;
---Purpose: ---Purpose:
-- Returns TRUE if direction of the edge <aE1> is not -- Returns TRUE if direction of the edge <aE1> is not
@ -225,7 +225,7 @@ is
aE1 : Edge from TopoDS; aE1 : Edge from TopoDS;
aF1 : Face from TopoDS; aF1 : Face from TopoDS;
aST1:out State from TopAbs; aST1:out State from TopAbs;
aContext:out Context from IntTools); aContext: Context from IntTools);
---Purpose: ---Purpose:
--- Internal usage --- Internal usage
--- ---
@ -308,7 +308,7 @@ is
aP2: Pnt from gp; aP2: Pnt from gp;
aF: Face from TopoDS; aF: Face from TopoDS;
aPx:out Pnt from gp; aPx:out Pnt from gp;
aContext:out Context from IntTools); aContext: Context from IntTools);
---Purpose: ---Purpose:
--- For 3D-point <aP1> find projection point <aPx> on the face <aF>. --- For 3D-point <aP1> find projection point <aPx> on the face <aF>.
--- If the distance (<aP1>, <aPx>) > TolF => --- If the distance (<aP1>, <aPx>) > TolF =>
@ -321,7 +321,7 @@ is
aF1 : Face from TopoDS; aF1 : Face from TopoDS;
aF2 : Face from TopoDS; aF2 : Face from TopoDS;
aST:out State from TopAbs; aST:out State from TopAbs;
aContext:out Context from IntTools); aContext: Context from IntTools);
---Purpose: ---Purpose:
--- Compute 3D-state for the point on the split edge <aSp> --- Compute 3D-state for the point on the split edge <aSp>
--- (with base edge <aE1> and the face <aF1>) comparing with --- (with base edge <aE1> and the face <aF1>) comparing with
@ -408,7 +408,7 @@ is
aEF1 :Edge from TopoDS; aEF1 :Edge from TopoDS;
aF1 :Face from TopoDS; aF1 :Face from TopoDS;
aF2 :Face from TopoDS; aF2 :Face from TopoDS;
aContext:out Context from IntTools) aContext: Context from IntTools)
returns State from TopAbs; returns State from TopAbs;
---Purpose: ---Purpose:
--- Used in touch case --- Used in touch case
@ -419,12 +419,12 @@ is
--- ---
CheckSameDomainFaceInside(myclass; theFace1: Face from TopoDS; CheckSameDomainFaceInside(myclass; theFace1: Face from TopoDS;
theFace2: Face from TopoDS; theFace2: Face from TopoDS;
theContext: in out Context from IntTools) theContext: Context from IntTools)
returns Boolean from Standard; returns Boolean from Standard;
ComputeFaceState(myclass; theFace: Face from TopoDS; ComputeFaceState(myclass; theFace: Face from TopoDS;
theRef : Solid from TopoDS; theRef : Solid from TopoDS;
theContext: in out Context from IntTools; theContext: Context from IntTools;
theState: out State from TopAbs) theState: out State from TopAbs)
returns Boolean from Standard; returns Boolean from Standard;
@ -437,7 +437,7 @@ is
aTolTangent:Real from Standard; aTolTangent:Real from Standard;
aTolRadius :Real from Standard; aTolRadius :Real from Standard;
aState :out State from TopAbs; aState :out State from TopAbs;
aContext:out Context from IntTools) aContext: Context from IntTools)
returns Boolean from Standard; returns Boolean from Standard;
TreatedAsAnalytic (myclass; aFx :Face from TopoDS; TreatedAsAnalytic (myclass; aFx :Face from TopoDS;
@ -446,7 +446,7 @@ is
aTolTangent:Real from Standard; aTolTangent:Real from Standard;
aTolRadius :Real from Standard; aTolRadius :Real from Standard;
aState :out State from TopAbs; aState :out State from TopAbs;
aContext:out Context from IntTools) aContext: Context from IntTools)
returns Boolean from Standard; returns Boolean from Standard;
HasAnalyticSurfaceType (myclass; aF: Face from TopoDS) HasAnalyticSurfaceType (myclass; aF: Face from TopoDS)

View File

@ -72,7 +72,7 @@ static Standard_Boolean CheckKeepArguments(const TopoDS_Face& F1,
//purpose : //purpose :
//======================================================================= //=======================================================================
void BOPTools_Tools3D::RemoveSims (const TopoDS_Shape& aS, void BOPTools_Tools3D::RemoveSims (const TopoDS_Shape& aS,
IntTools_Context& aContext) const Handle(IntTools_Context)& aContext)
{ {
TopExp_Explorer anExp(aS, TopAbs_FACE); TopExp_Explorer anExp(aS, TopAbs_FACE);
for (; anExp.More(); anExp.Next()) { for (; anExp.More(); anExp.Next()) {
@ -87,7 +87,7 @@ static Standard_Boolean CheckKeepArguments(const TopoDS_Face& F1,
//purpose : //purpose :
//======================================================================= //=======================================================================
void BOPTools_Tools3D::RemoveSims (const TopoDS_Face& aFF, void BOPTools_Tools3D::RemoveSims (const TopoDS_Face& aFF,
IntTools_Context& aContext) const Handle(IntTools_Context)& aContext)
{ {
Standard_Boolean anIsClosed, anIsPointInFace1, anIsPointInFace2; Standard_Boolean anIsClosed, anIsPointInFace1, anIsPointInFace2;
Standard_Real aT1, aT2, aT, aX, aY, dt=1.e-7, aTol; 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.SetX(aP2D.X()+dt*aV2Dx.X());
aP2Dx.SetY(aP2D.Y()+dt*aV2Dx.Y()); 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.SetX(aP2D.X()-dt*aV2Dx.X());
aP2Dx.SetY(aP2D.Y()-dt*aV2Dx.Y()); aP2Dx.SetY(aP2D.Y()-dt*aV2Dx.Y());
// //
anIsPointInFace2=aContext.IsPointInFace(aF, aP2Dx); anIsPointInFace2=aContext->IsPointInFace(aF, aP2Dx);
// //
if (anIsPointInFace1 && anIsPointInFace2) { 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, Standard_Boolean BOPTools_Tools3D::IsSplitToReverse1 (const TopoDS_Edge& aEF1,
const TopoDS_Edge& aEF2, const TopoDS_Edge& aEF2,
IntTools_Context& aContext) const Handle(IntTools_Context)& aContext)
{ {
Standard_Boolean aFlag; Standard_Boolean aFlag;
Standard_Real aT1, aT2, aScPr, a, b; Standard_Real aT1, aT2, aScPr, a, b;
@ -494,7 +494,7 @@ Standard_Boolean BOPTools_Tools3D::DoSplitSEAMOnFace(const TopoDS_Edge& theSplit
gp_Dir aDT1(aV1); gp_Dir aDT1(aV1);
// //
aFlag=aContext.ProjectPointOnEdge(aP, aEF2, aT2); aFlag=aContext->ProjectPointOnEdge(aP, aEF2, aT2);
// //
aFlag=BOPTools_Tools2D::EdgeTangent(aEF2, aT2, aV2); aFlag=BOPTools_Tools2D::EdgeTangent(aEF2, aT2, aV2);
if(!aFlag) { if(!aFlag) {
@ -940,7 +940,7 @@ static void GetApproxNormalToFaceOnEdgeEx(const TopoDS_Edge& aE,
const TopoDS_Edge& anE1, const TopoDS_Edge& anE1,
const TopoDS_Face& aF1, const TopoDS_Face& aF1,
TopAbs_State& aStPF1, TopAbs_State& aStPF1,
IntTools_Context& aContext) const Handle(IntTools_Context)& aContext)
{ {
Standard_Boolean bIsAdjExists; Standard_Boolean bIsAdjExists;
@ -1008,14 +1008,14 @@ static void GetApproxNormalToFaceOnEdgeEx(const TopoDS_Edge& aE,
BOPTools_Tools3D::GetApproxNormalToFaceOnEdge (aSpxSimm, aFx1, aT, aPx2, aDNFx2); BOPTools_Tools3D::GetApproxNormalToFaceOnEdge (aSpxSimm, aFx1, aT, aPx2, aDNFx2);
} }
aContext.ProjectPointOnEdge(aPx, anE1, aT1); aContext->ProjectPointOnEdge(aPx, anE1, aT1);
PointNearE (anE1, aF1, aT1, aPF1, aMoreShift); PointNearE (anE1, aF1, aT1, aPF1, aMoreShift);
} }
else {// if (bIsAdjExists) else {// if (bIsAdjExists)
BOPTools_Tools3D::GetApproxNormalToFaceOnEdge (aSpxSimm, aFx2, aT, aPx2, aDNFx2); BOPTools_Tools3D::GetApproxNormalToFaceOnEdge (aSpxSimm, aFx2, aT, aPx2, aDNFx2);
// //
aContext.ProjectPointOnEdge(aPx, anE1, aT1); aContext->ProjectPointOnEdge(aPx, anE1, aT1);
PointNearE (anE1, aF1, aT1, aPF1, aMoreShift); PointNearE (anE1, aF1, aT1, aPF1, aMoreShift);
} }

View File

@ -196,7 +196,7 @@
const gp_Pnt& aP2, const gp_Pnt& aP2,
const TopoDS_Face& aF, const TopoDS_Face& aF,
gp_Pnt& aPF, gp_Pnt& aPF,
IntTools_Context& aContext) const Handle(IntTools_Context)& aContext)
{ {
Standard_Boolean bFlag; Standard_Boolean bFlag;
Standard_Real aD, aTolF, U, V; Standard_Real aD, aTolF, U, V;
@ -205,7 +205,7 @@
aTolF=BRep_Tool::Tolerance(aF); aTolF=BRep_Tool::Tolerance(aF);
// //
GeomAPI_ProjectPointOnSurf& aProjector=aContext.ProjPS(aF); GeomAPI_ProjectPointOnSurf& aProjector=aContext->ProjPS(aF);
// //
aProjector.Perform(aP1); aProjector.Perform(aP1);
// //
@ -245,7 +245,7 @@
const TopoDS_Face& aF1, const TopoDS_Face& aF1,
const TopoDS_Face& aF2, const TopoDS_Face& aF2,
TopAbs_State& aStPF, TopAbs_State& aStPF,
IntTools_Context& aContext) const Handle(IntTools_Context)& aContext)
{ {
Standard_Real aT1, aT2, aT, aTolF2, aDt2D; Standard_Real aT1, aT2, aT, aTolF2, aDt2D;
gp_Pnt2d aPx2DNear; gp_Pnt2d aPx2DNear;
@ -284,7 +284,7 @@
// //
//-- EJG //-- EJG
Standard_Boolean isIn = aContext.IsPointInFace(aF1,aPx2DNear); Standard_Boolean isIn = aContext->IsPointInFace(aF1,aPx2DNear);
if( !isIn ) { if( !isIn ) {
Standard_Real aEF1Tol = BRep_Tool::Tolerance(aEF1); Standard_Real aEF1Tol = BRep_Tool::Tolerance(aEF1);
Standard_Real aF1Tol = BRep_Tool::Tolerance(aF1); Standard_Real aF1Tol = BRep_Tool::Tolerance(aF1);
@ -311,7 +311,7 @@
Standard_Boolean bFlag; Standard_Boolean bFlag;
Standard_Real aD, U, V; 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); Handle(Geom_Surface) aS2=BRep_Tool::Surface(aF2);
// //
@ -784,7 +784,7 @@ void Add(const TopoDS_Shape& aS,
const TopoDS_Edge& aEF1, const TopoDS_Edge& aEF1,
const TopoDS_Face& aF1, const TopoDS_Face& aF1,
const TopoDS_Face& aF2, const TopoDS_Face& aF2,
IntTools_Context& aContext) const Handle(IntTools_Context)& aContext)
{ {
gp_Dir aDBF1, aDNF2; gp_Dir aDBF1, aDNF2;
TopAbs_State aStPF; TopAbs_State aStPF;
@ -836,7 +836,7 @@ void Add(const TopoDS_Shape& aS,
// =========================================================================================== // ===========================================================================================
Standard_Boolean BOPTools_Tools3D::ComputeFaceState(const TopoDS_Face& theFace, Standard_Boolean BOPTools_Tools3D::ComputeFaceState(const TopoDS_Face& theFace,
const TopoDS_Solid& theRef, const TopoDS_Solid& theRef,
IntTools_Context& theContext, const Handle(IntTools_Context)& theContext,
TopAbs_State& theState) TopAbs_State& theState)
{ {
TopAbs_State aState = TopAbs_ON; TopAbs_State aState = TopAbs_ON;
@ -852,7 +852,7 @@ Standard_Boolean BOPTools_Tools3D::ComputeFaceState(const TopoDS_Face& theFace,
Standard_Real U = umin + adeltau; Standard_Real U = umin + adeltau;
Standard_Boolean bFoundValidPoint = Standard_False; Standard_Boolean bFoundValidPoint = Standard_False;
Standard_Boolean bFoundInFacePoint = 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; Standard_Integer i = 0, j = 0;
for(i = 1; !bFoundValidPoint && (i <= nbpoints); i++, U+=adeltau) { 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) { for(j = 1; !bFoundValidPoint && (j <= nbpoints); j++, V+=adeltav) {
gp_Pnt2d aPoint(U,V); gp_Pnt2d aPoint(U,V);
if(theContext.IsPointInFace(theFace, aPoint)) { if(theContext->IsPointInFace(theFace, aPoint)) {
bFoundInFacePoint = Standard_True; bFoundInFacePoint = Standard_True;
gp_Pnt aP3d = aSurface->Value(U, V); 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) { for(j = 1; !bFoundValidPoint && (j <= nbpoints); j++, V+=adeltav) {
gp_Pnt2d aPoint(U,V); gp_Pnt2d aPoint(U,V);
if(theContext.IsPointInOnFace(theFace, aPoint)) { if(theContext->IsPointInOnFace(theFace, aPoint)) {
bFoundInFacePoint = Standard_True; bFoundInFacePoint = Standard_True;
gp_Pnt aP3d = aSurface->Value(U, V); 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(); TopoDS_Face aFace2 = aSolidClassifier.Face();
if(!aFace2.IsNull()) { if(!aFace2.IsNull()) {
GeomAPI_ProjectPointOnSurf& aProjector = theContext.ProjPS(aFace2); GeomAPI_ProjectPointOnSurf& aProjector = theContext->ProjPS(aFace2);
aProjector.Perform(aP3d); aProjector.Perform(aP3d);
if(aProjector.IsDone()) { if(aProjector.IsDone()) {
@ -918,7 +918,7 @@ Standard_Boolean BOPTools_Tools3D::ComputeFaceState(const TopoDS_Face& theFace,
gp_Pnt2d aPoint2(U2, V2); gp_Pnt2d aPoint2(U2, V2);
if(aProjector.LowerDistance() < aTolerance) { if(aProjector.LowerDistance() < aTolerance) {
if(theContext.IsPointInFace(aFace2, aPoint2)) if(theContext->IsPointInFace(aFace2, aPoint2))
aState = TopAbs_ON; 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, Standard_Boolean BOPTools_Tools3D::CheckSameDomainFaceInside(const TopoDS_Face& theFace1,
const TopoDS_Face& theFace2, const TopoDS_Face& theFace2,
IntTools_Context& theContext) const Handle(IntTools_Context)& theContext)
{ {
Standard_Boolean bFoundON, bPointInFace; Standard_Boolean bFoundON, bPointInFace;
Standard_Integer nbpoints, i, j; Standard_Integer nbpoints, i, j;
@ -976,14 +976,14 @@ Standard_Boolean BOPTools_Tools3D::CheckSameDomainFaceInside(const TopoDS_Face&
adeltav=(vmax - vmin) / (nbpoints + 1); adeltav=(vmax - vmin) / (nbpoints + 1);
bFoundON = Standard_False; bFoundON = Standard_False;
// //
GeomAPI_ProjectPointOnSurf& aProjector = theContext.ProjPS(theFace2); GeomAPI_ProjectPointOnSurf& aProjector = theContext->ProjPS(theFace2);
// //
for(i=1; i<=nbpoints; ++i){ for(i=1; i<=nbpoints; ++i){
U=umin+i*adeltau; U=umin+i*adeltau;
for(j=1; j<=nbpoints; ++j) { for(j=1; j<=nbpoints; ++j) {
V=vmin+j*adeltav; V=vmin+j*adeltav;
aP2D.SetCoord(U,V); aP2D.SetCoord(U,V);
bPointInFace=theContext.IsPointInFace(theFace1, aP2D); bPointInFace=theContext->IsPointInFace(theFace1, aP2D);
if(bPointInFace) { if(bPointInFace) {
aP3D=aS1->Value(U, V); aP3D=aS1->Value(U, V);
aProjector.Perform(aP3D); aProjector.Perform(aP3D);
@ -996,7 +996,7 @@ Standard_Boolean BOPTools_Tools3D::CheckSameDomainFaceInside(const TopoDS_Face&
return Standard_False; return Standard_False;
} }
// //
bPointInFace=theContext.IsPointInFace(theFace2, aP2D); bPointInFace=theContext->IsPointInFace(theFace2, aP2D);
if (bPointInFace) { if (bPointInFace) {
bFoundON = Standard_True; bFoundON = Standard_True;
} }

View File

@ -44,7 +44,7 @@ static
const Standard_Real aTolTangent, const Standard_Real aTolTangent,
const Standard_Real aTolR, const Standard_Real aTolR,
TopAbs_State& aSt, TopAbs_State& aSt,
IntTools_Context& ) const Handle(IntTools_Context)& )
{ {
Standard_Boolean bFlag, bIsAnalytic, bIsDirsCoinside; Standard_Boolean bFlag, bIsAnalytic, bIsDirsCoinside;
Standard_Real aT1, aTb, aTe; Standard_Real aT1, aTb, aTe;
@ -92,7 +92,7 @@ static
const Standard_Real aTolTangent, const Standard_Real aTolTangent,
const Standard_Real aTolR, const Standard_Real aTolR,
TopAbs_State& aSt, TopAbs_State& aSt,
IntTools_Context& aContext) const Handle(IntTools_Context)& aContext)
{ {
Standard_Boolean bFlag, bIsAnalytic, bIsDirsCoinside; Standard_Boolean bFlag, bIsAnalytic, bIsDirsCoinside;
Standard_Real aT1; Standard_Real aT1;
@ -110,7 +110,7 @@ static
} }
// //
BOPTools_Tools3D::GetNormalToFaceOnEdge(anEx, aFx, aTx, aDNSx); BOPTools_Tools3D::GetNormalToFaceOnEdge(anEx, aFx, aTx, aDNSx);
aContext.ProjectPointOnEdge(aPx, anE1, aT1); aContext->ProjectPointOnEdge(aPx, anE1, aT1);
BOPTools_Tools3D::GetNormalToFaceOnEdge(anE1, aF1, aT1, aDNS1); BOPTools_Tools3D::GetNormalToFaceOnEdge(anE1, aF1, aT1, aDNS1);
// //
bIsDirsCoinside=IntTools_Tools::IsDirsCoinside(aDNSx, aDNS1, aTolTangent); bIsDirsCoinside=IntTools_Tools::IsDirsCoinside(aDNSx, aDNS1, aTolTangent);

View File

@ -32,7 +32,8 @@ uses
IntPatch, IntPatch,
IntSurf, IntSurf,
BRepClass3d, BRepClass3d,
TColgp TColgp,
MMgt
is is
@ -59,7 +60,6 @@ is
class MarkedRangeSet; class MarkedRangeSet;
---Purpose: auxiliary class for range management ---Purpose: auxiliary class for range management
--modified by NIZHNY-MKK Wed Oct 5 18:08:38 2005.BEGIN
class BaseRangeSample; class BaseRangeSample;
---Purpose: base class for range index management ---Purpose: base class for range index management
@ -72,7 +72,6 @@ is
class CurveRangeLocalizeData; class CurveRangeLocalizeData;
class SurfaceRangeLocalizeData; class SurfaceRangeLocalizeData;
--modified by NIZHNY-MKK Wed Oct 5 18:08:43 2005.END
class BeanFaceIntersector; class BeanFaceIntersector;
---Purpose: class provides computing ranges of parameters ---Purpose: class provides computing ranges of parameters
@ -115,7 +114,7 @@ is
--- ---
--- P o i n t e r s --- 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 --- I n s t a n t i a t i o n s
--- ---

View File

@ -19,7 +19,7 @@ uses
SequenceOfRoots from IntTools, SequenceOfRoots from IntTools,
MarkedRangeSet from IntTools, MarkedRangeSet from IntTools,
SequenceOfRanges from IntTools, SequenceOfRanges from IntTools,
PContext from IntTools, Context from IntTools,
ExtCS from Extrema, ExtCS from Extrema,
ProjectPointOnSurf from GeomAPI, ProjectPointOnSurf from GeomAPI,
Edge from TopoDS, Edge from TopoDS,
@ -113,11 +113,17 @@ is
--- optimization purposes --- optimization purposes
--- ---
SetContext(me: in out; theContext: PContext from IntTools); SetContext(me: in out;
theContext: Context from IntTools);
---Purpose: ---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; SetBeanParameters(me: in out;theFirstParOnCurve : Real from Standard;
theLastParOnCurve : Real from Standard); theLastParOnCurve : Real from Standard);
---Purpose: ---Purpose:
@ -227,7 +233,7 @@ fields
myProjector : ProjectPointOnSurf from GeomAPI; myProjector : ProjectPointOnSurf from GeomAPI;
myRangeManager : MarkedRangeSet from IntTools; myRangeManager : MarkedRangeSet from IntTools;
myDeflection : Real from Standard; myDeflection : Real from Standard;
myContext : PContext from IntTools; myContext : Context from IntTools;
-- results -- results
myResults : SequenceOfRanges from IntTools; myResults : SequenceOfRanges from IntTools;

View File

@ -120,7 +120,7 @@ myIsDone(Standard_False)
{ {
myCriteria = Precision::Confusion(); myCriteria = Precision::Confusion();
myCurveResolution = Precision::PConfusion(); myCurveResolution = Precision::PConfusion();
myContext = NULL;
} }
// ================================================================================== // ==================================================================================
@ -140,7 +140,6 @@ myFaceTolerance(0.),
myDeflection(0.01), myDeflection(0.01),
myIsDone(Standard_False) myIsDone(Standard_False)
{ {
myContext = NULL;
Init(theEdge, theFace); Init(theEdge, theFace);
} }
@ -161,7 +160,6 @@ myVMaxParameter(0.),
myDeflection(0.01), myDeflection(0.01),
myIsDone(Standard_False) myIsDone(Standard_False)
{ {
myContext = NULL;
Init(theCurve, theSurface, theBeanTolerance, theFaceTolerance); Init(theCurve, theSurface, theBeanTolerance, theFaceTolerance);
} }
@ -197,7 +195,6 @@ myIsDone(Standard_False)
mySurface = theSurface; mySurface = theSurface;
myTrsfSurface = Handle(Geom_Surface)::DownCast(mySurface.Surface().Surface()->Transformed(mySurface.Trsf())); 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(), SetSurfaceParameters(mySurface.FirstUParameter(), mySurface.LastUParameter(),
mySurface.FirstVParameter(), mySurface.LastVParameter()); mySurface.FirstVParameter(), mySurface.LastVParameter());
myResults.Clear(); myResults.Clear();
myContext = NULL;
} }
// ================================================================================== // ==================================================================================
@ -243,7 +239,6 @@ void IntTools_BeanFaceIntersector::Init(const BRepAdaptor_Curve& theCurve,
SetSurfaceParameters(mySurface.FirstUParameter(), mySurface.LastUParameter(), SetSurfaceParameters(mySurface.FirstUParameter(), mySurface.LastUParameter(),
mySurface.FirstVParameter(), mySurface.LastVParameter()); mySurface.FirstVParameter(), mySurface.LastVParameter());
myResults.Clear(); myResults.Clear();
myContext = NULL;
} }
// ================================================================================== // ==================================================================================
@ -264,17 +259,24 @@ void IntTools_BeanFaceIntersector::Init(const BRepAdaptor_Curve& theCurve,
Init(theCurve, theSurface, theBeanTolerance, theFaceTolerance); Init(theCurve, theSurface, theBeanTolerance, theFaceTolerance);
SetBeanParameters(theFirstParOnCurve, theLastParOnCurve); SetBeanParameters(theFirstParOnCurve, theLastParOnCurve);
SetSurfaceParameters(theUMinParameter, theUMaxParameter, theVMinParameter, theVMaxParameter); SetSurfaceParameters(theUMinParameter, theUMaxParameter, theVMinParameter, theVMaxParameter);
myContext = NULL;
} }
// ================================================================================== // ==================================================================================
// function: SetContext // function: SetContext
// purpose: // purpose:
// ================================================================================== // ==================================================================================
void IntTools_BeanFaceIntersector::SetContext(const IntTools_PContext& theContext) void IntTools_BeanFaceIntersector::SetContext(const Handle(IntTools_Context)& theContext)
{ {
myContext = theContext; myContext = theContext;
} }
// ==================================================================================
// function: Context
// purpose:
// ==================================================================================
const Handle(IntTools_Context)& IntTools_BeanFaceIntersector::Context()const
{
return myContext;
}
// ================================================================================== // ==================================================================================
// function: SetBeanParameters // 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_Integer aDiscretization = 30; // corresponds to discretization of BSpline usually approximated by 30 points.
Standard_Real aRelativeDeflection = 0.01; Standard_Real aRelativeDeflection = 0.01;
myDeflection = aRelativeDeflection; myDeflection = aRelativeDeflection;
//
if (myContext.IsNull()) {
myContext=new IntTools_Context;
}
//
if(myCurve.GetType()==GeomAbs_Line && mySurface.GetType()==GeomAbs_Plane) { if(myCurve.GetType()==GeomAbs_Line && mySurface.GetType()==GeomAbs_Plane) {
ComputeLinePlane(); ComputeLinePlane();
return; return;
@ -455,21 +461,12 @@ Standard_Real IntTools_BeanFaceIntersector::Distance(const Standard_Real theArg)
{ {
gp_Pnt aPoint = myCurve.Value(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()); GeomAPI_ProjectPointOnSurf& aProjector = myContext->ProjPS(mySurface.Face());
aProjector.Perform(aPoint); aProjector.Perform(aPoint);
if(aProjector.IsDone() && aProjector.NbPoints() > 0) { if(aProjector.IsDone() && aProjector.NbPoints() > 0) {
return aProjector.LowerDistance(); return aProjector.LowerDistance();
} }
}
// //
Standard_Real aDistance = RealLast(); Standard_Real aDistance = RealLast();
@ -530,17 +527,6 @@ Standard_Real IntTools_BeanFaceIntersector::Distance(const Standard_Real theArg,
Standard_Real aDistance = RealLast(); Standard_Real aDistance = RealLast();
Standard_Boolean projectionfound = Standard_False; 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;
}
}
else {
GeomAPI_ProjectPointOnSurf& aProjector = myContext->ProjPS(mySurface.Face()); GeomAPI_ProjectPointOnSurf& aProjector = myContext->ProjPS(mySurface.Face());
aProjector.Perform(aPoint); aProjector.Perform(aPoint);
@ -549,7 +535,6 @@ Standard_Real IntTools_BeanFaceIntersector::Distance(const Standard_Real theArg,
aDistance = aProjector.LowerDistance(); aDistance = aProjector.LowerDistance();
projectionfound = Standard_True; projectionfound = Standard_True;
} }
}
if(!projectionfound) { if(!projectionfound) {
// //
@ -1792,7 +1777,7 @@ Standard_Boolean IntTools_BeanFaceIntersector::ComputeLocalized() {
Standard_Real dMinU = 10. * Precision::PConfusion(); Standard_Real dMinU = 10. * Precision::PConfusion();
Standard_Real dMinV = dMinU; Standard_Real dMinV = dMinU;
IntTools_SurfaceRangeLocalizeData aSurfaceDataInit(3, 3, dMinU, dMinV); 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.RemoveRangeOutAll();
aSurfaceData.ClearGrid(); aSurfaceData.ClearGrid();

View File

@ -6,6 +6,7 @@
class Context from IntTools class Context from IntTools
inherits TShared from MMgt
---Purpose: ---Purpose:
--- The class is to provide direct access --- The class is to provide direct access
@ -38,13 +39,12 @@ uses
is is
Create Create
returns Context from IntTools; returns mutable Context from IntTools;
---C++: alias "Standard_EXPORT virtual ~IntTools_Context();" ---C++: alias "Standard_EXPORT virtual ~IntTools_Context();"
---Purpose: ---Purpose:
--- Empty constructor --- Empty constructor
---
FClass2d(me: in out; FClass2d(me: mutable;
aF: Face from TopoDS) aF: Face from TopoDS)
returns FClass2d from IntTools; returns FClass2d from IntTools;
---C++: return & ---C++: return &
@ -53,7 +53,7 @@ is
--- for given face --- for given face
--- ---
ProjPS (me: in out; ProjPS (me: mutable;
aF: Face from TopoDS) aF: Face from TopoDS)
returns ProjectPointOnSurf from GeomAPI; returns ProjectPointOnSurf from GeomAPI;
---C++: return & ---C++: return &
@ -62,7 +62,7 @@ is
--- for given face --- for given face
--- ---
ProjPC (me: in out; ProjPC (me: mutable;
aE: Edge from TopoDS) aE: Edge from TopoDS)
returns ProjectPointOnCurve from GeomAPI; returns ProjectPointOnCurve from GeomAPI;
---C++: return & ---C++: return &
@ -71,7 +71,7 @@ is
--- for given edge --- for given edge
--- ---
ProjPT (me: in out; ProjPT (me: mutable;
aC: Curve from Geom) aC: Curve from Geom)
returns ProjectPointOnCurve from GeomAPI; returns ProjectPointOnCurve from GeomAPI;
---C++: return & ---C++: return &
@ -80,7 +80,7 @@ is
--- for given curve --- for given curve
--- ---
SurfaceData(me: in out; SurfaceData(me: mutable;
aF: Face from TopoDS) aF: Face from TopoDS)
returns SurfaceRangeLocalizeData from IntTools; returns SurfaceRangeLocalizeData from IntTools;
---C++: return & ---C++: return &
@ -89,7 +89,7 @@ is
--- for given face --- for given face
SolidClassifier(me: in out; SolidClassifier(me: mutable;
aSolid: Solid from TopoDS) aSolid: Solid from TopoDS)
returns SolidClassifier from BRepClass3d; returns SolidClassifier from BRepClass3d;
---C++: return & ---C++: return &
@ -100,7 +100,7 @@ is
--- API Block --- API Block
--- ---
ComputeVE (me:out; ComputeVE (me:mutable;
aV : Vertex from TopoDS; aV : Vertex from TopoDS;
aE : Edge from TopoDS; aE : Edge from TopoDS;
aT :out Real from Standard) aT :out Real from Standard)
@ -117,8 +117,7 @@ is
--- 3. projection algorithm failed (-3) --- 3. projection algorithm failed (-3)
--- ---
--modified by NIZNHY-PKV Tue Feb 2 08:20:43 2010f ComputeVE (me:mutable;
ComputeVE (me:out;
aV : Vertex from TopoDS; aV : Vertex from TopoDS;
aE : Edge from TopoDS; aE : Edge from TopoDS;
aT :out Real from Standard; aT :out Real from Standard;
@ -142,9 +141,8 @@ is
--- vertex tolerance should be modified or not --- vertex tolerance should be modified or not
--- aDist - the value of the distance between the vertex --- aDist - the value of the distance between the vertex
--- and the edge --- and the edge
--modified by NIZNHY-PKV Tue Feb 2 08:20:55 2010t
ComputeVS (me:out; ComputeVS (me:mutable;
aV : Vertex from TopoDS; aV : Vertex from TopoDS;
aF : Face from TopoDS; aF : Face from TopoDS;
U : out Real from Standard; U : out Real from Standard;
@ -161,7 +159,7 @@ is
--- 3. projection point out or on the boundaries of face (-3) --- 3. projection point out or on the boundaries of face (-3)
--- ---
StatePointFace(me:out; StatePointFace(me:mutable;
aF : Face from TopoDS; aF : Face from TopoDS;
aP2D : Pnt2d from gp) aP2D : Pnt2d from gp)
returns State from TopAbs; returns State from TopAbs;
@ -170,7 +168,7 @@ is
--- relative to face aF --- relative to face aF
--- ---
IsPointInFace(me:out; IsPointInFace(me:mutable;
aF : Face from TopoDS; aF : Face from TopoDS;
aP2D : Pnt2d from gp) aP2D : Pnt2d from gp)
returns Boolean from Standard; returns Boolean from Standard;
@ -180,7 +178,7 @@ is
--- otherwise returns false --- otherwise returns false
--- ---
IsPointInOnFace(me:out; IsPointInOnFace(me:mutable;
aF : Face from TopoDS; aF : Face from TopoDS;
aP2D : Pnt2d from gp) aP2D : Pnt2d from gp)
returns Boolean from Standard; returns Boolean from Standard;
@ -189,7 +187,7 @@ is
--- inside or on the boundaries of aF --- inside or on the boundaries of aF
--- ---
IsValidPointForFace(me:out; IsValidPointForFace(me:mutable ;
aP3D : Pnt from gp; aP3D : Pnt from gp;
aF : Face from TopoDS; aF : Face from TopoDS;
aTol : Real from Standard) aTol : Real from Standard)
@ -201,7 +199,7 @@ is
--- of the face aF --- of the face aF
--- ---
IsValidPointForFaces(me:out; IsValidPointForFaces(me:mutable;
aP3D : Pnt from gp; aP3D : Pnt from gp;
aF1 : Face from TopoDS; aF1 : Face from TopoDS;
aF2 : Face from TopoDS; aF2 : Face from TopoDS;
@ -212,7 +210,7 @@ is
--- for both face aF1 and aF2 --- for both face aF1 and aF2
--- ---
IsValidBlockForFace (me:out; IsValidBlockForFace (me:mutable;
aT1 : Real from Standard; aT1 : Real from Standard;
aT2 : Real from Standard; aT2 : Real from Standard;
aIC : Curve from IntTools; aIC : Curve from IntTools;
@ -225,7 +223,7 @@ is
--- parameters aT1 and aT2 --- parameters aT1 and aT2
--- ---
IsValidBlockForFaces (me:out; IsValidBlockForFaces (me:mutable;
aT1 : Real from Standard; aT1 : Real from Standard;
aT2 : Real from Standard; aT2 : Real from Standard;
aIC : Curve from IntTools; aIC : Curve from IntTools;
@ -238,7 +236,7 @@ is
--- for both faces aF1 and aF2 --- for both faces aF1 and aF2
--- ---
IsVertexOnLine(me:out; IsVertexOnLine(me:mutable;
aV : Vertex from TopoDS; aV : Vertex from TopoDS;
aIC : Curve from IntTools; aIC : Curve from IntTools;
aTolC: Real from Standard; aTolC: Real from Standard;
@ -253,7 +251,7 @@ is
--- returns false (in this case aT isn't significant) --- returns false (in this case aT isn't significant)
--- ---
IsVertexOnLine(me:out; IsVertexOnLine(me:mutable;
aV : Vertex from TopoDS; aV : Vertex from TopoDS;
aTolV: Real from Standard; aTolV: Real from Standard;
aIC : Curve from IntTools; aIC : Curve from IntTools;
@ -269,7 +267,7 @@ is
--- returns false (in this case aT isn't significant) --- returns false (in this case aT isn't significant)
--- ---
ProjectPointOnEdge (me:out; ProjectPointOnEdge (me:mutable;
aP : Pnt from gp; aP : Pnt from gp;
aE : Edge from TopoDS; aE : Edge from TopoDS;
aT :out Real from Standard) aT :out Real from Standard)

View File

@ -24,8 +24,9 @@ uses
FClass2d from IntTools, FClass2d from IntTools,
SequenceOfRoots from IntTools, SequenceOfRoots from IntTools,
SequenceOfCommonPrts from IntTools, SequenceOfCommonPrts from IntTools,
PContext from IntTools, Context from IntTools,
Range from IntTools Range from IntTools
--raises --raises
is is
@ -87,9 +88,17 @@ is
--- The algorithm processes edge inside these boundaries. --- The algorithm processes edge inside these boundaries.
--- ---
SetContext (me: in out; theContext: PContext from IntTools); SetContext (me: in out;
theContext: Context from IntTools);
---Purpose: ---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); Perform (me:out);
@ -241,7 +250,7 @@ fields
myErrorStatus : Integer from Standard; myErrorStatus : Integer from Standard;
--- internal members --- internal members
myContext : PContext from IntTools; myContext : Context from IntTools;
myProjectableRanges: SequenceOfRanges from IntTools; myProjectableRanges: SequenceOfRanges from IntTools;
myFClass2d : FClass2d from IntTools; myFClass2d : FClass2d from IntTools;
myFuncArray : CArray1OfReal from IntTools; myFuncArray : CArray1OfReal from IntTools;

View File

@ -86,9 +86,24 @@ static
myErrorStatus=1; myErrorStatus=1;
myParallel=Standard_False; myParallel=Standard_False;
myPar1=0.; 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 //function : SetEdge
//purpose : //purpose :
@ -223,8 +238,6 @@ static
myErrorStatus=3; myErrorStatus=3;
} }
} }
//======================================================================= //=======================================================================
//function : Prepare //function : Prepare
//purpose : //purpose :
@ -403,15 +416,6 @@ static
// //
Standard_Real ULD, VLD; 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); GeomAPI_ProjectPointOnSurf& aLocProj = myContext->ProjPS(myFace);
aLocProj.Perform(P); aLocProj.Perform(P);
bFlag = aLocProj.IsDone(); bFlag = aLocProj.IsDone();
@ -419,7 +423,6 @@ static
if(bFlag) { if(bFlag) {
aLocProj.LowerDistanceParameters(ULD, VLD); aLocProj.LowerDistanceParameters(ULD, VLD);
} }
}
// //
if (bFlag) { if (bFlag) {
@ -429,12 +432,7 @@ static
TopAbs_State aState; TopAbs_State aState;
gp_Pnt2d aP2d(ULD, VLD); 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) { if (aState==TopAbs_IN || aState==TopAbs_ON) {
@ -473,16 +471,6 @@ static
// //
Standard_Boolean bFlag = Standard_False; 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); GeomAPI_ProjectPointOnSurf& aLocProj = myContext->ProjPS(myFace);
aLocProj.Perform(P); aLocProj.Perform(P);
bFlag = aLocProj.IsDone(); bFlag = aLocProj.IsDone();
@ -490,7 +478,6 @@ static
if(bFlag) { if(bFlag) {
aD = aLocProj.LowerDistance(); aD = aLocProj.LowerDistance();
} }
}
// //
if (!bFlag) { if (!bFlag) {
@ -1253,14 +1240,6 @@ static
return theflag; return theflag;
} }
//=======================================================================
//function : SetContext
//purpose :
//=======================================================================
void IntTools_EdgeFace::SetContext(const IntTools_PContext& theContext)
{
myContext = theContext;
}
//======================================================================= //=======================================================================
//function : Perform //function : Perform
@ -1270,17 +1249,19 @@ static
{ {
Standard_Integer i, aNb; Standard_Integer i, aNb;
IntTools_CommonPrt aCommonPrt; IntTools_CommonPrt aCommonPrt;
//IntTools_Root aRoot; // Wng in Gcc 3.0
//...
aCommonPrt.SetEdge1(myEdge);
// //
aCommonPrt.SetEdge1(myEdge);
// //
myErrorStatus=0; myErrorStatus=0;
CheckData(); CheckData();
if (myErrorStatus) if (myErrorStatus) {
return; return;
}
//
if (myContext.IsNull()) {
myContext=new IntTools_Context;
}
//
myIsDone = Standard_False; myIsDone = Standard_False;
myC.Initialize(myEdge); myC.Initialize(myEdge);
GeomAbs_CurveType aCurveType; GeomAbs_CurveType aCurveType;
@ -1307,7 +1288,7 @@ static
myS.Initialize (myFace,Standard_True); myS.Initialize (myFace,Standard_True);
if(myContext == NULL) { if(myContext.IsNull()) {
myFClass2d.Init(myFace, 1.e-6); myFClass2d.Init(myFace, 1.e-6);
} }

View File

@ -11,15 +11,17 @@ class FaceFace from IntTools
uses uses
TopolTool from Adaptor3d,
HSurface from GeomAdaptor,
ListOfPntOn2S from IntSurf ,
Intersection from IntPatch,
Face from TopoDS, Face from TopoDS,
SequenceOfCurves from IntTools, SequenceOfCurves from IntTools,
Intersection from IntPatch,
LineConstructor from IntTools, LineConstructor from IntTools,
HSurface from GeomAdaptor,
TopolTool from Adaptor3d,
SequenceOfPntOn2Faces from IntTools, SequenceOfPntOn2Faces from IntTools,
--amv Context from IntTools
ListOfPntOn2S from IntSurf
raises NotDone from StdFail raises NotDone from StdFail
is is
@ -102,10 +104,8 @@ is
---Purpose: ---Purpose:
--- Returns True if faces are tangent --- Returns True if faces are tangent
--- ---
--modified by NIZNHY-PKV Fri Sep 16 07:44:22 2011
PrepareLines3D (me:out; PrepareLines3D (me:out;
bToSplit: Boolean from Standard=Standard_True); bToSplit: Boolean from Standard=Standard_True);
--PrepareLines3D (me:out);
---Purpose: ---Purpose:
--- Provides post-processing the result lines. --- Provides post-processing the result lines.
--- <bToSplit> - the flag. --- <bToSplit> - the flag.
@ -113,7 +113,8 @@ is
-- on parts. -- on parts.
-- In case of <bToSplit> is false the closed 3D-curves remain untouched. -- In case of <bToSplit> 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 -- private block
@ -126,6 +127,17 @@ is
ComputeTolReached3d(me:out) ComputeTolReached3d(me:out)
is protected; 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 fields
myIsDone : Boolean from Standard; myIsDone : Boolean from Standard;
@ -150,8 +162,11 @@ fields
myFace2 : Face from TopoDS; myFace2 : Face from TopoDS;
myPnts : SequenceOfPntOn2Faces from IntTools; 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; end FaceFace from IntTools;

View File

@ -108,10 +108,9 @@
#include <IntTools_Context.hxx> #include <IntTools_Context.hxx>
#include <IntSurf_ListIteratorOfListOfPntOn2S.hxx> #include <IntSurf_ListIteratorOfListOfPntOn2S.hxx>
//modified by NIZNHY-PKV Mon Dec 26 13:37:52 2011f
static static
void RefineVector(gp_Vec2d& aV2D); void RefineVector(gp_Vec2d& aV2D);
//modified by NIZNHY-PKV Mon Dec 26 13:37:54 2011t
static static
void DumpWLine(const Handle(IntPatch_WLine)& aWLine); void DumpWLine(const Handle(IntPatch_WLine)& aWLine);
// //
@ -179,7 +178,8 @@ static
const IntTools_LineConstructor& theLConstructor, const IntTools_LineConstructor& theLConstructor,
const Standard_Boolean theAvoidLConstructor, const Standard_Boolean theAvoidLConstructor,
IntPatch_SequenceOfLine& theNewLines, IntPatch_SequenceOfLine& theNewLines,
Standard_Real& theReachedTol3d); Standard_Real& theReachedTol3d,
const Handle(IntTools_Context)& );
static static
Standard_Boolean ParameterOutOfBoundary(const Standard_Real theParameter, Standard_Boolean ParameterOutOfBoundary(const Standard_Real theParameter,
@ -188,7 +188,8 @@ static
const TopoDS_Face& theFace2, const TopoDS_Face& theFace2,
const Standard_Real theOtherParameter, const Standard_Real theOtherParameter,
const Standard_Boolean bIncreasePar, const Standard_Boolean bIncreasePar,
Standard_Real& theNewParameter); Standard_Real& theNewParameter,
const Handle(IntTools_Context)& );
static static
Standard_Boolean IsCurveValid(Handle(Geom2d_Curve)& thePCurve); Standard_Boolean IsCurveValid(Handle(Geom2d_Curve)& thePCurve);
@ -216,7 +217,8 @@ static
const TopoDS_Face& theFace2, const TopoDS_Face& theFace2,
Handle(TColgp_HArray1OfPnt2d)& theResultOnS1, Handle(TColgp_HArray1OfPnt2d)& theResultOnS1,
Handle(TColgp_HArray1OfPnt2d)& theResultOnS2, Handle(TColgp_HArray1OfPnt2d)& theResultOnS2,
Handle(TColStd_HArray1OfReal)& theResultRadius); Handle(TColStd_HArray1OfReal)& theResultRadius,
const Handle(IntTools_Context)& );
static static
Standard_Boolean FindPoint(const gp_Pnt2d& theFirstPoint, Standard_Boolean FindPoint(const gp_Pnt2d& theFirstPoint,
@ -263,6 +265,7 @@ static
void ApproxParameters(const Handle(GeomAdaptor_HSurface)& aHS1, void ApproxParameters(const Handle(GeomAdaptor_HSurface)& aHS1,
const Handle(GeomAdaptor_HSurface)& aHS2, const Handle(GeomAdaptor_HSurface)& aHS2,
Standard_Integer& iDegMin, Standard_Integer& iDegMin,
Standard_Integer& iNbIter,
Standard_Integer& iDegMax); Standard_Integer& iDegMax);
static static
@ -279,6 +282,19 @@ static
static static
Standard_Integer IndexType(const GeomAbs_SurfaceType aType); 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 : //function :
@ -293,6 +309,23 @@ static
myTolReached2d=0.; myTolReached2d=0.;
myTolReached3d=0.; myTolReached3d=0.;
SetParameters(Standard_True, Standard_True, Standard_True, 1.e-07); 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 //function : Face1
@ -302,7 +335,6 @@ static
{ {
return myFace1; return myFace1;
} }
//======================================================================= //=======================================================================
//function : Face2 //function : Face2
//purpose : //purpose :
@ -311,7 +343,6 @@ static
{ {
return myFace2; return myFace2;
} }
//======================================================================= //=======================================================================
//function : TangentFaces //function : TangentFaces
//purpose : //purpose :
@ -350,11 +381,11 @@ static
//======================================================================= //=======================================================================
const IntTools_SequenceOfCurves& IntTools_FaceFace::Lines() const const IntTools_SequenceOfCurves& IntTools_FaceFace::Lines() const
{ {
StdFail_NotDone_Raise_if(!myIsDone, StdFail_NotDone_Raise_if
(!myIsDone,
"IntTools_FaceFace::Lines() => !myIntersector.IsDone()"); "IntTools_FaceFace::Lines() => !myIntersector.IsDone()");
return mySeqOfCurve; return mySeqOfCurve;
} }
//======================================================================= //=======================================================================
//function : TolReached2d //function : TolReached2d
//purpose : //purpose :
@ -381,12 +412,10 @@ static
//function : SetList //function : SetList
//purpose : //purpose :
//======================================================================= //=======================================================================
void IntTools_FaceFace::SetList(IntSurf_ListOfPntOn2S& aListOfPnts) void IntTools_FaceFace::SetList(IntSurf_ListOfPntOn2S& aListOfPnts)
{ {
myListOfPnts = aListOfPnts; myListOfPnts = aListOfPnts;
} }
//======================================================================= //=======================================================================
//function : Perform //function : Perform
//purpose : intersect surfaces of the faces //purpose : intersect surfaces of the faces
@ -404,6 +433,10 @@ void IntTools_FaceFace::SetList(IntSurf_ListOfPntOn2S& aListOfPnts)
Handle(IntTools_TopolTool) dom1, dom2; Handle(IntTools_TopolTool) dom1, dom2;
BRepAdaptor_Surface aBAS1, aBAS2; BRepAdaptor_Surface aBAS1, aBAS2;
// //
if (myContext.IsNull()) {
myContext=new IntTools_Context;
}
//
mySeqOfCurve.Clear(); mySeqOfCurve.Clear();
myTolReached2d=0.; myTolReached2d=0.;
myTolReached3d=0.; myTolReached3d=0.;
@ -464,15 +497,10 @@ void IntTools_FaceFace::SetList(IntSurf_ListOfPntOn2S& aListOfPnts)
myIsDone = Standard_True; myIsDone = Standard_True;
if(myTangentFaces) { if(!myTangentFaces) {
return;
}
// //
NbLinPP = mySeqOfCurve.Length(); NbLinPP = mySeqOfCurve.Length();
if(NbLinPP == 0) { if(NbLinPP) {
return;
}
Standard_Real aTolFMax; Standard_Real aTolFMax;
// //
myTolReached3d = 1.e-7; myTolReached3d = 1.e-7;
@ -497,6 +525,8 @@ void IntTools_FaceFace::SetList(IntSurf_ListOfPntOn2S& aListOfPnts)
aIC.SetSecondCurve2d(aC2D1); aIC.SetSecondCurve2d(aC2D1);
} }
} }
}
}
return; return;
}//if(aType1==GeomAbs_Plane && aType2==GeomAbs_Plane){ }//if(aType1==GeomAbs_Plane && aType2==GeomAbs_Plane){
// //
@ -689,13 +719,11 @@ void IntTools_FaceFace::SetList(IntSurf_ListOfPntOn2S& aListOfPnts)
GeomAbs_SurfaceType aType1, aType2; GeomAbs_SurfaceType aType1, aType2;
// //
aNbLin=myIntersector.NbLines(); aNbLin=myIntersector.NbLines();
//
aType1=myHS1->Surface().GetType(); aType1=myHS1->Surface().GetType();
aType2=myHS2->Surface().GetType(); aType2=myHS2->Surface().GetType();
// //
if (aNbLin==2 && if (aType1==GeomAbs_Cylinder && aType2==GeomAbs_Cylinder) {
aType1==GeomAbs_Cylinder && if (aNbLin==2){
aType2==GeomAbs_Cylinder) {
Handle(IntPatch_Line) aIL1, aIL2; Handle(IntPatch_Line) aIL1, aIL2;
IntPatch_IType aTL1, aTL2; IntPatch_IType aTL1, aTL2;
// //
@ -717,11 +745,59 @@ void IntTools_FaceFace::SetList(IntSurf_ListOfPntOn2S& aListOfPnts)
if (aD<aDTresh) { if (aD<aDTresh) {
myTolReached3d=aD+dTol; myTolReached3d=aD+dTol;
} }
return;
} }
} }
//ZZ
{// Check the distances
Standard_Boolean bIsDone;
Standard_Integer i, j, aNbP;
Standard_Real aT, aT1, aT2, dT, aD2, aD2Max;
//
aD2Max=0.;
aNbP=11;
aNbLin=mySeqOfCurve.Length();
//
for (i=1; i<=aNbLin; ++i) {
const IntTools_Curve& aIC=mySeqOfCurve(i);
const Handle(Geom_Curve)& aC3D=aIC.Curve();
const Handle(Geom2d_Curve)& aC2D1=aIC.FirstCurve2d();
const Handle(Geom2d_Curve)& aC2D2=aIC.SecondCurve2d();
//
if (aC3D.IsNull()) {
continue;
}
const Handle(Geom_BSplineCurve)& aBC=
Handle(Geom_BSplineCurve)::DownCast(aC3D);
if (aBC.IsNull()) {
continue;
}
//
aT1=aBC->FirstParameter();
aT2=aBC->LastParameter();
//
dT=(aT2-aT1)/(aNbP-1);
for (j=0; j<aNbP; ++j) {
aT=aT1+j*dT;
if (j==aNbP-1) {
aT=aT2;
}
aD2=MaxSquareDistance(aT, aC3D, aC2D1, aC2D2,
myHS1, myHS2, myFace1, myFace2, myContext);
if (aD2>aD2Max) {
aD2Max=aD2;
}
}//for (j=0; j<aNbP; ++j) {
}//for (i=1; i<=aNbLin; ++i) {
//
myTolReached3d=sqrt(aD2Max);
}
}// if (aType1==GeomAbs_Cylinder && aType2==GeomAbs_Cylinder) {
//
//904/G3 f //904/G3 f
if (aType1==GeomAbs_Plane && else if (aType1==GeomAbs_Plane && aType2==GeomAbs_Plane) {
aType2==GeomAbs_Plane) {
Standard_Real aTolF1, aTolF2, aTolFMax, aTolTresh; Standard_Real aTolF1, aTolF2, aTolFMax, aTolTresh;
// //
aTolTresh=1.e-7; aTolTresh=1.e-7;
@ -733,10 +809,10 @@ void IntTools_FaceFace::SetList(IntSurf_ListOfPntOn2S& aListOfPnts)
if (aTolFMax>aTolTresh) { if (aTolFMax>aTolTresh) {
myTolReached3d=aTolFMax; myTolReached3d=aTolFMax;
} }
} }//if (aType1==GeomAbs_Plane && aType2==GeomAbs_Plane) {
//t //t
//IFV Bug OCC20297 //IFV Bug OCC20297
if((aType1 == GeomAbs_Cylinder && aType2 == GeomAbs_Plane) || else if((aType1 == GeomAbs_Cylinder && aType2 == GeomAbs_Plane) ||
(aType2 == GeomAbs_Cylinder && aType1 == GeomAbs_Plane)) { (aType2 == GeomAbs_Cylinder && aType1 == GeomAbs_Plane)) {
if(aNbLin == 1) { if(aNbLin == 1) {
const Handle(IntPatch_Line)& aIL1 = myIntersector.Line(1); const Handle(IntPatch_Line)& aIL1 = myIntersector.Line(1);
@ -766,10 +842,10 @@ void IntTools_FaceFace::SetList(IntSurf_ListOfPntOn2S& aListOfPnts)
} }
} //aIL1->ArcType() == IntPatch_Circle } //aIL1->ArcType() == IntPatch_Circle
} //aNbLin == 1 } //aNbLin == 1
} // aType1 == GeomAbs_Cylinder && aType2 == GeomAbs_Plane) ... } // aType1 == GeomAbs_Cylinder && aType2 == GeomAbs_Plane)
//End IFV Bug OCC20297 //End IFV Bug OCC20297
// //
if ((aType1==GeomAbs_Plane && aType2==GeomAbs_Torus) || else if ((aType1==GeomAbs_Plane && aType2==GeomAbs_Torus) ||
(aType2==GeomAbs_Plane && aType1==GeomAbs_Torus)) { (aType2==GeomAbs_Plane && aType1==GeomAbs_Torus)) {
aNbLin=mySeqOfCurve.Length(); aNbLin=mySeqOfCurve.Length();
if (aNbLin!=1) { if (aNbLin!=1) {
@ -785,7 +861,8 @@ void IntTools_FaceFace::SetList(IntSurf_ListOfPntOn2S& aListOfPnts)
// //
const IntTools_Curve& aIC=mySeqOfCurve(1); const IntTools_Curve& aIC=mySeqOfCurve(1);
const Handle(Geom_Curve)& aC3D=aIC.Curve(); 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()) { if (aBS.IsNull()) {
return; return;
} }
@ -828,18 +905,13 @@ void IntTools_FaceFace::SetList(IntSurf_ListOfPntOn2S& aListOfPnts)
} }
}// if ((aType1==GeomAbs_Plane && aType2==GeomAbs_Torus) || }// if ((aType1==GeomAbs_Plane && aType2==GeomAbs_Torus) ||
// //
if ((aType1==GeomAbs_SurfaceOfRevolution && aType2==GeomAbs_Cylinder) || else if ((aType1==GeomAbs_SurfaceOfRevolution && aType2==GeomAbs_Cylinder) ||
(aType2==GeomAbs_SurfaceOfRevolution && aType1==GeomAbs_Cylinder)) { (aType2==GeomAbs_SurfaceOfRevolution && aType1==GeomAbs_Cylinder)) {
Standard_Boolean bIsDone;
Standard_Integer i, j, aNbP; Standard_Integer i, j, aNbP;
Standard_Real aT, aT1, aT2, dT, aU1, aV1, aU2, aV2; Standard_Real aT, aT1, aT2, dT, aD2max, aD2;
Standard_Real aDSmax, aDS1, aDS2, aDS;
gp_Pnt2d aP2D1, aP2D2;
gp_Pnt aP3D, aP3D1, aP3D2;
IntTools_Context aCtx;
// //
aNbLin=mySeqOfCurve.Length(); aNbLin=mySeqOfCurve.Length();
aDSmax=-1.; aD2max=0.;
aNbP=11; aNbP=11;
// //
for (i=1; i<=aNbLin; ++i) { for (i=1; i<=aNbLin; ++i) {
@ -851,7 +923,8 @@ void IntTools_FaceFace::SetList(IntSurf_ListOfPntOn2S& aListOfPnts)
if (aC3D.IsNull()) { if (aC3D.IsNull()) {
continue; continue;
} }
const Handle(Geom_BSplineCurve)& aBC=Handle(Geom_BSplineCurve)::DownCast(aC3D); const Handle(Geom_BSplineCurve)& aBC=
Handle(Geom_BSplineCurve)::DownCast(aC3D);
if (aBC.IsNull()) { if (aBC.IsNull()) {
return; return;
} }
@ -866,57 +939,17 @@ void IntTools_FaceFace::SetList(IntSurf_ListOfPntOn2S& aListOfPnts)
aT=aT2; aT=aT2;
} }
// //
aC3D->D0(aT, aP3D); aD2=MaxSquareDistance(aT, aC3D, aC2D1, aC2D2,
// 1 myHS1, myHS2, myFace1, myFace2, myContext);
if (!aC2D1.IsNull()) { if (aD2>aD2max) {
aC2D1->D0(aT, aP2D1); aD2max=aD2;
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;
}
} }
}//for (j=0; j<aNbP; ++j) { }//for (j=0; j<aNbP; ++j) {
}//for (i=1; i<=aNbLin; ++i) { }//for (i=1; i<=aNbLin; ++i) {
// //
aDS=myTolReached3d*myTolReached3d; aD2=myTolReached3d*myTolReached3d;
if (aDSmax > aDS) { if (aD2max > aD2) {
myTolReached3d=sqrt(aDSmax); myTolReached3d=sqrt(aD2max);
} }
}//if((aType1==GeomAbs_SurfaceOfRevolution ... }//if((aType1==GeomAbs_SurfaceOfRevolution ...
} }
@ -955,12 +988,22 @@ void IntTools_FaceFace::SetList(IntSurf_ListOfPntOn2S& aListOfPnts)
// //
const Handle(IntPatch_WLine)& aWLine= const Handle(IntPatch_WLine)& aWLine=
Handle(IntPatch_WLine)::DownCast(L); Handle(IntPatch_WLine)::DownCast(L);
// //DEBf
//DumpWLine(aWLine);
//DEBt
anewL = ComputePurgedWLine(aWLine); anewL = ComputePurgedWLine(aWLine);
if(anewL.IsNull()) { if(anewL.IsNull()) {
return; return;
} }
L = anewL; L = anewL;
//DEBf
/*
{ const Handle(IntPatch_WLine)& aWLineX=
Handle(IntPatch_WLine)::DownCast(L);
DumpWLine(aWLineX);
}
*/
//DEBt
// //
if(!myListOfPnts.IsEmpty()) { if(!myListOfPnts.IsEmpty()) {
bAvoidLineConstructor = Standard_True; bAvoidLineConstructor = Standard_True;
@ -1158,7 +1201,7 @@ void IntTools_FaceFace::SetList(IntSurf_ListOfPntOn2S& aListOfPnts)
if(P1.Distance(P2) > aTolDist) { if(P1.Distance(P2) > aTolDist) {
Standard_Real anewpar = fprm; 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; fprm = anewpar;
} }
aSeqFprm.Append(fprm); aSeqFprm.Append(fprm);
@ -1180,7 +1223,7 @@ void IntTools_FaceFace::SetList(IntSurf_ListOfPntOn2S& aListOfPnts)
if(P1.Distance(P2) > aTolDist) { if(P1.Distance(P2) > aTolDist) {
Standard_Real anewpar = lprm; 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; lprm = anewpar;
} }
aSeqFprm.Append(aNul); aSeqFprm.Append(aNul);
@ -1618,10 +1661,15 @@ void IntTools_FaceFace::SetList(IntSurf_ListOfPntOn2S& aListOfPnts)
if(reApprox && !rejectSurface) if(reApprox && !rejectSurface)
theapp3d.SetParameters(myTolApprox, tol2d, 4, 8, 0, Standard_False, aParType); theapp3d.SetParameters(myTolApprox, tol2d, 4, 8, 0, Standard_False, aParType);
else { else {
Standard_Integer iDegMax, iDegMin; Standard_Integer iDegMax, iDegMin, iNbIter;
// //
ApproxParameters(myHS1, myHS2, iDegMin, iDegMax); //modified by NIZNHY-PKV Mon Jan 30 14:19:32 2012f
theapp3d.SetParameters(myTolApprox, tol2d, iDegMin, iDegMax, 0, Standard_True, aParType); 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, myLConstruct,
bAvoidLineConstructor, bAvoidLineConstructor,
aSeqOfL, aSeqOfL,
aReachedTol); aReachedTol,
myContext);
if ( bIsDecomposited && ( myTolReached3d < aReachedTol ) ) if ( bIsDecomposited && ( myTolReached3d < aReachedTol ) )
myTolReached3d = aReachedTol; myTolReached3d = aReachedTol;
@ -2897,9 +2946,7 @@ Standard_Boolean FindPoint(const gp_Pnt2d& theFirstPoint,
} }
gp_Vec2d anormvec = aVec; gp_Vec2d anormvec = aVec;
anormvec.Normalize(); anormvec.Normalize();
//modified by NIZNHY-PKV Mon Dec 19 11:46:06 2011f
RefineVector(anormvec); RefineVector(anormvec);
//modified by NIZNHY-PKV Mon Dec 19 11:46:10 2011t
Standard_Real adot1 = anormvec.Dot(anOtherVecNormal); Standard_Real adot1 = anormvec.Dot(anOtherVecNormal);
if(fabs(adot1) < Precision::Angular()) if(fabs(adot1) < Precision::Angular())
@ -3044,8 +3091,6 @@ Standard_Boolean CheckTangentZonesExist( const Handle(GeomAdaptor_HSurface)& the
( theSurface2->GetType() != GeomAbs_Torus ) ) ( theSurface2->GetType() != GeomAbs_Torus ) )
return Standard_False; return Standard_False;
IntTools_Context aContext;
gp_Torus aTor1 = theSurface1->Torus(); gp_Torus aTor1 = theSurface1->Torus();
gp_Torus aTor2 = theSurface2->Torus(); gp_Torus aTor2 = theSurface2->Torus();
@ -3072,12 +3117,13 @@ Standard_Integer ComputeTangentZones( const Handle(GeomAdaptor_HSurface)& theSur
const TopoDS_Face& theFace2, const TopoDS_Face& theFace2,
Handle(TColgp_HArray1OfPnt2d)& theResultOnS1, Handle(TColgp_HArray1OfPnt2d)& theResultOnS1,
Handle(TColgp_HArray1OfPnt2d)& theResultOnS2, Handle(TColgp_HArray1OfPnt2d)& theResultOnS2,
Handle(TColStd_HArray1OfReal)& theResultRadius) { Handle(TColStd_HArray1OfReal)& theResultRadius,
const Handle(IntTools_Context)& aContext)
{
Standard_Integer aResult = 0; Standard_Integer aResult = 0;
if ( !CheckTangentZonesExist( theSurface1, theSurface2 ) ) if ( !CheckTangentZonesExist( theSurface1, theSurface2 ) )
return aResult; return aResult;
IntTools_Context aContext;
TColgp_SequenceOfPnt2d aSeqResultS1, aSeqResultS2; TColgp_SequenceOfPnt2d aSeqResultS1, aSeqResultS2;
TColStd_SequenceOfReal aSeqResultRad; TColStd_SequenceOfReal aSeqResultRad;
@ -3151,7 +3197,8 @@ Standard_Integer ComputeTangentZones( const Handle(GeomAdaptor_HSurface)& theSur
Standard_Integer surfit = 0; Standard_Integer surfit = 0;
for ( surfit = 0; surfit < 2; surfit++ ) { 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(); gp_Pnt aP3d = (surfit == 0) ? P1.Value() : P2.Value();
aProjector.Perform(aP3d); aProjector.Perform(aP3d);
@ -3282,7 +3329,9 @@ Standard_Boolean DecompositionOfWLine(const Handle(IntPatch_WLine)& theWLine,
const IntTools_LineConstructor& theLConstructor, const IntTools_LineConstructor& theLConstructor,
const Standard_Boolean theAvoidLConstructor, const Standard_Boolean theAvoidLConstructor,
IntPatch_SequenceOfLine& theNewLines, IntPatch_SequenceOfLine& theNewLines,
Standard_Real& theReachedTol3d) { Standard_Real& theReachedTol3d,
const Handle(IntTools_Context)& aContext)
{
Standard_Boolean bRet, bAvoidLineConstructor; Standard_Boolean bRet, bAvoidLineConstructor;
Standard_Integer aNbPnts, aNbParts; Standard_Integer aNbPnts, aNbParts;
@ -3307,13 +3356,12 @@ Standard_Boolean DecompositionOfWLine(const Handle(IntPatch_WLine)& theWLine,
TColStd_Array1OfListOfInteger anArrayOfLines(1, aNbPnts); TColStd_Array1OfListOfInteger anArrayOfLines(1, aNbPnts);
TColStd_Array1OfInteger anArrayOfLineType(1, aNbPnts); TColStd_Array1OfInteger anArrayOfLineType(1, aNbPnts);
TColStd_ListOfInteger aListOfPointIndex; TColStd_ListOfInteger aListOfPointIndex;
IntTools_Context aContext;
Handle(TColgp_HArray1OfPnt2d) aTanZoneS1; Handle(TColgp_HArray1OfPnt2d) aTanZoneS1;
Handle(TColgp_HArray1OfPnt2d) aTanZoneS2; Handle(TColgp_HArray1OfPnt2d) aTanZoneS2;
Handle(TColStd_HArray1OfReal) aTanZoneRadius; Handle(TColStd_HArray1OfReal) aTanZoneRadius;
Standard_Integer aNbZone = ComputeTangentZones( theSurface1, theSurface2, theFace1, theFace2, Standard_Integer aNbZone = ComputeTangentZones( theSurface1, theSurface2, theFace1, theFace2,
aTanZoneS1, aTanZoneS2, aTanZoneRadius ); aTanZoneS1, aTanZoneS2, aTanZoneRadius, aContext);
// //
nblines=0; nblines=0;
@ -3751,7 +3799,8 @@ Standard_Boolean DecompositionOfWLine(const Handle(IntPatch_WLine)& theWLine,
if(found) { if(found) {
// check point // check point
Standard_Real aCriteria = BRep_Tool::Tolerance(theFace1) + BRep_Tool::Tolerance(theFace2); 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) aSurface = (surfit == 0) ? theSurface1 : theSurface2;
Handle(GeomAdaptor_HSurface) aSurfaceOther = (surfit == 0) ? theSurface2 : theSurface1; 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 < vmin ) ? vmin : foundV;
foundV = ( foundV > vmax ) ? vmax : 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); aP3d = aSurfaceOther->Value(foundU, foundV);
aProjector2.Perform(aP3d); aProjector2.Perform(aP3d);
@ -4004,11 +4054,12 @@ Standard_Boolean ParameterOutOfBoundary(const Standard_Real theParameter,
const TopoDS_Face& theFace2, const TopoDS_Face& theFace2,
const Standard_Real theOtherParameter, const Standard_Real theOtherParameter,
const Standard_Boolean bIncreasePar, const Standard_Boolean bIncreasePar,
Standard_Real& theNewParameter) { Standard_Real& theNewParameter,
const Handle(IntTools_Context)& aContext)
{
Standard_Boolean bIsComputed = Standard_False; Standard_Boolean bIsComputed = Standard_False;
theNewParameter = theParameter; theNewParameter = theParameter;
IntTools_Context aContext;
Standard_Real acurpar = theParameter; Standard_Real acurpar = theParameter;
TopAbs_State aState = TopAbs_ON; TopAbs_State aState = TopAbs_ON;
Standard_Integer iter = 0; Standard_Integer iter = 0;
@ -4039,7 +4090,7 @@ Standard_Boolean ParameterOutOfBoundary(const Standard_Real theParameter,
if(aPrj1.IsDone()) { if(aPrj1.IsDone()) {
aPrj1.LowerDistanceParameters(U, V); aPrj1.LowerDistanceParameters(U, V);
aState = aContext.StatePointFace(theFace1, gp_Pnt2d(U, V)); aState = aContext->StatePointFace(theFace1, gp_Pnt2d(U, V));
} }
if(aState != TopAbs_ON) { if(aState != TopAbs_ON) {
@ -4047,7 +4098,7 @@ Standard_Boolean ParameterOutOfBoundary(const Standard_Real theParameter,
if(aPrj2.IsDone()) { if(aPrj2.IsDone()) {
aPrj2.LowerDistanceParameters(U, V); 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, void ApproxParameters(const Handle(GeomAdaptor_HSurface)& aHS1,
const Handle(GeomAdaptor_HSurface)& aHS2, const Handle(GeomAdaptor_HSurface)& aHS2,
Standard_Integer& iDegMin, Standard_Integer& iDegMin,
Standard_Integer& iDegMax) Standard_Integer& iDegMax,
Standard_Integer& iNbIter)
{ {
GeomAbs_SurfaceType aTS1, aTS2; GeomAbs_SurfaceType aTS1, aTS2;
// //
iNbIter=0;
iDegMin=4; iDegMin=4;
iDegMax=8; iDegMax=8;
// //
@ -4430,6 +4484,11 @@ void ApproxParameters(const Handle(GeomAdaptor_HSurface)& aHS1,
iDegMax=6; 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 //function : Tolerances
@ -4544,6 +4603,7 @@ void DumpWLine(const Handle(IntPatch_WLine)& aWLine)
Standard_Integer i, aNbPnts; Standard_Integer i, aNbPnts;
Standard_Real aX, aY, aZ, aU1, aV1, aU2, aV2; Standard_Real aX, aY, aZ, aU1, aV1, aU2, aV2;
// //
printf(" *WLine\n");
aNbPnts=aWLine->NbPnts(); aNbPnts=aWLine->NbPnts();
for (i=1; i<=aNbPnts; ++i) { for (i=1; i<=aNbPnts; ++i) {
const IntSurf_PntOn2S aPntOn2S=aWLine->Point(i); const IntSurf_PntOn2S aPntOn2S=aWLine->Point(i);
@ -4551,12 +4611,11 @@ void DumpWLine(const Handle(IntPatch_WLine)& aWLine)
aP3D.Coord(aX, aY, aZ); aP3D.Coord(aX, aY, aZ);
aPntOn2S.Parameters(aU1, aV1, aU2, aV2); aPntOn2S.Parameters(aU1, aV1, aU2, aV2);
// //
//printf("point p_%d %lf %lf %lf\n", i, aX, aY, aZ); 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", //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); // i, aX, aY, aZ, aU1, aV1, aU2, aV2);
} }
} }
//modified by NIZNHY-PKV Wed Dec 14 12:22:48 2011f
//======================================================================= //=======================================================================
//function : RefineVector //function : RefineVector
//purpose : //purpose :
@ -4588,4 +4647,63 @@ void RefineVector(gp_Vec2d& aV2D)
} }
aV2D.SetCoord(aC[0], aC[1]); 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

View File

@ -18,8 +18,7 @@ uses
Vertex from TopoDS, Vertex from TopoDS,
Range from IntTools, Range from IntTools,
Box from Bnd, Box from Bnd,
Context from IntTools, Context from IntTools
PContext from IntTools
--raises --raises
@ -38,6 +37,18 @@ is
returns ShrunkRange from IntTools; returns ShrunkRange from IntTools;
---Purpose: ---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); SetShrunkRange(me:out; aR:Range from IntTools);
---Purpose: ---Purpose:
@ -104,7 +115,7 @@ fields
myRange : Range from IntTools; myRange : Range from IntTools;
myShrunkRange : Range from IntTools; myShrunkRange : Range from IntTools;
myBndBox : Box from Bnd; myBndBox : Box from Bnd;
myCtx : PContext from IntTools; myContext : Context from IntTools;
myIsDone : Boolean from Standard; myIsDone : Boolean from Standard;
myErrorStatus : Integer from Standard; myErrorStatus : Integer from Standard;

View File

@ -39,18 +39,34 @@
const TopoDS_Vertex& aV1, const TopoDS_Vertex& aV1,
const TopoDS_Vertex& aV2, const TopoDS_Vertex& aV2,
const IntTools_Range& aR, const IntTools_Range& aR,
const IntTools_Context& aCtx) const Handle(IntTools_Context)& aCtx)
{ {
myEdge=aE; myEdge=aE;
myV1=aV1; myV1=aV1;
myV2=aV2; myV2=aV2;
myRange=aR; myRange=aR;
myCtx=(IntTools_PContext)&aCtx; myContext=aCtx;
myIsDone=Standard_False; myIsDone=Standard_False;
myErrorStatus=1; myErrorStatus=1;
Perform(); 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 //function : Edge
//purpose : //purpose :
//======================================================================= //=======================================================================
@ -103,13 +119,14 @@
GeomAbs_CurveType aCurveType; GeomAbs_CurveType aCurveType;
Handle(Geom_Curve) aC; Handle(Geom_Curve) aC;
// //
if (myContext.IsNull()) {
myContext=new IntTools_Context;
}
//
aTolE =BRep_Tool::Tolerance(myEdge); aTolE =BRep_Tool::Tolerance(myEdge);
aTolV1=BRep_Tool::Tolerance(myV1); aTolV1=BRep_Tool::Tolerance(myV1);
aTolV2=BRep_Tool::Tolerance(myV2); aTolV2=BRep_Tool::Tolerance(myV2);
//xf //
//dt1=aCoeff*(aTolV1+aTolE);
//dt2=aCoeff*(aTolV2+aTolE);
//xt
myRange.Range (t1, t2); myRange.Range (t1, t2);
// //
BRepAdaptor_Curve aBAC(myEdge); BRepAdaptor_Curve aBAC(myEdge);
@ -272,15 +289,10 @@
BRepBuilderAPI_MakeVertex aMV1(aP1L); BRepBuilderAPI_MakeVertex aMV1(aP1L);
const TopoDS_Vertex& aV1L=aMV1.Vertex(); const TopoDS_Vertex& aV1L=aMV1.Vertex();
// //
pri=myCtx->ComputeVE (aV1L, myEdge, t1C); pri=myContext->ComputeVE (aV1L, myEdge, t1C);
// //
if (pri==-3) { if (pri==-3) {
//modified by NIZNHY-PKV Tue Apr 6 14:06:29 2010
t1C = t1; t1C = t1;
//myErrorStatus=4;
//return;
//modified by NIZNHY-PKV Tue Apr 6 14:06:31 2010
} }
} }
} }
@ -369,14 +381,10 @@
BRepBuilderAPI_MakeVertex aMV2(aP2L); BRepBuilderAPI_MakeVertex aMV2(aP2L);
const TopoDS_Vertex& aV2L=aMV2.Vertex(); const TopoDS_Vertex& aV2L=aMV2.Vertex();
// //
pri=myCtx->ComputeVE (aV2L, myEdge, t2C); pri=myContext->ComputeVE (aV2L, myEdge, t2C);
// //
if (pri==-3) { if (pri==-3) {
//modified by NIZNHY-PKV Tue Apr 6 14:07:34 2010f
t2C = t2; t2C = t2;
//myErrorStatus=5;
//return;
//modified by NIZNHY-PKV Tue Apr 6 14:07:39 2010t
} }
} }
} }