1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-04-03 17:56: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,
Offset from BRepOffset,
Face from TopoDS,
MapOfShape from TopTools,
IndexedMapOfShape from TopTools,
DataMapOfShapeShape from TopTools,
Real from Standard
is
Compute(myclass ; AsDes : mutable AsDes from BRepAlgo;
F : Face from TopoDS;
NewEdges : MapOfShape from TopTools;
NewEdges : IndexedMapOfShape from TopTools;
Tol : Real from Standard);
---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());
U1 = BRep_Tool::Parameter(V,E1);
U2 = BRep_Tool::Parameter(V,E2);
U1 = (BRep_Tool::Degenerated(E1))?
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();
O2 = itLV2.Value().Orientation();
P = BRep_Tool::Pnt(V);
@ -279,7 +283,7 @@ static void EdgeInter(const TopoDS_Face& F,
Standard_Real f[3],l[3];
Standard_Real MilTol2 = 1000*Tol*Tol;
Standard_Real TolDub = 1.e-7;
Standard_Real TolDub = 1.e-7;
Standard_Integer i;
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();
TopoDS_Vertex aNewVertex = BRepLib_MakeVertex(P);
aNewVertex.Orientation(TopAbs_INTERNAL);
B.UpdateVertex( aNewVertex, aT1, E1, Tol );
B.UpdateVertex( aNewVertex, aT2, E2, Tol );
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 MilTol2 = 1000*Tol*Tol;
Standard_Real TolDub = 1.e-7;
Standard_Real TolDub = 1.e-7;
Standard_Integer i;
//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();
TopoDS_Vertex aNewVertex = BRepLib_MakeVertex(P);
aNewVertex.Orientation(TopAbs_INTERNAL);
B.UpdateVertex( aNewVertex, aT1, E1, Tol );
B.UpdateVertex( aNewVertex, aT2, E2, Tol );
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))
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->Transformed(MinLoc.Transformation()));
@ -1394,10 +1400,10 @@ static Standard_Boolean UpdateVertex(TopoDS_Vertex V,
//purpose :
//=======================================================================
void BRepOffset_Inter2d::Compute (const Handle(BRepAlgo_AsDes)& AsDes,
const TopoDS_Face& F,
const TopTools_MapOfShape& NewEdges,
const Standard_Real Tol)
void BRepOffset_Inter2d::Compute (const Handle(BRepAlgo_AsDes)& AsDes,
const TopoDS_Face& F,
const TopTools_IndexedMapOfShape& NewEdges,
const Standard_Real Tol)
{
#ifdef DEB
NbF2d++;

View File

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

View File

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

View File

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

View File

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

View File

@ -16,6 +16,7 @@ uses
Shape from TopoDS,
Orientation from TopAbs,
MapOfShape from TopTools,
IndexedMapOfShape from TopTools,
DataMapOfShapeShape from TopTools,
DataMapOfShapeListOfShape from TopTools,
ListOfShape from TopTools,
@ -158,7 +159,7 @@ is
CorrectOrientation (myclass ;
SI : in Shape from TopoDS;
NewEdges : in MapOfShape from TopTools;
NewEdges : in IndexedMapOfShape from TopTools;
AsDes : in out AsDes from BRepAlgo;
InitOffset : in out Image from BRepAlgo;
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,
const TopTools_MapOfShape& NewEdges,
const TopTools_IndexedMapOfShape& NewEdges,
Handle(BRepAlgo_AsDes)& AsDes,
BRepAlgo_Image& InitOffset,
const Standard_Real Offset)

View File

@ -328,8 +328,8 @@ fields
myCreated : DataMapOfShapeDataMapOfShapeListOfShape from BRepFill;
myCutEdges : DataMapOfShapeListOfShape from TopTools;
myFaces : MapOfShape from TopTools;
myEdges : MapOfShape from TopTools;
myFaces : IndexedMapOfShape from TopTools;
myEdges : IndexedMapOfShape from TopTools;
myStopFaces : MapOfShape from TopTools;
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,
TopTools_MapOfShape& Map,
TopTools_IndexedMapOfShape& Map,
const TopoDS_Shape& S,
const BRepOffset_Offset& OF,
const BRepOffset_Analyse& Analyse,
@ -967,7 +967,12 @@ void BiTgte_Blend::Perform(const Standard_Boolean BuildShape)
for ( ; expf.More(); expf.Next()) {
const TopoDS_Shape& F = expf.Current();
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));
}
}
@ -990,7 +995,12 @@ void BiTgte_Blend::Perform(const Standard_Boolean BuildShape)
for ( ; exp.More(); exp.Next()) {
const TopoDS_Shape& F = exp.Current();
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);
}
else if ( myStopFaces.Contains(F)) {
@ -1474,7 +1484,7 @@ void BiTgte_Blend::ComputeCenters()
BiTgte_DataMapOfShapeBox MapSBox;
TopTools_MapOfShape Done;
TopTools_MapIteratorOfMapOfShape it;
//TopTools_MapIteratorOfMapOfShape it;
BRep_Builder B;
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
// ----------------------------------------
Standard_Boolean JenRajoute = Standard_True;
Standard_Integer i;
while ( JenRajoute) {
JenRajoute = Standard_False;
@ -1498,8 +1509,9 @@ void BiTgte_Blend::ComputeCenters()
// locate in myFaces the Faces connected to myEdges.
// -------------------------------------------------
Fini = Standard_True;
for (it.Initialize(myEdges); it.More(); it.Next()) {
const TopoDS_Edge& E = TopoDS::Edge(it.Key());
//for (it.Initialize(myEdges); it.More(); it.Next()) {
for (i = 1; i <= myEdges.Extent(); i++) {
const TopoDS_Edge& E = TopoDS::Edge(myEdges(i));
if (BRep_Tool::Degenerated(E)) continue;
const TopTools_ListOfShape& L = myAncestors.FindFromKey(E);
@ -1523,15 +1535,16 @@ void BiTgte_Blend::ComputeCenters()
// --------------------------------------------
// Construction of Offsets of all faces.
// --------------------------------------------
for (it.Initialize(myFaces); it.More(); it.Next()) {
const TopoDS_Shape& AS = it.Key();
//for (it.Initialize(myFaces); it.More(); it.Next()) {
for (i = 1; i <= myFaces.Extent(); i++) {
const TopoDS_Shape& AS = myFaces(i);
if ( myMapSF.IsBound(AS)) continue;
BRepOffset_Offset OF1;
TopoDS_Face BigF;
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)) {
BRepOffset_Tool::EnLargeFace(F,BigF,Standard_True);
OF1.Init(BigF,myRadius,EdgeTgt);
@ -1703,10 +1716,10 @@ void BiTgte_Blend::ComputeCenters()
BRepOffset_Type OT = BRepOffset_Concave;
if (myRadius < 0.) OT = BRepOffset_Convex;
it.Initialize(myFaces);
TopTools_ListOfShape LOF;
for ( ; it.More(); it.Next()) {
const TopoDS_Shape& CurS = it.Key();
//it.Initialize(myFaces);
for (i = 1; i <= myFaces.Extent(); i++) {
const TopoDS_Shape& CurS = myFaces(i);
// tube on free border, it is undesirable.
if ( myStopFaces.Contains(CurS)) continue;
@ -1882,9 +1895,10 @@ void BiTgte_Blend::ComputeSurfaces()
BRepOffset_Type OT = BRepOffset_Concave;
if (myRadius < 0.) OT = BRepOffset_Convex;
TopTools_MapIteratorOfMapOfShape ic(myEdges);
for ( ; ic.More(); ic.Next()) {
const TopoDS_Edge& CurE = TopoDS::Edge(ic.Key());
//TopTools_MapIteratorOfMapOfShape ic(myEdges);
Standard_Integer i;
for (i = 1; i <= myEdges.Extent(); i++) {
const TopoDS_Edge& CurE = TopoDS::Edge(myEdges(i));
const TopTools_ListOfShape& L = myAsDes->Ascendant(CurE);
if ( L.Extent() != 2) continue;