Bug 0020422: Partition anomaly.

This commit is contained in:
jfa 2009-08-03 11:59:04 +00:00
parent 2f3fe5a3bf
commit c2ed58c9b8
3 changed files with 113 additions and 153 deletions

View File

@ -172,7 +172,8 @@ is
theFace :Face from TopoDS; theFace :Face from TopoDS;
theEdge :Edge from TopoDS; theEdge :Edge from TopoDS;
theFace1 :Face 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 ---Purpose: Returns True if the face theFace is inside of the
-- couple of faces theFace1, theFace2. -- couple of faces theFace1, theFace2.
-- The faces theFace, theFace1, theFace2 must -- The faces theFace, theFace1, theFace2 must
@ -182,7 +183,8 @@ is
IsInternalFace(myclass; IsInternalFace(myclass;
theFace :Face from TopoDS; theFace :Face from TopoDS;
theEdge :Edge 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 ---Purpose: Returns True if the face theFace is inside of the
-- appropriate couple of faces (from the set theLF) . -- appropriate couple of faces (from the set theLF) .
-- The faces of the set theLF and theFace must -- The faces of the set theLF and theFace must

View File

@ -98,6 +98,16 @@ static
const gp_Dir& , const gp_Dir& ,
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 //function : IsInternalFace
//purpose : //purpose :
@ -132,7 +142,7 @@ static
else if (aNbF==1) { else if (aNbF==1) {
// aE is internal edge on aLF.First() // aE is internal edge on aLF.First()
const TopoDS_Face& aF1=TopoDS::Face(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; return bRet;
} }
else if (aNbF==2) { else if (aNbF==2) {
@ -141,7 +151,7 @@ static
// //
if (aF2.IsSame(aF1) && BRep_Tool::IsClosed(aE, aF1)) { if (aF2.IsSame(aF1) && BRep_Tool::IsClosed(aE, aF1)) {
// treat as it was for 1 face // 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; return bRet;
} }
} }
@ -149,7 +159,7 @@ static
return bRet; // it can not be so return bRet; // it can not be so
} }
else { // aNbF=2,4,6,8,... else { // aNbF=2,4,6,8,...
bRet=GEOMAlgo_Tools3D::IsInternalFace(theFace, aE, aLF); bRet=GEOMAlgo_Tools3D::IsInternalFace(theFace, aE, aLF, theContext);
return bRet; return bRet;
} }
}//for(; aExp.More(); aExp.Next()) { }//for(; aExp.More(); aExp.Next()) {
@ -171,7 +181,8 @@ static
//======================================================================= //=======================================================================
Standard_Boolean GEOMAlgo_Tools3D::IsInternalFace(const TopoDS_Face& theFace, Standard_Boolean GEOMAlgo_Tools3D::IsInternalFace(const TopoDS_Face& theFace,
const TopoDS_Edge& theEdge, const TopoDS_Edge& theEdge,
const TopTools_ListOfShape& theLF) const TopTools_ListOfShape& theLF,
IntTools_Context& theContext)
{ {
Standard_Boolean bRet; Standard_Boolean bRet;
Standard_Boolean aNbF; Standard_Boolean aNbF;
@ -182,7 +193,7 @@ static
if (aNbF==2) { if (aNbF==2) {
const TopoDS_Face& aF1=TopoDS::Face(theLF.First()); const TopoDS_Face& aF1=TopoDS::Face(theLF.First());
const TopoDS_Face& aF2=TopoDS::Face(theLF.Last()); 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; return bRet;
} }
// //
@ -198,7 +209,7 @@ static
// //
const TopoDS_Face& aF1=TopoDS::Face(aCSFF.Shape1()); const TopoDS_Face& aF1=TopoDS::Face(aCSFF.Shape1());
const TopoDS_Face& aF2=TopoDS::Face(aCSFF.Shape2()); 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) { if (bRet) {
return bRet; return bRet;
} }
@ -211,12 +222,14 @@ static
//purpose : //purpose :
//======================================================================= //=======================================================================
Standard_Boolean GEOMAlgo_Tools3D::IsInternalFace(const TopoDS_Face& theFace, Standard_Boolean GEOMAlgo_Tools3D::IsInternalFace(const TopoDS_Face& theFace,
const TopoDS_Edge& theEdge, const TopoDS_Edge& theEdge,
const TopoDS_Face& theFace1, const TopoDS_Face& theFace1,
const TopoDS_Face& theFace2) const TopoDS_Face& theFace2,
IntTools_Context& theContext)
{ {
Standard_Boolean bRet; 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_Pnt aPx, aPF, aPF1, aPF2;
gp_Pnt2d aP2D, aPF2D; gp_Pnt2d aP2D, aPF2D;
gp_Dir aDNF1, aDNF2; gp_Dir aDNF1, aDNF2;
@ -251,64 +264,40 @@ static
// 3 // 3
bRet=Standard_False; bRet=Standard_False;
// //
//modified by NIZNHY-PKV Mon Nov 13 12:12:53 2006f //modified by NIZNHY-PKV Tue Jul 14 07:22:38 2009f
GetApproxNormalToFaceOnEdge (aE1, theFace1, aT, aPF1, aDNF1, theContext);
GetApproxNormalToFaceOnEdge (aE2, theFace2, aT, aPF2, aDNF2, theContext);
//BOPTools_Tools3D::GetApproxNormalToFaceOnEdge (aE1, theFace1, aT, aPF1, aDNF1);
//BOPTools_Tools3D::GetApproxNormalToFaceOnEdge (aE2, theFace2, aT, aPF2, aDNF2);
//modified by NIZNHY-PKV Tue Jul 14 07:22:42 2009t
// //
BOPTools_Tools3D::GetApproxNormalToFaceOnEdge (aE1, theFace1, aT, aPF1, aDNF1); aTwoPI=2.*PI;
BOPTools_Tools3D::GetApproxNormalToFaceOnEdge (aE2, theFace2, aT, aPF2, aDNF2); gp_Vec aVBF (aPx, aPF );
gp_Vec aVBF1(aPx, aPF1);
gp_Vec aVBF2(aPx, aPF2);
// //
{ gp_Dir aDTF1;
Standard_Real aA12, aA1x, aTwoPI; gp_Dir aDBF (aVBF);
// gp_Dir aDBF1(aVBF1);
aTwoPI=2.*PI; gp_Dir aDBF2(aVBF2);
gp_Vec aVBF (aPx, aPF ); //
gp_Vec aVBF1(aPx, aPF1); aDTF1=aDNF1^aDBF1;
gp_Vec aVBF2(aPx, aPF2); aA12=AngleWithRef(aDBF1, aDBF2, aDTF1);
// if (aA12<0.) {
gp_Dir aDTF1; aA12=aA12+aTwoPI;
gp_Dir aDBF (aVBF); }
gp_Dir aDBF1(aVBF1);
gp_Dir aDBF2(aVBF2); aA1x=AngleWithRef(aDBF1, aDBF , aDTF1);
// if (aA1x<0.) {
aDTF1=aDNF1^aDBF1; aA1x=aA1x+aTwoPI;
//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 (aA1x<aA12) {
bRet=!bRet; //TopAbs_IN;
}
} }
// //
/* if (aA1x<aA12) {
{ bRet=!bRet; //TopAbs_IN;
Standard_Real aD1, aD2;
//
//BOPTools_Tools3D::GetApproxNormalToFaceOnEdge (aE1, theFace1, aT, aPF1, aDNF1);
gp_Pln aPlnF1(aPx, aDNF1);
//
aD1=BOPTools_Tools3D::SignDistance(aPF, aPlnF1);
if (aD1<=0.) {
//BOPTools_Tools3D::GetApproxNormalToFaceOnEdge (aE2, theFace2, aT, aPF2, aDNF2);
gp_Pln aPlnF2(aPx, aDNF2);
//
aD2=BOPTools_Tools3D::SignDistance(aPF, aPlnF2);
if (aD2<=0.) {
bRet=!bRet; //TopAbs_IN;
}
}
} }
*/
//modified by NIZNHY-PKV Mon Nov 13 12:12:55 2006t
// //
return bRet; return bRet;
} }
//======================================================================= //=======================================================================
//function : GetFaceOff //function : GetFaceOff
@ -352,15 +341,12 @@ static
BOPTools_Tools3D::GetApproxNormalToFaceOnEdge (aE2, aF2, aT, aPn2, aDN2); BOPTools_Tools3D::GetApproxNormalToFaceOnEdge (aE2, aF2, aT, aPn2, aDN2);
aDN2.Reverse(); aDN2.Reverse();
// Angle // Angle
//
//aAngle=aDN1.AngleWithRef(aDN2, aDTtgt);
aAngle=AngleWithRef(aDN1, aDN2, aDTtgt); aAngle=AngleWithRef(aDN1, aDN2, aDTtgt);
//
if(aAngle<0.) { if(aAngle<0.) {
aAngle=aTwoPI+aAngle; aAngle=aTwoPI+aAngle;
} }
} }
//
if (aAngle<aAngleMin){ if (aAngle<aAngleMin){
aAngleMin=aAngle; aAngleMin=aAngle;
theFOff=aF2; theFOff=aF2;
@ -934,7 +920,6 @@ static
theLCB.Append(aF); theLCB.Append(aF);
} }
} }
//======================================================================= //=======================================================================
//function : FindFacePairs //function : FindFacePairs
//purpose : //purpose :
@ -1060,98 +1045,71 @@ Standard_Real AngleWithRef(const gp_Dir& theD1,
} }
return aBeta; return aBeta;
} }
// //modified by NIZNHY-PKV Tue Jul 14 07:49:55 2009f
/*
static
void Path(const TopoDS_Shape& ,
const TopoDS_Shape& ,
const TopTools_IndexedDataMapOfShapeListOfShape& ,
const TopTools_IndexedMapOfShape& ,
TopTools_IndexedMapOfShape& );
//======================================================================= //=======================================================================
// function: MakeConnexityBlock. //function : GetApproxNormalToFaceOnEdge
// purpose: //purpose :
//======================================================================= //=======================================================================
void GEOMAlgo_Tools3D::MakeConnexityBlock (const TopTools_ListOfShape& theLFIn, void GetApproxNormalToFaceOnEdge (const TopoDS_Edge& aEx,
const TopTools_IndexedMapOfShape& theMEAvoid, const TopoDS_Face& aFx,
TopTools_ListOfShape& theLCB) Standard_Real aT,
gp_Pnt& aPF,
gp_Dir& aDNF,
IntTools_Context& aCtx)
{ {
Standard_Integer j, aNbF; Standard_Boolean bReverse;
TopTools_IndexedDataMapOfShapeListOfShape aEFMap; Standard_Real aT1, aT2, dT, aU, aV;
TopTools_IndexedMapOfShape aMFP, aCBMap; gp_Dir aDTT, aDNFT, aDBT;
TopTools_ListIteratorOfListOfShape aIt; gp_Pnt aPFT, aPFx;
TopExp_Explorer aExp; Handle(Geom_Curve) aC3D;
TopAbs_ShapeEnum aType; TopoDS_Face aF;
TopoDS_Edge aE;
// //
aIt.Initialize(theLFIn); bReverse=Standard_False;
for (; aIt.More(); aIt.Next()) { aF=aFx;
const TopoDS_Shape& aF=aIt.Value(); aE=aEx;
aType=aF.ShapeType(); if (aF.Orientation()==TopAbs_REVERSED){
TopExp::MapShapesAndAncestors(aF, TopAbs_EDGE, TopAbs_FACE, aEFMap); bReverse=!bReverse;
} aE.Reverse();
//
aCBMap.Clear();
const TopoDS_Shape& aF=theLFIn.First();
//
aCBMap.Add(aF);
//
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); aF.Orientation(TopAbs_FORWARD);
aIt.Initialize(aLF); //GEOMAlgo_Tools3D::GetEdgeOnFace(aEx, aF, aE);
for (; aIt.More(); aIt.Next()) {
const TopoDS_Shape& aF1=aIt.Value();
if (!aF1.IsSame(aF)) {
Path (aE, aF1, aEFMap, theMEAvoid, aCBMap);
}
}
} }
// //
aNbF=aCBMap.Extent(); // Point at aT
for (j=1; j<=aNbF; ++j) { aC3D =BRep_Tool::Curve(aE, aT1, aT2);
const TopoDS_Shape& aFx=aCBMap(j); aC3D->D0(aT, aPFT);
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;
// //
if (theCBMap.Contains(theF1)){ // Normal at aT
return; BOPTools_Tools3D::GetNormalToFaceOnEdge (aE, aF, aT, aDNFT);
}
theCBMap.Add(theF1); // Tangent at aT
BOPTools_Tools3D::GetTangentToEdge(aE, aT, aDTT);
// //
aExp.Init(theF1, TopAbs_EDGE); // Binormal at aT
for (; aExp.More(); aExp.Next()){ aDBT=aDNFT^aDTT;
const TopoDS_Shape& aE=aExp.Current(); //
if (!aE.IsSame(theE1)){ dT=BOPTools_Tools3D::MinStepIn2d();//~1.e-5;
if (theMEAvoid.Contains(aE)) { aPFx.SetXYZ(aPFT.XYZ()+dT*aDBT.XYZ());
continue; //
} aPF=aPFx;
// aDNF=aDNFT;
const TopTools_ListOfShape& aLF=theEFMap.FindFromKey(aE); if (bReverse) {
aIt.Initialize(aLF); aDNF.Reverse();
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

View File

@ -154,13 +154,13 @@ Standard_EXPORT static TopAbs_State ComputeState(const TopoDS_Face& theFace,con
//! couple of faces theFace1, theFace2. <br> //! couple of faces theFace1, theFace2. <br>
//! The faces theFace, theFace1, theFace2 must <br> //! The faces theFace, theFace1, theFace2 must <br>
//! share the edge theEdge <br> //! share the edge theEdge <br>
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 <br> //! Returns True if the face theFace is inside of the <br>
//! appropriate couple of faces (from the set theLF) . <br> //! appropriate couple of faces (from the set theLF) . <br>
//! The faces of the set theLF and theFace must <br> //! The faces of the set theLF and theFace must <br>
//! share the edge theEdge <br> //! share the edge theEdge <br>
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 <br> //! Returns True if the face theFace is inside the <br>
//! solid theSolid. <br> //! solid theSolid. <br>