// static function: CheckEdge
// purpose:
// ----------------------------------------------------------------------
-Standard_Boolean CheckEdge(const TopoDS_Edge& theEdge) {
- IntTools_Context aContext;
+Standard_Boolean CheckEdge(const TopoDS_Edge& theEdge)
+{
+ Handle(IntTools_Context) aContext;
TopoDS_Vertex aV1, aV2;
+ //
+ //modified by NIZNHY-PKV Tue Jan 31 15:07:13 2012f
+ aContext=new IntTools_Context;
+ ////modified by NIZNHY-PKV Tue Jan 31 15:07:16 2012t
TopExp::Vertices(theEdge, aV1, aV2);
+
if(aV1.IsNull() || aV2.IsNull() || BRep_Tool::Degenerated(theEdge))
return Standard_True;
Standard_Real aFirst = 0., aLast = 0.;
static Standard_Boolean IsValidSeam(const TopoDS_Edge& aE,
const TopoDS_Face& aF,
const Standard_Real aT,
- IntTools_Context& aContext);
+ const Handle(IntTools_Context)& aContext);
static void CorrespondantSeam(const TopoDS_Edge& aSpE1Seam11,
const Standard_Real aT1,
const TopoDS_Face& aF2FWD,
const Standard_Boolean bIsTakenSp1,
BOP_WireEdgeSet& aWES,
- IntTools_Context& aContext);
+ const Handle(IntTools_Context)& aContext);
//=======================================================================
nSp2=aPB2.Edge();
const TopoDS_Edge& anE2=TopoDS::Edge(aDS.GetShape(nE2));
//
- IntTools_Context& aContext=pPaveFiller->ChangeContext();
- aFlag=aContext.ProjectPointOnEdge(aPx1, anE2, aTs);
+ const Handle(IntTools_Context)& aContext=pPaveFiller->Context();
+ aFlag=aContext->ProjectPointOnEdge(aPx1, anE2, aTs);
//
if (!aFlag) {
BOPTColStd_Dump::PrintMessage(" BOP_SDFWESFiller::PrepareOnParts() failed\n");
BOPTools_CommonBlockPool& aCBPool=pPaveFiller->ChangeCommonBlockPool();
BOP_WireEdgeSet& aWES=*myWES;
//
- IntTools_Context& aContext=pPaveFiller->ChangeContext();
+ const Handle(IntTools_Context)& aContext=pPaveFiller->Context();
//
Standard_Integer nE1, nE2, aNbSpON, nSp1, aBid, nSpTaken, nSp2, iRankF1, iRankF2;
Standard_Real aT1, aT2, aU, aV, aScPr;
//
const BOPTools_ListOfPaveBlock& aSplitEdges=aSplitShapesPool(aDS.RefEdge(nED));
//
- IntTools_Context& aContext=pPaveFiller->ChangeContext();
+ const Handle(IntTools_Context)& aContext=pPaveFiller->Context();
const TopoDS_Edge& aDE=TopoDS::Edge(aDS.Shape(nED));
const TopoDS_Face& aDF=TopoDS::Face(aDS.Shape(nFD));
const TopoDS_Face& aFaceReference=TopoDS::Face(aDS.Shape(nF2));
//
aState=TopAbs_OUT;
//
- bIsValidPoint=aContext.IsValidPointForFace(aPxNear, aFaceReference, 1.e-3);
+ bIsValidPoint=aContext->IsValidPointForFace(aPxNear, aFaceReference, 1.e-3);
//
if (bIsValidPoint) {
aState=TopAbs_IN;
const Standard_Boolean bIsTakenSp1,
BOP_WireEdgeSet& aWES,
- IntTools_Context& aContext)
+ const Handle(IntTools_Context)& aContext)
{
Standard_Boolean bIsValidSeam11, bIsValidSeam12,
bIsValidSeam21, bIsValidSeam22;
Standard_Boolean IsValidSeam(const TopoDS_Edge& aE,
const TopoDS_Face& aF,
const Standard_Real aT,
- IntTools_Context& aContext)
+ const Handle(IntTools_Context)& aContext)
{
Standard_Boolean bIsPointInOnFace;
gp_Pnt2d aPx2DNear;
BOPTools_Tools3D::PointNearEdge(aE, aF, aT, aPx2DNear, aPxNear);
//
- bIsPointInOnFace=aContext.IsPointInOnFace(aF, aPx2DNear);
+ bIsPointInOnFace=aContext->IsPointInOnFace(aF, aPx2DNear);
return bIsPointInOnFace;
}
//=======================================================================
const Standard_Integer theFaceIndex,
const BOPTools_PDSFiller& theDSFiller,
const BOP_Operation& theOperation,
- IntTools_Context& theContext);
+ const Handle(IntTools_Context)& theContext);
//=======================================================================
//
BOPTools_PaveFiller* pPaveFiller=(BOPTools_PaveFiller*)&aPaveFiller;
BOPTools_CommonBlockPool& aCBPool=pPaveFiller->ChangeCommonBlockPool();
//
- IntTools_Context& aContext=pPaveFiller->ChangeContext();
+ const Handle(IntTools_Context)& aContext=pPaveFiller->Context();
//
Standard_Integer nEF1, nF2, nSpF1, nSpF2, nEF2, nSpTaken, iRankF1;
Standard_Boolean bToReverse;
BOPTools_PaveFiller* pPaveFiller=(BOPTools_PaveFiller*)&aPF;
BOPTools_CommonBlockPool& aCBPool=pPaveFiller->ChangeCommonBlockPool();
//
- IntTools_Context& aContext=pPaveFiller->ChangeContext();
+ const Handle(IntTools_Context)& aContext=pPaveFiller->Context();
//
Standard_Integer nEF1, nF2, nSpF1, nSpF2, nEF2, nSpTaken, nF2x, iRankF1;
Standard_Boolean bToReverse;
const Standard_Integer theFaceIndex,
const BOPTools_PDSFiller& theDSFiller,
const BOP_Operation& theOperation,
- IntTools_Context& theContext) {
+ const Handle(IntTools_Context)& theContext) {
Standard_Integer anE = -1;
gp_Pnt aPoint3d;
Standard_Real aTolerance = BRep_Tool::Tolerance(theSplit); //???
BOPTools_Tools3D::PointNearEdge(theSplit, aFaceCur, amidpar, aTolerance, aPoint2d, aPoint3d);
- GeomAPI_ProjectPointOnSurf& aProjector = theContext.ProjPS(aFace);
+ GeomAPI_ProjectPointOnSurf& aProjector = theContext->ProjPS(aFace);
aProjector.Perform(aPoint3d);
if(aProjector.IsDone()) {
if(adist < BRep_Tool::Tolerance(aFace)) {
aProjector.LowerDistanceParameters(U, V);
- if(theContext.IsPointInFace(aFace, gp_Pnt2d(U, V))) {
+ if(theContext->IsPointInFace(aFace, gp_Pnt2d(U, V))) {
avoid = Standard_False;
break;
}
gp_Pnt aPoint3d;
Standard_Real aTolerance = BRep_Tool::Tolerance(theSplit); //???
BOPTools_Tools3D::PointNearEdge(theSplit, aFaceCur, amidpar, aTolerance, aPoint2d, aPoint3d);
- GeomAPI_ProjectPointOnSurf& aProjector = theContext.ProjPS(aFace);
+ GeomAPI_ProjectPointOnSurf& aProjector = theContext->ProjPS(aFace);
aProjector.Perform(aPoint3d);
if(aProjector.IsDone()) {
if(adist < BRep_Tool::Tolerance(aFace)) {
aProjector.LowerDistanceParameters(U, V);
- if(theContext.IsPointInFace(aFace, gp_Pnt2d(U, V))) {
+ if(theContext->IsPointInFace(aFace, gp_Pnt2d(U, V))) {
avoid = Standard_False;
break;
}
gp_Pnt aPoint3d;
Standard_Real aTolerance = BRep_Tool::Tolerance(theSplit); //???
BOPTools_Tools3D::PointNearEdge(theSplit, aFaceCur, amidpar, aTolerance, aPoint2d, aPoint3d);
- GeomAPI_ProjectPointOnSurf& aProjector = theContext.ProjPS(aFace);
+ GeomAPI_ProjectPointOnSurf& aProjector = theContext->ProjPS(aFace);
aProjector.Perform(aPoint3d);
if(aProjector.IsDone()) {
if(adist < BRep_Tool::Tolerance(aFace)) {
aProjector.LowerDistanceParameters(U, V);
- if(theContext.IsPointInFace(aFace, gp_Pnt2d(U, V))) {
+ if(theContext->IsPointInFace(aFace, gp_Pnt2d(U, V))) {
avoid = Standard_False;
break;
}
const BOP_Operation myOperation,
const TopTools_IndexedDataMapOfShapeListOfShape& aMEF,
BOP_WireEdgeSet& aWES,
- IntTools_Context& aContext);
+ const Handle(IntTools_Context)& aContext);
static
void SecondInternal(TopoDS_Edge& aSS,
const Standard_Integer iRankF1,
const BOP_Operation myOperation,
BOP_WireEdgeSet& aWES,
- IntTools_Context& aContext);
+ const Handle(IntTools_Context)& aContext);
//=======================================================================
BOPTools_InterferencePool* pIntrPool=(BOPTools_InterferencePool*)&myDSFiller->InterfPool();
BOPTools_CArray1OfSSInterference& aFFs=pIntrPool->SSInterferences();
//
- IntTools_Context& aContext=pPaveFiller->ChangeContext();
+ const Handle(IntTools_Context)& aContext=pPaveFiller->Context();
//
Standard_Boolean bIsToKeep;
Standard_Integer nEF1, nF2, nF2x, nSpF1, iRankF1;
BOPTools_PaveFiller* pPaveFiller=(BOPTools_PaveFiller*)&aPaveFiller;
BOPTools_CommonBlockPool& aCBPool=pPaveFiller->ChangeCommonBlockPool();
//
- IntTools_Context& aContext=pPaveFiller->ChangeContext();
+ const Handle(IntTools_Context)& aContext=pPaveFiller->Context();
//
Standard_Integer nEF1, nF2, nSpF1, nSpF2, nEF2, nSpTaken, iRankF1;
TopAbs_Orientation anOrEF1, anOrEF2;
BOPTools_PaveFiller* pPaveFiller=(BOPTools_PaveFiller*)&aPF;
BOPTools_CommonBlockPool& aCBPool=pPaveFiller->ChangeCommonBlockPool();
//
- IntTools_Context& aContext=pPaveFiller->ChangeContext();
+ const Handle(IntTools_Context)& aContext=pPaveFiller->Context();
//
Standard_Integer nEF1, nF2, nSpF1, nSpF2, nEF2, nSpTaken, iRankF1, nF2x, iRankF2;
TopAbs_Orientation anOrEF1, anOrEF2;
const BOP_Operation myOperation,
const TopTools_IndexedDataMapOfShapeListOfShape& aMEF,
BOP_WireEdgeSet& aWES,
- IntTools_Context& aContext)
+ const Handle(IntTools_Context)& aContext)
{
Standard_Boolean bToReverse;
TopAbs_Orientation anOrEF2;
const Standard_Integer iRankF1,
const BOP_Operation myOperation,
BOP_WireEdgeSet& aWES,
- IntTools_Context& aContext)
+ const Handle(IntTools_Context)& aContext)
{
Standard_Boolean bToReverse, bIsToKeep;
if (aSS.Orientation()==TopAbs_INTERNAL) {
BOPTools_PaveFiller* pPaveFiller=(BOPTools_PaveFiller*)&aPF;
BOPTools_CommonBlockPool& aCBPool=pPaveFiller->ChangeCommonBlockPool();
//
- IntTools_Context& aContext=pPaveFiller->ChangeContext();
+ const Handle(IntTools_Context)& aContext=pPaveFiller->Context();
//
Standard_Integer nEF1, nF2, nSpF1, nSpF2, nEF2, nSpTaken, iRankF1, nF2x, iRankF2, iSenseFlag;
TopAbs_Orientation anOrEF1;
TopoDS_Edge aSpF2 = TopoDS::Edge(aSp2);
Standard_Boolean bToReverse=
- BOPTools_Tools3D::IsSplitToReverse1 (aSpF1, aSpF2, pPaveFiller->ChangeContext());
+ BOPTools_Tools3D::IsSplitToReverse1 (aSpF1, aSpF2, pPaveFiller->Context());
if (bToReverse) {
aSpF2.Reverse();
Standard_Integer nF2 = aFF.OppositeIndex(nF1);
const TopoDS_Face& aF2 = TopoDS::Face(aDS.Shape(nF2));
- if(BOPTools_Tools3D::CheckSameDomainFaceInside(aFace, aF2, pPaveFiller->ChangeContext())) {
+ if(BOPTools_Tools3D::CheckSameDomainFaceInside(aFace, aF2, pPaveFiller->Context())) {
theState = TopAbs_ON;
return Standard_True;
}
}
}
- if(!BOPTools_Tools3D::ComputeFaceState(aFace, aRefSolid, pPaveFiller->ChangeContext(), aState)) {
+ if(!BOPTools_Tools3D::ComputeFaceState(aFace, aRefSolid, pPaveFiller->Context(), aState)) {
return Standard_False;
}
theState = aState;
bAnalytic = BOPTools_Tools3D::TreatedAsAnalytic(aF2, aSp, aFace,
aTolTangent, aTolR,
- aStPF, pPaveFiller->ChangeContext());
+ aStPF, pPaveFiller->Context());
if(bAnalytic) {
aState = aStPF;
bFound = Standard_True;
const TopoDS_Face& aF2=TopoDS::Face(S2);
Standard_Boolean aToApproxC3d, aToApproxC2dOnS1, aToApproxC2dOnS2, anIsDone;
+ Standard_Boolean bToSplit;
Standard_Integer i, aNbCurves;
Standard_Real anAppTol, aTolR;
TCollection_AsciiString aNm("c_");
-
+ //
+ bToSplit=Standard_False;
aToApproxC3d=Standard_True;
aToApproxC2dOnS1=Standard_False;
aToApproxC2dOnS2=Standard_False;
return 1;
}
- aFF.PrepareLines3D();
+ aFF.PrepareLines3D(bToSplit);
const IntTools_SequenceOfCurves& aSCs=aFF.Lines();
//
const TopoDS_Face& aF=TopoDS::Face(S1);
//
- IntTools_Context aCtx;
+ Handle(IntTools_Context) aCtx=new IntTools_Context;
BOPTools_Tools3D::RemoveSims (aF, aCtx);
//
di << " Ok\n";
#include <BooleanOperations_AncestorsSeqAndSuccessorsSeq.hxx>
#include <BOPTColStd_Failure.hxx>
+#include <IntTools_Context.hxx>
//=======================================================================
// function: BOPTools_Checker::BOPTools_Checker
{
myCheckResults.Clear();
try {
+ //
+ if (myContext.IsNull()) {
+ myContext=new IntTools_Context;
+ }
//
// 0. Prepare the IteratorOfCoupleOfShape
myDSIt.SetDataStructure(myDS);
continue;
}
//
- aFlag=myContext.ComputeVE (aV1, aE2, aT);
+ aFlag=myContext->ComputeVE (aV1, aE2, aT);
//
if (!aFlag) {
char buf[512];
continue;
}
//
- aFlag=myContext.ComputeVS (aV1, aF2, aU, aV);
+ aFlag=myContext->ComputeVS (aV1, aF2, aU, aV);
//
if (!aFlag) {
char buf[512];
aC.Bounds(aT1, aT2, aP1, aP2);
//
- bValid=myContext.IsValidBlockForFaces(aT1, aT2, aC, aF1, aF2, 1.e-3);
+ bValid=myContext->IsValidBlockForFaces(aT1, aT2, aC, aF1, aF2, 1.e-3);
//
if (bValid) {
char buf[512];
if (aTypeReference==TopAbs_SOLID) {
// ... \ Solid processing
- IntTools_Context& aContext=myFiller->ChangeContext();
+ const Handle(IntTools_Context)& aContext=myFiller->Context();
const TopoDS_Solid& aReferenceSolid=TopoDS::Solid(aReference);
- BRepClass3d_SolidClassifier& SC=aContext.SolidClassifier(aReferenceSolid);
+ BRepClass3d_SolidClassifier& SC=aContext->SolidClassifier(aReferenceSolid);
//
SC.Perform(aPxNear, aTol);
//
Standard_Boolean bIsValidPoint;
TopAbs_State aState=TopAbs_OUT;
//
- IntTools_Context& aContext=myFiller->ChangeContext();
- bIsValidPoint=aContext.IsValidPointForFace(aPxNear, aFaceReference, 1.e-3);
+ const Handle(IntTools_Context)& aContext=myFiller->Context();
+ bIsValidPoint=aContext->IsValidPointForFace(aPxNear, aFaceReference, 1.e-3);
//
if (bIsValidPoint) {
aState=TopAbs_IN;
---
--- Selectors
---
- ---
+ ---
+ SetContext(me:out;
+ aContext: Context from IntTools);
+ ---Purpose:
+ --- Sets the intersecton context
+ ---
Context(me)
returns Context from IntTools;
---C++:return const &
---Purpose:
--- Selector
---
- ChangeContext(me:out)
- returns Context from IntTools;
- ---C++:return &
+-- ChangeContext(me:out)
+-- returns Context from IntTools;
+ -- C++:return &
---Purpose:
--- Selector
---
{
return mySectionAttribute;
}
-
+//=======================================================================
+// function: SetContext
+// purpose:
+//=======================================================================
+void BOPTools_PaveFiller::SetContext(const Handle(IntTools_Context)& aContext)
+{
+ myContext=aContext;
+}
//=======================================================================
// function: Context
// purpose:
//=======================================================================
- const IntTools_Context& BOPTools_PaveFiller::Context() const
+const Handle(IntTools_Context)& BOPTools_PaveFiller::Context() const
{
return myContext;
}
+/*
//=======================================================================
// function: ChangeContext
// purpose:
{
return myContext;
}
-
+*/
//=======================================================================
// function: Perform
// purpose:
void BOPTools_PaveFiller::Perform()
{
try {
+ //
+ if (myContext.IsNull()) {
+ myContext=new IntTools_Context;
+ }
//
// 0. Prepare the IteratorOfCoupleOfShape
myDSIt.SetDataStructure(myDS);
const TColStd_SetOfInteger& aToolSubSet)
{
try {
+ //
+ if (myContext.IsNull()) {
+ myContext=new IntTools_Context;
+ }
+ //
//
// 0. Prepare the IteratorOfCoupleOfShape
myDSIt.SetDataStructure(myDS);
void BOPTools_PaveFiller::ToCompletePerform()
{
try {
+ //
+ if (myContext.IsNull()) {
+ myContext=new IntTools_Context;
+ }
+ //
PutPavesOnCurves();
MakeSplitEdges ();
continue;
}
//
- aFlag=myContext.ComputeVE (aV1, aE2, aT);
+ aFlag=myContext->ComputeVE (aV1, aE2, aT);
//
if (!aFlag) {
//
const TopoDS_Vertex& aV1=TopoDS::Vertex(aS1);
const TopoDS_Face& aF2=TopoDS::Face (aS2);
//
- aFlag=myContext.ComputeVS (aV1, aF2, aU, aV);
+ aFlag=myContext->ComputeVS (aV1, aF2, aU, aV);
//
if (!aFlag) {
//
aEF.SetDiscretize (aDiscretize);
aEF.SetDeflection (aDeflection);
//
- aEF.SetContext((IntTools_PContext)&myContext);
+ aEF.SetContext(myContext);
//
BRepAdaptor_Curve aCurve(aE);
Standard_Real aTNew;
//
- iFlag=myContext.ComputeVE(aVF, aE, aTNew);
+ iFlag=myContext->ComputeVE(aVF, aE, aTNew);
//
aT=aTNew;
aNewShape=nVF;
const Standard_Real theTolerance,
const BOPTools_PInterferencePool& theIntrPool,
const BooleanOperations_PShapesDataStructure& theDS,
- IntTools_Context* theContext,
+ const Handle(IntTools_Context)& theContext,
const BOPTools_PaveSet& theEdgePaveSet,
const Standard_Boolean bAddNewVertex,
const Standard_Boolean bAddOldVertex,
aFFs.SetBlockLength(aNbFFs);
}
//
- //modified by NIZNHY-PKV Thu Oct 20 07:09:57 2011f
bToSplit=Standard_False;
- //modified by NIZNHY-PKV Thu Oct 20 07:09:59 2011t
for (; myDSIt.More(); myDSIt.Next()) {
Standard_Boolean justaddinterference = Standard_True;
TopoDS_Face aF2=TopoDS::Face(myDS->GetShape(nF2));
//
IntSurf_ListOfPntOn2S aListOfPnts;
- GeomAPI_ProjectPointOnSurf& aProj1 = myContext.ProjPS(aF1);
- GeomAPI_ProjectPointOnSurf& aProj2 = myContext.ProjPS(aF2);
+ GeomAPI_ProjectPointOnSurf& aProj1 = myContext->ProjPS(aF1);
+ GeomAPI_ProjectPointOnSurf& aProj2 = myContext->ProjPS(aF2);
BOPTools_CArray1OfESInterference& aEFs=myIntrPool->ESInterferences();
TColStd_MapOfInteger aMapEdgeIndex1, aMapEdgeIndex2;
anApproxTol=1.e-7;
IntTools_FaceFace aFF;
+ //
+ aFF.SetContext(myContext);
+ //
aFF.SetParameters (bToApproxC3d,
bToApproxC2dOnS1,
bToApproxC2dOnS2,
if (aTolR3D < 1.e-7){
aTolR3D=1.e-7;
}
- //modified by NIZNHY-PKV Thu Oct 20 07:10:38 2011f
aFF.PrepareLines3D(bToSplit);
- //aFF.PrepareLines3D();
- //modified by NIZNHY-PKV Thu Oct 20 07:10:41 2011t
//
anIndexIn=0;
Standard_Integer aNbCurves, aNbPoints;
// Checking of validity in 2D
//
Standard_Real aTolerance = (aTolR3D < 1.e-3) ? 1.e-3 : aTolR3D;
- bValid=myContext.IsValidBlockForFaces(aT1, aT2, aC, aF1, aF2, aTolerance);
+ bValid=myContext->IsValidBlockForFaces(aT1, aT2, aC, aF1, aF2, aTolerance);
//
if (!bValid) {
continue;
Standard_Boolean bVF;
Standard_Integer aNewShape;
//
- bVF=myContext.IsValidPointForFaces (aPAlone, aF1, aF2, 1.e-3);
+ bVF=myContext->IsValidPointForFaces (aPAlone, aF1, aF2, 1.e-3);
//
if (bVF) {
BooleanOperations_AncestorsSeqAndSuccessorsSeq anASSeq;
// VE
if (!iV) {
- iVE=myContext.ComputeVE (aV11, aE2, aTE);
+ iVE=myContext->ComputeVE (aV11, aE2, aTE);
if (!iVE) {
iCount++;
if (iCount>iCountExt) {
// VE
if (!iV) {
//
- iVE=myContext.ComputeVE (aV12, aE2, aTE);
+ iVE=myContext->ComputeVE (aV12, aE2, aTE);
//
if (!iVE) {
iCount++;
nE2=aPBR.Edge();
const TopoDS_Edge& aE2=TopoDS::Edge(myDS->GetShape(nE2));
// VE
- iVM=myContext.ComputeVE(aVM, aE2, aTmp);
+ iVM=myContext->ComputeVE(aVM, aE2, aTmp);
//
return iVM;
}
TopoDS_Face aF1=TopoDS::Face(myDS->GetShape(nF1));
TopoDS_Face aF2=TopoDS::Face(myDS->GetShape(nF2));
//
- bVF=myContext.IsValidPointForFaces (aP1, aF1, aF2, aTolR3D);
+ bVF=myContext->IsValidPointForFaces (aP1, aF1, aF2, aTolR3D);
//
if (bVF) {
PutBoundPaveOnCurve (aP1, aT1, aBC, aFFi);
}
//
- bVF=myContext.IsValidPointForFaces (aP2, aF1, aF2, aTolR3D);
+ bVF=myContext->IsValidPointForFaces (aP2, aF1, aF2, aTolR3D);
//
if (bVF) {
PutBoundPaveOnCurve (aP2, aT2, aBC, aFFi);
TopoDS_Face aF1=TopoDS::Face(myDS->GetShape(nF1));
TopoDS_Face aF2=TopoDS::Face(myDS->GetShape(nF2));
//
- bVF=myContext.IsValidPointForFaces (aP1, aF1, aF2, aTolR3D);
+ bVF=myContext->IsValidPointForFaces (aP1, aF1, aF2, aTolR3D);
//
if (bVF) {
PutBoundPaveOnCurveSpec (aP1, aT1, aBC, aFFi);
}
//
- bVF=myContext.IsValidPointForFaces (aP2, aF1, aF2, aTolR3D);
+ bVF=myContext->IsValidPointForFaces (aP2, aF1, aF2, aTolR3D);
//
if (bVF) {
PutBoundPaveOnCurveSpec (aP2, aT2, aBC, aFFi);
if(!aMap.Add(anE)) continue;
anErrStat =
- myContext.ComputeVE(aNewVertex, TopoDS::Edge(anE), aPar);
+ myContext->ComputeVE(aNewVertex, TopoDS::Edge(anE), aPar);
if(anErrStat) continue;
//
Standard_Real aT1, aT2;
TopoDS_Vertex aNewVertex1;
BOPTools_Tools::MakeNewVertex(aP1, aTolV, aNewVertex1);
anErrStat =
- myContext.ComputeVE(aNewVertex1, TopoDS::Edge(anE), aT1);
+ myContext->ComputeVE(aNewVertex1, TopoDS::Edge(anE), aT1);
if(!anErrStat) continue; //curve and edge seem to be coincide
aWhat = nV;
if(!aMap.Add(anE)) continue;
anErrStat =
- myContext.ComputeVE(aNewVertex, TopoDS::Edge(anE), aPar);
+ myContext->ComputeVE(aNewVertex, TopoDS::Edge(anE), aPar);
if(anErrStat) continue;
//
Standard_Real aT1, aT2;
TopoDS_Vertex aNewVertex1;
BOPTools_Tools::MakeNewVertex(aP1, aTolV, aNewVertex1);
anErrStat =
- myContext.ComputeVE(aNewVertex1, TopoDS::Edge(anE), aT1);
+ myContext->ComputeVE(aNewVertex1, TopoDS::Edge(anE), aT1);
if(!anErrStat) continue; //curve and edge seem to be coincide
aWhat = nV;
//
aTolVExt=BRep_Tool::Tolerance(aV);
ExtendedTolerance(nV, aTolVExt);
- bIsVertexOnLine=myContext.IsVertexOnLine(aV, aTolVExt, aC, aTolR3D, aT);
+ bIsVertexOnLine=myContext->IsVertexOnLine(aV, aTolVExt, aC, aTolR3D, aT);
//
if (bIsVertexOnLine) {
BOPTools_Pave aPaveNew(nV, aT, BooleanOperations_SurfaceSurface);
}
}
//
- //modified by NIZNHY-PKV Thu Oct 20 07:14:32 2011f
// Put closing pave if needded
for (j=1; j<=aNbCurves; ++j) {
BOPTools_Curve& aBC=aSCvs(j);
PutClosingPaveOnCurve (aBC, aFFi);
}
- //modified by NIZNHY-PKV Thu Oct 20 07:14:34 2011t
//
// xxx
for (j=1; j<=aNbCurves; j++) {
UnUsedMap(aSCvs, aPSF, aMapUnUsed);
aNbVtx=aMapUnUsed.Extent();
if (aNbVtx) {
- IntTools_Context& aCtx=aPF.ChangeContext();
+ const Handle(IntTools_Context)& aCtx=aPF.Context();
//
aNbSCvs=aSCvs.Length();
if (aNbSCvs==1) {
BOPTools_Curve& aBC=aSCvs(1);
const IntTools_Curve& aIC=aBC.Curve();
Handle (Geom_Curve) aC3D= aIC.Curve();
- //modified by NIZNHY-PKV Wed Nov 02 13:33:42 2011f
//
bIsClosed=IntTools_Tools::IsClosed(aC3D);
if (bIsClosed) {
return;
}
- //modified by NIZNHY-PKV Wed Nov 02 13:33:44 2011t
- GeomAPI_ProjectPointOnCurve& aProjPT=aCtx.ProjPT(aC3D);
+ GeomAPI_ProjectPointOnCurve& aProjPT=aCtx->ProjPT(aC3D);
//
for (jx=1; jx<=aNbVtx; ++jx) {
nV=aMapUnUsed(jx);
TopoDS_Face anOtherFace = TopoDS::Face(atmpShape);
gp_Pnt aP3d = aCurve->Value(t2);
- if(myContext.IsPointInOnFace(TopoDS::Face(aFace), aP2dOnFace) &&
- myContext.IsValidPointForFace(aP3d, anOtherFace, BRep_Tool::Tolerance(anEdge))) {
+ if(myContext->IsPointInOnFace(TopoDS::Face(aFace), aP2dOnFace) &&
+ myContext->IsValidPointForFace(aP3d, anOtherFace, BRep_Tool::Tolerance(anEdge))) {
BOPTools_Pave aPave1;
aPave1.SetParam(t1);
aPave1.SetIndex(-1);
TopoDS_Shape aOppFace = myDS->Shape(nFOpposite);
if(!bHasCBOnFace && !bFaceCBFound &&
- myContext.IsValidPointForFace(aPMid, TopoDS::Face(aOppFace),
+ myContext->IsValidPointForFace(aPMid, TopoDS::Face(aOppFace),
BRep_Tool::Tolerance(anEdge) +
BRep_Tool::Tolerance(TopoDS::Face(aOppFace)))) {
bFaceCBFound = Standard_True;
TopoDS_Shape aTmpEdge = anExpE.Current();
Standard_Real aParameter = 0.;
- if(myContext.ComputeVE(aVMid, TopoDS::Edge(aTmpEdge), aParameter) == 0) {
+ if(myContext->ComputeVE(aVMid, TopoDS::Edge(aTmpEdge), aParameter) == 0) {
bEdgeCBFound = Standard_True;
break;
}
Standard_Boolean bAddNewVertextmp = bAddNewVertex, bAddOldVertextmp = bAddOldVertex;
if(!CheckNewVertexAndUpdateData(aNewVertex, aPaveOnEdge.Param(), anEdge, aPaveOnCurve.Param(),
- nF1, nF2, theTolerance, myIntrPool, myDS, &myContext, aPS,
+ nF1, nF2, theTolerance, myIntrPool, myDS, myContext, aPS,
bAddNewVertextmp, bAddOldVertextmp, theBC, aPaveToPut,
bAddNewVertex, bAddOldVertex)) {
bAddNewVertex = Standard_False;
TopoDS_Edge anOppEdge = TopoDS::Edge(myDS->Shape(anOppIndex));
Standard_Real aOppParameter = 0.;
- if(myContext.ComputeVE(aNewVertex, anOppEdge, aOppParameter) == 0) {
+ if(myContext->ComputeVE(aNewVertex, anOppEdge, aOppParameter) == 0) {
if((aOppParameter > aRange.First()) && (aOppParameter < aRange.Last())) {
// put pave on same domain edge. begin
BRep_Builder aBB;
aBB.MakeVertex(aTestpVertex, aMidPnt, BRep_Tool::Tolerance(anEdge));
- if(myContext.ComputeVE(aTestpVertex, aOppEdge, aProjPar) == 0) {
+ if(myContext->ComputeVE(aTestpVertex, aOppEdge, aProjPar) == 0) {
if(aProjPar > aCurRange2.First() && aProjPar < aCurRange2.Last()) {
if(!bReverse)
aNewCB.SetPaveBlock2(aPBCurrent2);
const Standard_Real theTolerance,
const BOPTools_PInterferencePool& theIntrPool,
const BooleanOperations_PShapesDataStructure& theDS,
- IntTools_Context* theContext,
+ const Handle(IntTools_Context)& theContext,
const BOPTools_PaveSet& theEdgePaveSet,
const Standard_Boolean bAddNewVertex,
const Standard_Boolean bAddOldVertex,
Standard_Boolean bUpdateVertex = Standard_True;
if(ptest1.Distance(ptest2) > (BRep_Tool::Tolerance(aVertex) + BRep_Tool::Tolerance(theEdge))) {
- IntTools_ShrunkRange aSR (theEdge, aV1, aV2, aRange, *theContext);
+ IntTools_ShrunkRange aSR (theEdge, aV1, aV2, aRange, theContext);
bUpdateVertex = !aSR.IsDone() || (aSR.ErrorStatus() != 0);
}
aC->D0(p1,pntf);
aC->D0(p2,pntl);
//
- //modified by NIZNHY-PKV Thu Oct 20 09:13:45 2011f
- //
aRT2=theRT*theRT;
d3d2 = pntf.SquareDistance(pntl);
if(d3d2 > aRT2) {
theRT=sqrt(d3d2);
}
- //
- /*
- Standard_Real d3d = pntf.Distance(pntl);
- if(d3d > theRT) {
- theRT = d3d;
- }
- */
- //modified by NIZNHY-PKV Thu Oct 20 09:15:20 2011t
}
return Standard_True;
}
TopoDS_Face aF[2];
//
BooleanOperations_PShapesDataStructure myDS=aPF.DS();
- IntTools_Context& myContext=aPF.ChangeContext();
+ const Handle(IntTools_Context)& myContext=aPF.Context();
//
aTolTresh=0.0005;
aAmin=0.012;// 0.7-7 deg
aC3D->D0(aT, aP);
//
for (i=0; i<2; ++i) {
- GeomAPI_ProjectPointOnSurf& aPPS=myContext.ProjPS(aF[i]);
+ GeomAPI_ProjectPointOnSurf& aPPS=myContext->ProjPS(aF[i]);
aPPS.Perform(aP);
aPPS.LowerDistanceParameters(aU, aV);
BOPTools_Tools3D::GetNormalToSurface(aS[i], aU, aV, aDN[i]);
aTolR3D=aTolR;
}
}
-//modified by NIZNHY-PKV Thu Oct 20 07:18:39 2011f
//=======================================================================
// function: PutClosingPaveOnCurve
// purpose:
}
}
}
-//modified by NIZNHY-PKV Thu Oct 20 07:18:42 2011t
gp_Pnt aP3d = aSurf->Value(aParU, aParV);
const TopoDS_Solid &aRefSolid = TopoDS::Solid(aRef);
- IntTools_Context &aContext = myFiller->ChangeContext();
- BRepClass3d_SolidClassifier &aSC =
- aContext.SolidClassifier(aRefSolid);
- //
+ const Handle(IntTools_Context)& aContext = myFiller->Context();
+ BRepClass3d_SolidClassifier &aSC =
+ aContext->SolidClassifier(aRefSolid);
+ //
aSC.Perform(aP3d, 1e-7);
- //
+ //
aSt = aSC.State();
}
}
}
//
const TopoDS_Solid& aRefSolid=TopoDS::Solid(Ref);
- IntTools_Context& aContext=myFiller->ChangeContext();
- BRepClass3d_SolidClassifier& aSC=aContext.SolidClassifier(aRefSolid);
+ const Handle(IntTools_Context)& aContext=myFiller->Context();
+ BRepClass3d_SolidClassifier& aSC=aContext->SolidClassifier(aRefSolid);
//
aSC.Perform(aP3d, 1e-7);
//
IsBlockInOnFace(myclass;
aPB : PaveBlock from BOPTools;
aF : Face from TopoDS;
- aContext:out Context from IntTools)
+ aContext: Context from IntTools)
returns Boolean from Standard;
---Purpose:
--- Returns TRUE if PaveBlock <aPB> lays on the face <aF>, i.e
//=======================================================================
Standard_Boolean BOPTools_Tools::IsBlockInOnFace (const BOPTools_PaveBlock& aPB1,
const TopoDS_Face& aF,
- IntTools_Context& aContext)
+ const Handle(IntTools_Context)& aContext)
{
Standard_Boolean bFlag;
Standard_Real f1, l1, ULD, VLD;
// Treatment P11
BOPTools_Tools::PointOnEdge(aE1, f1, aP11);
//
- GeomAPI_ProjectPointOnSurf& aProjector=aContext.ProjPS(aF);
+ GeomAPI_ProjectPointOnSurf& aProjector=aContext->ProjPS(aF);
aProjector.Perform(aP11);
//
bFlag=aProjector.IsDone();
aProjector.LowerDistanceParameters(ULD, VLD);
aP2D.SetCoord(ULD, VLD);
//
- bFlag=aContext.IsPointInOnFace (aF, aP2D);
+ bFlag=aContext->IsPointInOnFace (aF, aP2D);
//
if (!bFlag) {
return bFlag;
aProjector.LowerDistanceParameters(ULD, VLD);
aP2D.SetCoord(ULD, VLD);
//
- bFlag=aContext.IsPointInOnFace (aF, aP2D);
+ bFlag=aContext->IsPointInOnFace (aF, aP2D);
//
if (!bFlag) {
return bFlag;
aProjector.LowerDistanceParameters(ULD, VLD);
aP2D.SetCoord(ULD, VLD);
//
- bFlag=aContext.IsPointInOnFace (aF, aP2D);
+ bFlag=aContext->IsPointInOnFace (aF, aP2D);
//
if (!bFlag) {
return bFlag;
RemoveSims (myclass;
aF: Face from TopoDS;
- aContext:out Context from IntTools);
+ aContext: Context from IntTools);
---Purpose:
-- Remove seam edges from face <aF>
--
RemoveSims (myclass;
aS: Shape from TopoDS;
- aContext:out Context from IntTools);
+ aContext: Context from IntTools);
---Purpose:
-- Remove seam edges from all faces of shape <aS>
--
IsSplitToReverse1 (myclass;
aE1: Edge from TopoDS;
aE2: Edge from TopoDS;
- aContext:out Context from IntTools)
+ aContext: Context from IntTools)
returns Boolean from Standard;
---Purpose:
-- Returns TRUE if direction of the edge <aE1> is not
aE1 : Edge from TopoDS;
aF1 : Face from TopoDS;
aST1:out State from TopAbs;
- aContext:out Context from IntTools);
+ aContext: Context from IntTools);
---Purpose:
--- Internal usage
---
aP2: Pnt from gp;
aF: Face from TopoDS;
aPx:out Pnt from gp;
- aContext:out Context from IntTools);
+ aContext: Context from IntTools);
---Purpose:
--- For 3D-point <aP1> find projection point <aPx> on the face <aF>.
--- If the distance (<aP1>, <aPx>) > TolF =>
aF1 : Face from TopoDS;
aF2 : Face from TopoDS;
aST:out State from TopAbs;
- aContext:out Context from IntTools);
+ aContext: Context from IntTools);
---Purpose:
--- Compute 3D-state for the point on the split edge <aSp>
--- (with base edge <aE1> and the face <aF1>) comparing with
aEF1 :Edge from TopoDS;
aF1 :Face from TopoDS;
aF2 :Face from TopoDS;
- aContext:out Context from IntTools)
+ aContext: Context from IntTools)
returns State from TopAbs;
---Purpose:
--- Used in touch case
---
CheckSameDomainFaceInside(myclass; theFace1: Face from TopoDS;
theFace2: Face from TopoDS;
- theContext: in out Context from IntTools)
+ theContext: Context from IntTools)
returns Boolean from Standard;
ComputeFaceState(myclass; theFace: Face from TopoDS;
theRef : Solid from TopoDS;
- theContext: in out Context from IntTools;
+ theContext: Context from IntTools;
theState: out State from TopAbs)
returns Boolean from Standard;
aTolTangent:Real from Standard;
aTolRadius :Real from Standard;
aState :out State from TopAbs;
- aContext:out Context from IntTools)
+ aContext: Context from IntTools)
returns Boolean from Standard;
TreatedAsAnalytic (myclass; aFx :Face from TopoDS;
aTolTangent:Real from Standard;
aTolRadius :Real from Standard;
aState :out State from TopAbs;
- aContext:out Context from IntTools)
+ aContext: Context from IntTools)
returns Boolean from Standard;
HasAnalyticSurfaceType (myclass; aF: Face from TopoDS)
//purpose :
//=======================================================================
void BOPTools_Tools3D::RemoveSims (const TopoDS_Shape& aS,
- IntTools_Context& aContext)
+ const Handle(IntTools_Context)& aContext)
{
TopExp_Explorer anExp(aS, TopAbs_FACE);
for (; anExp.More(); anExp.Next()) {
//purpose :
//=======================================================================
void BOPTools_Tools3D::RemoveSims (const TopoDS_Face& aFF,
- IntTools_Context& aContext)
+ const Handle(IntTools_Context)& aContext)
{
Standard_Boolean anIsClosed, anIsPointInFace1, anIsPointInFace2;
Standard_Real aT1, aT2, aT, aX, aY, dt=1.e-7, aTol;
aP2Dx.SetX(aP2D.X()+dt*aV2Dx.X());
aP2Dx.SetY(aP2D.Y()+dt*aV2Dx.Y());
//
- anIsPointInFace1=aContext.IsPointInFace(aF, aP2Dx);
+ anIsPointInFace1=aContext->IsPointInFace(aF, aP2Dx);
//
aP2Dx.SetX(aP2D.X()-dt*aV2Dx.X());
aP2Dx.SetY(aP2D.Y()-dt*aV2Dx.Y());
//
- anIsPointInFace2=aContext.IsPointInFace(aF, aP2Dx);
+ anIsPointInFace2=aContext->IsPointInFace(aF, aP2Dx);
//
if (anIsPointInFace1 && anIsPointInFace2) {
//=======================================================================
Standard_Boolean BOPTools_Tools3D::IsSplitToReverse1 (const TopoDS_Edge& aEF1,
const TopoDS_Edge& aEF2,
- IntTools_Context& aContext)
+ const Handle(IntTools_Context)& aContext)
{
Standard_Boolean aFlag;
Standard_Real aT1, aT2, aScPr, a, b;
gp_Dir aDT1(aV1);
//
- aFlag=aContext.ProjectPointOnEdge(aP, aEF2, aT2);
+ aFlag=aContext->ProjectPointOnEdge(aP, aEF2, aT2);
//
aFlag=BOPTools_Tools2D::EdgeTangent(aEF2, aT2, aV2);
if(!aFlag) {
const TopoDS_Edge& anE1,
const TopoDS_Face& aF1,
TopAbs_State& aStPF1,
- IntTools_Context& aContext)
+ const Handle(IntTools_Context)& aContext)
{
Standard_Boolean bIsAdjExists;
BOPTools_Tools3D::GetApproxNormalToFaceOnEdge (aSpxSimm, aFx1, aT, aPx2, aDNFx2);
}
- aContext.ProjectPointOnEdge(aPx, anE1, aT1);
+ aContext->ProjectPointOnEdge(aPx, anE1, aT1);
PointNearE (anE1, aF1, aT1, aPF1, aMoreShift);
}
else {// if (bIsAdjExists)
BOPTools_Tools3D::GetApproxNormalToFaceOnEdge (aSpxSimm, aFx2, aT, aPx2, aDNFx2);
//
- aContext.ProjectPointOnEdge(aPx, anE1, aT1);
+ aContext->ProjectPointOnEdge(aPx, anE1, aT1);
PointNearE (anE1, aF1, aT1, aPF1, aMoreShift);
}
const gp_Pnt& aP2,
const TopoDS_Face& aF,
gp_Pnt& aPF,
- IntTools_Context& aContext)
+ const Handle(IntTools_Context)& aContext)
{
Standard_Boolean bFlag;
Standard_Real aD, aTolF, U, V;
aTolF=BRep_Tool::Tolerance(aF);
//
- GeomAPI_ProjectPointOnSurf& aProjector=aContext.ProjPS(aF);
+ GeomAPI_ProjectPointOnSurf& aProjector=aContext->ProjPS(aF);
//
aProjector.Perform(aP1);
//
const TopoDS_Face& aF1,
const TopoDS_Face& aF2,
TopAbs_State& aStPF,
- IntTools_Context& aContext)
+ const Handle(IntTools_Context)& aContext)
{
Standard_Real aT1, aT2, aT, aTolF2, aDt2D;
gp_Pnt2d aPx2DNear;
//
//-- EJG
- Standard_Boolean isIn = aContext.IsPointInFace(aF1,aPx2DNear);
+ Standard_Boolean isIn = aContext->IsPointInFace(aF1,aPx2DNear);
if( !isIn ) {
Standard_Real aEF1Tol = BRep_Tool::Tolerance(aEF1);
Standard_Real aF1Tol = BRep_Tool::Tolerance(aF1);
Standard_Boolean bFlag;
Standard_Real aD, U, V;
//
- GeomAPI_ProjectPointOnSurf& aProjector=aContext.ProjPS(aF2);
+ GeomAPI_ProjectPointOnSurf& aProjector=aContext->ProjPS(aF2);
//
Handle(Geom_Surface) aS2=BRep_Tool::Surface(aF2);
//
const TopoDS_Edge& aEF1,
const TopoDS_Face& aF1,
const TopoDS_Face& aF2,
- IntTools_Context& aContext)
+ const Handle(IntTools_Context)& aContext)
{
gp_Dir aDBF1, aDNF2;
TopAbs_State aStPF;
// ===========================================================================================
Standard_Boolean BOPTools_Tools3D::ComputeFaceState(const TopoDS_Face& theFace,
const TopoDS_Solid& theRef,
- IntTools_Context& theContext,
+ const Handle(IntTools_Context)& theContext,
TopAbs_State& theState)
{
TopAbs_State aState = TopAbs_ON;
Standard_Real U = umin + adeltau;
Standard_Boolean bFoundValidPoint = Standard_False;
Standard_Boolean bFoundInFacePoint = Standard_False;
- BRepClass3d_SolidClassifier& aSolidClassifier = theContext.SolidClassifier(theRef);
+ BRepClass3d_SolidClassifier& aSolidClassifier = theContext->SolidClassifier(theRef);
Standard_Integer i = 0, j = 0;
for(i = 1; !bFoundValidPoint && (i <= nbpoints); i++, U+=adeltau) {
for(j = 1; !bFoundValidPoint && (j <= nbpoints); j++, V+=adeltav) {
gp_Pnt2d aPoint(U,V);
- if(theContext.IsPointInFace(theFace, aPoint)) {
+ if(theContext->IsPointInFace(theFace, aPoint)) {
bFoundInFacePoint = Standard_True;
gp_Pnt aP3d = aSurface->Value(U, V);
for(j = 1; !bFoundValidPoint && (j <= nbpoints); j++, V+=adeltav) {
gp_Pnt2d aPoint(U,V);
- if(theContext.IsPointInOnFace(theFace, aPoint)) {
+ if(theContext->IsPointInOnFace(theFace, aPoint)) {
bFoundInFacePoint = Standard_True;
gp_Pnt aP3d = aSurface->Value(U, V);
TopoDS_Face aFace2 = aSolidClassifier.Face();
if(!aFace2.IsNull()) {
- GeomAPI_ProjectPointOnSurf& aProjector = theContext.ProjPS(aFace2);
+ GeomAPI_ProjectPointOnSurf& aProjector = theContext->ProjPS(aFace2);
aProjector.Perform(aP3d);
if(aProjector.IsDone()) {
gp_Pnt2d aPoint2(U2, V2);
if(aProjector.LowerDistance() < aTolerance) {
- if(theContext.IsPointInFace(aFace2, aPoint2))
+ if(theContext->IsPointInFace(aFace2, aPoint2))
aState = TopAbs_ON;
}
}
// ===========================================================================================
Standard_Boolean BOPTools_Tools3D::CheckSameDomainFaceInside(const TopoDS_Face& theFace1,
const TopoDS_Face& theFace2,
- IntTools_Context& theContext)
+ const Handle(IntTools_Context)& theContext)
{
Standard_Boolean bFoundON, bPointInFace;
Standard_Integer nbpoints, i, j;
adeltav=(vmax - vmin) / (nbpoints + 1);
bFoundON = Standard_False;
//
- GeomAPI_ProjectPointOnSurf& aProjector = theContext.ProjPS(theFace2);
+ GeomAPI_ProjectPointOnSurf& aProjector = theContext->ProjPS(theFace2);
//
for(i=1; i<=nbpoints; ++i){
U=umin+i*adeltau;
for(j=1; j<=nbpoints; ++j) {
V=vmin+j*adeltav;
aP2D.SetCoord(U,V);
- bPointInFace=theContext.IsPointInFace(theFace1, aP2D);
+ bPointInFace=theContext->IsPointInFace(theFace1, aP2D);
if(bPointInFace) {
aP3D=aS1->Value(U, V);
aProjector.Perform(aP3D);
return Standard_False;
}
//
- bPointInFace=theContext.IsPointInFace(theFace2, aP2D);
+ bPointInFace=theContext->IsPointInFace(theFace2, aP2D);
if (bPointInFace) {
bFoundON = Standard_True;
}
const Standard_Real aTolTangent,
const Standard_Real aTolR,
TopAbs_State& aSt,
- IntTools_Context& )
+ const Handle(IntTools_Context)& )
{
Standard_Boolean bFlag, bIsAnalytic, bIsDirsCoinside;
Standard_Real aT1, aTb, aTe;
const Standard_Real aTolTangent,
const Standard_Real aTolR,
TopAbs_State& aSt,
- IntTools_Context& aContext)
+ const Handle(IntTools_Context)& aContext)
{
Standard_Boolean bFlag, bIsAnalytic, bIsDirsCoinside;
Standard_Real aT1;
}
//
BOPTools_Tools3D::GetNormalToFaceOnEdge(anEx, aFx, aTx, aDNSx);
- aContext.ProjectPointOnEdge(aPx, anE1, aT1);
+ aContext->ProjectPointOnEdge(aPx, anE1, aT1);
BOPTools_Tools3D::GetNormalToFaceOnEdge(anE1, aF1, aT1, aDNS1);
//
bIsDirsCoinside=IntTools_Tools::IsDirsCoinside(aDNSx, aDNS1, aTolTangent);
IntPatch,
IntSurf,
BRepClass3d,
- TColgp
+ TColgp,
+ MMgt
is
class MarkedRangeSet;
---Purpose: auxiliary class for range management
---modified by NIZHNY-MKK Wed Oct 5 18:08:38 2005.BEGIN
class BaseRangeSample;
---Purpose: base class for range index management
class CurveRangeLocalizeData;
class SurfaceRangeLocalizeData;
---modified by NIZHNY-MKK Wed Oct 5 18:08:43 2005.END
class BeanFaceIntersector;
---Purpose: class provides computing ranges of parameters
---
--- 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
---
SequenceOfRoots from IntTools,
MarkedRangeSet from IntTools,
SequenceOfRanges from IntTools,
- PContext from IntTools,
+ Context from IntTools,
ExtCS from Extrema,
ProjectPointOnSurf from GeomAPI,
Edge from TopoDS,
--- optimization purposes
---
- SetContext(me: in out; theContext: PContext from IntTools);
+ SetContext(me: in out;
+ theContext: Context from IntTools);
---Purpose:
- --- Sets the context
+ --- Sets the intersecton context
---
-
+ Context(me)
+ returns Context from IntTools;
+ ---C++: return const &
+ ---Purpose:
+ --- Gets the intersecton context
+ ---
SetBeanParameters(me: in out;theFirstParOnCurve : Real from Standard;
theLastParOnCurve : Real from Standard);
---Purpose:
myProjector : ProjectPointOnSurf from GeomAPI;
myRangeManager : MarkedRangeSet from IntTools;
myDeflection : Real from Standard;
- myContext : PContext from IntTools;
+ myContext : Context from IntTools;
-- results
myResults : SequenceOfRanges from IntTools;
{
myCriteria = Precision::Confusion();
myCurveResolution = Precision::PConfusion();
- myContext = NULL;
+
}
// ==================================================================================
myDeflection(0.01),
myIsDone(Standard_False)
{
- myContext = NULL;
Init(theEdge, theFace);
}
myDeflection(0.01),
myIsDone(Standard_False)
{
- myContext = NULL;
Init(theCurve, theSurface, theBeanTolerance, theFaceTolerance);
}
mySurface = theSurface;
myTrsfSurface = Handle(Geom_Surface)::DownCast(mySurface.Surface().Surface()->Transformed(mySurface.Trsf()));
- myContext = NULL;
}
// ==================================================================================
SetSurfaceParameters(mySurface.FirstUParameter(), mySurface.LastUParameter(),
mySurface.FirstVParameter(), mySurface.LastVParameter());
myResults.Clear();
- myContext = NULL;
}
// ==================================================================================
SetSurfaceParameters(mySurface.FirstUParameter(), mySurface.LastUParameter(),
mySurface.FirstVParameter(), mySurface.LastVParameter());
myResults.Clear();
- myContext = NULL;
}
// ==================================================================================
Init(theCurve, theSurface, theBeanTolerance, theFaceTolerance);
SetBeanParameters(theFirstParOnCurve, theLastParOnCurve);
SetSurfaceParameters(theUMinParameter, theUMaxParameter, theVMinParameter, theVMaxParameter);
- myContext = NULL;
}
// ==================================================================================
// function: SetContext
// purpose:
// ==================================================================================
-void IntTools_BeanFaceIntersector::SetContext(const IntTools_PContext& theContext)
+void IntTools_BeanFaceIntersector::SetContext(const Handle(IntTools_Context)& theContext)
{
myContext = theContext;
}
+// ==================================================================================
+// function: Context
+// purpose:
+// ==================================================================================
+const Handle(IntTools_Context)& IntTools_BeanFaceIntersector::Context()const
+{
+ return myContext;
+}
// ==================================================================================
// function: SetBeanParameters
Standard_Integer aDiscretization = 30; // corresponds to discretization of BSpline usually approximated by 30 points.
Standard_Real aRelativeDeflection = 0.01;
myDeflection = aRelativeDeflection;
-
+ //
+ if (myContext.IsNull()) {
+ myContext=new IntTools_Context;
+ }
+ //
if(myCurve.GetType()==GeomAbs_Line && mySurface.GetType()==GeomAbs_Plane) {
ComputeLinePlane();
return;
{
gp_Pnt aPoint = myCurve.Value(theArg);
- if(myContext == NULL) {
- myProjector.Init(aPoint, myTrsfSurface, myUMinParameter, myUMaxParameter,
- myVMinParameter, myVMaxParameter, 1.e-10);
- if(myProjector.IsDone() && myProjector.NbPoints() > 0) {
- return myProjector.LowerDistance();
- }
- }
- else {
- GeomAPI_ProjectPointOnSurf& aProjector = myContext->ProjPS(mySurface.Face());
- aProjector.Perform(aPoint);
-
- if(aProjector.IsDone() && aProjector.NbPoints() > 0) {
- return aProjector.LowerDistance();
- }
+ GeomAPI_ProjectPointOnSurf& aProjector = myContext->ProjPS(mySurface.Face());
+ aProjector.Perform(aPoint);
+
+ if(aProjector.IsDone() && aProjector.NbPoints() > 0) {
+ return aProjector.LowerDistance();
}
//
Standard_Real aDistance = RealLast();
Standard_Real aDistance = RealLast();
Standard_Boolean projectionfound = Standard_False;
- if(myContext == NULL) {
- myProjector.Init(aPoint, myTrsfSurface, myUMinParameter, myUMaxParameter,
- myVMinParameter, myVMaxParameter, 1.e-10);
-
- if(myProjector.IsDone() && myProjector.NbPoints() > 0) {
- myProjector.LowerDistanceParameters(theUParameter, theVParameter);
- aDistance = myProjector.LowerDistance();
- projectionfound = Standard_True;
- }
- }
- else {
- GeomAPI_ProjectPointOnSurf& aProjector = myContext->ProjPS(mySurface.Face());
- aProjector.Perform(aPoint);
-
- if(aProjector.IsDone() && aProjector.NbPoints() > 0) {
- aProjector.LowerDistanceParameters(theUParameter, theVParameter);
- aDistance = aProjector.LowerDistance();
- projectionfound = Standard_True;
- }
+ GeomAPI_ProjectPointOnSurf& aProjector = myContext->ProjPS(mySurface.Face());
+ aProjector.Perform(aPoint);
+
+ if(aProjector.IsDone() && aProjector.NbPoints() > 0) {
+ aProjector.LowerDistanceParameters(theUParameter, theVParameter);
+ aDistance = aProjector.LowerDistance();
+ projectionfound = Standard_True;
}
-
+
if(!projectionfound) {
//
for(Standard_Integer i = 0; i < 4; i++) {
Standard_Real dMinU = 10. * Precision::PConfusion();
Standard_Real dMinV = dMinU;
IntTools_SurfaceRangeLocalizeData aSurfaceDataInit(3, 3, dMinU, dMinV);
- IntTools_SurfaceRangeLocalizeData& aSurfaceData = (myContext) ? myContext->SurfaceData(mySurface.Face()) : aSurfaceDataInit;
+ IntTools_SurfaceRangeLocalizeData& aSurfaceData = myContext->SurfaceData(mySurface.Face());
aSurfaceData.RemoveRangeOutAll();
aSurfaceData.ClearGrid();
---Copyright: Matra Datavision 2002
-class Context from IntTools
+class Context from IntTools
+ inherits TShared from MMgt
---Purpose:
--- The class is to provide direct access
is
Create
- returns Context from IntTools;
- ---C++: alias "Standard_EXPORT virtual ~IntTools_Context();"
+ returns mutable Context from IntTools;
+ ---C++: alias "Standard_EXPORT virtual ~IntTools_Context();"
---Purpose:
--- Empty constructor
- ---
-
- FClass2d(me: in out;
+
+ FClass2d(me: mutable;
aF: Face from TopoDS)
returns FClass2d from IntTools;
---C++: return &
--- for given face
---
- ProjPS (me: in out;
+ ProjPS (me: mutable;
aF: Face from TopoDS)
returns ProjectPointOnSurf from GeomAPI;
---C++: return &
--- for given face
---
- ProjPC (me: in out;
+ ProjPC (me: mutable;
aE: Edge from TopoDS)
returns ProjectPointOnCurve from GeomAPI;
---C++: return &
--- for given edge
---
- ProjPT (me: in out;
+ ProjPT (me: mutable;
aC: Curve from Geom)
returns ProjectPointOnCurve from GeomAPI;
---C++: return &
--- for given curve
---
- SurfaceData(me: in out;
+ SurfaceData(me: mutable;
aF: Face from TopoDS)
returns SurfaceRangeLocalizeData from IntTools;
---C++: return &
--- for given face
- SolidClassifier(me: in out;
+ SolidClassifier(me: mutable;
aSolid: Solid from TopoDS)
returns SolidClassifier from BRepClass3d;
---C++: return &
--- API Block
---
- ComputeVE (me:out;
+ ComputeVE (me:mutable;
aV : Vertex from TopoDS;
aE : Edge from TopoDS;
aT :out Real from Standard)
--- 3. projection algorithm failed (-3)
---
- --modified by NIZNHY-PKV Tue Feb 2 08:20:43 2010f
- ComputeVE (me:out;
+ ComputeVE (me:mutable;
aV : Vertex from TopoDS;
aE : Edge from TopoDS;
aT :out Real from Standard;
--- vertex tolerance should be modified or not
--- aDist - the value of the distance between the vertex
--- and the edge
- --modified by NIZNHY-PKV Tue Feb 2 08:20:55 2010t
- ComputeVS (me:out;
+ ComputeVS (me:mutable;
aV : Vertex from TopoDS;
aF : Face from TopoDS;
U : out Real from Standard;
--- 3. projection point out or on the boundaries of face (-3)
---
- StatePointFace(me:out;
+ StatePointFace(me:mutable;
aF : Face from TopoDS;
aP2D : Pnt2d from gp)
returns State from TopAbs;
--- relative to face aF
---
- IsPointInFace(me:out;
+ IsPointInFace(me:mutable;
aF : Face from TopoDS;
aP2D : Pnt2d from gp)
returns Boolean from Standard;
--- otherwise returns false
---
- IsPointInOnFace(me:out;
+ IsPointInOnFace(me:mutable;
aF : Face from TopoDS;
aP2D : Pnt2d from gp)
returns Boolean from Standard;
--- inside or on the boundaries of aF
---
- IsValidPointForFace(me:out;
+ IsValidPointForFace(me:mutable ;
aP3D : Pnt from gp;
aF : Face from TopoDS;
aTol : Real from Standard)
--- of the face aF
---
- IsValidPointForFaces(me:out;
+ IsValidPointForFaces(me:mutable;
aP3D : Pnt from gp;
aF1 : Face from TopoDS;
aF2 : Face from TopoDS;
--- for both face aF1 and aF2
---
- IsValidBlockForFace (me:out;
+ IsValidBlockForFace (me:mutable;
aT1 : Real from Standard;
aT2 : Real from Standard;
aIC : Curve from IntTools;
--- parameters aT1 and aT2
---
- IsValidBlockForFaces (me:out;
+ IsValidBlockForFaces (me:mutable;
aT1 : Real from Standard;
aT2 : Real from Standard;
aIC : Curve from IntTools;
--- for both faces aF1 and aF2
---
- IsVertexOnLine(me:out;
+ IsVertexOnLine(me:mutable;
aV : Vertex from TopoDS;
aIC : Curve from IntTools;
aTolC: Real from Standard;
--- returns false (in this case aT isn't significant)
---
- IsVertexOnLine(me:out;
+ IsVertexOnLine(me:mutable;
aV : Vertex from TopoDS;
aTolV: Real from Standard;
aIC : Curve from IntTools;
--- returns false (in this case aT isn't significant)
---
- ProjectPointOnEdge (me:out;
+ ProjectPointOnEdge (me:mutable;
aP : Pnt from gp;
aE : Edge from TopoDS;
aT :out Real from Standard)
//function : ~
//purpose :
//=======================================================================
- IntTools_Context::~IntTools_Context()
+IntTools_Context::~IntTools_Context()
{
Standard_Address anAdr;
Standard_Integer i, aNb;
FClass2d from IntTools,
SequenceOfRoots from IntTools,
SequenceOfCommonPrts from IntTools,
- PContext from IntTools,
- Range from IntTools
+ Context from IntTools,
+ Range from IntTools
+
--raises
is
--- The algorithm processes edge inside these boundaries.
---
- SetContext (me: in out; theContext: PContext from IntTools);
+ SetContext (me: in out;
+ theContext: Context from IntTools);
---Purpose:
- --- Set container of projection algorithms
+ --- Sets the intersecton context
---
-
+
+ Context (me)
+ returns Context from IntTools;
+ ---C++:return const &
+ ---Purpose:
+ --- Gets the intersecton context
+ ---
+
Perform (me:out);
---Purpose:
--- Launches the process
myErrorStatus : Integer from Standard;
--- internal members
- myContext : PContext from IntTools;
+ myContext : Context from IntTools;
myProjectableRanges: SequenceOfRanges from IntTools;
myFClass2d : FClass2d from IntTools;
myFuncArray : CArray1OfReal from IntTools;
myErrorStatus=1;
myParallel=Standard_False;
myPar1=0.;
- myContext = NULL;
+}
+//=======================================================================
+//function : SetContext
+//purpose :
+//=======================================================================
+void IntTools_EdgeFace::SetContext(const Handle(IntTools_Context)& theContext)
+{
+ myContext = theContext;
}
+//=======================================================================
+//function : Context
+//purpose :
+//=======================================================================
+const Handle(IntTools_Context)& IntTools_EdgeFace::Context()const
+{
+ return myContext;
+}
//=======================================================================
//function : SetEdge
//purpose :
//function : IsDone
//purpose :
//=======================================================================
- Standard_Boolean IntTools_EdgeFace::IsDone()const
+Standard_Boolean IntTools_EdgeFace::IsDone()const
{
return myIsDone;
}
//function : ErrorStatus
//purpose :
//=======================================================================
- Standard_Integer IntTools_EdgeFace::ErrorStatus()const
+Standard_Integer IntTools_EdgeFace::ErrorStatus()const
{
return myErrorStatus;
}
//function : CommonParts
//purpose :
//=======================================================================
- const IntTools_SequenceOfCommonPrts& IntTools_EdgeFace::CommonParts() const
+const IntTools_SequenceOfCommonPrts& IntTools_EdgeFace::CommonParts() const
{
return mySeqOfCommonPrts;
}
//function : Range
//purpose :
//=======================================================================
- const IntTools_Range& IntTools_EdgeFace::Range() const
+const IntTools_Range& IntTools_EdgeFace::Range() const
{
return myRange;
}
//function : CheckData
//purpose :
//=======================================================================
- void IntTools_EdgeFace::CheckData()
+void IntTools_EdgeFace::CheckData()
{
if (BRep_Tool::Degenerated(myEdge)) {
myErrorStatus=2;
myErrorStatus=3;
}
}
-
-
//=======================================================================
//function : Prepare
//purpose :
//
Standard_Real ULD, VLD;
- if(myContext == NULL) {
- aProjector.Init(P, GS, Umin, Usup, Vmin, Vsup, myEpsT);
- bFlag=aProjector.IsDone();
-
- if(bFlag) {
- aProjector.LowerDistanceParameters(ULD, VLD);
- }
- }
- else {
- GeomAPI_ProjectPointOnSurf& aLocProj = myContext->ProjPS(myFace);
- aLocProj.Perform(P);
- bFlag = aLocProj.IsDone();
-
- if(bFlag) {
- aLocProj.LowerDistanceParameters(ULD, VLD);
- }
+ GeomAPI_ProjectPointOnSurf& aLocProj = myContext->ProjPS(myFace);
+ aLocProj.Perform(P);
+ bFlag = aLocProj.IsDone();
+
+ if(bFlag) {
+ aLocProj.LowerDistanceParameters(ULD, VLD);
}
//
TopAbs_State aState;
gp_Pnt2d aP2d(ULD, VLD);
- if(myContext == NULL) {
- aState=myFClass2d.Perform(aP2d);
- }
- else {
- aState = myContext->FClass2d(myFace).Perform(aP2d);
- }
+ aState = myContext->FClass2d(myFace).Perform(aP2d);
//
if (aState==TopAbs_IN || aState==TopAbs_ON) {
//
Standard_Boolean bFlag = Standard_False;
- if(myContext == NULL) {
- GeomAPI_ProjectPointOnSurf aProjector;
- aProjector.Init(P, GS, Umin, Usup, Vmin, Vsup, myEpsT);
- bFlag=aProjector.IsDone();
-
- if(bFlag) {
- aD=aProjector.LowerDistance();
- }
- }
- else {
- GeomAPI_ProjectPointOnSurf& aLocProj = myContext->ProjPS(myFace);
- aLocProj.Perform(P);
- bFlag = aLocProj.IsDone();
-
- if(bFlag) {
- aD = aLocProj.LowerDistance();
- }
+ GeomAPI_ProjectPointOnSurf& aLocProj = myContext->ProjPS(myFace);
+ aLocProj.Perform(P);
+ bFlag = aLocProj.IsDone();
+
+ if(bFlag) {
+ aD = aLocProj.LowerDistance();
}
//
return theflag;
}
-//=======================================================================
-//function : SetContext
-//purpose :
-//=======================================================================
- void IntTools_EdgeFace::SetContext(const IntTools_PContext& theContext)
-{
- myContext = theContext;
-}
//=======================================================================
//function : Perform
{
Standard_Integer i, aNb;
IntTools_CommonPrt aCommonPrt;
- //IntTools_Root aRoot; // Wng in Gcc 3.0
- //...
-
- aCommonPrt.SetEdge1(myEdge);
//
+ aCommonPrt.SetEdge1(myEdge);
//
myErrorStatus=0;
CheckData();
- if (myErrorStatus)
+ if (myErrorStatus) {
return;
-
+ }
+ //
+ if (myContext.IsNull()) {
+ myContext=new IntTools_Context;
+ }
+ //
myIsDone = Standard_False;
myC.Initialize(myEdge);
GeomAbs_CurveType aCurveType;
myS.Initialize (myFace,Standard_True);
- if(myContext == NULL) {
+ if(myContext.IsNull()) {
myFClass2d.Init(myFace, 1.e-6);
}
---Purpose: This class provides the intersection of
--- face's underlying surfaces.
-uses
+uses
+ TopolTool from Adaptor3d,
+ HSurface from GeomAdaptor,
+ ListOfPntOn2S from IntSurf ,
+ Intersection from IntPatch,
Face from TopoDS,
SequenceOfCurves from IntTools,
- Intersection from IntPatch,
LineConstructor from IntTools,
- HSurface from GeomAdaptor,
- TopolTool from Adaptor3d,
- SequenceOfPntOn2Faces from IntTools,
- --amv
- ListOfPntOn2S from IntSurf
+ SequenceOfPntOn2Faces from IntTools,
+ Context from IntTools
+
+
raises NotDone from StdFail
is
Create
- returns FaceFace from IntTools;
+ returns FaceFace from IntTools;
---Purpose:
--- Empty constructor.
---
---Purpose:
--- Returns True if faces are tangent
---
- --modified by NIZNHY-PKV Fri Sep 16 07:44:22 2011
PrepareLines3D (me:out;
bToSplit: Boolean from Standard=Standard_True);
- --PrepareLines3D (me:out);
---Purpose:
--- Provides post-processing the result lines.
--- <bToSplit> - the flag.
-- on parts.
-- 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
ComputeTolReached3d(me:out)
is protected;
-
+
+ SetContext(me:out;
+ aContext : Context from IntTools);
+ ---Purpose:
+ --- Sets the intersecton context
+
+ Context(me)
+ returns Context from IntTools;
+ ---C++: return const &
+ ---Purpose:
+ --- Gets the intersecton context
+ ---
fields
myIsDone : Boolean from Standard;
myFace2 : Face from TopoDS;
myPnts : SequenceOfPntOn2Faces from IntTools;
- --amv
- myListOfPnts : ListOfPntOn2S from IntSurf;
+ myListOfPnts : ListOfPntOn2S from IntSurf;
+
+ --modified by NIZNHY-PKV Tue Jan 31 08:27:18 2012f
+ myContext : Context from IntTools;
+ --modified by NIZNHY-PKV Tue Jan 31 08:27:21 2012t
end FaceFace from IntTools;
#include <IntTools_Context.hxx>
#include <IntSurf_ListIteratorOfListOfPntOn2S.hxx>
-//modified by NIZNHY-PKV Mon Dec 26 13:37:52 2011f
static
void RefineVector(gp_Vec2d& aV2D);
-//modified by NIZNHY-PKV Mon Dec 26 13:37:54 2011t
+
static
void DumpWLine(const Handle(IntPatch_WLine)& aWLine);
//
const IntTools_LineConstructor& theLConstructor,
const Standard_Boolean theAvoidLConstructor,
IntPatch_SequenceOfLine& theNewLines,
- Standard_Real& theReachedTol3d);
+ Standard_Real& theReachedTol3d,
+ const Handle(IntTools_Context)& );
static
Standard_Boolean ParameterOutOfBoundary(const Standard_Real theParameter,
const TopoDS_Face& theFace2,
const Standard_Real theOtherParameter,
const Standard_Boolean bIncreasePar,
- Standard_Real& theNewParameter);
+ Standard_Real& theNewParameter,
+ const Handle(IntTools_Context)& );
static
Standard_Boolean IsCurveValid(Handle(Geom2d_Curve)& thePCurve);
const TopoDS_Face& theFace2,
Handle(TColgp_HArray1OfPnt2d)& theResultOnS1,
Handle(TColgp_HArray1OfPnt2d)& theResultOnS2,
- Handle(TColStd_HArray1OfReal)& theResultRadius);
+ Handle(TColStd_HArray1OfReal)& theResultRadius,
+ const Handle(IntTools_Context)& );
static
Standard_Boolean FindPoint(const gp_Pnt2d& theFirstPoint,
Handle(GeomAdaptor_HSurface) theGASurface);
static
-gp_Pnt2d AdjustByNeighbour(const gp_Pnt2d& theaNeighbourPoint,
- const gp_Pnt2d& theOriginalPoint,
- Handle(GeomAdaptor_HSurface) theGASurface);
+ gp_Pnt2d AdjustByNeighbour(const gp_Pnt2d& theaNeighbourPoint,
+ const gp_Pnt2d& theOriginalPoint,
+ Handle(GeomAdaptor_HSurface) theGASurface);
static
-Standard_Boolean ApproxWithPCurves(const gp_Cylinder& theCyl,
- const gp_Sphere& theSph);
+ Standard_Boolean ApproxWithPCurves(const gp_Cylinder& theCyl,
+ const gp_Sphere& theSph);
static void PerformPlanes(const Handle(GeomAdaptor_HSurface)& theS1,
const Handle(GeomAdaptor_HSurface)& theS2,
void ApproxParameters(const Handle(GeomAdaptor_HSurface)& aHS1,
const Handle(GeomAdaptor_HSurface)& aHS2,
Standard_Integer& iDegMin,
+ Standard_Integer& iNbIter,
Standard_Integer& iDegMax);
static
static
Standard_Integer IndexType(const GeomAbs_SurfaceType aType);
+//
+//modified by NIZNHY-PKV Tue Jan 31 08:02:24 2012f
+static
+ Standard_Real MaxSquareDistance (const Standard_Real aT,
+ const Handle(Geom_Curve)& aC3D,
+ const Handle(Geom2d_Curve)& aC2D1,
+ const Handle(Geom2d_Curve)& aC2D2,
+ const Handle(GeomAdaptor_HSurface) myHS1,
+ const Handle(GeomAdaptor_HSurface) myHS2,
+ const TopoDS_Face& aF1,
+ const TopoDS_Face& aF2,
+ const Handle(IntTools_Context)& aCtx);
+//modified by NIZNHY-PKV Tue Jan 31 08:02:28 2012t
//
//=======================================================================
//function :
//purpose :
//=======================================================================
- IntTools_FaceFace::IntTools_FaceFace()
+IntTools_FaceFace::IntTools_FaceFace()
{
myTangentFaces=Standard_False;
//
myTolReached2d=0.;
myTolReached3d=0.;
SetParameters(Standard_True, Standard_True, Standard_True, 1.e-07);
+
+}
+//=======================================================================
+//function : SetContext
+//purpose :
+//=======================================================================
+void IntTools_FaceFace::SetContext(const Handle(IntTools_Context)& aContext)
+{
+ myContext=aContext;
+}
+//=======================================================================
+//function : Context
+//purpose :
+//=======================================================================
+const Handle(IntTools_Context)& IntTools_FaceFace::Context()const
+{
+ return myContext;
}
//=======================================================================
//function : Face1
//purpose :
//=======================================================================
- const TopoDS_Face& IntTools_FaceFace::Face1() const
+const TopoDS_Face& IntTools_FaceFace::Face1() const
{
return myFace1;
}
-
//=======================================================================
//function : Face2
//purpose :
//=======================================================================
- const TopoDS_Face& IntTools_FaceFace::Face2() const
+const TopoDS_Face& IntTools_FaceFace::Face2() const
{
return myFace2;
}
-
//=======================================================================
//function : TangentFaces
//purpose :
//=======================================================================
- Standard_Boolean IntTools_FaceFace::TangentFaces() const
+Standard_Boolean IntTools_FaceFace::TangentFaces() const
{
return myTangentFaces;
}
//function : Points
//purpose :
//=======================================================================
- const IntTools_SequenceOfPntOn2Faces& IntTools_FaceFace::Points() const
+const IntTools_SequenceOfPntOn2Faces& IntTools_FaceFace::Points() const
{
return myPnts;
}
//function : IsDone
//purpose :
//=======================================================================
- Standard_Boolean IntTools_FaceFace::IsDone() const
+Standard_Boolean IntTools_FaceFace::IsDone() const
{
return myIsDone;
}
//function : TolReached3d
//purpose :
//=======================================================================
- Standard_Real IntTools_FaceFace::TolReached3d() const
+Standard_Real IntTools_FaceFace::TolReached3d() const
{
return myTolReached3d;
}
//function : Lines
//purpose : return lines of intersection
//=======================================================================
- const IntTools_SequenceOfCurves& IntTools_FaceFace::Lines() const
+const IntTools_SequenceOfCurves& IntTools_FaceFace::Lines() const
{
- StdFail_NotDone_Raise_if(!myIsDone,
- "IntTools_FaceFace::Lines() => !myIntersector.IsDone()");
+ StdFail_NotDone_Raise_if
+ (!myIsDone,
+ "IntTools_FaceFace::Lines() => !myIntersector.IsDone()");
return mySeqOfCurve;
}
-
//=======================================================================
//function : TolReached2d
//purpose :
//=======================================================================
- Standard_Real IntTools_FaceFace::TolReached2d() const
+Standard_Real IntTools_FaceFace::TolReached2d() const
{
return myTolReached2d;
}
// function: SetParameters
//
// =======================================================================
- void IntTools_FaceFace::SetParameters(const Standard_Boolean ToApproxC3d,
- const Standard_Boolean ToApproxC2dOnS1,
- const Standard_Boolean ToApproxC2dOnS2,
- const Standard_Real ApproximationTolerance)
+void IntTools_FaceFace::SetParameters(const Standard_Boolean ToApproxC3d,
+ const Standard_Boolean ToApproxC2dOnS1,
+ const Standard_Boolean ToApproxC2dOnS2,
+ const Standard_Real ApproximationTolerance)
{
myApprox = ToApproxC3d;
myApprox1 = ToApproxC2dOnS1;
//function : SetList
//purpose :
//=======================================================================
-
void IntTools_FaceFace::SetList(IntSurf_ListOfPntOn2S& aListOfPnts)
{
myListOfPnts = aListOfPnts;
}
-
//=======================================================================
//function : Perform
//purpose : intersect surfaces of the faces
Handle(IntTools_TopolTool) dom1, dom2;
BRepAdaptor_Surface aBAS1, aBAS2;
//
+ if (myContext.IsNull()) {
+ myContext=new IntTools_Context;
+ }
+ //
mySeqOfCurve.Clear();
myTolReached2d=0.;
myTolReached3d=0.;
mySeqOfCurve, myTangentFaces);
myIsDone = Standard_True;
-
- if(myTangentFaces) {
- return;
- }
- //
- NbLinPP = mySeqOfCurve.Length();
- if(NbLinPP == 0) {
- return;
- }
-
- Standard_Real aTolFMax;
- //
- myTolReached3d = 1.e-7;
- //
- aTolFMax=Max(aTolF1, aTolF2);
- //
- if (aTolFMax>myTolReached3d) {
- myTolReached3d=aTolFMax;
- }
- myTolReached2d = myTolReached3d;
- //
- if (bReverse) {
- Handle(Geom2d_Curve) aC2D1, aC2D2;
+
+ if(!myTangentFaces) {
//
- aNbLin=mySeqOfCurve.Length();
- for (i=1; i<=aNbLin; ++i) {
- IntTools_Curve& aIC=mySeqOfCurve(i);
- aC2D1=aIC.FirstCurve2d();
- aC2D2=aIC.SecondCurve2d();
+ NbLinPP = mySeqOfCurve.Length();
+ if(NbLinPP) {
+ Standard_Real aTolFMax;
//
- aIC.SetFirstCurve2d(aC2D2);
- aIC.SetSecondCurve2d(aC2D1);
+ myTolReached3d = 1.e-7;
+ //
+ aTolFMax=Max(aTolF1, aTolF2);
+ //
+ if (aTolFMax>myTolReached3d) {
+ myTolReached3d=aTolFMax;
+ }
+ myTolReached2d = myTolReached3d;
+ //
+ if (bReverse) {
+ Handle(Geom2d_Curve) aC2D1, aC2D2;
+ //
+ aNbLin=mySeqOfCurve.Length();
+ for (i=1; i<=aNbLin; ++i) {
+ IntTools_Curve& aIC=mySeqOfCurve(i);
+ aC2D1=aIC.FirstCurve2d();
+ aC2D2=aIC.SecondCurve2d();
+ //
+ aIC.SetFirstCurve2d(aC2D2);
+ aIC.SetSecondCurve2d(aC2D1);
+ }
+ }
}
}
return;
GeomAbs_SurfaceType aType1, aType2;
//
aNbLin=myIntersector.NbLines();
- //
aType1=myHS1->Surface().GetType();
aType2=myHS2->Surface().GetType();
//
- if (aNbLin==2 &&
- aType1==GeomAbs_Cylinder &&
- aType2==GeomAbs_Cylinder) {
- Handle(IntPatch_Line) aIL1, aIL2;
- IntPatch_IType aTL1, aTL2;
- //
- aIL1=myIntersector.Line(1);
- aIL2=myIntersector.Line(2);
- aTL1=aIL1->ArcType();
- aTL2=aIL2->ArcType();
- if (aTL1==IntPatch_Lin && aTL2==IntPatch_Lin) {
- Standard_Real aD, aDTresh, dTol;
- gp_Lin aL1, aL2;
- //
- dTol=1.e-8;
- aDTresh=1.5e-6;
+ if (aType1==GeomAbs_Cylinder && aType2==GeomAbs_Cylinder) {
+ if (aNbLin==2){
+ Handle(IntPatch_Line) aIL1, aIL2;
+ IntPatch_IType aTL1, aTL2;
//
- aL1=Handle(IntPatch_GLine)::DownCast(aIL1)->Line();
- aL2=Handle(IntPatch_GLine)::DownCast(aIL2)->Line();
- aD=aL1.Distance(aL2);
- aD=0.5*aD;
- if (aD<aDTresh) {
- myTolReached3d=aD+dTol;
+ aIL1=myIntersector.Line(1);
+ aIL2=myIntersector.Line(2);
+ aTL1=aIL1->ArcType();
+ aTL2=aIL2->ArcType();
+ if (aTL1==IntPatch_Lin && aTL2==IntPatch_Lin) {
+ Standard_Real aD, aDTresh, dTol;
+ gp_Lin aL1, aL2;
+ //
+ dTol=1.e-8;
+ aDTresh=1.5e-6;
+ //
+ aL1=Handle(IntPatch_GLine)::DownCast(aIL1)->Line();
+ aL2=Handle(IntPatch_GLine)::DownCast(aIL2)->Line();
+ aD=aL1.Distance(aL2);
+ aD=0.5*aD;
+ if (aD<aDTresh) {
+ 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
- if (aType1==GeomAbs_Plane &&
- aType2==GeomAbs_Plane) {
+ else if (aType1==GeomAbs_Plane && aType2==GeomAbs_Plane) {
Standard_Real aTolF1, aTolF2, aTolFMax, aTolTresh;
//
aTolTresh=1.e-7;
if (aTolFMax>aTolTresh) {
myTolReached3d=aTolFMax;
}
- }
+ }//if (aType1==GeomAbs_Plane && aType2==GeomAbs_Plane) {
//t
//IFV Bug OCC20297
- if((aType1 == GeomAbs_Cylinder && aType2 == GeomAbs_Plane) ||
- (aType2 == GeomAbs_Cylinder && aType1 == GeomAbs_Plane)) {
+ else if((aType1 == GeomAbs_Cylinder && aType2 == GeomAbs_Plane) ||
+ (aType2 == GeomAbs_Cylinder && aType1 == GeomAbs_Plane)) {
if(aNbLin == 1) {
const Handle(IntPatch_Line)& aIL1 = myIntersector.Line(1);
if(aIL1->ArcType() == IntPatch_Circle) {
}
} //aIL1->ArcType() == IntPatch_Circle
} //aNbLin == 1
- } // aType1 == GeomAbs_Cylinder && aType2 == GeomAbs_Plane) ...
+ } // aType1 == GeomAbs_Cylinder && aType2 == GeomAbs_Plane)
//End IFV Bug OCC20297
//
- if ((aType1==GeomAbs_Plane && aType2==GeomAbs_Torus) ||
- (aType2==GeomAbs_Plane && aType1==GeomAbs_Torus)) {
+ else if ((aType1==GeomAbs_Plane && aType2==GeomAbs_Torus) ||
+ (aType2==GeomAbs_Plane && aType1==GeomAbs_Torus)) {
aNbLin=mySeqOfCurve.Length();
if (aNbLin!=1) {
return;
//
const IntTools_Curve& aIC=mySeqOfCurve(1);
const Handle(Geom_Curve)& aC3D=aIC.Curve();
- const Handle(Geom_BSplineCurve)& aBS=Handle(Geom_BSplineCurve)::DownCast(aC3D);
+ const Handle(Geom_BSplineCurve)& aBS=
+ Handle(Geom_BSplineCurve)::DownCast(aC3D);
if (aBS.IsNull()) {
return;
}
}
}// if ((aType1==GeomAbs_Plane && aType2==GeomAbs_Torus) ||
//
- if ((aType1==GeomAbs_SurfaceOfRevolution && aType2==GeomAbs_Cylinder) ||
- (aType2==GeomAbs_SurfaceOfRevolution && aType1==GeomAbs_Cylinder)) {
- Standard_Boolean bIsDone;
+ else if ((aType1==GeomAbs_SurfaceOfRevolution && aType2==GeomAbs_Cylinder) ||
+ (aType2==GeomAbs_SurfaceOfRevolution && aType1==GeomAbs_Cylinder)) {
Standard_Integer i, j, aNbP;
- Standard_Real aT, aT1, aT2, dT, aU1, aV1, aU2, aV2;
- Standard_Real aDSmax, aDS1, aDS2, aDS;
- gp_Pnt2d aP2D1, aP2D2;
- gp_Pnt aP3D, aP3D1, aP3D2;
- IntTools_Context aCtx;
+ Standard_Real aT, aT1, aT2, dT, aD2max, aD2;
//
aNbLin=mySeqOfCurve.Length();
- aDSmax=-1.;
+ aD2max=0.;
aNbP=11;
//
for (i=1; i<=aNbLin; ++i) {
if (aC3D.IsNull()) {
continue;
}
- const Handle(Geom_BSplineCurve)& aBC=Handle(Geom_BSplineCurve)::DownCast(aC3D);
+ const Handle(Geom_BSplineCurve)& aBC=
+ Handle(Geom_BSplineCurve)::DownCast(aC3D);
if (aBC.IsNull()) {
return;
}
aT=aT2;
}
//
- aC3D->D0(aT, aP3D);
- // 1
- if (!aC2D1.IsNull()) {
- aC2D1->D0(aT, aP2D1);
- aP2D1.Coord(aU1, aV1);
- myHS1->D0(aU1, aV1, aP3D1);
- aDS1=aP3D.SquareDistance(aP3D1);
- if (aDS1>aDSmax) {
- aDSmax=aDS1;
- }
- }
- // 2
- if (!aC2D2.IsNull()) {
- aC2D2->D0(aT, aP2D2);
- aP2D2.Coord(aU2, aV2);
- myHS2->D0(aU2, aV2, aP3D2);
- aDS2=aP3D.SquareDistance(aP3D2);
- if (aDS2>aDSmax) {
- aDSmax=aDS2;
- }
- }
- // 3
- GeomAPI_ProjectPointOnSurf& aPPS1=aCtx.ProjPS(myFace1);
- aPPS1.Perform(aP3D);
- bIsDone=aPPS1.IsDone();
- if (bIsDone) {
- aPPS1.LowerDistanceParameters(aU1, aV1);
- myHS1->D0(aU1, aV1, aP3D1);
- aDS1=aP3D.SquareDistance(aP3D1);
- if (aDS1>aDSmax) {
- aDSmax=aDS1;
- }
- }
- // 4
- GeomAPI_ProjectPointOnSurf& aPPS2=aCtx.ProjPS(myFace2);
- aPPS2.Perform(aP3D);
- bIsDone=aPPS2.IsDone();
- if (bIsDone) {
- aPPS2.LowerDistanceParameters(aU2, aV2);
- myHS2->D0(aU2, aV2, aP3D2);
- aDS2=aP3D.SquareDistance(aP3D2);
- if (aDS2>aDSmax) {
- aDSmax=aDS2;
- }
+ aD2=MaxSquareDistance(aT, aC3D, aC2D1, aC2D2,
+ myHS1, myHS2, myFace1, myFace2, myContext);
+ if (aD2>aD2max) {
+ aD2max=aD2;
}
}//for (j=0; j<aNbP; ++j) {
}//for (i=1; i<=aNbLin; ++i) {
//
- aDS=myTolReached3d*myTolReached3d;
- if (aDSmax > aDS) {
- myTolReached3d=sqrt(aDSmax);
+ aD2=myTolReached3d*myTolReached3d;
+ if (aD2max > aD2) {
+ myTolReached3d=sqrt(aD2max);
}
}//if((aType1==GeomAbs_SurfaceOfRevolution ...
}
//
const Handle(IntPatch_WLine)& aWLine=
Handle(IntPatch_WLine)::DownCast(L);
- //
+ //DEBf
+ //DumpWLine(aWLine);
+ //DEBt
anewL = ComputePurgedWLine(aWLine);
if(anewL.IsNull()) {
return;
}
L = anewL;
+ //DEBf
+ /*
+ { const Handle(IntPatch_WLine)& aWLineX=
+ Handle(IntPatch_WLine)::DownCast(L);
+ DumpWLine(aWLineX);
+ }
+ */
+ //DEBt
//
if(!myListOfPnts.IsEmpty()) {
bAvoidLineConstructor = Standard_True;
if(P1.Distance(P2) > aTolDist) {
Standard_Real anewpar = fprm;
- if(ParameterOutOfBoundary(fprm, newc, myFace1, myFace2, lprm, Standard_False, anewpar)) {
+ if(ParameterOutOfBoundary(fprm, newc, myFace1, myFace2, lprm, Standard_False, anewpar, myContext)) {
fprm = anewpar;
}
aSeqFprm.Append(fprm);
if(P1.Distance(P2) > aTolDist) {
Standard_Real anewpar = lprm;
- if(ParameterOutOfBoundary(lprm, newc, myFace1, myFace2, fprm, Standard_True, anewpar)) {
+ if(ParameterOutOfBoundary(lprm, newc, myFace1, myFace2, fprm, Standard_True, anewpar, myContext)) {
lprm = anewpar;
}
aSeqFprm.Append(aNul);
if(reApprox && !rejectSurface)
theapp3d.SetParameters(myTolApprox, tol2d, 4, 8, 0, Standard_False, aParType);
else {
- Standard_Integer iDegMax, iDegMin;
+ Standard_Integer iDegMax, iDegMin, iNbIter;
+ //
+ //modified by NIZNHY-PKV Mon Jan 30 14:19:32 2012f
+ ApproxParameters(myHS1, myHS2, iDegMin, iDegMax, iNbIter);
+ theapp3d.SetParameters(myTolApprox, tol2d, iDegMin, iDegMax, iNbIter, Standard_True, aParType);
//
- ApproxParameters(myHS1, myHS2, iDegMin, iDegMax);
- theapp3d.SetParameters(myTolApprox, tol2d, iDegMin, iDegMax, 0, Standard_True, aParType);
+ // 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
}
}
//
myLConstruct,
bAvoidLineConstructor,
aSeqOfL,
- aReachedTol);
+ aReachedTol,
+ myContext);
if ( bIsDecomposited && ( myTolReached3d < aReachedTol ) )
myTolReached3d = aReachedTol;
}
gp_Vec2d anormvec = aVec;
anormvec.Normalize();
- //modified by NIZNHY-PKV Mon Dec 19 11:46:06 2011f
RefineVector(anormvec);
- //modified by NIZNHY-PKV Mon Dec 19 11:46:10 2011t
Standard_Real adot1 = anormvec.Dot(anOtherVecNormal);
if(fabs(adot1) < Precision::Angular())
( theSurface2->GetType() != GeomAbs_Torus ) )
return Standard_False;
- IntTools_Context aContext;
-
gp_Torus aTor1 = theSurface1->Torus();
gp_Torus aTor2 = theSurface2->Torus();
const TopoDS_Face& theFace2,
Handle(TColgp_HArray1OfPnt2d)& theResultOnS1,
Handle(TColgp_HArray1OfPnt2d)& theResultOnS2,
- Handle(TColStd_HArray1OfReal)& theResultRadius) {
+ Handle(TColStd_HArray1OfReal)& theResultRadius,
+ const Handle(IntTools_Context)& aContext)
+{
Standard_Integer aResult = 0;
if ( !CheckTangentZonesExist( theSurface1, theSurface2 ) )
return aResult;
- IntTools_Context aContext;
TColgp_SequenceOfPnt2d aSeqResultS1, aSeqResultS2;
TColStd_SequenceOfReal aSeqResultRad;
Standard_Integer surfit = 0;
for ( surfit = 0; surfit < 2; surfit++ ) {
- GeomAPI_ProjectPointOnSurf& aProjector = (surfit == 0) ? aContext.ProjPS(theFace1) : aContext.ProjPS(theFace2);
+ GeomAPI_ProjectPointOnSurf& aProjector =
+ (surfit == 0) ? aContext->ProjPS(theFace1) : aContext->ProjPS(theFace2);
gp_Pnt aP3d = (surfit == 0) ? P1.Value() : P2.Value();
aProjector.Perform(aP3d);
const IntTools_LineConstructor& theLConstructor,
const Standard_Boolean theAvoidLConstructor,
IntPatch_SequenceOfLine& theNewLines,
- Standard_Real& theReachedTol3d) {
+ Standard_Real& theReachedTol3d,
+ const Handle(IntTools_Context)& aContext)
+{
Standard_Boolean bRet, bAvoidLineConstructor;
Standard_Integer aNbPnts, aNbParts;
TColStd_Array1OfListOfInteger anArrayOfLines(1, aNbPnts);
TColStd_Array1OfInteger anArrayOfLineType(1, aNbPnts);
TColStd_ListOfInteger aListOfPointIndex;
- IntTools_Context aContext;
Handle(TColgp_HArray1OfPnt2d) aTanZoneS1;
Handle(TColgp_HArray1OfPnt2d) aTanZoneS2;
Handle(TColStd_HArray1OfReal) aTanZoneRadius;
Standard_Integer aNbZone = ComputeTangentZones( theSurface1, theSurface2, theFace1, theFace2,
- aTanZoneS1, aTanZoneS2, aTanZoneRadius );
+ aTanZoneS1, aTanZoneS2, aTanZoneRadius, aContext);
//
nblines=0;
if(found) {
// check point
Standard_Real aCriteria = BRep_Tool::Tolerance(theFace1) + BRep_Tool::Tolerance(theFace2);
- GeomAPI_ProjectPointOnSurf& aProjector = (surfit == 0) ? aContext.ProjPS(theFace2) : aContext.ProjPS(theFace1);
+ GeomAPI_ProjectPointOnSurf& aProjector =
+ (surfit == 0) ? aContext->ProjPS(theFace2) : aContext->ProjPS(theFace1);
Handle(GeomAdaptor_HSurface) aSurface = (surfit == 0) ? theSurface1 : theSurface2;
Handle(GeomAdaptor_HSurface) aSurfaceOther = (surfit == 0) ? theSurface2 : theSurface1;
foundV = ( foundV < vmin ) ? vmin : foundV;
foundV = ( foundV > vmax ) ? vmax : foundV;
- GeomAPI_ProjectPointOnSurf& aProjector2 = (surfit == 0) ? aContext.ProjPS(theFace1) : aContext.ProjPS(theFace2);
+ GeomAPI_ProjectPointOnSurf& aProjector2 =
+ (surfit == 0) ? aContext->ProjPS(theFace1) : aContext->ProjPS(theFace2);
aP3d = aSurfaceOther->Value(foundU, foundV);
aProjector2.Perform(aP3d);
const TopoDS_Face& theFace2,
const Standard_Real theOtherParameter,
const Standard_Boolean bIncreasePar,
- Standard_Real& theNewParameter) {
+ Standard_Real& theNewParameter,
+ const Handle(IntTools_Context)& aContext)
+{
Standard_Boolean bIsComputed = Standard_False;
theNewParameter = theParameter;
- IntTools_Context aContext;
Standard_Real acurpar = theParameter;
TopAbs_State aState = TopAbs_ON;
Standard_Integer iter = 0;
if(aPrj1.IsDone()) {
aPrj1.LowerDistanceParameters(U, V);
- aState = aContext.StatePointFace(theFace1, gp_Pnt2d(U, V));
+ aState = aContext->StatePointFace(theFace1, gp_Pnt2d(U, V));
}
if(aState != TopAbs_ON) {
if(aPrj2.IsDone()) {
aPrj2.LowerDistanceParameters(U, V);
- aState = aContext.StatePointFace(theFace2, gp_Pnt2d(U, V));
+ aState = aContext->StatePointFace(theFace2, gp_Pnt2d(U, V));
}
}
void ApproxParameters(const Handle(GeomAdaptor_HSurface)& aHS1,
const Handle(GeomAdaptor_HSurface)& aHS2,
Standard_Integer& iDegMin,
- Standard_Integer& iDegMax)
+ Standard_Integer& iDegMax,
+ Standard_Integer& iNbIter)
+
{
GeomAbs_SurfaceType aTS1, aTS2;
//
+ iNbIter=0;
iDegMin=4;
iDegMax=8;
//
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
Standard_Integer i, aNbPnts;
Standard_Real aX, aY, aZ, aU1, aV1, aU2, aV2;
//
+ printf(" *WLine\n");
aNbPnts=aWLine->NbPnts();
for (i=1; i<=aNbPnts; ++i) {
const IntSurf_PntOn2S aPntOn2S=aWLine->Point(i);
aP3D.Coord(aX, aY, aZ);
aPntOn2S.Parameters(aU1, aV1, aU2, aV2);
//
- //printf("point p_%d %lf %lf %lf\n", i, aX, aY, aZ);
- printf("point p_%d %20.15lf %20.15lf %20.15lf %20.15lf %20.15lf %20.15lf %20.15lf\n",
- i, aX, aY, aZ, aU1, aV1, aU2, aV2);
+ printf("point p_%d %lf %lf %lf\n", i, aX, aY, aZ);
+ //printf("point p_%d %20.15lf %20.15lf %20.15lf %20.15lf %20.15lf %20.15lf %20.15lf\n",
+ // i, aX, aY, aZ, aU1, aV1, aU2, aV2);
}
}
-//modified by NIZNHY-PKV Wed Dec 14 12:22:48 2011f
//=======================================================================
//function : RefineVector
//purpose :
}
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
Vertex from TopoDS,
Range from IntTools,
Box from Bnd,
- Context from IntTools,
- PContext from IntTools
+ Context from IntTools
--raises
returns ShrunkRange from IntTools;
---Purpose:
---
-
+ SetContext(me:out;
+ aContext : Context from IntTools);
+ ---Purpose:
+ --- Sets the intersecton context
+ ---
+ Context(me)
+ returns Context from IntTools;
+ ---C++: return const &
+ ---Purpose:
+ --- Gets the intersecton context
+ ---
+
+
SetShrunkRange(me:out; aR:Range from IntTools);
---Purpose:
--- Sets an shrunk range
myRange : Range from IntTools;
myShrunkRange : Range from IntTools;
myBndBox : Box from Bnd;
- myCtx : PContext from IntTools;
- myIsDone : Boolean from Standard;
- myErrorStatus : Integer from Standard;
+ myContext : Context from IntTools;
+ myIsDone : Boolean from Standard;
+ myErrorStatus : Integer from Standard;
end ShrunkRange;
//function : IntTools_ShrunkRange
//purpose :
//=======================================================================
- IntTools_ShrunkRange::IntTools_ShrunkRange ()
+IntTools_ShrunkRange::IntTools_ShrunkRange ()
{
}
//function : IntTools_ShrunkRange
//purpose :
//=======================================================================
- IntTools_ShrunkRange::IntTools_ShrunkRange (const TopoDS_Edge& aE,
+IntTools_ShrunkRange::IntTools_ShrunkRange (const TopoDS_Edge& aE,
const TopoDS_Vertex& aV1,
const TopoDS_Vertex& aV2,
const IntTools_Range& aR,
- const IntTools_Context& aCtx)
+ const Handle(IntTools_Context)& aCtx)
{
myEdge=aE;
myV1=aV1;
myV2=aV2;
myRange=aR;
- myCtx=(IntTools_PContext)&aCtx;
+ myContext=aCtx;
myIsDone=Standard_False;
myErrorStatus=1;
Perform();
}
//=======================================================================
+//function : SetContext
+//purpose :
+//=======================================================================
+void IntTools_ShrunkRange::SetContext(const Handle(IntTools_Context)& aContext)
+{
+ myContext=aContext;
+}
+//=======================================================================
+//function : Context
+//purpose :
+//=======================================================================
+const Handle(IntTools_Context)& IntTools_ShrunkRange::Context()const
+{
+ return myContext;
+}
+//=======================================================================
//function : Edge
//purpose :
//=======================================================================
- const TopoDS_Edge& IntTools_ShrunkRange::Edge() const
+const TopoDS_Edge& IntTools_ShrunkRange::Edge() const
{
return myEdge;
}
//function : ShrunkRange
//purpose :
//=======================================================================
- const IntTools_Range& IntTools_ShrunkRange::ShrunkRange() const
+const IntTools_Range& IntTools_ShrunkRange::ShrunkRange() const
{
return myShrunkRange;
}
//function : BndBox
//purpose :
//=======================================================================
- const Bnd_Box& IntTools_ShrunkRange::BndBox() const
+const Bnd_Box& IntTools_ShrunkRange::BndBox() const
{
return myBndBox;
}
//function : IsDone
//purpose :
//=======================================================================
- Standard_Boolean IntTools_ShrunkRange::IsDone() const
+Standard_Boolean IntTools_ShrunkRange::IsDone() const
{
return myIsDone;
}
//function : ErrorStatus
//purpose :
//=======================================================================
- Standard_Integer IntTools_ShrunkRange::ErrorStatus() const
+Standard_Integer IntTools_ShrunkRange::ErrorStatus() const
{
return myErrorStatus;
}
//function : Perform
//purpose :
//=======================================================================
- void IntTools_ShrunkRange::Perform()
+void IntTools_ShrunkRange::Perform()
{
Standard_Real aCF, aCL, aTolE, aTolV1, aTolV2, t1, t11, t1C, t2, t12, t2C;
Standard_Real aCoeff, dt1, dt2, aR;
GeomAbs_CurveType aCurveType;
Handle(Geom_Curve) aC;
//
+ if (myContext.IsNull()) {
+ myContext=new IntTools_Context;
+ }
+ //
aTolE =BRep_Tool::Tolerance(myEdge);
aTolV1=BRep_Tool::Tolerance(myV1);
aTolV2=BRep_Tool::Tolerance(myV2);
- //xf
- //dt1=aCoeff*(aTolV1+aTolE);
- //dt2=aCoeff*(aTolV2+aTolE);
- //xt
+ //
myRange.Range (t1, t2);
//
BRepAdaptor_Curve aBAC(myEdge);
BRepBuilderAPI_MakeVertex aMV1(aP1L);
const TopoDS_Vertex& aV1L=aMV1.Vertex();
//
- pri=myCtx->ComputeVE (aV1L, myEdge, t1C);
+ pri=myContext->ComputeVE (aV1L, myEdge, t1C);
//
if (pri==-3) {
- //modified by NIZNHY-PKV Tue Apr 6 14:06:29 2010
t1C = t1;
- //myErrorStatus=4;
- //return;
- //modified by NIZNHY-PKV Tue Apr 6 14:06:31 2010
-
}
}
}
BRepBuilderAPI_MakeVertex aMV2(aP2L);
const TopoDS_Vertex& aV2L=aMV2.Vertex();
//
- pri=myCtx->ComputeVE (aV2L, myEdge, t2C);
+ pri=myContext->ComputeVE (aV2L, myEdge, t2C);
//
if (pri==-3) {
- //modified by NIZNHY-PKV Tue Apr 6 14:07:34 2010f
t2C = t2;
- //myErrorStatus=5;
- //return;
- //modified by NIZNHY-PKV Tue Apr 6 14:07:39 2010t
}
}
}