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

0022864: The algorithm BiTgte_Blend obtains instable results

This commit is contained in:
JGV 2011-12-23 14:51:38 +00:00 committed by bugmaster
parent 0f633a2224
commit 975ec82af4
10 changed files with 165 additions and 124 deletions

View File

@ -15,14 +15,14 @@ uses
AsDes from BRepAlgo, AsDes from BRepAlgo,
Offset from BRepOffset, Offset from BRepOffset,
Face from TopoDS, Face from TopoDS,
MapOfShape from TopTools, IndexedMapOfShape from TopTools,
DataMapOfShapeShape from TopTools, DataMapOfShapeShape from TopTools,
Real from Standard Real from Standard
is is
Compute(myclass ; AsDes : mutable AsDes from BRepAlgo; Compute(myclass ; AsDes : mutable AsDes from BRepAlgo;
F : Face from TopoDS; F : Face from TopoDS;
NewEdges : MapOfShape from TopTools; NewEdges : IndexedMapOfShape from TopTools;
Tol : Real from Standard); Tol : Real from Standard);
---Purpose: Computes the intersections between the edges stored ---Purpose: Computes the intersections between the edges stored

View File

@ -144,8 +144,12 @@ static void Store (const TopoDS_Edge& E1,
TopoDS_Vertex V = TopoDS::Vertex(itLV1.Value()); TopoDS_Vertex V = TopoDS::Vertex(itLV1.Value());
U1 = BRep_Tool::Parameter(V,E1); U1 = (BRep_Tool::Degenerated(E1))?
U2 = BRep_Tool::Parameter(V,E2); BRep_Tool::Parameter(TopoDS::Vertex(V.Oriented(TopAbs_INTERNAL)), E1) :
BRep_Tool::Parameter(V, E1);
U2 = (BRep_Tool::Degenerated(E2))?
BRep_Tool::Parameter(TopoDS::Vertex(V.Oriented(TopAbs_INTERNAL)), E2) :
BRep_Tool::Parameter(V, E2);
O1 = V.Orientation(); O1 = V.Orientation();
O2 = itLV2.Value().Orientation(); O2 = itLV2.Value().Orientation();
P = BRep_Tool::Pnt(V); P = BRep_Tool::Pnt(V);
@ -279,7 +283,7 @@ static void EdgeInter(const TopoDS_Face& F,
Standard_Real f[3],l[3]; Standard_Real f[3],l[3];
Standard_Real MilTol2 = 1000*Tol*Tol; Standard_Real MilTol2 = 1000*Tol*Tol;
Standard_Real TolDub = 1.e-7; Standard_Real TolDub = 1.e-7;
Standard_Integer i; Standard_Integer i;
BRep_Tool::Range(E1, f[1], l[1]); BRep_Tool::Range(E1, f[1], l[1]);
@ -357,6 +361,7 @@ static void EdgeInter(const TopoDS_Face& F,
gp_Pnt P = ResPoints(i); //ponc1.Value(); gp_Pnt P = ResPoints(i); //ponc1.Value();
TopoDS_Vertex aNewVertex = BRepLib_MakeVertex(P); TopoDS_Vertex aNewVertex = BRepLib_MakeVertex(P);
aNewVertex.Orientation(TopAbs_INTERNAL);
B.UpdateVertex( aNewVertex, aT1, E1, Tol ); B.UpdateVertex( aNewVertex, aT1, E1, Tol );
B.UpdateVertex( aNewVertex, aT2, E2, Tol ); B.UpdateVertex( aNewVertex, aT2, E2, Tol );
gp_Pnt P1 = CE1.Value(aT1); gp_Pnt P1 = CE1.Value(aT1);
@ -550,7 +555,7 @@ static void RefEdgeInter(const TopoDS_Face& F,
Standard_Real f[3],l[3]; Standard_Real f[3],l[3];
Standard_Real MilTol2 = 1000*Tol*Tol; Standard_Real MilTol2 = 1000*Tol*Tol;
Standard_Real TolDub = 1.e-7; Standard_Real TolDub = 1.e-7;
Standard_Integer i; Standard_Integer i;
//BRep_Tool::Range(E1, f[1], l[1]); //BRep_Tool::Range(E1, f[1], l[1]);
@ -625,6 +630,7 @@ static void RefEdgeInter(const TopoDS_Face& F,
gp_Pnt P = ResPoints(i); //ponc1.Value(); gp_Pnt P = ResPoints(i); //ponc1.Value();
TopoDS_Vertex aNewVertex = BRepLib_MakeVertex(P); TopoDS_Vertex aNewVertex = BRepLib_MakeVertex(P);
aNewVertex.Orientation(TopAbs_INTERNAL);
B.UpdateVertex( aNewVertex, aT1, E1, Tol ); B.UpdateVertex( aNewVertex, aT1, E1, Tol );
B.UpdateVertex( aNewVertex, aT2, E2, Tol ); B.UpdateVertex( aNewVertex, aT2, E2, Tol );
gp_Pnt P1 = CE1.Value(aT1); gp_Pnt P1 = CE1.Value(aT1);
@ -1163,7 +1169,7 @@ static void ExtentEdge(const TopoDS_Edge& E,TopoDS_Edge& NE, const Standard_Real
if (!Precision::IsInfinite(f) && !Precision::IsInfinite(l)) if (!Precision::IsInfinite(f) && !Precision::IsInfinite(l))
BRepLib::SameParameter( NE, Precision::Confusion(), Standard_True ); BRepLib::SameParameter( NE, Precision::Confusion(), Standard_True );
} }
else //no 3d curve else if (!BRep_Tool::Degenerated(E)) //no 3d curve
{ {
MinSurf = Handle(Geom_Surface)::DownCast MinSurf = Handle(Geom_Surface)::DownCast
(MinSurf->Transformed(MinLoc.Transformation())); (MinSurf->Transformed(MinLoc.Transformation()));
@ -1394,10 +1400,10 @@ static Standard_Boolean UpdateVertex(TopoDS_Vertex V,
//purpose : //purpose :
//======================================================================= //=======================================================================
void BRepOffset_Inter2d::Compute (const Handle(BRepAlgo_AsDes)& AsDes, void BRepOffset_Inter2d::Compute (const Handle(BRepAlgo_AsDes)& AsDes,
const TopoDS_Face& F, const TopoDS_Face& F,
const TopTools_MapOfShape& NewEdges, const TopTools_IndexedMapOfShape& NewEdges,
const Standard_Real Tol) const Standard_Real Tol)
{ {
#ifdef DEB #ifdef DEB
NbF2d++; NbF2d++;

View File

@ -18,7 +18,8 @@ uses
Shape from TopoDS, Shape from TopoDS,
Face from TopoDS, Face from TopoDS,
ListOfShape from TopTools, ListOfShape from TopTools,
MapOfShape from TopTools, --MapOfShape from TopTools,
IndexedMapOfShape from TopTools,
DataMapOfShapeShape from TopTools, DataMapOfShapeShape from TopTools,
DataMapOfShapeListOfShape from TopTools, DataMapOfShapeListOfShape from TopTools,
Real from Standard, Real from Standard,
@ -55,7 +56,7 @@ is
is static; is static;
ContextIntByInt( me : in out; ContextIntByInt( me : in out;
ContextFaces : MapOfShape from TopTools; ContextFaces : IndexedMapOfShape from TopTools;
ExtentContext : Boolean from Standard; ExtentContext : Boolean from Standard;
MapSF : DataMapOfShapeOffset from BRepOffset; MapSF : DataMapOfShapeOffset from BRepOffset;
A : Analyse from BRepOffset; A : Analyse from BRepOffset;
@ -65,11 +66,11 @@ is
is static; is static;
ContextIntByArc(me : in out; ContextIntByArc(me : in out;
ContextFaces : MapOfShape from TopTools; ContextFaces : IndexedMapOfShape from TopTools;
ExtentContext : Boolean from Standard; ExtentContext : Boolean from Standard;
Analyse : Analyse from BRepOffset; Analyse : Analyse from BRepOffset;
InitOffsetFace : Image from BRepAlgo; InitOffsetFace : Image from BRepAlgo;
InitOffsetEdge : in out Image from BRepAlgo) InitOffsetEdge : in out Image from BRepAlgo)
is static; is static;
AddCommonEdges(me : in out; AddCommonEdges(me : in out;
@ -85,14 +86,14 @@ is
returns Boolean from Standard returns Boolean from Standard
is static; is static;
TouchedFaces(me : in out) returns MapOfShape from TopTools TouchedFaces(me : in out) returns IndexedMapOfShape from TopTools
---C++: return & ---C++: return &
is static; is static;
AsDes(me) returns AsDes from BRepAlgo AsDes(me) returns AsDes from BRepAlgo
is static; is static;
NewEdges(me : in out) returns MapOfShape from TopTools NewEdges(me : in out) returns IndexedMapOfShape from TopTools
---C++: return & ---C++: return &
is static; is static;
@ -105,9 +106,9 @@ is
fields fields
myAsDes : AsDes from BRepAlgo; myAsDes : AsDes from BRepAlgo;
myTouched : MapOfShape from TopTools; myTouched : IndexedMapOfShape from TopTools;
myDone : DataMapOfShapeListOfShape from TopTools; myDone : DataMapOfShapeListOfShape from TopTools;
myNewEdges : MapOfShape from TopTools; myNewEdges : IndexedMapOfShape from TopTools;
mySide : State from TopAbs; mySide : State from TopAbs;
myTol : Real from Standard; myTol : Real from Standard;

View File

@ -28,6 +28,7 @@
#include <TopTools_MapIteratorOfMapOfShape.hxx> #include <TopTools_MapIteratorOfMapOfShape.hxx>
#include <TopTools_IndexedMapOfShape.hxx> #include <TopTools_IndexedMapOfShape.hxx>
#include <Extrema_ExtPC.hxx> #include <Extrema_ExtPC.hxx>
#include <TopTools_MapOfShape.hxx>
@ -570,8 +571,8 @@ void BRepOffset_Inter3d::ConnexIntByInt
//======================================================================= //=======================================================================
void BRepOffset_Inter3d::ContextIntByInt void BRepOffset_Inter3d::ContextIntByInt
(const TopTools_MapOfShape& ContextFaces, (const TopTools_IndexedMapOfShape& ContextFaces,
const Standard_Boolean ExtentContext, const Standard_Boolean ExtentContext,
const BRepOffset_DataMapOfShapeOffset& MapSF, const BRepOffset_DataMapOfShapeOffset& MapSF,
const BRepOffset_Analyse& Analyse, const BRepOffset_Analyse& Analyse,
TopTools_DataMapOfShapeShape& MES, TopTools_DataMapOfShapeShape& MES,
@ -579,7 +580,6 @@ void BRepOffset_Inter3d::ContextIntByInt
TopTools_ListOfShape& Failed) TopTools_ListOfShape& Failed)
{ {
TopTools_ListOfShape LInt1,LInt2; TopTools_ListOfShape LInt1,LInt2;
TopTools_MapIteratorOfMapOfShape itCF(ContextFaces);
TopTools_MapOfShape MV; TopTools_MapOfShape MV;
TopExp_Explorer exp; TopExp_Explorer exp;
TopoDS_Face OF,NF,WCF; TopoDS_Face OF,NF,WCF;
@ -587,8 +587,10 @@ void BRepOffset_Inter3d::ContextIntByInt
TopoDS_Compound C; TopoDS_Compound C;
BRep_Builder B; BRep_Builder B;
TopTools_ListIteratorOfListOfShape it; TopTools_ListIteratorOfListOfShape it;
for (; itCF.More(); itCF.Next()) { Standard_Integer i;
const TopoDS_Face& CF = TopoDS::Face(itCF.Key());
for (i = 1; i <= ContextFaces.Extent(); i++) {
const TopoDS_Face& CF = TopoDS::Face(ContextFaces(i));
myTouched.Add(CF); myTouched.Add(CF);
if (ExtentContext) { if (ExtentContext) {
BRepOffset_Tool::EnLargeFace(CF,NF,0,0); BRepOffset_Tool::EnLargeFace(CF,NF,0,0);
@ -597,8 +599,8 @@ void BRepOffset_Inter3d::ContextIntByInt
} }
TopAbs_State Side = TopAbs_OUT; TopAbs_State Side = TopAbs_OUT;
for (itCF.Initialize(ContextFaces); itCF.More(); itCF.Next()) { for (i = 1; i <= ContextFaces.Extent(); i++) {
const TopoDS_Face& CF = TopoDS::Face(itCF.Key()); const TopoDS_Face& CF = TopoDS::Face(ContextFaces(i));
if (ExtentContext) WCF = TopoDS::Face(MES(CF)); if (ExtentContext) WCF = TopoDS::Face(MES(CF));
else WCF = CF; else WCF = CF;
@ -691,29 +693,29 @@ void BRepOffset_Inter3d::ContextIntByInt
//purpose : //purpose :
//======================================================================= //=======================================================================
void BRepOffset_Inter3d::ContextIntByArc(const TopTools_MapOfShape& ContextFaces, void BRepOffset_Inter3d::ContextIntByArc(const TopTools_IndexedMapOfShape& ContextFaces,
const Standard_Boolean InSide, const Standard_Boolean InSide,
const BRepOffset_Analyse& Analyse, const BRepOffset_Analyse& Analyse,
const BRepAlgo_Image& InitOffsetFace, const BRepAlgo_Image& InitOffsetFace,
BRepAlgo_Image& InitOffsetEdge) BRepAlgo_Image& InitOffsetEdge)
{ {
TopTools_ListOfShape LInt1,LInt2; TopTools_ListOfShape LInt1,LInt2;
TopTools_MapIteratorOfMapOfShape it(ContextFaces);
TopTools_MapOfShape MV; TopTools_MapOfShape MV;
TopExp_Explorer exp; TopExp_Explorer exp;
TopoDS_Face OF1,OF2; TopoDS_Face OF1,OF2;
TopoDS_Edge OE; TopoDS_Edge OE;
BRep_Builder B; BRep_Builder B;
TopoDS_Edge NullEdge; TopoDS_Edge NullEdge;
Standard_Integer j;
for (; it.More(); it.Next()) { for (j = 1; j <= ContextFaces.Extent(); j++) {
const TopoDS_Face& CF = TopoDS::Face(it.Key()); const TopoDS_Face& CF = TopoDS::Face(ContextFaces(j));
myTouched.Add(CF); myTouched.Add(CF);
} }
for (it.Initialize(ContextFaces); it.More(); it.Next()) { for (j = 1; j <= ContextFaces.Extent(); j++) {
const TopoDS_Face& CF = TopoDS::Face(it.Key()); const TopoDS_Face& CF = TopoDS::Face(ContextFaces(j));
for (exp.Init(CF.Oriented(TopAbs_FORWARD),TopAbs_EDGE); for (exp.Init(CF.Oriented(TopAbs_FORWARD),TopAbs_EDGE);
exp.More(); exp.Next()) { exp.More(); exp.Next()) {
const TopoDS_Edge& E = TopoDS::Edge(exp.Current()); const TopoDS_Edge& E = TopoDS::Edge(exp.Current());
@ -909,7 +911,7 @@ const
//purpose : //purpose :
//======================================================================= //=======================================================================
TopTools_MapOfShape& BRepOffset_Inter3d::TouchedFaces() TopTools_IndexedMapOfShape& BRepOffset_Inter3d::TouchedFaces()
{ {
return myTouched; return myTouched;
} }
@ -931,7 +933,7 @@ Handle(BRepAlgo_AsDes) BRepOffset_Inter3d::AsDes() const
//purpose : //purpose :
//======================================================================= //=======================================================================
TopTools_MapOfShape& BRepOffset_Inter3d::NewEdges() TopTools_IndexedMapOfShape& BRepOffset_Inter3d::NewEdges()
{ {
return myNewEdges; return myNewEdges;
} }

View File

@ -26,6 +26,7 @@ uses
Face from TopoDS, Face from TopoDS,
Edge from TopoDS, Edge from TopoDS,
MapOfShape from TopTools, MapOfShape from TopTools,
IndexedMapOfShape from TopTools,
ListOfShape from TopTools, ListOfShape from TopTools,
MakeLoops from BRepOffset MakeLoops from BRepOffset
@ -123,7 +124,7 @@ is
ClosingFaces (me) ClosingFaces (me)
---Purpose: Returns the list of closing faces stores by AddFace ---Purpose: Returns the list of closing faces stores by AddFace
---C++: return const & ---C++: return const &
returns MapOfShape from TopTools returns IndexedMapOfShape from TopTools
is static; is static;
---Category: private methods ---Category: private methods
@ -143,12 +144,12 @@ is
is static private; is static private;
Intersection2D ( me : in out ; Intersection2D ( me : in out ;
Modif : MapOfShape from TopTools; Modif : IndexedMapOfShape from TopTools;
NewEdges : MapOfShape from TopTools) NewEdges : IndexedMapOfShape from TopTools)
is static private; is static private;
MakeLoops ( me : in out ; MakeLoops ( me : in out ;
Modif : in out MapOfShape from TopTools) Modif : in out IndexedMapOfShape from TopTools)
is static private; is static private;
MakeLoopsOnContext ( me : in out ; MakeLoopsOnContext ( me : in out ;
@ -156,7 +157,7 @@ is
is static private; is static private;
MakeFaces ( me : in out ; MakeFaces ( me : in out ;
Modif : in out MapOfShape from TopTools) Modif : in out IndexedMapOfShape from TopTools)
is static private; is static private;
MakeShells (me : in out ) MakeShells (me : in out )
@ -200,8 +201,8 @@ fields
myFaceOffset : DataMapOfShapeReal from TopTools; myFaceOffset : DataMapOfShapeReal from TopTools;
myFaces : MapOfShape from TopTools; myFaces : IndexedMapOfShape from TopTools;
myAnalyse : Analyse from BRepOffset; myAnalyse : Analyse from BRepOffset;
myOffsetShape : Shape from TopoDS; -- Result myOffsetShape : Shape from TopoDS; -- Result
myInitOffsetFace : Image from BRepAlgo; myInitOffsetFace : Image from BRepAlgo;

View File

@ -127,20 +127,22 @@
//purpose : //purpose :
//======================================================================= //=======================================================================
static void DEBVerticesControl (const TopTools_MapOfShape& NewEdges, static void DEBVerticesControl (const TopTools_IndexedMapOfShape& NewEdges,
Handle(BRepAlgo_AsDes) AsDes) Handle(BRepAlgo_AsDes) AsDes)
{ {
Standard_Integer NVP = 0; Standard_Integer NVP = 0;
Standard_Integer NVM = 0; Standard_Integer NVM = 0;
Standard_Integer NVN = 0; Standard_Integer NVN = 0;
TopTools_ListOfShape LVP; TopTools_ListOfShape LVP;
TopTools_MapIteratorOfMapOfShape it; //TopTools_MapIteratorOfMapOfShape it;
TopTools_ListIteratorOfListOfShape it1LE ; TopTools_ListIteratorOfListOfShape it1LE ;
TopTools_ListIteratorOfListOfShape it2LE ; TopTools_ListIteratorOfListOfShape it2LE ;
for (it.Initialize(NewEdges) ; it.More(); it.Next()) { //for (it.Initialize(NewEdges) ; it.More(); it.Next()) {
const TopoDS_Edge& NE = TopoDS::Edge(it.Key()); Standard_Integer i;
for (i = 1; i <= NewEdges.Extent(); i++) {
const TopoDS_Edge& NE = TopoDS::Edge(NewEdges(i));
if (AsDes->HasDescendant(NE)) { if (AsDes->HasDescendant(NE)) {
for (it1LE.Initialize(AsDes->Descendant(NE)); it1LE.More(); it1LE.Next()) { for (it1LE.Initialize(AsDes->Descendant(NE)); it1LE.More(); it1LE.Next()) {
if (AsDes->Ascendant(it1LE.Value()).Extent() < 3) { if (AsDes->Ascendant(it1LE.Value()).Extent() < 3) {
@ -181,8 +183,9 @@ static void DEBVerticesControl (const TopTools_MapOfShape& NewEdges,
TopTools_ListIteratorOfListOfShape it1(LVP); TopTools_ListIteratorOfListOfShape it1(LVP);
Standard_Real TolConf = 1.e-5; Standard_Real TolConf = 1.e-5;
Standard_Real Tol = Precision::Confusion(); Standard_Real Tol = Precision::Confusion();
Standard_Integer i = 1; //Standard_Integer i = 1;
i = 1;
for ( ; it1.More(); it1.Next()) { for ( ; it1.More(); it1.Next()) {
TopoDS_Shape V1 = it1.Value(); TopoDS_Shape V1 = it1.Value();
gp_Pnt P1 = BRep_Tool::Pnt(TopoDS::Vertex(V1)); gp_Pnt P1 = BRep_Tool::Pnt(TopoDS::Vertex(V1));
@ -226,8 +229,8 @@ static void DEBVerticesControl (const TopTools_MapOfShape& NewEdges,
#endif #endif
static void UpdateTolerance ( TopoDS_Shape& myShape, static void UpdateTolerance ( TopoDS_Shape& myShape,
const TopTools_MapOfShape& myFaces); const TopTools_IndexedMapOfShape& myFaces);
static Standard_Boolean FindParameter(const TopoDS_Vertex& V, static Standard_Boolean FindParameter(const TopoDS_Vertex& V,
@ -563,8 +566,8 @@ void BRepOffset_MakeOffset::SetOffsetOnFace(const TopoDS_Face& F,
//purpose : //purpose :
//======================================================================= //=======================================================================
static void RemoveCorks (TopoDS_Shape& S, static void RemoveCorks (TopoDS_Shape& S,
TopTools_MapOfShape& Faces) TopTools_IndexedMapOfShape& Faces)
{ {
TopoDS_Compound SS; TopoDS_Compound SS;
BRep_Builder B; BRep_Builder B;
@ -580,8 +583,14 @@ static void RemoveCorks (TopoDS_Shape& S,
B.Add(SS,Cork); B.Add(SS,Cork);
} }
else { else {
Faces.Remove (Cork); //Faces.Remove (Cork);
Faces.Add (Cork); // to reset it with proper orientation. //begin instead of Remove//
TopoDS_Shape LastShape = Faces(Faces.Extent());
Faces.RemoveLast();
if (Faces.FindIndex(Cork) != 0)
Faces.Substitute(Faces.FindIndex(Cork), LastShape);
//end instead of Remove //
Faces.Add(Cork); // to reset it with proper orientation.
} }
} }
S = SS; S = SS;
@ -612,9 +621,9 @@ static Standard_Boolean IsConnectedShell( const TopoDS_Shape& S )
//purpose : //purpose :
//======================================================================= //=======================================================================
static void MakeList (TopTools_ListOfShape& OffsetFaces, static void MakeList (TopTools_ListOfShape& OffsetFaces,
const BRepAlgo_Image& myInitOffsetFace, const BRepAlgo_Image& myInitOffsetFace,
const TopTools_MapOfShape& myFaces) const TopTools_IndexedMapOfShape& myFaces)
{ {
TopTools_ListIteratorOfListOfShape itLOF(myInitOffsetFace.Roots()); TopTools_ListIteratorOfListOfShape itLOF(myInitOffsetFace.Roots());
for ( ; itLOF.More(); itLOF.Next()) { for ( ; itLOF.More(); itLOF.Next()) {
@ -694,8 +703,8 @@ void BRepOffset_MakeOffset::MakeOffsetShape()
//----------------- //-----------------
// Intersection2D // Intersection2D
//----------------- //-----------------
TopTools_MapOfShape& Modif = Inter.TouchedFaces(); TopTools_IndexedMapOfShape& Modif = Inter.TouchedFaces();
TopTools_MapOfShape& NewEdges = Inter.NewEdges(); TopTools_IndexedMapOfShape& NewEdges = Inter.NewEdges();
if (!Modif.IsEmpty()) Intersection2D (Modif,NewEdges); if (!Modif.IsEmpty()) Intersection2D (Modif,NewEdges);
//------------------------------------------------------- //-------------------------------------------------------
@ -1006,7 +1015,7 @@ void BRepOffset_MakeOffset::BuildOffsetByInter()
//----------------------------------------------------------- //-----------------------------------------------------------
// Great restriction of new edges and update of AsDes. // Great restriction of new edges and update of AsDes.
//------------------------------------------ ---------------- //------------------------------------------ ----------------
TopTools_MapOfShape NewEdges; TopTools_IndexedMapOfShape NewEdges;
TopExp_Explorer Exp2,ExpC; TopExp_Explorer Exp2,ExpC;
TopoDS_Shape NE; TopoDS_Shape NE;
TopoDS_Edge TNE; TopoDS_Edge TNE;
@ -1087,9 +1096,9 @@ void BRepOffset_MakeOffset::BuildOffsetByInter()
//---------------------------------------------- //----------------------------------------------
// Intersections 2d on caps. // Intersections 2d on caps.
//---------------------------------------------- //----------------------------------------------
TopTools_MapIteratorOfMapOfShape itCork(myFaces); Standard_Integer i;
for (; itCork.More(); itCork.Next()) { for (i = 1; i <= myFaces.Extent(); i++) {
const TopoDS_Face& Cork = TopoDS::Face(itCork.Key()); const TopoDS_Face& Cork = TopoDS::Face(myFaces(i));
BRepOffset_Inter2d::Compute(AsDes,Cork,NewEdges,myTol); BRepOffset_Inter2d::Compute(AsDes,Cork,NewEdges,myTol);
} }
@ -1099,7 +1108,7 @@ void BRepOffset_MakeOffset::BuildOffsetByInter()
myMakeLoops.Build(LFE ,AsDes,IMOE); myMakeLoops.Build(LFE ,AsDes,IMOE);
#ifdef DEB #ifdef DEB
TopTools_MapOfShape COES; TopTools_IndexedMapOfShape COES;
#endif #endif
//--------------------------- //---------------------------
// MAJ SD. for faces // // MAJ SD. for faces //
@ -1290,9 +1299,9 @@ void BRepOffset_MakeOffset::BuildOffsetByInter()
//--------------------------- //---------------------------
// MAJ SD. for caps // MAJ SD. for caps
//--------------------------- //---------------------------
TopTools_MapOfShape View; //TopTools_MapOfShape View;
for (itCork.Initialize(myFaces); itCork.More(); itCork.Next()) { for (i = 1; i <= myFaces.Extent(); i++) {
const TopoDS_Shape& Cork = itCork.Key(); const TopoDS_Shape& Cork = myFaces(i);
const TopTools_ListOfShape& LE = AsDes->Descendant(Cork); const TopTools_ListOfShape& LE = AsDes->Descendant(Cork);
for (itLF.Initialize(LE) ; itLF.More(); itLF.Next()) { for (itLF.Initialize(LE) ; itLF.More(); itLF.Next()) {
const TopoDS_Edge& OE = TopoDS::Edge(itLF.Value()); const TopoDS_Edge& OE = TopoDS::Edge(itLF.Value());
@ -1625,8 +1634,7 @@ void BRepOffset_MakeOffset::ToContext (BRepOffset_DataMapOfShapeOffset& MapSF)
{ {
TopTools_DataMapOfShapeShape Created; TopTools_DataMapOfShapeShape Created;
TopTools_DataMapOfShapeShape MEF; TopTools_DataMapOfShapeShape MEF;
TopTools_MapOfShape FacesToBuild; TopTools_IndexedMapOfShape FacesToBuild;
TopTools_MapIteratorOfMapOfShape it(myFaces);
TopTools_ListIteratorOfListOfShape itl; TopTools_ListIteratorOfListOfShape itl;
TopExp_Explorer exp; TopExp_Explorer exp;
@ -1634,9 +1642,11 @@ void BRepOffset_MakeOffset::ToContext (BRepOffset_DataMapOfShapeOffset& MapSF)
// if (myOffset < 0.) Side = TopAbs_OUT; // if (myOffset < 0.) Side = TopAbs_OUT;
TopAbs_State Side = TopAbs_OUT; TopAbs_State Side = TopAbs_OUT;
for (; it.More(); it.Next()) { /*
const TopoDS_Face& CF = TopoDS::Face(it.Key()); Standard_Integer i;
for (i = 1; i <= myFaces.Extent(); i++) {
const TopoDS_Face& CF = TopoDS::Face(myFaces(i));
for (exp.Init(CF.Oriented(TopAbs_FORWARD),TopAbs_EDGE); for (exp.Init(CF.Oriented(TopAbs_FORWARD),TopAbs_EDGE);
exp.More(); exp.Next()) { exp.More(); exp.Next()) {
const TopoDS_Edge& E = TopoDS::Edge(exp.Current()); const TopoDS_Edge& E = TopoDS::Edge(exp.Current());
@ -1649,12 +1659,15 @@ void BRepOffset_MakeOffset::ToContext (BRepOffset_DataMapOfShapeOffset& MapSF)
} }
} }
} }
//------------------------------------------------------- */
//--------------------------------------------------------
// Determine the edges and faces reconstructed by // Determine the edges and faces reconstructed by
// intersection. // intersection.
//--------------------------------------------------------- //---------------------------------------------------------
for ( it.Initialize(myFaces); it.More(); it.Next()) { Standard_Integer j;
const TopoDS_Face& CF = TopoDS::Face(it.Key()); for (j = 1; j <= myFaces.Extent(); j++) {
const TopoDS_Face& CF = TopoDS::Face(myFaces(j));
for (exp.Init(CF.Oriented(TopAbs_FORWARD),TopAbs_EDGE); for (exp.Init(CF.Oriented(TopAbs_FORWARD),TopAbs_EDGE);
exp.More(); exp.Next()) { exp.More(); exp.Next()) {
const TopoDS_Edge& E = TopoDS::Edge(exp.Current()); const TopoDS_Edge& E = TopoDS::Edge(exp.Current());
@ -1690,8 +1703,8 @@ void BRepOffset_MakeOffset::ToContext (BRepOffset_DataMapOfShapeOffset& MapSF)
TopoDS_Shape OE,NE; TopoDS_Shape OE,NE;
TopAbs_Orientation Or; TopAbs_Orientation Or;
for (it.Initialize(FacesToBuild); it.More(); it.Next()) { for (j = 1; j <= FacesToBuild.Extent(); j++) {
const TopoDS_Shape& S = it.Key(); const TopoDS_Shape& S = FacesToBuild(j);
BRepOffset_Offset BOF; BRepOffset_Offset BOF;
BOF = MapSF(S); BOF = MapSF(S);
F = TopoDS::Face(BOF.Face()); F = TopoDS::Face(BOF.Face());
@ -2565,7 +2578,7 @@ void BRepOffset_MakeOffset::Intersection3D(BRepOffset_Inter3d& Inter)
//Complete. //Complete.
//------------- //-------------
Inter.CompletInt (OffsetFaces,myInitOffsetFace); Inter.CompletInt (OffsetFaces,myInitOffsetFace);
TopTools_MapOfShape& NewEdges = Inter.NewEdges(); TopTools_IndexedMapOfShape& NewEdges = Inter.NewEdges();
if (myJoin == GeomAbs_Intersection) { if (myJoin == GeomAbs_Intersection) {
BRepOffset_Tool::CorrectOrientation (myShape,NewEdges,myAsDes,myInitOffsetFace,myOffset); BRepOffset_Tool::CorrectOrientation (myShape,NewEdges,myAsDes,myInitOffsetFace,myOffset);
} }
@ -2586,8 +2599,8 @@ void BRepOffset_MakeOffset::Intersection3D(BRepOffset_Inter3d& Inter)
//purpose : //purpose :
//======================================================================= //=======================================================================
void BRepOffset_MakeOffset::Intersection2D(const TopTools_MapOfShape& Modif, void BRepOffset_MakeOffset::Intersection2D(const TopTools_IndexedMapOfShape& Modif,
const TopTools_MapOfShape& NewEdges) const TopTools_IndexedMapOfShape& NewEdges)
{ {
#ifdef DEB #ifdef DEB
if (ChronBuild) { if (ChronBuild) {
@ -2599,13 +2612,14 @@ void BRepOffset_MakeOffset::Intersection2D(const TopTools_MapOfShape& Modif,
//-------------------------------------------------------- //--------------------------------------------------------
// calculate intersections2d on faces concerned by // calculate intersections2d on faces concerned by
// intersection3d // intersection3d
//-------------------------------------------------------- //---------------------------------------------------------
TopTools_MapIteratorOfMapOfShape it(Modif); //TopTools_MapIteratorOfMapOfShape it(Modif);
//----------------------------------------------- //-----------------------------------------------
// Intersection of edges 2 by 2. // Intersection of edges 2 by 2.
//----------------------------------------------- //-----------------------------------------------
for ( it.Initialize(Modif); it.More(); it.Next()) { Standard_Integer i;
const TopoDS_Face& F = TopoDS::Face(it.Key()); for (i = 1; i <= Modif.Extent(); i++) {
const TopoDS_Face& F = TopoDS::Face(Modif(i));
BRepOffset_Inter2d::Compute(myAsDes,F,NewEdges,myTol); BRepOffset_Inter2d::Compute(myAsDes,F,NewEdges,myTol);
} }
@ -2623,7 +2637,7 @@ void BRepOffset_MakeOffset::Intersection2D(const TopTools_MapOfShape& Modif,
//purpose : //purpose :
//======================================================================= //=======================================================================
void BRepOffset_MakeOffset::MakeLoops(TopTools_MapOfShape& Modif) void BRepOffset_MakeOffset::MakeLoops(TopTools_IndexedMapOfShape& Modif)
{ {
#ifdef DEB #ifdef DEB
if (ChronBuild) { if (ChronBuild) {
@ -2632,22 +2646,24 @@ void BRepOffset_MakeOffset::MakeLoops(TopTools_MapOfShape& Modif)
Clock.Start(); Clock.Start();
} }
#endif #endif
TopTools_MapIteratorOfMapOfShape it(Modif); //TopTools_MapIteratorOfMapOfShape it(Modif);
TopTools_ListOfShape LF,LC; TopTools_ListOfShape LF,LC;
//----------------------------------------- //-----------------------------------------
// unwinding of faces // modified. // unwinding of faces // modified.
//----------------------------------------- //-----------------------------------------
for (; it.More(); it.Next()) { Standard_Integer i;
if (!myFaces.Contains(it.Key())) LF.Append(it.Key()); for (i = 1; i <= Modif.Extent(); i++) {
if (!myFaces.Contains(Modif(i)))
LF.Append(Modif(i));
} }
myMakeLoops.Build(LF,myAsDes,myImageOffset); myMakeLoops.Build(LF,myAsDes,myImageOffset);
//----------------------------------------- //-----------------------------------------
// unwinding of caps. // unwinding of caps.
//----------------------------------------- //-----------------------------------------
for (it.Initialize(myFaces); it.More(); it.Next()) { for (i = 1; i <= myFaces.Extent(); i++)
LC.Append(it.Key()); LC.Append(myFaces(i));
}
Standard_Boolean InSide = 1; Standard_Boolean InSide = 1;
if (myOffset > 0 ) InSide = 0; if (myOffset > 0 ) InSide = 0;
myMakeLoops.BuildOnContext(LC,myAnalyse,myAsDes,myImageOffset,InSide); myMakeLoops.BuildOnContext(LC,myAnalyse,myAsDes,myImageOffset,InSide);
@ -2663,7 +2679,7 @@ void BRepOffset_MakeOffset::MakeLoops(TopTools_MapOfShape& Modif)
// share edges that were reconstructed. // share edges that were reconstructed.
//======================================================================= //=======================================================================
void BRepOffset_MakeOffset::MakeFaces(TopTools_MapOfShape& Modif) void BRepOffset_MakeOffset::MakeFaces(TopTools_IndexedMapOfShape& Modif)
{ {
#ifdef DEb #ifdef DEb
if (ChronBuild) { if (ChronBuild) {
@ -3203,7 +3219,7 @@ const BRepAlgo_Image& BRepOffset_MakeOffset::OffsetEdgesFromShapes() const
//purpose : //purpose :
//======================================================================= //=======================================================================
const TopTools_MapOfShape& BRepOffset_MakeOffset::ClosingFaces () const const TopTools_IndexedMapOfShape& BRepOffset_MakeOffset::ClosingFaces () const
{ {
return myFaces; return myFaces;
} }
@ -3402,16 +3418,16 @@ void BRepOffset_MakeOffset::EncodeRegularity ()
//======================================================================= //=======================================================================
static void UpdateTolerance (TopoDS_Shape& S, static void UpdateTolerance (TopoDS_Shape& S,
const TopTools_MapOfShape& Faces) const TopTools_IndexedMapOfShape& Faces)
{ {
BRep_Builder B; BRep_Builder B;
TopTools_MapOfShape View; TopTools_MapOfShape View;
TopoDS_Vertex V[2]; TopoDS_Vertex V[2];
// The edges of caps are not modified. // The edges of caps are not modified.
TopTools_MapIteratorOfMapOfShape it; Standard_Integer j;
for (it.Initialize(Faces); it.More(); it.Next()) { for (j = 1; j <= Faces.Extent(); j++) {
const TopoDS_Shape& F = it.Key(); const TopoDS_Shape& F = Faces(j);
TopExp_Explorer Exp; TopExp_Explorer Exp;
for (Exp.Init(F,TopAbs_EDGE); Exp.More(); Exp.Next()) { for (Exp.Init(F,TopAbs_EDGE); Exp.More(); Exp.Next()) {
View.Add(Exp.Current()); View.Add(Exp.Current());

View File

@ -16,6 +16,7 @@ uses
Shape from TopoDS, Shape from TopoDS,
Orientation from TopAbs, Orientation from TopAbs,
MapOfShape from TopTools, MapOfShape from TopTools,
IndexedMapOfShape from TopTools,
DataMapOfShapeShape from TopTools, DataMapOfShapeShape from TopTools,
DataMapOfShapeListOfShape from TopTools, DataMapOfShapeListOfShape from TopTools,
ListOfShape from TopTools, ListOfShape from TopTools,
@ -158,7 +159,7 @@ is
CorrectOrientation (myclass ; CorrectOrientation (myclass ;
SI : in Shape from TopoDS; SI : in Shape from TopoDS;
NewEdges : in MapOfShape from TopTools; NewEdges : in IndexedMapOfShape from TopTools;
AsDes : in out AsDes from BRepAlgo; AsDes : in out AsDes from BRepAlgo;
InitOffset : in out Image from BRepAlgo; InitOffset : in out Image from BRepAlgo;
Offset : in Real from Standard); Offset : in Real from Standard);

View File

@ -3949,7 +3949,7 @@ static Standard_Boolean IsInOut (BRepTopAdaptor_FClass2d& FC,
//======================================================================= //=======================================================================
void BRepOffset_Tool::CorrectOrientation(const TopoDS_Shape& SI, void BRepOffset_Tool::CorrectOrientation(const TopoDS_Shape& SI,
const TopTools_MapOfShape& NewEdges, const TopTools_IndexedMapOfShape& NewEdges,
Handle(BRepAlgo_AsDes)& AsDes, Handle(BRepAlgo_AsDes)& AsDes,
BRepAlgo_Image& InitOffset, BRepAlgo_Image& InitOffset,
const Standard_Real Offset) const Standard_Real Offset)

View File

@ -328,8 +328,8 @@ fields
myCreated : DataMapOfShapeDataMapOfShapeListOfShape from BRepFill; myCreated : DataMapOfShapeDataMapOfShapeListOfShape from BRepFill;
myCutEdges : DataMapOfShapeListOfShape from TopTools; myCutEdges : DataMapOfShapeListOfShape from TopTools;
myFaces : MapOfShape from TopTools; myFaces : IndexedMapOfShape from TopTools;
myEdges : MapOfShape from TopTools; myEdges : IndexedMapOfShape from TopTools;
myStopFaces : MapOfShape from TopTools; myStopFaces : MapOfShape from TopTools;
myAnalyse : Analyse from BRepOffset; myAnalyse : Analyse from BRepOffset;

View File

@ -145,7 +145,7 @@ static Standard_Boolean IsOnRestriction(const TopoDS_Vertex& V,
//======================================================================= //=======================================================================
static void Add(const TopoDS_Edge& E, static void Add(const TopoDS_Edge& E,
TopTools_MapOfShape& Map, TopTools_IndexedMapOfShape& Map,
const TopoDS_Shape& S, const TopoDS_Shape& S,
const BRepOffset_Offset& OF, const BRepOffset_Offset& OF,
const BRepOffset_Analyse& Analyse, const BRepOffset_Analyse& Analyse,
@ -967,7 +967,12 @@ void BiTgte_Blend::Perform(const Standard_Boolean BuildShape)
for ( ; expf.More(); expf.Next()) { for ( ; expf.More(); expf.Next()) {
const TopoDS_Shape& F = expf.Current(); const TopoDS_Shape& F = expf.Current();
if ( myFaces.Contains(F) && Sew->IsModified(F)) { if ( myFaces.Contains(F) && Sew->IsModified(F)) {
myFaces.Remove(F); //myFaces.Remove(F);
TopoDS_Shape LastFace = myFaces(myFaces.Extent());
myFaces.RemoveLast();
if (myFaces.FindIndex(F) != 0)
myFaces.Substitute(myFaces.FindIndex(F), LastFace);
////////////////////
myFaces.Add(Sew->Modified(F)); myFaces.Add(Sew->Modified(F));
} }
} }
@ -990,7 +995,12 @@ void BiTgte_Blend::Perform(const Standard_Boolean BuildShape)
for ( ; exp.More(); exp.Next()) { for ( ; exp.More(); exp.Next()) {
const TopoDS_Shape& F = exp.Current(); const TopoDS_Shape& F = exp.Current();
if ( myFaces.Contains(F)) { if ( myFaces.Contains(F)) {
myFaces.Remove(F); //myFaces.Remove(F);
TopoDS_Shape LastFace = myFaces(myFaces.Extent());
myFaces.RemoveLast();
if (myFaces.FindIndex(F) != 0)
myFaces.Substitute(myFaces.FindIndex(F), LastFace);
////////////////////
myFaces.Add(F); myFaces.Add(F);
} }
else if ( myStopFaces.Contains(F)) { else if ( myStopFaces.Contains(F)) {
@ -1474,7 +1484,7 @@ void BiTgte_Blend::ComputeCenters()
BiTgte_DataMapOfShapeBox MapSBox; BiTgte_DataMapOfShapeBox MapSBox;
TopTools_MapOfShape Done; TopTools_MapOfShape Done;
TopTools_MapIteratorOfMapOfShape it; //TopTools_MapIteratorOfMapOfShape it;
BRep_Builder B; BRep_Builder B;
TopoDS_Compound Co; // to only know on which edges the tubes are made TopoDS_Compound Co; // to only know on which edges the tubes are made
@ -1484,7 +1494,8 @@ void BiTgte_Blend::ComputeCenters()
// Calculate Sections Face/Face + Propagation // Calculate Sections Face/Face + Propagation
// ---------------------------------------- // ----------------------------------------
Standard_Boolean JenRajoute = Standard_True; Standard_Boolean JenRajoute = Standard_True;
Standard_Integer i;
while ( JenRajoute) { while ( JenRajoute) {
JenRajoute = Standard_False; JenRajoute = Standard_False;
@ -1498,8 +1509,9 @@ void BiTgte_Blend::ComputeCenters()
// locate in myFaces the Faces connected to myEdges. // locate in myFaces the Faces connected to myEdges.
// ------------------------------------------------- // -------------------------------------------------
Fini = Standard_True; Fini = Standard_True;
for (it.Initialize(myEdges); it.More(); it.Next()) { //for (it.Initialize(myEdges); it.More(); it.Next()) {
const TopoDS_Edge& E = TopoDS::Edge(it.Key()); for (i = 1; i <= myEdges.Extent(); i++) {
const TopoDS_Edge& E = TopoDS::Edge(myEdges(i));
if (BRep_Tool::Degenerated(E)) continue; if (BRep_Tool::Degenerated(E)) continue;
const TopTools_ListOfShape& L = myAncestors.FindFromKey(E); const TopTools_ListOfShape& L = myAncestors.FindFromKey(E);
@ -1523,15 +1535,16 @@ void BiTgte_Blend::ComputeCenters()
// -------------------------------------------- // --------------------------------------------
// Construction of Offsets of all faces. // Construction of Offsets of all faces.
// -------------------------------------------- // --------------------------------------------
for (it.Initialize(myFaces); it.More(); it.Next()) { //for (it.Initialize(myFaces); it.More(); it.Next()) {
const TopoDS_Shape& AS = it.Key(); for (i = 1; i <= myFaces.Extent(); i++) {
const TopoDS_Shape& AS = myFaces(i);
if ( myMapSF.IsBound(AS)) continue; if ( myMapSF.IsBound(AS)) continue;
BRepOffset_Offset OF1; BRepOffset_Offset OF1;
TopoDS_Face BigF; TopoDS_Face BigF;
if (AS.ShapeType() == TopAbs_FACE) { if (AS.ShapeType() == TopAbs_FACE) {
const TopoDS_Face& F = TopoDS::Face(it.Key()); const TopoDS_Face& F = TopoDS::Face(myFaces(i));
if ( TouchedByCork.Contains(F)) { if ( TouchedByCork.Contains(F)) {
BRepOffset_Tool::EnLargeFace(F,BigF,Standard_True); BRepOffset_Tool::EnLargeFace(F,BigF,Standard_True);
OF1.Init(BigF,myRadius,EdgeTgt); OF1.Init(BigF,myRadius,EdgeTgt);
@ -1703,10 +1716,10 @@ void BiTgte_Blend::ComputeCenters()
BRepOffset_Type OT = BRepOffset_Concave; BRepOffset_Type OT = BRepOffset_Concave;
if (myRadius < 0.) OT = BRepOffset_Convex; if (myRadius < 0.) OT = BRepOffset_Convex;
it.Initialize(myFaces);
TopTools_ListOfShape LOF; TopTools_ListOfShape LOF;
for ( ; it.More(); it.Next()) { //it.Initialize(myFaces);
const TopoDS_Shape& CurS = it.Key(); for (i = 1; i <= myFaces.Extent(); i++) {
const TopoDS_Shape& CurS = myFaces(i);
// tube on free border, it is undesirable. // tube on free border, it is undesirable.
if ( myStopFaces.Contains(CurS)) continue; if ( myStopFaces.Contains(CurS)) continue;
@ -1882,9 +1895,10 @@ void BiTgte_Blend::ComputeSurfaces()
BRepOffset_Type OT = BRepOffset_Concave; BRepOffset_Type OT = BRepOffset_Concave;
if (myRadius < 0.) OT = BRepOffset_Convex; if (myRadius < 0.) OT = BRepOffset_Convex;
TopTools_MapIteratorOfMapOfShape ic(myEdges); //TopTools_MapIteratorOfMapOfShape ic(myEdges);
for ( ; ic.More(); ic.Next()) { Standard_Integer i;
const TopoDS_Edge& CurE = TopoDS::Edge(ic.Key()); for (i = 1; i <= myEdges.Extent(); i++) {
const TopoDS_Edge& CurE = TopoDS::Edge(myEdges(i));
const TopTools_ListOfShape& L = myAsDes->Ascendant(CurE); const TopTools_ListOfShape& L = myAsDes->Ascendant(CurE);
if ( L.Extent() != 2) continue; if ( L.Extent() != 2) continue;