From: jfa Date: Tue, 4 Aug 2009 06:40:29 +0000 (+0000) Subject: Bug 0020422: Partition anomaly. A fix by PKV. X-Git-Tag: V4_1_0_maintainance_FINAL~15 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=3d3f3b5e4f397544567713ae4e5e7f8eec1cc15f;p=modules%2Fgeom.git Bug 0020422: Partition anomaly. A fix by PKV. --- diff --git a/src/GEOMAlgo/GEOMAlgo_Tools3D.cdl b/src/GEOMAlgo/GEOMAlgo_Tools3D.cdl index 0bbc2fc20..fdffee3ad 100755 --- a/src/GEOMAlgo/GEOMAlgo_Tools3D.cdl +++ b/src/GEOMAlgo/GEOMAlgo_Tools3D.cdl @@ -172,7 +172,8 @@ is theFace :Face from TopoDS; theEdge :Edge from TopoDS; theFace1 :Face from TopoDS; - theFace2 :Face from TopoDS) + theFace2 :Face from TopoDS; + theContext:out Context from IntTools) ---Purpose: Returns True if the face theFace is inside of the -- couple of faces theFace1, theFace2. -- The faces theFace, theFace1, theFace2 must @@ -182,7 +183,8 @@ is IsInternalFace(myclass; theFace :Face from TopoDS; theEdge :Edge from TopoDS; - theLF :ListOfShape from TopTools) + theLF :ListOfShape from TopTools; + theContext:out Context from IntTools) ---Purpose: Returns True if the face theFace is inside of the -- appropriate couple of faces (from the set theLF) . -- The faces of the set theLF and theFace must diff --git a/src/GEOMAlgo/GEOMAlgo_Tools3D.cxx b/src/GEOMAlgo/GEOMAlgo_Tools3D.cxx index f990d80f6..a8cf68686 100755 --- a/src/GEOMAlgo/GEOMAlgo_Tools3D.cxx +++ b/src/GEOMAlgo/GEOMAlgo_Tools3D.cxx @@ -98,6 +98,16 @@ static const gp_Dir& , const gp_Dir& ); +//modified by NIZNHY-PKV Tue Jul 14 07:24:10 2009f +static + void GetApproxNormalToFaceOnEdge (const TopoDS_Edge& aE, + const TopoDS_Face& aF, + Standard_Real aT, + gp_Pnt& aPF, + gp_Dir& aDNF, + IntTools_Context& aCtx); +//modified by NIZNHY-PKV Tue Jul 14 07:24:15 2009t + //======================================================================= //function : IsInternalFace //purpose : @@ -132,7 +142,7 @@ static else if (aNbF==1) { // aE is internal edge on aLF.First() const TopoDS_Face& aF1=TopoDS::Face(aLF.First()); - bRet=GEOMAlgo_Tools3D::IsInternalFace(theFace, aE, aF1, aF1); + bRet=GEOMAlgo_Tools3D::IsInternalFace(theFace, aE, aF1, aF1, theContext); return bRet; } else if (aNbF==2) { @@ -141,7 +151,7 @@ static // if (aF2.IsSame(aF1) && BRep_Tool::IsClosed(aE, aF1)) { // treat as it was for 1 face - bRet=GEOMAlgo_Tools3D::IsInternalFace(theFace, aE, aF1, aF2); + bRet=GEOMAlgo_Tools3D::IsInternalFace(theFace, aE, aF1, aF2, theContext); return bRet; } } @@ -149,7 +159,7 @@ static return bRet; // it can not be so } else { // aNbF=2,4,6,8,... - bRet=GEOMAlgo_Tools3D::IsInternalFace(theFace, aE, aLF); + bRet=GEOMAlgo_Tools3D::IsInternalFace(theFace, aE, aLF, theContext); return bRet; } }//for(; aExp.More(); aExp.Next()) { @@ -171,7 +181,8 @@ static //======================================================================= Standard_Boolean GEOMAlgo_Tools3D::IsInternalFace(const TopoDS_Face& theFace, const TopoDS_Edge& theEdge, - const TopTools_ListOfShape& theLF) + const TopTools_ListOfShape& theLF, + IntTools_Context& theContext) { Standard_Boolean bRet; Standard_Boolean aNbF; @@ -182,7 +193,7 @@ static if (aNbF==2) { const TopoDS_Face& aF1=TopoDS::Face(theLF.First()); const TopoDS_Face& aF2=TopoDS::Face(theLF.Last()); - bRet=GEOMAlgo_Tools3D::IsInternalFace(theFace, theEdge, aF1, aF2); + bRet=GEOMAlgo_Tools3D::IsInternalFace(theFace, theEdge, aF1, aF2, theContext); return bRet; } // @@ -198,7 +209,7 @@ static // const TopoDS_Face& aF1=TopoDS::Face(aCSFF.Shape1()); const TopoDS_Face& aF2=TopoDS::Face(aCSFF.Shape2()); - bRet=GEOMAlgo_Tools3D::IsInternalFace(theFace, theEdge, aF1, aF2); + bRet=GEOMAlgo_Tools3D::IsInternalFace(theFace, theEdge, aF1, aF2, theContext); if (bRet) { return bRet; } @@ -211,12 +222,14 @@ static //purpose : //======================================================================= Standard_Boolean GEOMAlgo_Tools3D::IsInternalFace(const TopoDS_Face& theFace, - const TopoDS_Edge& theEdge, - const TopoDS_Face& theFace1, - const TopoDS_Face& theFace2) + const TopoDS_Edge& theEdge, + const TopoDS_Face& theFace1, + const TopoDS_Face& theFace2, + IntTools_Context& theContext) { Standard_Boolean bRet; - Standard_Real aT1, aT2, aT, aDt2D, aDt2Dx;//aD1, aD2, + Standard_Real aT1, aT2, aT, aDt2D, aDt2Dx; + Standard_Real aA12, aA1x, aTwoPI; gp_Pnt aPx, aPF, aPF1, aPF2; gp_Pnt2d aP2D, aPF2D; gp_Dir aDNF1, aDNF2; @@ -251,64 +264,40 @@ static // 3 bRet=Standard_False; // - //modified by NIZNHY-PKV Mon Nov 13 12:12:53 2006f - // - BOPTools_Tools3D::GetApproxNormalToFaceOnEdge (aE1, theFace1, aT, aPF1, aDNF1); - BOPTools_Tools3D::GetApproxNormalToFaceOnEdge (aE2, theFace2, aT, aPF2, aDNF2); - // - { - Standard_Real aA12, aA1x, aTwoPI; - // - aTwoPI=2.*PI; - gp_Vec aVBF (aPx, aPF ); - gp_Vec aVBF1(aPx, aPF1); - gp_Vec aVBF2(aPx, aPF2); - // - gp_Dir aDTF1; - gp_Dir aDBF (aVBF); - gp_Dir aDBF1(aVBF1); - gp_Dir aDBF2(aVBF2); - // - aDTF1=aDNF1^aDBF1; - //aA12=aDBF1.AngleWithRef(aDBF2, aDTF1); - aA12=AngleWithRef(aDBF1, aDBF2, aDTF1); - if (aA12<0.) { - aA12=aA12+aTwoPI; - } - //aA1x=aDBF1.AngleWithRef(aDBF , aDTF1); - aA1x=AngleWithRef(aDBF1, aDBF , aDTF1); - if (aA1x<0.) { - aA1x=aA1x+aTwoPI; - } - // - if (aA1xD0(aT, aPFT); // - aCBMap.Add(aF); + // Normal at aT + BOPTools_Tools3D::GetNormalToFaceOnEdge (aE, aF, aT, aDNFT); + + // Tangent at aT + BOPTools_Tools3D::GetTangentToEdge(aE, aT, aDTT); // - aExp.Init(aF, TopAbs_EDGE); - for (; aExp.More(); aExp.Next()){ - const TopoDS_Shape& aE=aExp.Current(); - if (theMEAvoid.Contains(aE)){ - continue; - } - // - const TopTools_ListOfShape& aLF=aEFMap.FindFromKey(aE); - aIt.Initialize(aLF); - for (; aIt.More(); aIt.Next()) { - const TopoDS_Shape& aF1=aIt.Value(); - if (!aF1.IsSame(aF)) { - Path (aE, aF1, aEFMap, theMEAvoid, aCBMap); - } - } - } + // Binormal at aT + aDBT=aDNFT^aDTT; // - aNbF=aCBMap.Extent(); - for (j=1; j<=aNbF; ++j) { - const TopoDS_Shape& aFx=aCBMap(j); - theLCB.Append(aFx); - } -} -//======================================================================= -// function: Path -// purpose: -//======================================================================= -void Path(const TopoDS_Shape& theE1, - const TopoDS_Shape& theF1, - const TopTools_IndexedDataMapOfShapeListOfShape& theEFMap, - const TopTools_IndexedMapOfShape& theMEAvoid, - TopTools_IndexedMapOfShape& theCBMap) -{ - TopTools_ListIteratorOfListOfShape aIt; - TopExp_Explorer aExp; + dT=BOPTools_Tools3D::MinStepIn2d();//~1.e-5; + aPFx.SetXYZ(aPFT.XYZ()+dT*aDBT.XYZ()); // - if (theCBMap.Contains(theF1)){ - return; + aPF=aPFx; + aDNF=aDNFT; + if (bReverse) { + aDNF.Reverse(); } - theCBMap.Add(theF1); // - aExp.Init(theF1, TopAbs_EDGE); - for (; aExp.More(); aExp.Next()){ - const TopoDS_Shape& aE=aExp.Current(); - if (!aE.IsSame(theE1)){ - if (theMEAvoid.Contains(aE)) { - continue; - } - // - const TopTools_ListOfShape& aLF=theEFMap.FindFromKey(aE); - aIt.Initialize(aLF); - for (; aIt.More(); aIt.Next()) { - const TopoDS_Shape& aF=aIt.Value(); - Path (aE, aF, theEFMap, theMEAvoid, theCBMap); - } + GeomAPI_ProjectPointOnSurf& aProjector=aCtx.ProjPS(aF); + aProjector.Perform(aPFx); + if(aProjector.IsDone()) { + Handle(Geom_Surface) aS; + // + aProjector.LowerDistanceParameters (aU, aV); + aS=BRep_Tool::Surface(aF); + aS->D0(aU, aV, aPF); + BOPTools_Tools3D::GetNormalToSurface (aS, aU, aV, aDNF); + if (bReverse){ + aDNF.Reverse(); } } } -*/ +//modified by NIZNHY-PKV Tue Jul 14 07:49:58 2009t diff --git a/src/GEOMAlgo/GEOMAlgo_Tools3D.hxx b/src/GEOMAlgo/GEOMAlgo_Tools3D.hxx index 42cd68861..50c28b2df 100644 --- a/src/GEOMAlgo/GEOMAlgo_Tools3D.hxx +++ b/src/GEOMAlgo/GEOMAlgo_Tools3D.hxx @@ -154,13 +154,13 @@ Standard_EXPORT static TopAbs_State ComputeState(const TopoDS_Face& theFace,con //! couple of faces theFace1, theFace2.
//! The faces theFace, theFace1, theFace2 must
//! share the edge theEdge
-Standard_EXPORT static Standard_Boolean IsInternalFace(const TopoDS_Face& theFace,const TopoDS_Edge& theEdge,const TopoDS_Face& theFace1,const TopoDS_Face& theFace2) ; +Standard_EXPORT static Standard_Boolean IsInternalFace(const TopoDS_Face& theFace,const TopoDS_Edge& theEdge,const TopoDS_Face& theFace1,const TopoDS_Face& theFace2,IntTools_Context& theContext) ; //! Returns True if the face theFace is inside of the
//! appropriate couple of faces (from the set theLF) .
//! The faces of the set theLF and theFace must
//! share the edge theEdge
-Standard_EXPORT static Standard_Boolean IsInternalFace(const TopoDS_Face& theFace,const TopoDS_Edge& theEdge,const TopTools_ListOfShape& theLF) ; +Standard_EXPORT static Standard_Boolean IsInternalFace(const TopoDS_Face& theFace,const TopoDS_Edge& theEdge,const TopTools_ListOfShape& theLF,IntTools_Context& theContext) ; //! Returns True if the face theFace is inside the
//! solid theSolid.