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

0028577: Get rid of the TopOpeBRep* algorithms in TKOffset toolkit

The TKOffset toolkit has been cleared from the usage of the obsolete TopOpeBRep* classes.
This commit is contained in:
emv 2017-03-21 15:47:34 +03:00 committed by bugmaster
parent 431d0f181e
commit 3b77eff652
4 changed files with 123 additions and 138 deletions

View File

@ -71,9 +71,6 @@
#include <TopTools_ListOfShape.hxx> #include <TopTools_ListOfShape.hxx>
#include <TopTools_MapOfShape.hxx> #include <TopTools_MapOfShape.hxx>
//#ifdef OCCT_DEBUG
//Standard_IMPORT Standard_Boolean TopOpeBRepBuild_GettraceFE();
//#endif
static void BCSmoothing(Handle(Geom_BSplineCurve)& theC, static void BCSmoothing(Handle(Geom_BSplineCurve)& theC,
const Standard_Integer theCont, const Standard_Integer theCont,
const Standard_Real theTol) const Standard_Real theTol)
@ -366,11 +363,6 @@ TopoDS_Shape& BRepLib_FuseEdges::Shape()
void BRepLib_FuseEdges::BuildListEdges() void BRepLib_FuseEdges::BuildListEdges()
{ {
//#ifdef OCCT_DEBUG
//Standard_Boolean tFE = TopOpeBRepBuild_GettraceFE();
//#endif
//-------------------------------------------------------- //--------------------------------------------------------
// Step One : Build the map ancestors // Step One : Build the map ancestors
//-------------------------------------------------------- //--------------------------------------------------------
@ -416,11 +408,6 @@ void BRepLib_FuseEdges::BuildListEdges()
void BRepLib_FuseEdges::BuildListResultEdges() void BRepLib_FuseEdges::BuildListResultEdges()
{ {
//#ifdef OCCT_DEBUG
//Standard_Boolean tFE = TopOpeBRepBuild_GettraceFE();
//#endif
// if we have edges to fuse // if we have edges to fuse
if (myMapLstEdg.Extent() > 0) { if (myMapLstEdg.Extent() > 0) {
TopTools_DataMapIteratorOfDataMapOfIntegerListOfShape itLstEdg; TopTools_DataMapIteratorOfDataMapOfIntegerListOfShape itLstEdg;
@ -545,11 +532,6 @@ void BRepLib_FuseEdges::BuildListResultEdges()
void BRepLib_FuseEdges::Perform() void BRepLib_FuseEdges::Perform()
{ {
//#ifdef OCCT_DEBUG
//Standard_Boolean tFE = TopOpeBRepBuild_GettraceFE();
//#endif
if (!myResultEdgesDone) { if (!myResultEdgesDone) {
BuildListResultEdges(); BuildListResultEdges();
} }
@ -803,9 +785,6 @@ Standard_Boolean BRepLib_FuseEdges::SameSupport(const TopoDS_Edge& E1,
typC1 != STANDARD_TYPE(Geom_Ellipse) && typC1 != STANDARD_TYPE(Geom_Ellipse) &&
typC1 != STANDARD_TYPE(Geom_BSplineCurve) && typC1 != STANDARD_TYPE(Geom_BSplineCurve) &&
typC1 != STANDARD_TYPE(Geom_BezierCurve)) { typC1 != STANDARD_TYPE(Geom_BezierCurve)) {
#ifdef OCCT_DEBUG
cout << " TopOpeBRepTool_FuseEdge : Type de Support non traite" << endl;
#endif
return Standard_False; return Standard_False;
} }

View File

@ -40,12 +40,15 @@
#include <TopoDS_Face.hxx> #include <TopoDS_Face.hxx>
#include <TopoDS_Shape.hxx> #include <TopoDS_Shape.hxx>
#include <TopoDS_Vertex.hxx> #include <TopoDS_Vertex.hxx>
#include <TopOpeBRepTool_BoxSort.hxx>
#include <TopTools_IndexedMapOfShape.hxx> #include <TopTools_IndexedMapOfShape.hxx>
#include <TopTools_ListIteratorOfListOfShape.hxx> #include <TopTools_ListIteratorOfListOfShape.hxx>
#include <TopTools_MapIteratorOfMapOfShape.hxx> #include <TopTools_MapIteratorOfMapOfShape.hxx>
#include <TopTools_MapOfShape.hxx> #include <TopTools_MapOfShape.hxx>
// //
#include <BRepBndLib.hxx>
#include <BOPCol_BoxBndTree.hxx>
#include <NCollection_UBTreeFiller.hxx>
//
#include <BOPTools_AlgoTools.hxx> #include <BOPTools_AlgoTools.hxx>
//======================================================================= //=======================================================================
@ -160,40 +163,55 @@ void BRepOffset_Inter3d::CompletInt(const TopTools_ListOfShape& SetOfFaces,
// Calculate the intersections of offset faces // Calculate the intersections of offset faces
// Distinction of intersection between faces // tangents. // Distinction of intersection between faces // tangents.
//--------------------------------------------------------------- //---------------------------------------------------------------
TopoDS_Face F2;
TopTools_ListIteratorOfListOfShape it;
//--------------------------------------------------------------- // Prepare tools for sorting the bounding boxes
// Construction of bounding boxes BOPCol_BoxBndTree aBBTree;
//--------------------------------------------------------------- NCollection_UBTreeFiller <Standard_Integer, Bnd_Box> aTreeFiller(aBBTree);
TopOpeBRepTool_BoxSort BOS; //
BRep_Builder B; NCollection_IndexedDataMap<TopoDS_Shape, Bnd_Box, TopTools_ShapeMapHasher> aMFaces;
TopoDS_Compound CompOS; // Construct bounding boxes for faces and add them to the tree
B.MakeCompound(CompOS); TopTools_ListIteratorOfListOfShape aItL(SetOfFaces);
for (; aItL.More(); aItL.Next()) {
for (it.Initialize(SetOfFaces); it.More(); it.Next()) { const TopoDS_Face& aF = TopoDS::Face(aItL.Value());
const TopoDS_Shape& OS = it.Value(); //
B.Add(CompOS,OS); // compute bounding box
Bnd_Box aBoxF;
BRepBndLib::Add(aF, aBoxF);
//
Standard_Integer i = aMFaces.Add(aF, aBoxF);
//
aTreeFiller.Add(i, aBoxF);
} }
BOS.AddBoxesMakeCOB(CompOS,TopAbs_FACE); //
// shake tree filler
//--------------------------- aTreeFiller.Fill();
// Intersection of faces // //
//--------------------------- // get faces with interfering bounding boxes
for (it.Initialize(SetOfFaces); it.More(); it.Next()) { aItL.Initialize(SetOfFaces);
const TopoDS_Face& F1 = TopoDS::Face(it.Value()); for (; aItL.More(); aItL.Next()) {
TColStd_ListIteratorOfListOfInteger itLI = BOS.Compare(F1); const TopoDS_Face& aF1 = TopoDS::Face(aItL.Value());
for (; itLI.More(); itLI.Next()) { const Bnd_Box& aBoxF1 = aMFaces.FindFromKey(aF1);
F2 = TopoDS::Face(BOS.TouchedShape(itLI)); //
FaceInter(F1,F2,InitOffsetFace); BOPCol_BoxBndTreeSelector aSelector;
aSelector.SetBox(aBoxF1);
aBBTree.Select(aSelector);
//
const BOPCol_ListOfInteger& aLI = aSelector.Indices();
BOPCol_ListIteratorOfListOfInteger aItLI(aLI);
for (; aItLI.More(); aItLI.Next()) {
Standard_Integer i = aItLI.Value();
const TopoDS_Face& aF2 = TopoDS::Face(aMFaces.FindKey(i));
//
// intersect faces
FaceInter(aF1, aF2, InitOffsetFace);
} }
} }
} }
//======================================================================= //=======================================================================
//function : CompletInt //function : FaceInter
//purpose : //purpose : Performs intersection of the given faces
//======================================================================= //=======================================================================
void BRepOffset_Inter3d::FaceInter(const TopoDS_Face& F1, void BRepOffset_Inter3d::FaceInter(const TopoDS_Face& F1,

View File

@ -24,6 +24,7 @@
#include <BRep_ListIteratorOfListOfCurveRepresentation.hxx> #include <BRep_ListIteratorOfListOfCurveRepresentation.hxx>
#include <BRep_TEdge.hxx> #include <BRep_TEdge.hxx>
#include <BRep_Tool.hxx> #include <BRep_Tool.hxx>
#include <BRep_Builder.hxx>
#include <BRepAdaptor_Curve.hxx> #include <BRepAdaptor_Curve.hxx>
#include <BRepAdaptor_Curve2d.hxx> #include <BRepAdaptor_Curve2d.hxx>
#include <BRepAdaptor_HCurve.hxx> #include <BRepAdaptor_HCurve.hxx>
@ -113,14 +114,6 @@
#include <TopoDS_Shape.hxx> #include <TopoDS_Shape.hxx>
#include <TopoDS_Vertex.hxx> #include <TopoDS_Vertex.hxx>
#include <TopoDS_Wire.hxx> #include <TopoDS_Wire.hxx>
#include <TopOpeBRep_DSFiller.hxx>
#include <TopOpeBRep_FacesFiller.hxx>
#include <TopOpeBRep_GeomTool.hxx>
#include <TopOpeBRep_ShapeIntersector.hxx>
#include <TopOpeBRepBuild_Builder.hxx>
#include <TopOpeBRepDS_CurveExplorer.hxx>
#include <TopOpeBRepDS_HDataStructure.hxx>
#include <TopOpeBRepTool_GeomTool.hxx>
#include <TopTools_IndexedDataMapOfShapeListOfShape.hxx> #include <TopTools_IndexedDataMapOfShapeListOfShape.hxx>
#include <TopTools_ListIteratorOfListOfShape.hxx> #include <TopTools_ListIteratorOfListOfShape.hxx>
#include <TopTools_SequenceOfShape.hxx> #include <TopTools_SequenceOfShape.hxx>

View File

@ -51,12 +51,13 @@
#include <TopoDS_Iterator.hxx> #include <TopoDS_Iterator.hxx>
#include <TopoDS_Shape.hxx> #include <TopoDS_Shape.hxx>
#include <TopoDS_Wire.hxx> #include <TopoDS_Wire.hxx>
#include <TopOpeBRep_EdgesIntersector.hxx>
#include <TopOpeBRep_Point2d.hxx>
#include <TopTools_DataMapOfShapeSequenceOfShape.hxx> #include <TopTools_DataMapOfShapeSequenceOfShape.hxx>
#include <TopTools_ListIteratorOfListOfShape.hxx> #include <TopTools_ListIteratorOfListOfShape.hxx>
#include <TopTools_SequenceOfShape.hxx> #include <TopTools_SequenceOfShape.hxx>
#include <Geom2dInt_GInter.hxx>
#include <IntRes2d_IntersectionPoint.hxx>
//======================================================================= //=======================================================================
//function : BRepOffsetAPI_DraftAngle //function : BRepOffsetAPI_DraftAngle
//purpose : //purpose :
@ -365,6 +366,19 @@ void BRepOffsetAPI_DraftAngle::CorrectWires()
CurEdge = Eseq(i); CurEdge = Eseq(i);
CurWire = Wseq(i); CurWire = Wseq(i);
CurFace = Fseq(i); CurFace = Fseq(i);
//
const TopoDS_Face& aFace = TopoDS::Face(CurFace);
//
// Prepare 2D adaptors for intersection.
// The seam edge has two 2D curve, thus we have to create 2 adaptors
BRepAdaptor_Curve2d aBAC2D1(TopoDS::Edge(CurEdge), aFace);
BRepAdaptor_Curve2d aBAC2D1R(TopoDS::Edge(CurEdge.Reversed()), aFace);
// Get surface of the face to get 3D intersection point
TopLoc_Location aLoc;
const Handle(Geom_Surface)& aSurf = BRep_Tool::Surface(aFace, aLoc);
// Get the tolerance of the current edge to compare intersection points
Standard_Real aTolCurE = BRep_Tool::Tolerance(TopoDS::Edge(CurEdge));
//
wit.Initialize( CurFace ); wit.Initialize( CurFace );
for (; wit.More(); wit.Next()) for (; wit.More(); wit.Next())
{ {
@ -372,102 +386,83 @@ void BRepOffsetAPI_DraftAngle::CorrectWires()
if (! aWire.IsSame( CurWire )) if (! aWire.IsSame( CurWire ))
{ {
TColgp_SequenceOfPnt pts; TColgp_SequenceOfPnt pts;
TopTools_SequenceOfShape edges;
TColStd_SequenceOfReal pars;
Standard_Boolean Wadd = Standard_False; Standard_Boolean Wadd = Standard_False;
eit.Initialize( aWire ); eit.Initialize( aWire );
for (; eit.More(); eit.Next()) for (; eit.More(); eit.Next())
{ {
TopoDS_Shape anEdge = eit.Value(); const TopoDS_Edge& anEdge = TopoDS::Edge(eit.Value());
TopOpeBRep_EdgesIntersector EInter; //
EInter.SetFaces( CurFace, CurFace ); // Prepare 2D adaptor for intersection
EInter.ForceTolerances( TolInter, TolInter ); BRepAdaptor_Curve2d aBAC2D2(anEdge, aFace);
EInter.Perform( CurEdge, anEdge ); // Perform intersection
if (EInter.IsEmpty()) Geom2dInt_GInter aGInter;
{ aGInter.Perform(aBAC2D1, aBAC2D2, TolInter, TolInter);
EInter.Perform( CurEdge.Reversed(), anEdge ); if (!aGInter.IsDone() || aGInter.IsEmpty()) {
if (EInter.IsEmpty()) // If first intersection is empty try intersection with reversed edge
aGInter.Perform(aBAC2D1R, aBAC2D2, TolInter, TolInter);
if (!aGInter.IsDone() || aGInter.IsEmpty()) {
continue; continue;
}
} }
//
Wadd = Standard_True; Wadd = Standard_True;
if (! WFmap.IsBound( aWire )) if (! WFmap.IsBound( aWire ))
WFmap.Bind( aWire, CurFace ); WFmap.Bind( aWire, CurFace );
Standard_Integer ind = 0; Standard_Integer ind = 0;
for (j = 1; j <= NonSeam.Length(); j++) for (j = 1; j <= NonSeam.Length(); j++) {
if (anEdge.IsSame( NonSeam(j) )) if (anEdge.IsSame(NonSeam(j)))
{ {
ind = j; ind = j;
break; break;
} }
if (ind == 0) }
{ if (ind == 0)
NonSeam.Append( anEdge ); {
NonSeamWires.Append( aWire ); NonSeam.Append(anEdge);
ind = NonSeam.Length(); NonSeamWires.Append(aWire);
TColStd_SequenceOfReal emptyseq1, emptyseq2; ind = NonSeam.Length();
TopTools_SequenceOfShape emptyedgeseq; TColStd_SequenceOfReal emptyseq1, emptyseq2;
ParsNonSeam.Append( emptyseq1 ); TopTools_SequenceOfShape emptyedgeseq;
Seam.Append( emptyedgeseq ); ParsNonSeam.Append(emptyseq1);
ParsSeam.Append( emptyseq2 ); Seam.Append(emptyedgeseq);
} ParsSeam.Append(emptyseq2);
if (! Emap.IsBound( CurEdge )) }
{ if (!Emap.IsBound(CurEdge))
TColStd_SequenceOfReal emptyseq; {
Emap.Bind( CurEdge, emptyseq ); TColStd_SequenceOfReal emptyseq;
} Emap.Bind(CurEdge, emptyseq);
EInter.InitPoint(); }
for (; EInter.MorePoint(); EInter.NextPoint()) //
{ // Get the tolerance of edge to compare intersection points
const TopOpeBRep_Point2d& bp = EInter.Point(); Standard_Real aTolE = BRep_Tool::Tolerance(anEdge);
if (bp.IsVertex(2)) // Tolerance to compare the intersection points is the maximal
// tolerance of intersecting edges
Standard_Real aTolCmp = Max(aTolCurE, aTolE);
//
Standard_Integer k, aNbIntPnt = aGInter.NbPoints();
for (k = 1; k <= aNbIntPnt; ++k) {
const IntRes2d_IntersectionPoint& aP2DInt = aGInter.Point(k);
const gp_Pnt2d& aP2D = aP2DInt.Value();
gp_Pnt aP3D = aSurf->Value(aP2D.X(), aP2D.Y());
//
// Check if the intersection point is new
Standard_Integer ied = 0;
for (j = 1; j <= pts.Length(); j++) {
if (aP3D.IsEqual(pts(j), aTolCmp))
{ {
gp_Pnt Pnt = bp.Value(); ied = j;
Standard_Integer ied = 0; break;
for (j = 1; j <= pts.Length(); j++)
if (Pnt.IsEqual( pts(j), Precision::Confusion() ))
{
ied = j;
break;
}
if (ied == 0)
{
pts.Append( Pnt );
edges.Append( anEdge );
pars.Append( bp.Parameter(2) );
Emap(CurEdge).Append( bp.Parameter(1) );
ParsNonSeam(ind).Append( bp.Parameter(2) );
Seam(ind).Append( CurEdge );
ParsSeam(ind).Append( bp.Parameter(1) );
}
/*
else
{
Standard_Real ParOnSeam = bp.Parameter(1);
Standard_Real Par1 = pars(ied);
Standard_Real Par2 = bp.Parameter(2);
BRepAdaptor_Curve2d SeamCurve( CurEdge, CurFace );
BRepAdaptor_Curve2d Curve1( edges(ied), CurFace );
BRepAdaptor_Curve2d Curve2( anEdge. CurFace );
gp_Pnt2d P2d;
gp_Vec2d SeamDer, Der1, Der2;
//SeamCurve->D1( ParOnSeam, P2d, SeamDer );
//Curve1->D1( Par1, P2d, Der1 );
//Curve2->D1( Par2, P2d, Der2 );
Standard_Real Crossed1 = SeamDer ^ Der1;
Standard_Real Crossed2 = SeamDer ^ Der2;
//if (Crossed1 > 0
}
*/
} }
else // ! bp.IsVertex(2) }
{ if (ied == 0)
//Temporary the case of tangency is not implemented {
Emap(CurEdge).Append( bp.Parameter(1) ); pts.Append(aP3D);
ParsNonSeam(ind).Append( bp.Parameter(2) ); Emap(CurEdge).Append(aP2DInt.ParamOnFirst());
Seam(ind).Append( CurEdge ); ParsNonSeam(ind).Append(aP2DInt.ParamOnSecond());
ParsSeam(ind).Append( bp.Parameter(1) ); Seam(ind).Append(CurEdge);
} ParsSeam(ind).Append(aP2DInt.ParamOnFirst());
} //for (; EInter.MorePoint(); EInter.NextPoint()) }
}
} //for (; eit.More(); eit.Next()) } //for (; eit.More(); eit.Next())
if (Wadd) if (Wadd)
{ {