//
return iRet;
}
-//=======================================================================
-//function :IsSplitToReverse
-//purpose :
-//=======================================================================
-Standard_Boolean GEOMAlgo_AlgoTools::IsSplitToReverse(const TopoDS_Edge& theSplit,
- const TopoDS_Edge& theEdge,
- const Handle(BOPInt_Context)& theContext)
-{
- Standard_Boolean bRet, aFlag, bIsDegenerated;
- Standard_Real aTE, aTS, aScPr, aTa, aTb, aT1, aT2;
- TopAbs_Orientation aOrSr, aOrSp;
- Handle(Geom_Curve) aCEdge, aCSplit;
- gp_Vec aVE, aVS;
- gp_Pnt aP;
- //
- bRet=Standard_False;
- //
- bIsDegenerated=(BRep_Tool::Degenerated(theSplit) ||
- BRep_Tool::Degenerated(theEdge));
- if (bIsDegenerated) {
- return bRet;
- }
- //
- aCEdge =BRep_Tool::Curve(theEdge , aT1, aT2);
- aCSplit=BRep_Tool::Curve(theSplit, aTa, aTb);
- //
- if (aCEdge==aCSplit) {
- aOrSr=theEdge.Orientation();
- aOrSp=theSplit.Orientation();
- bRet=(aOrSr!=aOrSp);
- return bRet;
- }
- //
- aTS=IntTools_Tools::IntermediatePoint(aTa, aTb);
- aCSplit->D0(aTS, aP);
- aFlag=BOPTools_AlgoTools2D::EdgeTangent(theSplit, aTS, aVS);
- gp_Dir aDTS(aVS);
- //
- aFlag=theContext->ProjectPointOnEdge(aP, theEdge, aTE);
- aFlag=BOPTools_AlgoTools2D::EdgeTangent(theEdge, aTE, aVE);
- gp_Dir aDTE(aVE);
- //
- aScPr=aDTS*aDTE;
- bRet=(aScPr<0.);
- //
- return bRet;
-}
-
-//=======================================================================
-//function :IsSplitToReverse
-//purpose :
-//=======================================================================
-Standard_Boolean GEOMAlgo_AlgoTools::IsSplitToReverse
- (const TopoDS_Face& theFSp,
- const TopoDS_Face& theFSr,
- const Handle(BOPInt_Context)& theContext)
-{
- Standard_Boolean bRet, bFound, bInFace;
- Standard_Real aT1, aT2, aT, aU, aV, aScPr;
- gp_Pnt aPFSp, aPFSr;
- gp_Dir aDNFSp;
- gp_Vec aD1U, aD1V;
- Handle(Geom_Surface) aSr, aSp;
- TopAbs_Orientation aOrSr, aOrSp;
- TopExp_Explorer anExp;
- TopoDS_Edge aESp;
- //
- bRet=Standard_False;
- //
- aSr=BRep_Tool::Surface(theFSr);
- aSp=BRep_Tool::Surface(theFSp);
- if (aSr==aSp) {
- aOrSr=theFSr.Orientation();
- aOrSp=theFSp.Orientation();
- bRet=(aOrSr!=aOrSp);
- return bRet;
- }
- //
- bFound=Standard_False;
- anExp.Init(theFSp, TopAbs_EDGE);
- for (; anExp.More(); anExp.Next()) {
- aESp=TopoDS::Edge(anExp.Current());
- if (!BRep_Tool::Degenerated(aESp)) {
- if (!BRep_Tool::IsClosed(aESp, theFSp)) {
- bFound=!bFound;
- break;
- }
- }
- }
- //
- if (!bFound) {
- Standard_Boolean bFlag;
- Standard_Integer iErr;
- gp_Pnt2d aP2DFSp;
- //
- iErr=GEOMAlgo_AlgoTools::PntInFace(theFSp, aPFSp, aP2DFSp);
- if (iErr) {
- return bRet;
- }
- //
- aP2DFSp.Coord(aU, aV);
- bFlag=BOPTools_AlgoTools3D::GetNormalToSurface(aSp, aU, aV, aDNFSp);
- if (!bFlag) {
- return bRet;
- }
- }
- else {
- BRep_Tool::Range(aESp, aT1, aT2);
- aT=IntTools_Tools::IntermediatePoint(aT1, aT2);
- BOPTools_AlgoTools3D::GetApproxNormalToFaceOnEdge(aESp, theFSp, aT, aPFSp, aDNFSp);
- }
- //
- // Parts of theContext.ComputeVS(..)
- GeomAPI_ProjectPointOnSurf& aProjector=theContext->ProjPS(theFSr);
- aProjector.Perform(aPFSp);
- if (!aProjector.IsDone()) {
- return bRet;
- }
- //
- aProjector.LowerDistanceParameters(aU, aV);
- gp_Pnt2d aP2D(aU, aV);
- bInFace=theContext->IsPointInFace (theFSr, aP2D);
- if (!bInFace) {
- return bRet;
- }
- //
- aSr->D1(aU, aV, aPFSr, aD1U, aD1V);
- gp_Dir aDD1U(aD1U);
- gp_Dir aDD1V(aD1V);
- gp_Dir aDNFSr=aDD1U^aDD1V;
- if (theFSr.Orientation()==TopAbs_REVERSED){
- aDNFSr.Reverse();
- }
- //
- aScPr=aDNFSp*aDNFSr;
- bRet=(aScPr<0.);
- //
- return bRet;
-}
-//=======================================================================
-// function: IsSplitToReverse
-// purpose:
-//=======================================================================
-Standard_Boolean GEOMAlgo_AlgoTools::IsSplitToReverse
- (const TopoDS_Shape& theSp,
- const TopoDS_Shape& theSr,
- const Handle(BOPInt_Context)& theCtx)
-{
- Standard_Boolean bRet;
- TopAbs_ShapeEnum aType;
- //
- bRet=Standard_False;
- //
- aType=theSp.ShapeType();
- switch (aType) {
- case TopAbs_EDGE: {
- const TopoDS_Edge& aESp=TopoDS::Edge(theSp);
- const TopoDS_Edge& aESr=TopoDS::Edge(theSr);
- bRet=GEOMAlgo_AlgoTools::IsSplitToReverse(aESp, aESr, theCtx);
- }
- break;
- //
- case TopAbs_FACE: {
- const TopoDS_Face& aFSp=TopoDS::Face(theSp);
- const TopoDS_Face& aFSr=TopoDS::Face(theSr);
- bRet=GEOMAlgo_AlgoTools::IsSplitToReverse(aFSp, aFSr, theCtx);
- }
- break;
- //
- default:
- break;
- }
- return bRet;
-}
//////////////////////////////////////////////////////////////////////////
//=======================================================================
// function: MakeContainer
}
}
//=======================================================================
-//function :IsSplitToReverse1
+//function :IsSplitToReverse
//purpose :
//=======================================================================
-Standard_Boolean GEOMAlgo_AlgoTools::IsSplitToReverse1
+Standard_Boolean GEOMAlgo_AlgoTools::IsSplitToReverse
(const TopoDS_Edge& aEF1,
const TopoDS_Edge& aEF2,
const Handle(BOPInt_Context)& aContext)