1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-09 13:22:24 +03:00

0025926: 3D offset in mode "Complete" with Join type "Intersection"

3D offset algorithm extension for degenerate (colliding) cases.
Patch for version 6.9.1 of Open CASCADE.

It includes the following commits:

Revision: 5a9dc37f84bb8c6c7ac1e43c1dbcf484b4261321
Author: emv <emv@opencascade.com>
Date: 22/10/15 9:00:54 AM
Message:
Make the possibility to produce empty result in case of any invalidity (spikes, self-intersections, faces inversion) optional.
----
Modified: src/BRepOffset/BRepOffset_MakeOffset.cdl
Modified: src/BRepOffset/BRepOffset_MakeOffset.cxx
Modified: src/BRepTest/BRepTest_FeatureCommands.cxx

Revision: aadba9a3f585693eddff1ea29b7063a08320ee23
Author: emv <emv@opencascade.com>
Date: 16/10/15 10:21:57 AM
Message:
Due to the small inaccuracy of the calculation of the bi-normal direction (direction inside the face on the edge)

the criterion on the coincidence of these directions has been weakened.
----
Modified: src/BRepOffset/BRepOffset_MakeOffset.cxx

Revision: 3564da4b4d631c8ed627d7ca7697328d6c371aae
Author: emv <emv@opencascade.com>
Date: 15/10/15 11:52:23 AM
Message:
The option to remove INTERNAL edges from the faces of the result of Offset operation has been added into Offset API.

By default these edges will be kept in the result.
To remove these edges make sure to set the corresponding flag to TRUE when initializing the Offset algo.

void BRepOffset_MakeOffset::Initialize(const TopoDS_Shape&    S,
                                       const Standard_Real    Offset,
                                       const Standard_Real    Tol,
                                       const BRepOffset_Mode  Mode,
                                       const Standard_Boolean Inter,
                                       const Standard_Boolean SelfInter,
                                       const GeomAbs_JoinType Join,
                                       const Standard_Boolean RemoveIntEdges,
                                       const Standard_Boolean Thickening)
----
Modified: src/BRepOffset/BRepOffset_MakeOffset.cdl
Modified: src/BRepOffset/BRepOffset_MakeOffset.cxx
Modified: src/BRepOffsetAPI/BRepOffsetAPI_MakeOffsetShape.cdl
Modified: src/BRepOffsetAPI/BRepOffsetAPI_MakeOffsetShape.cxx
Modified: src/BRepOffsetAPI/BRepOffsetAPI_MakeThickSolid.cdl
Modified: src/BRepOffsetAPI/BRepOffsetAPI_MakeThickSolid.cxx
Modified: src/BRepTest/BRepTest_FeatureCommands.cxx

Revision: fe25cda7b7
Author: emv <emv@opencascade.com>
Date: 08/10/15 12:11:06 PM
Message:
Temporary patch to produce empty result in case of any invalidity (spikes, self-intersections, faces inversion).
----
Modified: src/BRepOffset/BRepOffset_MakeOffset.cxx

Revision: 0fe92803d2
Author: emv <emv@opencascade.com>
Date: 27/08/15 11:21:55 AM
Message:
Using local face tolerance for edges intersection.
----
Modified: src/BRepOffset/BRepOffset_MakeOffset.cxx

Revision: 7a38094a2b
Author: emv <emv@opencascade.com>
Date: 10/07/15 12:52:58 PM
Message:
Corrections in splitting faces and making shells functions.
----
Modified: src/BRepOffset/BRepOffset_MakeOffset.cxx

Revision: 2102c85e9f
Author: emv <emv@opencascade.com>
Date: 07/07/15 2:18:28 PM
Message:
3D Offset algorithm extension for the cases with the shapes having the faces connected only by the VERTEX.
----
Modified: src/BRepOffset/BRepOffset_Inter2d.cdl
Modified: src/BRepOffset/BRepOffset_Inter2d.cxx
Modified: src/BRepOffset/BRepOffset_Inter3d.cxx
Modified: src/BRepOffset/BRepOffset_MakeOffset.cxx

Revision: c4362927dc
Author: emv <emv@opencascade.com>
Date: 30/06/15 12:22:42 PM
Message:
Fix for correct shells splitting when building solids.
----
Modified: src/BOPAlgo/BOPAlgo_MakerVolume.cxx
Modified: src/BOPAlgo/BOPAlgo_ShellSplitter.cxx

Revision: ee5d676aee
Author: emv <emv@opencascade.com>
Date: 17/06/15 11:30:10 AM
Message:
Treatment of the shells with free edges has been changed to keep the faces with internal edges.
----
Modified: src/BRepAlgo/BRepAlgo_Tool.cxx

Revision: 999dacb4d0
Author: emv <emv@opencascade.com>
Date: 04/06/15 10:53:22 AM
Message:
0025926: 3D offset in mode "Complete" with Join type "Intersection"

3D offset algorithm extension for degenerate (colliding) cases.
----
Modified: src/BRepOffset/BRepOffset_Inter2d.cxx
Modified: src/BRepOffset/BRepOffset_Inter3d.cxx
Modified: src/BRepOffset/BRepOffset_MakeOffset.cdl
Modified: src/BRepOffset/BRepOffset_MakeOffset.cxx
This commit is contained in:
emv
2015-10-22 09:31:48 +03:00
parent 3b5f0ca372
commit de262ba883
11 changed files with 4441 additions and 2860 deletions

View File

@@ -52,8 +52,16 @@ TopoDS_Shape BRepAlgo_Tool::Deboucle3D(const TopoDS_Shape& S,
Standard_Boolean JeGarde = Standard_True;
for ( Standard_Integer i = 1; i <= Map.Extent() && JeGarde; i++) {
if (Map(i).Extent() < 2) {
const TopTools_ListOfShape& aLF = Map(i);
if (aLF.Extent() < 2) {
const TopoDS_Edge& anEdge = TopoDS::Edge(Map.FindKey(i));
if (anEdge.Orientation() == TopAbs_INTERNAL) {
const TopoDS_Face& aFace = TopoDS::Face(aLF.First());
if (aFace.Orientation() != TopAbs_INTERNAL) {
continue;
}
}
//
if (!Boundary.Contains(anEdge) &&
!BRep_Tool::Degenerated(anEdge) )
JeGarde = Standard_False;

View File

@@ -48,7 +48,8 @@ is
MES : in out DataMapOfShapeShape from TopTools;
Build : DataMapOfShapeShape from TopTools;
AsDes : AsDes from BRepAlgo;
Offset: Real from Standard;
AsDes2d : AsDes from BRepAlgo;
Offset : Real from Standard;
Tol : Real from Standard);
-- Modified by skv - Fri Dec 26 16:53:16 2003 OCC4455 End

View File

@@ -265,6 +265,7 @@ static void Store (const TopoDS_Edge& E1,
//=======================================================================
static void EdgeInter(const TopoDS_Face& F,
const BRepAdaptor_Surface& BAsurf,
const TopoDS_Edge& E1,
const TopoDS_Edge& E2,
const Handle(BRepAlgo_AsDes)& AsDes,
@@ -328,7 +329,7 @@ static void EdgeInter(const TopoDS_Face& F,
DegPoint = CEdeg.Value( CEdeg.FirstParameter() );
}
}
BRepAdaptor_Surface BAsurf(F);
Handle(Geom2d_Curve) pcurve1 = BRep_Tool::CurveOnSurface(E1, F, f[1], l[1]);
Handle(Geom2d_Curve) pcurve2 = BRep_Tool::CurveOnSurface(E2, F, f[2], l[2]);
Geom2dAdaptor_Curve GAC1(pcurve1, f[1], l[1]);
@@ -535,6 +536,7 @@ static void EdgeInter(const TopoDS_Face& F,
//=======================================================================
static void RefEdgeInter(const TopoDS_Face& F,
const BRepAdaptor_Surface& BAsurf,
const TopoDS_Edge& E1,
const TopoDS_Edge& E2,
const Handle(BRepAlgo_AsDes)& AsDes,
@@ -596,7 +598,7 @@ static void RefEdgeInter(const TopoDS_Face& F,
DegPoint = CEdeg.Value( CEdeg.FirstParameter() );
}
}
BRepAdaptor_Surface BAsurf(F);
Handle(Geom2d_Curve) pcurve1 = BRep_Tool::CurveOnSurface(E1, F, f[1], l[1]);
Handle(Geom2d_Curve) pcurve2 = BRep_Tool::CurveOnSurface(E2, F, f[2], l[2]);
Geom2dAdaptor_Curve GAC1(pcurve1, f[1], l[1]);
@@ -803,7 +805,6 @@ static void RefEdgeInter(const TopoDS_Face& F,
}
}
//======================================================================
//function : EvaluateMaxSegment
//purpose : return MaxSegment to pass in approximation
@@ -1425,7 +1426,8 @@ void BRepOffset_Inter2d::Compute (const Handle(BRepAlgo_AsDes)& AsDes,
const TopTools_ListOfShape& LE = AsDes->Descendant(F);
TopoDS_Vertex V1,V2;
Standard_Integer j, i = 1;
BRepAdaptor_Surface BAsurf(F);
//
for ( it1LE.Initialize(LE) ; it1LE.More(); it1LE.Next()) {
const TopoDS_Edge& E1 = TopoDS::Edge(it1LE.Value());
j = 1;
@@ -1440,8 +1442,8 @@ void BRepOffset_Inter2d::Compute (const Handle(BRepAlgo_AsDes)& AsDes,
if ( (!EdgesOfFace.Contains(E1) || !EdgesOfFace.Contains(E2)) &&
(NewEdges.Contains(E1) || NewEdges.Contains(E2)) ) {
TopoDS_Shape aLocalShape = F.Oriented(TopAbs_FORWARD);
EdgeInter(TopoDS::Face(aLocalShape),E1,E2,AsDes,Tol,Standard_True);
// EdgeInter(TopoDS::Face(F.Oriented(TopAbs_FORWARD)),E1,E2,AsDes,Tol,Standard_True);
EdgeInter(TopoDS::Face(aLocalShape),BAsurf,E1,E2,AsDes,Tol,Standard_True);
// EdgeInter(TopoDS::Face(F.Oriented(TopAbs_FORWARD)),E1,E2,AsDes,Tol,Standard_True);
}
it2LE.Next();
j++;
@@ -1463,6 +1465,7 @@ void BRepOffset_Inter2d::ConnexIntByInt
TopTools_DataMapOfShapeShape& MES,
const TopTools_DataMapOfShapeShape& Build,
const Handle(BRepAlgo_AsDes)& AsDes,
const Handle(BRepAlgo_AsDes)& AsDes2d,
const Standard_Real Offset,
const Standard_Real Tol)
// Modified by skv - Fri Dec 26 16:53:18 2003 OCC4455 End
@@ -1503,6 +1506,16 @@ void BRepOffset_Inter2d::ConnexIntByInt
TopoDS_Face FIO = TopoDS::Face(OFI.Face());
if (MES.IsBound(FIO)) FIO = TopoDS::Face(MES(FIO));
//
TopTools_MapOfShape aME;
const TopTools_ListOfShape& aLE = AsDes->Descendant(FIO);
TopTools_ListIteratorOfListOfShape aItLE(aLE);
for (; aItLE.More(); aItLE.Next()) {
const TopoDS_Shape& aE = aItLE.Value();
aME.Add(aE);
}
//
BRepAdaptor_Surface BAsurf(FIO);
TopExp_Explorer exp(FI.Oriented(TopAbs_FORWARD),TopAbs_WIRE);
for (; exp.More(); exp.Next()) {
@@ -1567,8 +1580,29 @@ void BRepOffset_Inter2d::ConnexIntByInt
TopExp_Explorer Exp1,Exp2;
for (Exp1.Init(NE1,TopAbs_EDGE) ; Exp1.More(); Exp1.Next()) {
for (Exp2.Init(NE2,TopAbs_EDGE) ; Exp2.More(); Exp2.Next()) {
RefEdgeInter(FIO,TopoDS::Edge(Exp1.Current()),TopoDS::Edge(Exp2.Current()),
AsDes,Tol,Standard_True/*Standard_False*/, Pref);
RefEdgeInter(FIO,BAsurf,TopoDS::Edge(Exp1.Current()),TopoDS::Edge(Exp2.Current()),
AsDes2d,Tol,Standard_True/*Standard_False*/, Pref);
}
}
//
if (Build.IsBound(Vref)) {
TopoDS_Shape NE3 = Build(Vref);
//
for (Exp2.Init(NE3,TopAbs_EDGE) ; Exp2.More(); Exp2.Next()) {
const TopoDS_Edge& aE3 = *(TopoDS_Edge*)&Exp2.Current();
if (!aME.Contains(aE3)) {
continue;
}
//
for (Exp1.Init(NE1,TopAbs_EDGE) ; Exp1.More(); Exp1.Next()) {
RefEdgeInter(FIO,BAsurf,TopoDS::Edge(Exp1.Current()),aE3,
AsDes2d,Tol,Standard_True/*Standard_False*/, Pref);
}
//
for (Exp1.Init(NE2,TopAbs_EDGE) ; Exp1.More(); Exp1.Next()) {
RefEdgeInter(FIO,BAsurf,TopoDS::Edge(Exp1.Current()),aE3,
AsDes2d,Tol,Standard_True/*Standard_False*/, Pref);
}
}
}
}
@@ -1576,18 +1610,15 @@ void BRepOffset_Inter2d::ConnexIntByInt
if (MES.IsBound(CEO)) {
TopoDS_Vertex V = CommonVertex(CEO,NEO);
UpdateVertex (V,CEO,TopoDS::Edge(MES(CEO)),Tol);
AsDes->Add (MES(CEO),V);
AsDes2d->Add (MES(CEO),V);
}
else if (MES.IsBound(NEO)) {
TopoDS_Vertex V = CommonVertex(CEO,NEO);
UpdateVertex (V,NEO,TopoDS::Edge(MES(NEO)),Tol);
AsDes->Add (MES(NEO),V);
AsDes2d->Add (MES(NEO),V);
}
}
CurE = NextE;
}
}
}

View File

@@ -40,6 +40,7 @@
#include <Extrema_ExtPC.hxx>
#include <TopTools_MapOfShape.hxx>
#include <Precision.hxx>
#include <GeomAPI_ProjectPointOnCurve.hxx>
@@ -97,110 +98,53 @@ static void ExtentEdge(const TopoDS_Face& /*F*/,
//function : SelectEdge
//purpose :
//=======================================================================
static void SelectEdge (const TopoDS_Face& /*F*/,
const TopoDS_Face& /*EF*/,
const TopoDS_Edge& E,
TopTools_ListOfShape& LInt)
static void SelectEdge (const TopoDS_Shape& theS,
TopTools_ListOfShape& theLE)
{
//------------------------------------------------------------
// Proofing on the intersections on periodical faces
//------------------------------------------------------------
TopTools_ListIteratorOfListOfShape it(LInt);
// Modified by Sergey KHROMOV - Wed Jun 5 11:43:04 2002 Begin
// Standard_Real dU = 1.0e100;
Standard_Real dU = RealLast();
// Modified by Sergey KHROMOV - Wed Jun 5 11:43:05 2002 End
TopoDS_Edge GE;
Standard_Real Fst, Lst, tmp;
BRep_Tool::Range(E, Fst, Lst);
BRepAdaptor_Curve Ad1(E);
gp_Pnt PFirst = Ad1.Value( Fst );
gp_Pnt PLast = Ad1.Value( Lst );
// Modified by Sergey KHROMOV - Wed Jun 5 11:23:10 2002 Begin
Extrema_ExtPC anExt;
// Modified by Sergey KHROMOV - Wed Jun 5 11:23:11 2002 End
//----------------------------------------------------------------------
// Selection of edge that coversmost of the domain of the initial edge.
//----------------------------------------------------------------------
for (; it.More(); it.Next()) {
const TopoDS_Edge& EI = TopoDS::Edge(it.Value());
BRep_Tool::Range(EI, Fst, Lst);
BRepAdaptor_Curve Ad2(EI);
// Modified by Sergey KHROMOV - Wed Jun 5 11:25:03 2002 Begin
Standard_Integer i;
Standard_Real aTol = BRep_Tool::Tolerance(EI);
Standard_Boolean isMinFound = Standard_False;
Standard_Real aSqrDist1 = Precision::Infinite();
Standard_Real aSqrDist2 = Precision::Infinite();
anExt.Initialize(Ad2, Fst, Lst, aTol);
// Seek for the min distance for PFirst:
anExt.Perform(PFirst);
if (anExt.IsDone()) {
for (i = 1; i <= anExt.NbExt(); i++) {
if (anExt.IsMin(i)) {
const gp_Pnt &aPMin = anExt.Point(i).Value();
aSqrDist1 = PFirst.SquareDistance(aPMin);
isMinFound = Standard_True;
break;
Standard_Real aT1, aT2, aDist, aDistMin;
TopExp_Explorer aExp;
TopTools_ListIteratorOfListOfShape aIt;
GeomAPI_ProjectPointOnCurve aProjPC;
gp_Pnt aPE1, aPE2;
TopoDS_Edge aRE;
//
aDistMin = RealLast();
//
aIt.Initialize(theLE);
for (; aIt.More(); aIt.Next()) {
const TopoDS_Edge& aE = *(TopoDS_Edge*)&aIt.Value();
//
const Handle(Geom_Curve)& aC = BRep_Tool::Curve(aE, aT1, aT2);
//
aProjPC.Init(aC, aT1, aT2);
aPE1 = aC->Value(aT1);
aPE2 = aC->Value(aT2);
//
aDist = 0.;
aExp.Init(theS, TopAbs_VERTEX);
for (; aExp.More(); aExp.Next()) {
const TopoDS_Vertex& aV = *(TopoDS_Vertex*)&aExp.Current();
const gp_Pnt aP = BRep_Tool::Pnt(aV);
//
aProjPC.Perform(aP);
if (aProjPC.NbPoints()) {
aDist += aProjPC.LowerDistance();
}
else {
aDist += Min(aP.Distance(aPE1), aP.Distance(aPE2));
}
}
}
if (!isMinFound) {
gp_Pnt aP1 = Ad2.Value(Fst);
gp_Pnt aP2 = Ad2.Value(Lst);
aSqrDist1 = Min(aP1.SquareDistance(PFirst), aP2.SquareDistance(PFirst));
}
// Seek for the min distance for PLast:
isMinFound = Standard_False;
anExt.Perform(PLast);
if (anExt.IsDone()) {
for (i = 1; i <= anExt.NbExt(); i++) {
if (anExt.IsMin(i)) {
const gp_Pnt &aPMin = anExt.Point(i).Value();
aSqrDist2 = PLast.SquareDistance(aPMin);
isMinFound = Standard_True;
break;
//
if (aDist < aDistMin) {
aDistMin = aDist;
aRE = aE;
}
}
}
if (!isMinFound) {
gp_Pnt aP1 = Ad2.Value(Fst);
gp_Pnt aP2 = Ad2.Value(Lst);
aSqrDist2 = Min(aP1.SquareDistance(PLast), aP2.SquareDistance(PLast));
}
tmp = aSqrDist1 + aSqrDist2;
// gp_Pnt P1 = Ad2.Value(Fst);
// gp_Pnt P2 = Ad2.Value(Lst);
// tmp = P1.Distance(PFirst) + P2.Distance(PLast);
if( tmp <= dU ) {
dU = tmp;
GE = EI;
}
// Modified by Sergey KHROMOV - Wed Jun 5 11:24:54 2002 End
}
LInt.Clear();
LInt.Append(GE);
//
theLE.Clear();
theLE.Append(aRE);
}
//=======================================================================
//function : CompletInt
//purpose :
@@ -300,13 +244,19 @@ void BRepOffset_Inter3d::FaceInter(const TopoDS_Face& F1,
// UNSUFFICIENT, but a larger criterion shakes too
// many sections.
//--------------------------------------------------------
if (InterFaces &&
BRepOffset_Tool::HasCommonShapes(TopoDS::Face(InitF1),
TopoDS::Face(InitF2),LE,LV))
if (!LE.IsEmpty())
if (InterFaces) {
if (BRepOffset_Tool::HasCommonShapes(TopoDS::Face(InitF1),
TopoDS::Face(InitF2),LE,LV)) {
if (!LE.IsEmpty()) {
BRepOffset_Tool::Inter3D (F1,F2,LInt1,LInt2,mySide,NullEdge);
}
}
else {
BRepOffset_Tool::Inter3D(F1,F2,LInt1,LInt2,mySide,NullEdge);
}
}
}
}
}
else {
if (InterPipes) {
@@ -476,31 +426,120 @@ void BRepOffset_Inter3d::ConnexIntByInt
TopTools_ListOfShape& Failed)
{
//TopExp_Explorer Exp(SI,TopAbs_EDGE);
TopTools_IndexedMapOfShape Emap;
TopExp::MapShapes( SI, TopAbs_EDGE, Emap );
TopTools_IndexedMapOfShape VEmap;
TopTools_IndexedDataMapOfShapeListOfShape aMVF;
TopoDS_Face F1,F2,OF1,OF2,NF1,NF2;
TopAbs_State CurSide = mySide;
BRep_Builder B;
TopTools_ListIteratorOfListOfShape it;
//for (; Exp.More(); Exp.Next()) {
for (Standard_Integer i = 1; i <= Emap.Extent(); i++) {
//const TopoDS_Edge& E = TopoDS::Edge(Exp.Current());
const TopoDS_Edge& E = TopoDS::Edge(Emap(i));
Standard_Boolean bEdge;
Standard_Integer i, aNb;
TopTools_ListIteratorOfListOfShape it, it1, itF1, itF2;
//
TopExp::MapShapes(SI, TopAbs_EDGE , VEmap);
TopExp::MapShapes(SI, TopAbs_VERTEX, VEmap);
TopExp::MapShapesAndAncestors(SI, TopAbs_VERTEX, TopAbs_FACE, aMVF);
//
aNb = VEmap.Extent();
for (i = 1; i <= aNb; ++i) {
const TopoDS_Shape& aS = VEmap(i);
//
TopoDS_Edge E;
TopTools_ListOfShape aLF1, aLF2;
//
bEdge = (aS.ShapeType() == TopAbs_EDGE);
if (bEdge) {
// faces connected by the edge
E = *(TopoDS_Edge*)&aS;
//
const BRepOffset_ListOfInterval& L = Analyse.Type(E);
if (!L.IsEmpty()) {
if (L.IsEmpty()) {
continue;
}
//
BRepOffset_Type OT = L.First().Type();
if (OT == BRepOffset_Convex || OT == BRepOffset_Concave) {
if (OT != BRepOffset_Convex && OT != BRepOffset_Concave) {
continue;
}
//
if (OT == BRepOffset_Concave) CurSide = TopAbs_IN;
else CurSide = TopAbs_OUT;
//-----------------------------------------------------------
// edge is of the proper type, return adjacent faces.
//-----------------------------------------------------------
const TopTools_ListOfShape& Anc = Analyse.Ancestors(E);
if (Anc.Extent() != 2) continue;
if (Anc.Extent() != 2) {
continue;
}
//
F1 = TopoDS::Face(Anc.First());
F2 = TopoDS::Face(Anc.Last ());
OF1 = TopoDS::Face(MapSF(F1).Face()); OF2 = TopoDS::Face(MapSF(F2).Face());
//
aLF1.Append(F1);
aLF2.Append(F2);
}
else {
// faces connected by the vertex
const TopTools_ListOfShape& aLF = aMVF.FindFromKey(aS);
if (aLF.Extent() < 2) {
continue;
}
//
Standard_Boolean bVertexOnly = Standard_False;
TopTools_MapOfShape aMFence;
//
it.Initialize(aLF);
for (; it.More(); it.Next()) {
const TopoDS_Face& aFV1 = *(TopoDS_Face*)&it.Value();
if (!aMFence.Add(aFV1)) {
continue;
}
//
TopTools_MapOfShape aME;
TopExp_Explorer aExp(aFV1, TopAbs_EDGE);
for (; aExp.More(); aExp.Next()) {
aME.Add(aExp.Current());
}
//
it1.Initialize(aLF);
for (it1.Next(); it1.More(); it1.Next()) {
const TopoDS_Face& aFV2 = *(TopoDS_Face*)&it1.Value();
if (aMFence.Contains(aFV2)) {
continue;
}
//
bVertexOnly = Standard_True;
aExp.Init(aFV2, TopAbs_EDGE);
for (; aExp.More(); aExp.Next()) {
const TopoDS_Shape& aEV2 = aExp.Current();
if (aME.Contains(aEV2)) {
bVertexOnly = Standard_False;
break;
}
}
//
if (bVertexOnly) {
aLF1.Append(aFV1);
aLF2.Append(aFV2);
aMFence.Add(aFV2);
}
}
}
//
if (aLF1.IsEmpty()) {
continue;
}
//
CurSide = mySide;
}
//
itF1.Initialize(aLF1);
itF2.Initialize(aLF2);
for (; itF1.More() && itF2.More(); itF1.Next(), itF2.Next()) {
F1 = TopoDS::Face(itF1.Value());
F2 = TopoDS::Face(itF2.Value());
//
OF1 = TopoDS::Face(MapSF(F1).Face());
OF2 = TopoDS::Face(MapSF(F2).Face());
if (!MES.IsBound(OF1)) {
Standard_Boolean enlargeU = Standard_True;
Standard_Boolean enlargeVfirst = Standard_True, enlargeVlast = Standard_True;
@@ -511,6 +550,7 @@ void BRepOffset_Inter3d::ConnexIntByInt
else {
NF1 = TopoDS::Face(MES(OF1));
}
//
if (!MES.IsBound(OF2)) {
Standard_Boolean enlargeU = Standard_True;
Standard_Boolean enlargeVfirst = Standard_True, enlargeVlast = Standard_True;
@@ -521,27 +561,41 @@ void BRepOffset_Inter3d::ConnexIntByInt
else {
NF2 = TopoDS::Face(MES(OF2));
}
//
if (!IsDone(NF1,NF2)) {
TopTools_ListOfShape LInt1,LInt2;
BRepOffset_Tool::Inter3D (NF1,NF2,LInt1,LInt2,CurSide,E,Standard_True);
if (LInt1.Extent() > 1)
{
BRepOffset_Tool::Inter3D (NF1,NF2,LInt1,LInt2,CurSide,E,bEdge);
if (LInt1.Extent() > 1) {
// intersection is in seceral edges (free sewing)
SelectEdge( NF1, NF2, E, LInt1 );
SelectEdge( NF1, NF2, E, LInt2 );
SelectEdge(aS, LInt1);
SelectEdge(aS, LInt2);
}
SetDone(NF1,NF2);
if (!LInt1.IsEmpty()) {
Store (NF1,NF2,LInt1,LInt2);
//
TopoDS_Compound C;
B.MakeCompound(C);
for (it.Initialize(LInt1) ; it.More(); it.Next()) {
B.Add(C,it.Value());
//
if (Build.IsBound(aS)) {
const TopoDS_Shape& aSE = Build(aS);
TopExp_Explorer aExp(aSE, TopAbs_EDGE);
for (; aExp.More(); aExp.Next()) {
const TopoDS_Shape& aNE = aExp.Current();
B.Add(C, aNE);
}
Build.Bind(E,C);
}
//
it.Initialize(LInt1);
for (; it.More(); it.Next()) {
const TopoDS_Shape& aNE = it.Value();
B.Add(C, aNE);
}
//
Build.Bind(aS,C);
}
else {
Failed.Append(E);
Failed.Append(aS);
}
} else { // IsDone(NF1,NF2)
// Modified by skv - Fri Dec 26 12:20:13 2003 OCC4455 Begin
@@ -550,30 +604,36 @@ void BRepOffset_Inter3d::ConnexIntByInt
if (!aLInt1.IsEmpty()) {
TopoDS_Compound C;
TopTools_ListIteratorOfListOfShape anIt2;
B.MakeCompound(C);
//
if (Build.IsBound(aS)) {
const TopoDS_Shape& aSE = Build(aS);
TopExp_Explorer aExp(aSE, TopAbs_EDGE);
for (; aExp.More(); aExp.Next()) {
const TopoDS_Shape& aNE = aExp.Current();
B.Add(C, aNE);
}
}
//
for (it.Initialize(aLInt1) ; it.More(); it.Next()) {
const TopoDS_Shape &anE1 = it.Value();
for (anIt2.Initialize(aLInt2) ; anIt2.More(); anIt2.Next()) {
const TopoDS_Shape &anE2 = anIt2.Value();
//
for (it1.Initialize(aLInt2) ; it1.More(); it1.Next()) {
const TopoDS_Shape &anE2 = it1.Value();
if (anE1.IsSame(anE2))
B.Add(C, anE1);
}
}
Build.Bind(E,C);
Build.Bind(aS,C);
}
else {
Failed.Append(E);
Failed.Append(aS);
}
}
}
// Modified by skv - Fri Dec 26 12:20:14 2003 OCC4455 End
}
}
}
}
//=======================================================================
@@ -597,10 +657,12 @@ void BRepOffset_Inter3d::ContextIntByInt
TopoDS_Edge OE;
TopoDS_Compound C;
BRep_Builder B;
TopTools_ListIteratorOfListOfShape it;
Standard_Integer i;
TopTools_ListIteratorOfListOfShape it, itF;
Standard_Integer i, j, aNb, aNbVE;
Standard_Boolean bEdge;
for (i = 1; i <= ContextFaces.Extent(); i++) {
aNb = ContextFaces.Extent();
for (i = 1; i <= aNb; i++) {
const TopoDS_Face& CF = TopoDS::Face(ContextFaces(i));
myTouched.Add(CF);
if (ExtentContext) {
@@ -610,14 +672,28 @@ void BRepOffset_Inter3d::ContextIntByInt
}
TopAbs_State Side = TopAbs_OUT;
for (i = 1; i <= ContextFaces.Extent(); i++) {
for (i = 1; i <= aNb; i++) {
const TopoDS_Face& CF = TopoDS::Face(ContextFaces(i));
if (ExtentContext) WCF = TopoDS::Face(MES(CF));
else WCF = CF;
for (exp.Init(CF.Oriented(TopAbs_FORWARD),TopAbs_EDGE);
exp.More(); exp.Next()) {
const TopoDS_Edge& E = TopoDS::Edge(exp.Current());
TopTools_IndexedMapOfShape VEmap;
TopExp::MapShapes(CF.Oriented(TopAbs_FORWARD), TopAbs_EDGE , VEmap);
TopExp::MapShapes(CF.Oriented(TopAbs_FORWARD), TopAbs_VERTEX, VEmap);
//
aNbVE = VEmap.Extent();
for (j = 1; j <= aNbVE; ++j) {
const TopoDS_Shape& aS = VEmap(j);
//
bEdge = (aS.ShapeType() == TopAbs_EDGE);
//
TopoDS_Edge E;
TopTools_ListOfShape Anc;
//
if (bEdge) {
// faces connected by the edge
//
E = *(TopoDS_Edge*)&aS;
if (!Analyse.HasAncestor(E)) {
//----------------------------------------------------------------
// the edges of faces of context that are not in the initial shape
@@ -659,8 +735,48 @@ void BRepOffset_Inter3d::ContextIntByInt
}
continue;
}
const TopTools_ListOfShape& Anc = Analyse.Ancestors(E);
const TopoDS_Face& F = TopoDS::Face(Anc.First());
Anc = Analyse.Ancestors(E);
}
else {
// faces connected by the vertex
//
if (!Analyse.HasAncestor(aS)) {
continue;
}
//
const TopTools_ListOfShape& aLE = Analyse.Ancestors(aS);
it.Initialize(aLE);
for (; it.More(); it.Next()) {
const TopoDS_Edge& aE = *(TopoDS_Edge*)&it.Value();
//
if (BRep_Tool::Degenerated(aE)) {
continue;
}
//
if (VEmap.Contains(aE)) {
continue;
}
//
const TopTools_ListOfShape& aLF = Analyse.Ancestors(aE);
itF.Initialize(aLF);
for (; itF.More(); itF.Next()) {
const TopoDS_Shape& aF = itF.Value();
Standard_Boolean bAdd = Standard_True;
exp.Init(aF, TopAbs_EDGE);
for (; exp.More() && bAdd; exp.Next()) {
const TopoDS_Shape& aEF = exp.Current();
bAdd = !VEmap.Contains(aEF);
}
if (bAdd) {
Anc.Append(aF);
}
}
}
}
//
itF.Initialize(Anc);
for (; itF.More(); itF.Next()) {
const TopoDS_Face& F = TopoDS::Face(itF.Value());
OF = TopoDS::Face(MapSF(F).Face());
TopoDS_Shape aLocalShape = MapSF(F).Generated(E);
OE = TopoDS::Edge(aLocalShape);
@@ -676,23 +792,33 @@ void BRepOffset_Inter3d::ContextIntByInt
TopTools_ListOfShape LInt1,LInt2;
TopTools_ListOfShape LOE;
LOE.Append(OE);
BRepOffset_Tool::Inter3D (WCF,NF,LInt1,LInt2,Side,E,Standard_True);
BRepOffset_Tool::Inter3D (WCF,NF,LInt1,LInt2,Side,E,bEdge);
SetDone(NF,CF);
if (!LInt1.IsEmpty()) {
Store (CF,NF,LInt1,LInt2);
if (LInt1.Extent() == 1) {
Build.Bind(E,LInt1.First());
if ((LInt1.Extent() == 1) && !Build.IsBound(aS)) {
Build.Bind(aS,LInt1.First());
}
else {
B.MakeCompound(C);
if (Build.IsBound(aS)) {
const TopoDS_Shape& aSE = Build(aS);
exp.Init(aSE, TopAbs_EDGE);
for (; exp.More(); exp.Next()) {
const TopoDS_Shape& aNE = exp.Current();
B.Add(C, aNE);
}
}
//
for (it.Initialize(LInt1) ; it.More(); it.Next()) {
B.Add(C,it.Value());
}
Build.Bind(E,C);
Build.Bind(aS,C);
}
}
else {
Failed.Append(E);
Failed.Append(aS);
}
}
}
}

View File

@@ -37,6 +37,8 @@ uses
MapOfShape from TopTools,
IndexedMapOfShape from TopTools,
ListOfShape from TopTools,
DataMapOfShapeShape from TopTools,
IndexedDataMapOfShapeListOfShape from TopTools,
MakeLoops from BRepOffset
is
@@ -50,7 +52,9 @@ is
Intersection : Boolean from Standard = Standard_False;
SelfInter : Boolean from Standard = Standard_False;
Join : JoinType from GeomAbs = GeomAbs_Arc;
Thickening : Boolean from Standard = Standard_False)
RemoveIntEdges : Boolean from Standard = Standard_False;
Thickening : Boolean from Standard = Standard_False;
RemoveInvalidFaces: Boolean from Standard = Standard_False)
returns MakeOffset from BRepOffset;
---Category: Initialization.
@@ -63,7 +67,9 @@ is
Intersection : Boolean from Standard = Standard_False;
SelfInter : Boolean from Standard = Standard_False;
Join : JoinType from GeomAbs = GeomAbs_Arc;
Thickening : Boolean from Standard = Standard_False)
RemoveIntEdges : Boolean from Standard = Standard_False;
Thickening : Boolean from Standard = Standard_False;
RemoveInvalidFaces: Boolean from Standard = Standard_False)
is static;
Clear (me : in out)
@@ -157,6 +163,18 @@ is
BuildOffsetByInter ( me : in out )
is static private;
BuildSplitsOfFaces (me:in out;
theLF : ListOfShape from TopTools;
theAsDes : AsDes from BRepAlgo;
theOrMap : out IndexedDataMapOfShapeListOfShape from TopTools;
theImage : out Image from BRepAlgo;
theLFail : out ListOfShape from TopTools;
bLimited : Boolean from Standard)
is static private;
---Purpose:
-- Building splits of the offset faces by the section curves
-- between the neighboring faces.
SelfInter (me : in out ;
Modif : in out MapOfShape from TopTools)
is static private;
@@ -210,6 +228,10 @@ is
---Purpose: Private method used to build walls for thickening the shell
is static private;
RemoveInternalEdges (me: in out)
---Purpose: Removes INTERNAL edges from the faces
is static private;
fields
myOffset : Real from Standard;
@@ -219,7 +241,9 @@ fields
myInter : Boolean from Standard;
mySelfInter : Boolean from Standard;
myJoin : JoinType from GeomAbs;
myRemoveIntEdges : Boolean from Standard;
myThickening : Boolean from Standard;
myRemoveInvalidFaces : Boolean from Standard;
myFaceOffset : DataMapOfShapeReal from TopTools;
@@ -240,5 +264,4 @@ fields
myBadShape : Shape from TopoDS;
myIsPerformSewing: Boolean from Standard; -- Handle bad walls in thicksolid mode.
end MakeOffset;

File diff suppressed because it is too large Load Diff

View File

@@ -46,7 +46,8 @@ is
Mode : Mode from BRepOffset = BRepOffset_Skin;
Intersection : Boolean from Standard = Standard_False;
SelfInter : Boolean from Standard = Standard_False;
Join : JoinType from GeomAbs = GeomAbs_Arc)
Join : JoinType from GeomAbs = GeomAbs_Arc;
RemoveIntEdges:Boolean from Standard = Standard_False)
---Purpose: Constructs a shape parallel to the shape S, where
-- - S may be a face, a shell, a solid or a compound of these shape kinds;
-- - Offset is the offset value. The offset shape is constructed:
@@ -82,6 +83,8 @@ is
-- - if Join is equal to GeomAbs_Intersection, then the parallels to the
-- two adjacent faces are enlarged and intersected,
-- so that there are no free edges on parallels to faces.
-- RemoveIntEdges flag defines whether to remove the INTERNAL edges
-- from the result or not.
-- Warnings
-- 1. All the faces of the shape S should be based on the surfaces
-- with continuity at least C1.

View File

@@ -43,9 +43,11 @@ BRepOffsetAPI_MakeOffsetShape::BRepOffsetAPI_MakeOffsetShape
const BRepOffset_Mode Mode,
const Standard_Boolean Intersection,
const Standard_Boolean SelfInter,
const GeomAbs_JoinType Join)
const GeomAbs_JoinType Join,
const Standard_Boolean RemoveIntEdges)
{
myOffsetShape.Initialize (S,Offset,Tol,Mode,Intersection,SelfInter,Join);
myOffsetShape.Initialize (S,Offset,Tol,Mode,Intersection,SelfInter,
Join, RemoveIntEdges);
Build();
}

View File

@@ -53,7 +53,8 @@ is
Mode : Mode from BRepOffset = BRepOffset_Skin;
Intersection : Boolean from Standard = Standard_False;
SelfInter : Boolean from Standard = Standard_False;
Join : JoinType from GeomAbs = GeomAbs_Arc)
Join : JoinType from GeomAbs = GeomAbs_Arc;
RemoveIntEdges : Boolean from Standard = Standard_False)
---Purpose: Constructs a hollowed solid from
-- the solid S by removing the set of faces ClosingFaces from S, where:
-- Offset defines the thickness of the walls. Its sign indicates
@@ -88,6 +89,8 @@ is
-- then the parallels to the two adjacent faces are
-- enlarged and intersected, so that there are no free
-- edges on parallels to faces.
-- - RemoveIntEdges flag defines whether to remove the INTERNAL edges
-- from the result or not.
-- Warnings
-- Since the algorithm of MakeThickSolid is based on
-- MakeOffsetShape algorithm, the warnings are the same as for

View File

@@ -44,9 +44,11 @@ BRepOffsetAPI_MakeThickSolid::BRepOffsetAPI_MakeThickSolid
const BRepOffset_Mode Mode,
const Standard_Boolean Intersection,
const Standard_Boolean SelfInter,
const GeomAbs_JoinType Join)
const GeomAbs_JoinType Join,
const Standard_Boolean RemoveIntEdges)
{
myOffsetShape.Initialize (S,Offset,Tol,Mode,Intersection,SelfInter,Join);
myOffsetShape.Initialize (S,Offset,Tol,Mode,Intersection,SelfInter,
Join, RemoveIntEdges);
TopTools_ListIteratorOfListOfShape it(ClosingFaces);
for (; it.More(); it.Next()) {
myOffsetShape.AddFace(TopoDS::Face(it.Value()));

View File

@@ -829,7 +829,7 @@ Standard_Integer thickshell(Draw_Interpretor& ,
Tol = Draw::Atof(a[5]);
BRepOffset_MakeOffset B;
B.Initialize(S,Of,Tol,BRepOffset_Skin,Inter,0,JT, Standard_True);
B.Initialize(S,Of,Tol,BRepOffset_Skin,Inter,0,JT, Standard_False, Standard_True);
// Clock.Start();
@@ -907,56 +907,66 @@ static Standard_Boolean theYaBouchon;
static Standard_Real TheTolerance = Precision::Confusion();
static Standard_Boolean TheInter = Standard_False;
static GeomAbs_JoinType TheJoin = GeomAbs_Arc;
static Standard_Boolean RemoveIntEdges = Standard_False;
static Standard_Boolean RemoveInvalidFaces = Standard_False;
Standard_Integer offsetparameter(Draw_Interpretor& di,
Standard_Integer n, const char** a)
{
if ( n == 1 ) {
//cout << " OffsetParameter Tol Inter(c/p) JoinType(a/i)" << endl;
//cout << " Current Values" << endl;
//cout << " --> Tolerance :" << TheTolerance << endl;
//cout << " --> TheInter :";
di << " OffsetParameter Tol Inter(c/p) JoinType(a/i)" << "\n";
di << " OffsetParameter Tol Inter(c/p) JoinType(a/i/t) [RemoveInternalEdges(r/k) RemoveInvalidFaces(r/k)]" << "\n";
di << " Current Values" << "\n";
di << " --> Tolerance :" << TheTolerance << "\n";
di << " --> TheInter :";
di << " --> Tolerance : " << TheTolerance << "\n";
di << " --> TheInter : ";
if ( TheInter) {
//cout << "Complet" ;
di << "Complet" ;
} else {
//cout << "Partial";
di << "Partial";
}
//cout << endl << " --> TheJoin :";
di << "\n" << " --> TheJoin :";
di << "\n" << " --> TheJoin : ";
switch (TheJoin) {
//case GeomAbs_Arc: cout << " Arc"; break;
//case GeomAbs_Intersection: cout << " Intersection"; break;
case GeomAbs_Arc: di << " Arc"; break;
case GeomAbs_Intersection: di << " Intersection"; break;
case GeomAbs_Arc: di << "Arc"; break;
case GeomAbs_Intersection: di << "Intersection"; break;
default:
break ;
}
//cout << endl;
//
di << "\n" << " --> Internal Edges : ";
if (RemoveIntEdges) {
di << "Remove";
}
else {
di << "Keep";
}
//
di << "\n" << " --> Invalid Faces : ";
if (RemoveInvalidFaces) {
di << "Remove";
}
else {
di << "Keep";
}
di << "\n";
//
return 0;
}
if ( n < 4 ) return 1;
//
TheTolerance = Draw::Atof(a[1]);
TheInter = strcmp(a[2],"p");
//
if ( !strcmp(a[3],"a")) TheJoin = GeomAbs_Arc;
else if ( !strcmp(a[3],"i")) TheJoin = GeomAbs_Intersection;
else if ( !strcmp(a[3],"t")) TheJoin = GeomAbs_Tangent;
//
RemoveIntEdges = (n >= 5) ? !strcmp(a[4], "r") : Standard_False;
RemoveInvalidFaces = (n == 6) ? !strcmp(a[5], "r") : Standard_False;
//
return 0;
}
//=======================================================================
//function : offsetinit
//purpose :
@@ -973,7 +983,8 @@ Standard_Integer offsetload(Draw_Interpretor& ,
TheRadius = Of;
// Standard_Boolean Inter = Standard_True;
TheOffset.Initialize(S,Of,TheTolerance,BRepOffset_Skin,TheInter,0,TheJoin);
TheOffset.Initialize(S,Of,TheTolerance,BRepOffset_Skin,TheInter,0,TheJoin,
RemoveIntEdges,Standard_False,RemoveInvalidFaces);
//------------------------------------------
// recuperation et chargement des bouchons.
//----------------------------------------