mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-04-10 18:51:21 +03:00
0023270: Wrong result done by boolean operation algorithm for cylinder and torus.
fix for the bug v3.0 Total: 14 modified files: src\BOP\BOP_CorrectTolerances.cdl src\BOP\BOP_CorrectTolerances.cxx src\BOP\BOP_Section.cxx src\BOP\BOP_ShellShell.cxx src\BOP\BOP_ShellSolid.cxx src\BOP\BOP_ShellSplitter.cxx src\BOP\BOP_SolidSolid.cxx src\BOP\BOP_WireShell.cxx src\BOP\BOP_WireSolid.cxx src\BOP\BOP_WireWire.cxx src\BOPTools\BOPTools_PaveFiller.cdl src\BOPTools\BOPTools_PaveFiller_3.cxx src\BOPTools\FILES src\BOPTools\BOPTools_PaveFiller_5.cxx Rebased on current master.
This commit is contained in:
parent
dfa3d64f55
commit
295cec28fe
@ -31,25 +31,18 @@ uses
|
|||||||
|
|
||||||
is
|
is
|
||||||
CorrectTolerances (myclass;
|
CorrectTolerances (myclass;
|
||||||
aS: Shape from TopoDS;
|
aS: Shape from TopoDS);
|
||||||
aTolMax: Real from Standard =0.0001);
|
|
||||||
---Purpose:
|
---Purpose:
|
||||||
--- Provides valid values of tolerances for the shape <aS>
|
--- Provides valid values of tolerances for the shape <aS>
|
||||||
--- <aTolMax> is max value of the tolerance that can be
|
|
||||||
--- accepted for correction. If real value of the tolerance
|
|
||||||
--- will be greater than <aTolMax>, the correction does not
|
|
||||||
--- perform.
|
|
||||||
---
|
|
||||||
CorrectCurveOnSurface (myclass;
|
CorrectCurveOnSurface (myclass;
|
||||||
aS: Shape from TopoDS;
|
aS: Shape from TopoDS);
|
||||||
aTolMax: Real from Standard =0.0001);
|
|
||||||
---Purpose:
|
---Purpose:
|
||||||
--- Provides valid values of tolerances for the shape <aS>
|
--- Provides valid values of tolerances for the shape <aS>
|
||||||
--- in terms of BRepCheck_InvalidCurveOnSurface.
|
--- in terms of BRepCheck_InvalidCurveOnSurface.
|
||||||
---
|
---
|
||||||
CorrectPointOnCurve (myclass;
|
CorrectPointOnCurve (myclass;
|
||||||
aS: Shape from TopoDS;
|
aS: Shape from TopoDS);
|
||||||
aTolMax: Real from Standard =0.0001);
|
|
||||||
---Purpose:
|
---Purpose:
|
||||||
--- Provides valid values of tolerances for the shape <aS>
|
--- Provides valid values of tolerances for the shape <aS>
|
||||||
--- in terms of BRepCheck_InvalidPointOnCurve.
|
--- in terms of BRepCheck_InvalidPointOnCurve.
|
||||||
|
@ -70,12 +70,10 @@
|
|||||||
|
|
||||||
|
|
||||||
static
|
static
|
||||||
void CheckEdge (const TopoDS_Edge& E,
|
void CheckEdge (const TopoDS_Edge& E);
|
||||||
const Standard_Real aMaxTol);
|
|
||||||
static
|
static
|
||||||
void CorrectEdgeTolerance (const TopoDS_Edge& myShape,
|
void CorrectEdgeTolerance (const TopoDS_Edge& myShape,
|
||||||
const TopoDS_Face& S,
|
const TopoDS_Face& S);
|
||||||
const Standard_Real aMaxTol);
|
|
||||||
static
|
static
|
||||||
Standard_Boolean Validate(const Adaptor3d_Curve& CRef,
|
Standard_Boolean Validate(const Adaptor3d_Curve& CRef,
|
||||||
const Adaptor3d_Curve& Other,
|
const Adaptor3d_Curve& Other,
|
||||||
@ -87,24 +85,20 @@ static
|
|||||||
static
|
static
|
||||||
void CorrectVertexTolerance(const TopoDS_Edge& aE);
|
void CorrectVertexTolerance(const TopoDS_Edge& aE);
|
||||||
//
|
//
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
// Function : CorrectTolerances
|
// Function : CorrectTolerances
|
||||||
// purpose :
|
// purpose :
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
void BOP_CorrectTolerances::CorrectTolerances(const TopoDS_Shape& aShape,
|
void BOP_CorrectTolerances::CorrectTolerances(const TopoDS_Shape& aShape)
|
||||||
const Standard_Real aMaxTol)
|
|
||||||
{
|
{
|
||||||
BOP_CorrectTolerances::CorrectPointOnCurve(aShape, aMaxTol);
|
BOP_CorrectTolerances::CorrectPointOnCurve(aShape);
|
||||||
BOP_CorrectTolerances::CorrectCurveOnSurface(aShape, aMaxTol);
|
BOP_CorrectTolerances::CorrectCurveOnSurface(aShape);
|
||||||
}
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
// Function : CorrectPointOnCurve
|
// Function : CorrectPointOnCurve
|
||||||
// purpose :
|
// purpose :
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
void BOP_CorrectTolerances::CorrectPointOnCurve(const TopoDS_Shape& S,
|
void BOP_CorrectTolerances::CorrectPointOnCurve(const TopoDS_Shape& S)
|
||||||
const Standard_Real aMaxTol)
|
|
||||||
{
|
{
|
||||||
Standard_Integer i, aNb;
|
Standard_Integer i, aNb;
|
||||||
TopTools_IndexedMapOfShape Edges;
|
TopTools_IndexedMapOfShape Edges;
|
||||||
@ -112,7 +106,7 @@ static
|
|||||||
aNb=Edges.Extent();
|
aNb=Edges.Extent();
|
||||||
for (i=1; i<=aNb; i++) {
|
for (i=1; i<=aNb; i++) {
|
||||||
const TopoDS_Edge& E= TopoDS::Edge(Edges(i));
|
const TopoDS_Edge& E= TopoDS::Edge(Edges(i));
|
||||||
CheckEdge(E, aMaxTol);
|
CheckEdge(E);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -120,8 +114,7 @@ static
|
|||||||
// Function : CorrectCurveOnSurface
|
// Function : CorrectCurveOnSurface
|
||||||
// purpose :
|
// purpose :
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
void BOP_CorrectTolerances::CorrectCurveOnSurface(const TopoDS_Shape& S,
|
void BOP_CorrectTolerances::CorrectCurveOnSurface(const TopoDS_Shape& S)
|
||||||
const Standard_Real aMaxTol)
|
|
||||||
{
|
{
|
||||||
Standard_Integer i, aNbFaces, j, aNbEdges;
|
Standard_Integer i, aNbFaces, j, aNbEdges;
|
||||||
TopTools_IndexedMapOfShape Faces;
|
TopTools_IndexedMapOfShape Faces;
|
||||||
@ -135,7 +128,7 @@ static
|
|||||||
aNbEdges=Edges.Extent();
|
aNbEdges=Edges.Extent();
|
||||||
for (j=1; j<=aNbEdges; j++) {
|
for (j=1; j<=aNbEdges; j++) {
|
||||||
const TopoDS_Edge& E= TopoDS::Edge(Edges(j));
|
const TopoDS_Edge& E= TopoDS::Edge(Edges(j));
|
||||||
CorrectEdgeTolerance (E, F, aMaxTol);
|
CorrectEdgeTolerance (E, F);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -145,8 +138,7 @@ static
|
|||||||
// purpose : Correct tolerances for Edge
|
// purpose : Correct tolerances for Edge
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
void CorrectEdgeTolerance (const TopoDS_Edge& myShape,
|
void CorrectEdgeTolerance (const TopoDS_Edge& myShape,
|
||||||
const TopoDS_Face& S,
|
const TopoDS_Face& S)
|
||||||
const Standard_Real aMaxTol)
|
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
// 1. Minimum of conditions to Perform
|
// 1. Minimum of conditions to Perform
|
||||||
@ -280,21 +272,16 @@ void CorrectEdgeTolerance (const TopoDS_Edge& myShape,
|
|||||||
Adaptor3d_CurveOnSurface ACS(GHPC,GAHS);
|
Adaptor3d_CurveOnSurface ACS(GHPC,GAHS);
|
||||||
ok = Validate(myHCurve->Curve(), ACS, Tol, SameParameter, aNewTol);
|
ok = Validate(myHCurve->Curve(), ACS, Tol, SameParameter, aNewTol);
|
||||||
if (ok) {
|
if (ok) {
|
||||||
if (cr->IsCurveOnClosedSurface()) {
|
//modified by NIZNHY-PKV Thu Sep 27 10:28:27 2012f
|
||||||
//return ;// BRepCheck::Add(lst,BRepCheck_InvalidCurveOnClosedSurface);
|
TE->UpdateTolerance(aNewTol+Delta);
|
||||||
}
|
CorrectVertexTolerance(myShape);
|
||||||
else {
|
/*
|
||||||
//return;//BRepCheck::Add(lst,BRepCheck_InvalidCurveOnSurface);
|
|
||||||
}
|
|
||||||
if (SameParameter) {
|
|
||||||
//return;//BRepCheck::Add(lst,BRepCheck_InvalidSameParameterFlag);
|
|
||||||
}
|
|
||||||
//
|
|
||||||
if (aNewTol<aMaxTol) {
|
if (aNewTol<aMaxTol) {
|
||||||
TE->UpdateTolerance(aNewTol+Delta);
|
TE->UpdateTolerance(aNewTol+Delta);
|
||||||
//
|
|
||||||
CorrectVertexTolerance(myShape);
|
CorrectVertexTolerance(myShape);
|
||||||
}
|
//}
|
||||||
|
*/
|
||||||
|
//modified by NIZNHY-PKV Thu Sep 27 10:28:44 2012t
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cr->IsCurveOnClosedSurface()) {
|
if (cr->IsCurveOnClosedSurface()) {
|
||||||
@ -304,14 +291,16 @@ void CorrectEdgeTolerance (const TopoDS_Edge& myShape,
|
|||||||
ACS.Load(GHPC); // meme remarque...
|
ACS.Load(GHPC); // meme remarque...
|
||||||
ok = Validate(myHCurve->Curve(),ACS,Tol,SameParameter, aNewTol);
|
ok = Validate(myHCurve->Curve(),ACS,Tol,SameParameter, aNewTol);
|
||||||
if (ok) {
|
if (ok) {
|
||||||
//return;//BRepCheck::Add(lst,BRepCheck_InvalidCurveOnClosedSurface);
|
//modified by NIZNHY-PKV Thu Sep 27 10:33:36 2012f
|
||||||
if (SameParameter) {
|
TE->UpdateTolerance(aNewTol+Delta);
|
||||||
//return;//BRepCheck::Add(lst,BRepCheck_InvalidSameParameterFlag);
|
CorrectVertexTolerance(myShape);
|
||||||
}
|
/*
|
||||||
if (aNewTol<aMaxTol) {
|
if (aNewTol<aMaxTol) {
|
||||||
TE->UpdateTolerance(aNewTol+Delta);
|
TE->UpdateTolerance(aNewTol+Delta);
|
||||||
CorrectVertexTolerance(myShape);
|
CorrectVertexTolerance(myShape);
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
//modified by NIZNHY-PKV Thu Sep 27 10:34:00 2012t
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -329,7 +318,7 @@ void CorrectEdgeTolerance (const TopoDS_Edge& myShape,
|
|||||||
P = Handle(Geom_Plane)::DownCast(Su);
|
P = Handle(Geom_Plane)::DownCast(Su);
|
||||||
}
|
}
|
||||||
if (P.IsNull()) { // not a plane
|
if (P.IsNull()) { // not a plane
|
||||||
return;//BRepCheck::Add(lst,BRepCheck_NoCurveOnSurface);
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
else {// on fait la projection a la volee, comme BRep_Tool
|
else {// on fait la projection a la volee, comme BRep_Tool
|
||||||
@ -355,11 +344,15 @@ void CorrectEdgeTolerance (const TopoDS_Edge& myShape,
|
|||||||
Standard_Boolean okx = Validate(myHCurve->Curve(),ACS,
|
Standard_Boolean okx = Validate(myHCurve->Curve(),ACS,
|
||||||
Tol,Standard_True, aNewTol); // voir dub...
|
Tol,Standard_True, aNewTol); // voir dub...
|
||||||
if (okx) {
|
if (okx) {
|
||||||
//return;//BRepCheck::Add(lst,BRepCheck_InvalidCurveOnSurface);
|
//modified by NIZNHY-PKV Thu Sep 27 10:34:10 2012f
|
||||||
|
TE->UpdateTolerance(aNewTol+Delta);
|
||||||
|
CorrectVertexTolerance(myShape);
|
||||||
|
/*
|
||||||
if (aNewTol<aMaxTol) {
|
if (aNewTol<aMaxTol) {
|
||||||
TE->UpdateTolerance(aNewTol+Delta);
|
TE->UpdateTolerance(aNewTol+Delta);
|
||||||
CorrectVertexTolerance(myShape);
|
CorrectVertexTolerance(myShape);
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -515,7 +508,7 @@ Standard_Boolean Validate(const Adaptor3d_Curve& CRef,
|
|||||||
// Function : CheckEdge
|
// Function : CheckEdge
|
||||||
// purpose : Correct tolerances for Vertices on Edge
|
// purpose : Correct tolerances for Vertices on Edge
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
void CheckEdge (const TopoDS_Edge& Ed, const Standard_Real aMaxTol)
|
void CheckEdge (const TopoDS_Edge& Ed)
|
||||||
{
|
{
|
||||||
TopoDS_Edge E=Ed;
|
TopoDS_Edge E=Ed;
|
||||||
E.Orientation(TopAbs_FORWARD);
|
E.Orientation(TopAbs_FORWARD);
|
||||||
@ -559,8 +552,12 @@ void CheckEdge (const TopoDS_Edge& Ed, const Standard_Real aMaxTol)
|
|||||||
aD2=prep.SquareDistance(Controlp);
|
aD2=prep.SquareDistance(Controlp);
|
||||||
if (aD2 > Tol) {
|
if (aD2 > Tol) {
|
||||||
aNewTolerance=sqrt(aD2)+dd;
|
aNewTolerance=sqrt(aD2)+dd;
|
||||||
|
//modified by NIZNHY-PKV Thu Sep 27 10:34:41 2012f
|
||||||
|
TV->UpdateTolerance(aNewTolerance);
|
||||||
|
/*
|
||||||
if (aNewTolerance<aMaxTol)
|
if (aNewTolerance<aMaxTol)
|
||||||
TV->UpdateTolerance(aNewTolerance);
|
TV->UpdateTolerance(aNewTolerance);
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
itpr.Next();
|
itpr.Next();
|
||||||
@ -580,8 +577,13 @@ void CheckEdge (const TopoDS_Edge& Ed, const Standard_Real aMaxTol)
|
|||||||
|
|
||||||
if (aD2 > Tol) {
|
if (aD2 > Tol) {
|
||||||
aNewTolerance=sqrt(aD2)+dd;
|
aNewTolerance=sqrt(aD2)+dd;
|
||||||
|
//modified by NIZNHY-PKV Thu Sep 27 10:34:55 2012f
|
||||||
|
TV->UpdateTolerance(aNewTolerance);
|
||||||
|
/*
|
||||||
if (aNewTolerance<aMaxTol)
|
if (aNewTolerance<aMaxTol)
|
||||||
TV->UpdateTolerance(aNewTolerance);
|
TV->UpdateTolerance(aNewTolerance);
|
||||||
|
*/
|
||||||
|
//modified by NIZNHY-PKV Thu Sep 27 10:35:01 2012t
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -269,7 +269,7 @@ BOP_Section::BOP_Section()
|
|||||||
mySectionEdges.Append(aS);
|
mySectionEdges.Append(aS);
|
||||||
}
|
}
|
||||||
myResult=aCompound;
|
myResult=aCompound;
|
||||||
BOP_CorrectTolerances::CorrectTolerances(myResult, 0.01);
|
BOP_CorrectTolerances::CorrectTolerances(myResult);
|
||||||
//
|
//
|
||||||
if (!myErrorStatus) {
|
if (!myErrorStatus) {
|
||||||
FillModified();
|
FillModified();
|
||||||
|
@ -65,7 +65,6 @@
|
|||||||
#include <BOP_Refiner.hxx>
|
#include <BOP_Refiner.hxx>
|
||||||
#include <Standard_Failure.hxx>
|
#include <Standard_Failure.hxx>
|
||||||
#include <Standard_ErrorHandler.hxx>
|
#include <Standard_ErrorHandler.hxx>
|
||||||
#include <TopTools_DataMapOfShapeInteger.hxx>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -81,14 +80,13 @@ BOP_ShellShell::BOP_ShellShell()
|
|||||||
// function: Destroy
|
// function: Destroy
|
||||||
// purpose:
|
// purpose:
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
void BOP_ShellShell::Destroy() {
|
void BOP_ShellShell::Destroy() {}
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
// function: DoWithFiller
|
// function: DoWithFiller
|
||||||
// purpose:
|
// purpose:
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
void BOP_ShellShell::DoWithFiller(const BOPTools_DSFiller& aDSFiller)
|
void BOP_ShellShell::DoWithFiller(const BOPTools_DSFiller& aDSFiller)
|
||||||
{
|
{
|
||||||
myErrorStatus=0;
|
myErrorStatus=0;
|
||||||
myIsDone=Standard_False;
|
myIsDone=Standard_False;
|
||||||
@ -101,12 +99,14 @@ void BOP_ShellShell::DoWithFiller(const BOPTools_DSFiller& aDSFiller)
|
|||||||
try {
|
try {
|
||||||
OCC_CATCH_SIGNALS
|
OCC_CATCH_SIGNALS
|
||||||
|
|
||||||
|
// modified by NIZHNY-MKK Fri Sep 3 15:14:17 2004.BEGIN
|
||||||
if(!myDSFiller->IsDone()) {
|
if(!myDSFiller->IsDone()) {
|
||||||
myErrorStatus = 1;
|
myErrorStatus = 1;
|
||||||
BOPTColStd_Dump::PrintMessage("DSFiller is invalid: Can not build result\n");
|
BOPTColStd_Dump::PrintMessage("DSFiller is invalid: Can not build result\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
//
|
// modified by NIZHNY-MKK Fri Sep 3 15:14:20 2004.END
|
||||||
|
|
||||||
Standard_Boolean bIsNewFiller;
|
Standard_Boolean bIsNewFiller;
|
||||||
bIsNewFiller=aDSFiller.IsNewFiller();
|
bIsNewFiller=aDSFiller.IsNewFiller();
|
||||||
|
|
||||||
@ -126,7 +126,7 @@ void BOP_ShellShell::DoWithFiller(const BOPTools_DSFiller& aDSFiller)
|
|||||||
aRefiner.SetInternals(myInternals);
|
aRefiner.SetInternals(myInternals);
|
||||||
aRefiner.Do();
|
aRefiner.Do();
|
||||||
//
|
//
|
||||||
BOP_CorrectTolerances::CorrectTolerances(myResult, 0.01);
|
BOP_CorrectTolerances::CorrectTolerances(myResult);
|
||||||
//
|
//
|
||||||
FillModified();
|
FillModified();
|
||||||
myIsDone=Standard_True;
|
myIsDone=Standard_True;
|
||||||
@ -141,7 +141,7 @@ void BOP_ShellShell::DoWithFiller(const BOPTools_DSFiller& aDSFiller)
|
|||||||
// function: BuildResult
|
// function: BuildResult
|
||||||
// purpose:
|
// purpose:
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
void BOP_ShellShell::BuildResult()
|
void BOP_ShellShell::BuildResult()
|
||||||
{
|
{
|
||||||
const BooleanOperations_ShapesDataStructure& aDS=myDSFiller->DS();
|
const BooleanOperations_ShapesDataStructure& aDS=myDSFiller->DS();
|
||||||
|
|
||||||
@ -231,7 +231,7 @@ void BOP_ShellShell::BuildResult()
|
|||||||
//
|
//
|
||||||
// vars
|
// vars
|
||||||
Standard_Boolean bIsTouchCase, bIsTouch;
|
Standard_Boolean bIsTouchCase, bIsTouch;
|
||||||
Standard_Integer i, aNb, j, aNbj, iFF, nF1, iRank, nF2;
|
Standard_Integer i, aNb, j, aNbj, iFF, nF1, iRank;
|
||||||
TopTools_ListOfShape aListOfNewFaces;
|
TopTools_ListOfShape aListOfNewFaces;
|
||||||
TopTools_IndexedMapOfShape anEMap;
|
TopTools_IndexedMapOfShape anEMap;
|
||||||
TopAbs_Orientation anOriF1;
|
TopAbs_Orientation anOriF1;
|
||||||
@ -283,65 +283,6 @@ void BOP_ShellShell::BuildResult()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// 3. Add IN2D, ON2D Parts to the WES
|
// 3. Add IN2D, ON2D Parts to the WES
|
||||||
//
|
|
||||||
//modified by NIZNHY-PKV Fri Sep 14 10:00:44 2012f
|
|
||||||
BOP_WireEdgeSet aWES1 (myFace);
|
|
||||||
//
|
|
||||||
for (j=1; j<=aNbj; j++) {
|
|
||||||
iFF=aFFIndicesMap(j);
|
|
||||||
BOPTools_SSInterference& aFF=aFFs(iFF);
|
|
||||||
bIsTouch=aFF.IsTangentFaces();
|
|
||||||
if (bIsTouch) {
|
|
||||||
nF2=aFF.OppositeIndex(nF1);
|
|
||||||
AddINON2DPartsSh(nF1, iFF, aWES1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//
|
|
||||||
if (iRank==2 || (iRank==1 && myOperation==BOP_CUT)) {
|
|
||||||
// #0023431
|
|
||||||
// Refine WES to remove duplicated edges:
|
|
||||||
// - for the faces of the Object: Cut operation
|
|
||||||
// - for the faces of the Tool: all operations
|
|
||||||
//
|
|
||||||
// The duplications caused by the separated treatment
|
|
||||||
// the faces of an argument for the cases when:
|
|
||||||
// -these faces contain shared edges and
|
|
||||||
// -they are same domain faces with the faces of the other argument.
|
|
||||||
TopTools_DataMapOfShapeInteger aDMSI;
|
|
||||||
|
|
||||||
//--
|
|
||||||
aWES1.InitStartElements();
|
|
||||||
for (; aWES1.MoreStartElements(); aWES1.NextStartElement()) {
|
|
||||||
const TopoDS_Edge& aE=*((TopoDS_Edge*)&aWES1.StartElement());
|
|
||||||
if (!aDMSI.IsBound(aE)) {
|
|
||||||
Standard_Integer iCnt=1;
|
|
||||||
//
|
|
||||||
aDMSI.Bind(aE, iCnt);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
Standard_Integer& iCnt=aDMSI.ChangeFind(aE);
|
|
||||||
++iCnt;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//
|
|
||||||
aWES1.InitStartElements();
|
|
||||||
for (; aWES1.MoreStartElements(); aWES1.NextStartElement()) {
|
|
||||||
const TopoDS_Shape& aE=aWES1.StartElement();
|
|
||||||
const Standard_Integer& iCnt=aDMSI.Find(aE);
|
|
||||||
if (iCnt==1) {
|
|
||||||
aWES.AddStartElement(aE);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
aWES1.InitStartElements();
|
|
||||||
for (; aWES1.MoreStartElements(); aWES1.NextStartElement()) {
|
|
||||||
const TopoDS_Shape& aE=aWES1.StartElement();
|
|
||||||
aWES.AddStartElement(aE);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//--
|
|
||||||
/*
|
|
||||||
for (j=1; j<=aNbj; j++) {
|
for (j=1; j<=aNbj; j++) {
|
||||||
iFF=aFFIndicesMap(j);
|
iFF=aFFIndicesMap(j);
|
||||||
BOPTools_SSInterference& aFF=aFFs(iFF);
|
BOPTools_SSInterference& aFF=aFFs(iFF);
|
||||||
@ -352,8 +293,6 @@ void BOP_ShellShell::BuildResult()
|
|||||||
AddINON2DPartsSh(nF1, iFF, aWES);
|
AddINON2DPartsSh(nF1, iFF, aWES);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
//modified by NIZNHY-PKV Fri Sep 14 10:00:48 2012t
|
|
||||||
// 4. Add EF parts (E (from F2) on F1 ),
|
// 4. Add EF parts (E (from F2) on F1 ),
|
||||||
// where F2 is non-same-domain face to F1
|
// where F2 is non-same-domain face to F1
|
||||||
anEMap.Clear();
|
anEMap.Clear();
|
||||||
@ -419,6 +358,15 @@ void BOP_ShellShell::BuildResult()
|
|||||||
}
|
}
|
||||||
}// end of (bIsTouchCase)'s else
|
}// end of (bIsTouchCase)'s else
|
||||||
//
|
//
|
||||||
|
//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||||
|
// Display the WES
|
||||||
|
if (myDraw) {
|
||||||
|
const TopTools_ListOfShape& aWESL=aWES.StartElements();
|
||||||
|
BOP_Draw::DrawListOfEdgesWithPC (myFace, aWESL, i, "ew_");
|
||||||
|
BOP_Draw::Wait();
|
||||||
|
}
|
||||||
|
//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||||
|
|
||||||
//
|
//
|
||||||
// d. Build new Faces from myFace
|
// d. Build new Faces from myFace
|
||||||
BOP_FaceBuilder aFB;
|
BOP_FaceBuilder aFB;
|
||||||
@ -448,24 +396,12 @@ void BOP_ShellShell::BuildResult()
|
|||||||
//
|
//
|
||||||
}// for (i=1; i<=aNb; i++)
|
}// for (i=1; i<=aNb; i++)
|
||||||
//
|
//
|
||||||
|
//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||||
|
// Display the new Faces
|
||||||
|
if (myDraw) {
|
||||||
|
BOP_Draw::DrawListOfShape(aListOfNewFaces, "fn_");
|
||||||
|
}
|
||||||
|
//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||||
myNewFaces.Clear();
|
myNewFaces.Clear();
|
||||||
myNewFaces.Append(aListOfNewFaces);
|
myNewFaces.Append(aListOfNewFaces);
|
||||||
}
|
}
|
||||||
/* DEB
|
|
||||||
{
|
|
||||||
TopoDS_Compound aCx;
|
|
||||||
BRep_Builder aBB;
|
|
||||||
//
|
|
||||||
aBB.MakeCompound(aCx);
|
|
||||||
aBB.Add(aCx, myFace);
|
|
||||||
//
|
|
||||||
aWES.InitStartElements();
|
|
||||||
for (; aWES.MoreStartElements(); aWES.NextStartElement()) {
|
|
||||||
const TopoDS_Shape& aE = aWES.StartElement();
|
|
||||||
aBB.Add(aCx, aE);
|
|
||||||
}
|
|
||||||
int a=0;
|
|
||||||
}
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
@ -182,7 +182,7 @@ static Standard_Boolean CheckSameDomainFaceInside(const TopoDS_Face& theFace1,
|
|||||||
aRefiner.Do();
|
aRefiner.Do();
|
||||||
//
|
//
|
||||||
//
|
//
|
||||||
BOP_CorrectTolerances::CorrectTolerances(myResult, 0.01);
|
BOP_CorrectTolerances::CorrectTolerances(myResult);
|
||||||
//
|
//
|
||||||
FillModified();
|
FillModified();
|
||||||
|
|
||||||
|
@ -204,7 +204,28 @@ static
|
|||||||
//
|
//
|
||||||
// 3. Post-pro the result aShape
|
// 3. Post-pro the result aShape
|
||||||
// and filling the myShapes field .
|
// and filling the myShapes field .
|
||||||
TopExp_Explorer aShellExp(aShape, TopAbs_SHELL);
|
//modified by NIZNHY-PKV Tue Sep 18 12:06:25 2012f
|
||||||
|
Standard_Integer aNbSh;
|
||||||
|
TopExp_Explorer aShellExp;
|
||||||
|
//
|
||||||
|
aShellExp.Init(aShape, TopAbs_SHELL);
|
||||||
|
for (aNbSh=0; aShellExp.More(); aShellExp.Next(), ++aNbSh) {
|
||||||
|
const TopoDS_Shape& aSh=aShellExp.Current();
|
||||||
|
}
|
||||||
|
//
|
||||||
|
if (aNbSh==1) {
|
||||||
|
Standard_Boolean bIsClosed;
|
||||||
|
//
|
||||||
|
bIsClosed=BRep_Tool::IsClosed(aShell);
|
||||||
|
if (bIsClosed) {
|
||||||
|
myShapes.Append(myFaces);
|
||||||
|
myIsDone=Standard_True;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//modified by NIZNHY-PKV Tue Sep 18 12:06:26 2012t
|
||||||
|
//
|
||||||
|
aShellExp.Init(aShape, TopAbs_SHELL);
|
||||||
for (; aShellExp.More(); aShellExp.Next()) {
|
for (; aShellExp.More(); aShellExp.Next()) {
|
||||||
const TopoDS_Shape& aSh= aShellExp.Current();
|
const TopoDS_Shape& aSh= aShellExp.Current();
|
||||||
|
|
||||||
@ -221,7 +242,7 @@ static
|
|||||||
myShapes.Append(aLF);
|
myShapes.Append(aLF);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
//
|
||||||
myIsDone=Standard_True;
|
myIsDone=Standard_True;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -182,7 +182,7 @@ static Standard_Boolean LocalIsKeepTwice(const TopoDS_Face& aF1,
|
|||||||
aRefiner.SetInternals(myInternals);
|
aRefiner.SetInternals(myInternals);
|
||||||
aRefiner.Do();
|
aRefiner.Do();
|
||||||
//
|
//
|
||||||
BOP_CorrectTolerances::CorrectTolerances(myResult, 0.01);
|
BOP_CorrectTolerances::CorrectTolerances(myResult);
|
||||||
//
|
//
|
||||||
FillModified();
|
FillModified();
|
||||||
|
|
||||||
|
@ -114,7 +114,7 @@ BOP_WireShell::BOP_WireShell()
|
|||||||
//
|
//
|
||||||
BuildResult();
|
BuildResult();
|
||||||
//
|
//
|
||||||
BOP_CorrectTolerances::CorrectTolerances(myResult, 0.01);
|
BOP_CorrectTolerances::CorrectTolerances(myResult);
|
||||||
//
|
//
|
||||||
FillModified();
|
FillModified();
|
||||||
myIsDone=Standard_True;
|
myIsDone=Standard_True;
|
||||||
|
@ -121,7 +121,7 @@ BOP_WireSolid::BOP_WireSolid()
|
|||||||
//
|
//
|
||||||
BuildResult();
|
BuildResult();
|
||||||
//
|
//
|
||||||
BOP_CorrectTolerances::CorrectTolerances(myResult, 0.01);
|
BOP_CorrectTolerances::CorrectTolerances(myResult);
|
||||||
//
|
//
|
||||||
FillModified();
|
FillModified();
|
||||||
|
|
||||||
|
@ -108,7 +108,7 @@ BOP_WireWire::BOP_WireWire()
|
|||||||
//
|
//
|
||||||
BuildResult();
|
BuildResult();
|
||||||
//
|
//
|
||||||
BOP_CorrectTolerances::CorrectTolerances(myResult, 0.01);
|
BOP_CorrectTolerances::CorrectTolerances(myResult);
|
||||||
//
|
//
|
||||||
FillModified();
|
FillModified();
|
||||||
myIsDone=Standard_True;
|
myIsDone=Standard_True;
|
||||||
|
@ -516,7 +516,6 @@ is
|
|||||||
--- Try to put 3D-point <aP> (parameter aT) on the curve <aBC>
|
--- Try to put 3D-point <aP> (parameter aT) on the curve <aBC>
|
||||||
---
|
---
|
||||||
|
|
||||||
--modified by NIZNHY-PKV Thu Oct 20 07:17:11 2011f
|
|
||||||
PutClosingPaveOnCurve (me:out;
|
PutClosingPaveOnCurve (me:out;
|
||||||
aBC :out Curve from BOPTools;
|
aBC :out Curve from BOPTools;
|
||||||
aFF :out SSInterference from BOPTools)
|
aFF :out SSInterference from BOPTools)
|
||||||
@ -525,7 +524,6 @@ is
|
|||||||
--- Put paves on the curve <aBC> in case when <aBC>
|
--- Put paves on the curve <aBC> in case when <aBC>
|
||||||
-- is closed 3D-curve
|
-- is closed 3D-curve
|
||||||
---
|
---
|
||||||
--modified by NIZNHY-PKV Thu Oct 20 07:17:11 2011t
|
|
||||||
|
|
||||||
FindPave (me:out;
|
FindPave (me:out;
|
||||||
aP :Pnt from gp;
|
aP :Pnt from gp;
|
||||||
@ -597,6 +595,25 @@ is
|
|||||||
returns Boolean from Standard
|
returns Boolean from Standard
|
||||||
is protected;
|
is protected;
|
||||||
|
|
||||||
|
--modified by NIZNHY-PKV Tue Aug 28 09:45:00 2012ft
|
||||||
|
TreatTechnoVertices(me:out;
|
||||||
|
aFF:out SSInterference from BOPTools)
|
||||||
|
is protected;
|
||||||
|
|
||||||
|
SplitPaveBlock(me:out;
|
||||||
|
aPB: PaveBlock from BOPTools;
|
||||||
|
nVT: Integer from Standard;
|
||||||
|
aPB1:out PaveBlock from BOPTools;
|
||||||
|
aPB2:out PaveBlock from BOPTools)
|
||||||
|
is protected;
|
||||||
|
|
||||||
|
CheckCoincidence(me:out;
|
||||||
|
aPB1: PaveBlock from BOPTools;
|
||||||
|
aPB2: PaveBlock from BOPTools)
|
||||||
|
returns Boolean from Standard
|
||||||
|
is protected;
|
||||||
|
--modified by NIZNHY-PKV Mon Jul 09 13:15:55 2012t
|
||||||
|
|
||||||
fields
|
fields
|
||||||
|
|
||||||
myIntrPool : PInterferencePool from BOPTools
|
myIntrPool : PInterferencePool from BOPTools
|
||||||
|
@ -538,6 +538,20 @@ static
|
|||||||
if (aMap.Contains(nV1) && aMap.Contains(nV2)) {
|
if (aMap.Contains(nV1) && aMap.Contains(nV2)) {
|
||||||
//
|
//
|
||||||
const BOPTools_ListOfPaveBlock& aLPBExisting=aFFi.PaveBlocks();
|
const BOPTools_ListOfPaveBlock& aLPBExisting=aFFi.PaveBlocks();
|
||||||
|
//
|
||||||
|
//modified by NIZNHY-PKV Tue Sep 18 11:59:35 2012f
|
||||||
|
iCheckIntermediatePoint=1;
|
||||||
|
BOPTools_ListIteratorOfListOfPaveBlock anItLPB(aLPBExisting);
|
||||||
|
for (; anItLPB.More(); anItLPB.Next()) {
|
||||||
|
const BOPTools_PaveBlock& aPBR=anItLPB.Value();
|
||||||
|
iCheckIntermediatePoint=
|
||||||
|
CheckIntermediatePoint(aPBNew, aPBR, aTolR3D);
|
||||||
|
if (!iCheckIntermediatePoint) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
bIsPaveBlock=(iCheckIntermediatePoint==0);
|
||||||
|
/*
|
||||||
bIsPaveBlock=IsPaveBlock(nV1, nV2, aLPBExisting);
|
bIsPaveBlock=IsPaveBlock(nV1, nV2, aLPBExisting);
|
||||||
//
|
//
|
||||||
iCheckIntermediatePoint=1;
|
iCheckIntermediatePoint=1;
|
||||||
@ -554,6 +568,8 @@ static
|
|||||||
}
|
}
|
||||||
bIsPaveBlock=bIsPaveBlock && !iCheckIntermediatePoint;
|
bIsPaveBlock=bIsPaveBlock && !iCheckIntermediatePoint;
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
//modified by NIZNHY-PKV Tue Sep 18 12:00:02 2012t
|
||||||
//
|
//
|
||||||
if (bIsPaveBlock) {
|
if (bIsPaveBlock) {
|
||||||
continue;
|
continue;
|
||||||
@ -1741,6 +1757,9 @@ static
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
//wkar OCC334 t
|
//wkar OCC334 t
|
||||||
|
//modified by NIZNHY-PKV Tue Sep 18 12:01:23 2012f
|
||||||
|
TreatTechnoVertices(aFFi);
|
||||||
|
//modified by NIZNHY-PKV Tue Sep 18 12:01:28 2012t
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
|
323
src/BOPTools/BOPTools_PaveFiller_5.cxx
Normal file
323
src/BOPTools/BOPTools_PaveFiller_5.cxx
Normal file
@ -0,0 +1,323 @@
|
|||||||
|
// Created on: 2001-03-13
|
||||||
|
// Created by: Peter KURNEV
|
||||||
|
// Copyright (c) 2001-2012 OPEN CASCADE SAS
|
||||||
|
//
|
||||||
|
// The content of this file is subject to the Open CASCADE Technology Public
|
||||||
|
// License Version 6.5 (the "License"). You may not use the content of this file
|
||||||
|
// except in compliance with the License. Please obtain a copy of the License
|
||||||
|
// at http://www.opencascade.org and read it completely before using this file.
|
||||||
|
//
|
||||||
|
// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
|
||||||
|
// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
|
||||||
|
//
|
||||||
|
// The Original Code and all software distributed under the License is
|
||||||
|
// distributed on an "AS IS" basis, without warranty of any kind, and the
|
||||||
|
// Initial Developer hereby disclaims all such warranties, including without
|
||||||
|
// limitation, any warranties of merchantability, fitness for a particular
|
||||||
|
// purpose or non-infringement. Please see the License for the specific terms
|
||||||
|
// and conditions governing the rights and limitations under the License.
|
||||||
|
|
||||||
|
#include <BOPTools_PaveFiller.ixx>
|
||||||
|
|
||||||
|
#include <TColStd_ListOfInteger.hxx>
|
||||||
|
#include <TColStd_ListIteratorOfListOfInteger.hxx>
|
||||||
|
#include <TColStd_IndexedMapOfInteger.hxx>
|
||||||
|
|
||||||
|
#include <gp_Pnt.hxx>
|
||||||
|
#include <Geom_Curve.hxx>
|
||||||
|
|
||||||
|
#include <TopoDS_Edge.hxx>
|
||||||
|
#include <BRep_Builder.hxx>
|
||||||
|
|
||||||
|
#include <BooleanOperations_ShapesDataStructure.hxx>
|
||||||
|
|
||||||
|
#include <IntTools_Curve.hxx>
|
||||||
|
#include <IntTools_Tools.hxx>
|
||||||
|
|
||||||
|
#include <BOPTools_Tools.hxx>
|
||||||
|
#include <BOPTools_SequenceOfCurves.hxx>
|
||||||
|
#include <BOPTools_Curve.hxx>
|
||||||
|
#include <BOPTools_ListOfPaveBlock.hxx>
|
||||||
|
#include <BOPTools_ListIteratorOfListOfPaveBlock.hxx>
|
||||||
|
#include <BOPTools_Pave.hxx>
|
||||||
|
#include <BOPTools_ListOfCommonBlock.hxx>
|
||||||
|
#include <BOPTools_ListIteratorOfListOfCommonBlock.hxx>
|
||||||
|
#include <BOPTools_CommonBlock.hxx>
|
||||||
|
|
||||||
|
//modified by NIZNHY-PKV Tue Aug 28 09:45:19 2012ft
|
||||||
|
//=======================================================================
|
||||||
|
//function : TreatTechnoVertices
|
||||||
|
//purpose :
|
||||||
|
//=======================================================================
|
||||||
|
void BOPTools_PaveFiller::TreatTechnoVertices(BOPTools_SSInterference& aFFi)
|
||||||
|
{
|
||||||
|
Standard_Boolean bFlag, bSplitted;
|
||||||
|
Standard_Integer nF1, nF2, aBid, j, aNbCurves, aNbVT, aNbLPB, nE, nVT, iFlag;
|
||||||
|
Standard_Integer nF, nE1, nE2, k;
|
||||||
|
Standard_Real aT;
|
||||||
|
TColStd_IndexedMapOfInteger aMVT;
|
||||||
|
|
||||||
|
TColStd_ListIteratorOfListOfInteger aItLI;
|
||||||
|
BOPTools_Pave aPave;
|
||||||
|
BOPTools_ListOfPaveBlock aLPB, aLPBS;
|
||||||
|
BOPTools_ListIteratorOfListOfPaveBlock aItLPB, aItLPB1;
|
||||||
|
//
|
||||||
|
nF1=aFFi.Index1();
|
||||||
|
nF2=aFFi.Index2();
|
||||||
|
BOPTools_SequenceOfCurves& aBCs=aFFi.Curves();
|
||||||
|
//
|
||||||
|
aNbCurves=aBCs.Length();
|
||||||
|
for (j=1; j<=aNbCurves; j++) {
|
||||||
|
BOPTools_Curve& aBC=aBCs(j);
|
||||||
|
//Handle(Geom_Curve) aC3D= aBC.Curve().Curve(); //DEB
|
||||||
|
TColStd_ListOfInteger& aLVT=aBC.TechnoVertices();
|
||||||
|
aItLI.Initialize(aLVT);
|
||||||
|
for (; aItLI.More(); aItLI.Next()) {
|
||||||
|
nVT=aItLI.Value();
|
||||||
|
aMVT.Add(nVT);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//
|
||||||
|
aNbVT=aMVT.Extent();
|
||||||
|
if (!aNbVT) {// nothing to do
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
//------------------------------
|
||||||
|
//
|
||||||
|
aBid=0;
|
||||||
|
SplitsInFace (aBid, nF1, nF2, aLPB);
|
||||||
|
SplitsInFace (aBid, nF2, nF1, aLPB);
|
||||||
|
SplitsOnFace (aBid, nF1, nF2, aLPB);
|
||||||
|
//
|
||||||
|
aNbLPB=aLPB.Extent();
|
||||||
|
if (!aNbLPB) {// nothing to do
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
//
|
||||||
|
for (k=1; k<=aNbVT; ++k) {
|
||||||
|
nVT=aMVT(k);
|
||||||
|
const TopoDS_Vertex& aV=*((TopoDS_Vertex*)&(myDS->Shape(nVT)));
|
||||||
|
//
|
||||||
|
// 1.Collect Pave Blocks (pretenders) to split by nVT => aLPBS
|
||||||
|
aLPBS.Clear();
|
||||||
|
aItLPB.Initialize(aLPB);
|
||||||
|
for (; aItLPB.More(); aItLPB.Next()) {
|
||||||
|
const BOPTools_PaveBlock& aPB=aItLPB.Value();
|
||||||
|
nE=aPB.OriginalEdge();
|
||||||
|
const TopoDS_Edge& aE=*((TopoDS_Edge*)&(myDS->Shape(nE)));
|
||||||
|
//
|
||||||
|
iFlag=myContext->ComputeVE(aV, aE, aT);
|
||||||
|
if (iFlag) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
//
|
||||||
|
aPave.SetIndex(nVT);
|
||||||
|
aPave.SetParam(aT);
|
||||||
|
//
|
||||||
|
BOPTools_ListOfPaveBlock& aLPBE=mySplitShapesPool(myDS->RefEdge(nE));
|
||||||
|
aItLPB1.Initialize(aLPBE);
|
||||||
|
for (; aItLPB1.More(); aItLPB1.Next()) {
|
||||||
|
const BOPTools_PaveBlock& aPBE=aItLPB1.Value();
|
||||||
|
if (aPBE.IsInBlock(aPave)) {
|
||||||
|
aLPBS.Append(aPBE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}//for (; aItLPB.More(); aItLPB.Next()) {
|
||||||
|
//
|
||||||
|
// 2.Split Pave Blocks [aLPBS] by the vertex [nVT]
|
||||||
|
BOPTools_ListIteratorOfListOfCommonBlock aItCB1, aItCB2;
|
||||||
|
BOPTools_PaveBlock aPB11, aPB12, aPB21, aPB22, aPB1, aPB2;
|
||||||
|
//
|
||||||
|
aItLPB.Initialize(aLPBS);
|
||||||
|
for (; aItLPB.More(); aItLPB.Next()) {
|
||||||
|
const BOPTools_PaveBlock& aPBS=aItLPB.Value();
|
||||||
|
nE=aPBS.OriginalEdge();
|
||||||
|
//
|
||||||
|
BOPTools_ListOfCommonBlock& aLCB1=myCommonBlockPool(myDS->RefEdge(nE));
|
||||||
|
aItCB1.Initialize(aLCB1);
|
||||||
|
for (; aItCB1.More(); aItCB1.Next()) {
|
||||||
|
BOPTools_CommonBlock& aCB1=aItCB1.Value();
|
||||||
|
aPB1=aCB1.PaveBlock1(nE);
|
||||||
|
nE1=aPB1.OriginalEdge();
|
||||||
|
//
|
||||||
|
if (aPB1.IsEqual(aPBS)) {
|
||||||
|
//
|
||||||
|
SplitPaveBlock(aPB1, nVT, aPB11, aPB12);
|
||||||
|
//
|
||||||
|
nF=aCB1.Face();
|
||||||
|
if (nF) {
|
||||||
|
BOPTools_CommonBlock aCBa, aCBb;
|
||||||
|
//
|
||||||
|
aLCB1.Remove(aItCB1);
|
||||||
|
//
|
||||||
|
aCBa.SetPaveBlock1(aPB11);
|
||||||
|
aCBa.SetFace(nF);
|
||||||
|
aCBb.SetPaveBlock2(aPB12);
|
||||||
|
aCBb.SetFace(nF);
|
||||||
|
//
|
||||||
|
aLCB1.Append(aCBa);
|
||||||
|
aLCB1.Append(aCBb);
|
||||||
|
//
|
||||||
|
break;
|
||||||
|
}// if (nF) {
|
||||||
|
else { // 1
|
||||||
|
BOPTools_CommonBlock aCBa, aCBb;
|
||||||
|
//
|
||||||
|
aPB2=aCB1.PaveBlock2(nE);
|
||||||
|
nE2=aPB2.OriginalEdge();
|
||||||
|
//
|
||||||
|
SplitPaveBlock(aPB2, nVT, aPB21, aPB22);
|
||||||
|
//
|
||||||
|
//aLCB1.Remove(aItCB1);
|
||||||
|
//
|
||||||
|
iFlag=0;
|
||||||
|
BOPTools_ListOfCommonBlock& aLCB2=myCommonBlockPool(myDS->RefEdge(nE2));
|
||||||
|
aItCB2.Initialize(aLCB2);
|
||||||
|
for (; aItCB2.More(); aItCB2.Next()) {
|
||||||
|
BOPTools_CommonBlock& aCB2=aItCB2.Value();
|
||||||
|
BOPTools_PaveBlock& aPBx=aCB2.PaveBlock1(nE2);
|
||||||
|
if (aPBx.IsEqual(aPB2)) {
|
||||||
|
aLCB2.Remove(aItCB2);
|
||||||
|
aLCB1.Remove(aItCB1);
|
||||||
|
//
|
||||||
|
bFlag=CheckCoincidence(aPB11, aPB21);
|
||||||
|
if (bFlag) {
|
||||||
|
aCBa.SetPaveBlock1(aPB11);
|
||||||
|
aCBa.SetPaveBlock2(aPB21);
|
||||||
|
aCBb.SetPaveBlock1(aPB12);
|
||||||
|
aCBb.SetPaveBlock2(aPB22);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
aCBa.SetPaveBlock1(aPB11);
|
||||||
|
aCBa.SetPaveBlock2(aPB22);
|
||||||
|
aCBb.SetPaveBlock1(aPB12);
|
||||||
|
aCBb.SetPaveBlock2(aPB21);
|
||||||
|
}
|
||||||
|
//
|
||||||
|
aLCB1.Append(aCBa);
|
||||||
|
aLCB1.Append(aCBb);
|
||||||
|
aLCB2.Append(aCBa);
|
||||||
|
aLCB2.Append(aCBb);
|
||||||
|
//
|
||||||
|
iFlag=1;
|
||||||
|
break;
|
||||||
|
}//if (aPB1.IsEqual(aPB2)) {
|
||||||
|
}//for (; aItCB2.More(); aItCB2.Next()) {
|
||||||
|
}//else { // 1
|
||||||
|
}//if (aPB1.IsEqual(aPBS)) {
|
||||||
|
if (iFlag) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}//for (; aItCB.More(); aItCB.Next()) {
|
||||||
|
}//for (; aItLPB.More(); aItLPB.Next()) {
|
||||||
|
}//for (k=1; k<=aNbVT; ++k) {
|
||||||
|
}
|
||||||
|
//=======================================================================
|
||||||
|
//function : SplitPaveBlock
|
||||||
|
//purpose :
|
||||||
|
//=======================================================================
|
||||||
|
void BOPTools_PaveFiller::SplitPaveBlock(const BOPTools_PaveBlock& aPBE,
|
||||||
|
const Standard_Integer nVT,
|
||||||
|
BOPTools_PaveBlock& aPB1,
|
||||||
|
BOPTools_PaveBlock& aPB2)
|
||||||
|
{
|
||||||
|
Standard_Integer nE, iFlag;
|
||||||
|
Standard_Real aT;
|
||||||
|
BOPTools_Pave aPave;
|
||||||
|
BOPTools_ListIteratorOfListOfPaveBlock aItLPB;
|
||||||
|
//
|
||||||
|
const TopoDS_Vertex& aVT=*((TopoDS_Vertex*)&(myDS->Shape(nVT)));
|
||||||
|
//
|
||||||
|
nE=aPBE.OriginalEdge();
|
||||||
|
const TopoDS_Edge& aE=*((TopoDS_Edge*)&(myDS->Shape(nE)));
|
||||||
|
//
|
||||||
|
BOPTools_ListOfPaveBlock& aLPB=mySplitShapesPool(myDS->RefEdge(nE));
|
||||||
|
//
|
||||||
|
aItLPB.Initialize(aLPB);
|
||||||
|
for (; aItLPB.More(); aItLPB.Next()) {
|
||||||
|
const BOPTools_PaveBlock& aPB=aItLPB.Value();
|
||||||
|
if (aPB.IsEqual(aPBE)) {
|
||||||
|
aLPB.Remove(aItLPB);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//
|
||||||
|
iFlag=myContext->ComputeVE(aVT, aE, aT);
|
||||||
|
//
|
||||||
|
aPave.SetIndex(nVT);
|
||||||
|
aPave.SetParam(aT);
|
||||||
|
//
|
||||||
|
aPB1.SetOriginalEdge(nE);
|
||||||
|
aPB1.SetPave1(aPBE.Pave1());
|
||||||
|
aPB1.SetPave2(aPave);
|
||||||
|
//
|
||||||
|
aPB2.SetOriginalEdge(nE);
|
||||||
|
aPB2.SetPave1(aPave);
|
||||||
|
aPB2.SetPave2(aPBE.Pave2());
|
||||||
|
//
|
||||||
|
aLPB.Append(aPB1);
|
||||||
|
aLPB.Append(aPB2);
|
||||||
|
}
|
||||||
|
|
||||||
|
//=======================================================================
|
||||||
|
//function : CheckCoincidence
|
||||||
|
//purpose :
|
||||||
|
//=======================================================================
|
||||||
|
Standard_Boolean
|
||||||
|
BOPTools_PaveFiller::CheckCoincidence(const BOPTools_PaveBlock& aPB1,
|
||||||
|
const BOPTools_PaveBlock& aPB2)
|
||||||
|
|
||||||
|
{
|
||||||
|
Standard_Boolean bRet;
|
||||||
|
Standard_Integer nV11, nV12, nV21, nV22, nE1, nE2, iFlag;
|
||||||
|
Standard_Real aT11, aT12, aT21, aT22, aTM, aTN, aTolE1;
|
||||||
|
gp_Pnt aPM;
|
||||||
|
TopoDS_Vertex aVM;
|
||||||
|
BRep_Builder aBB;
|
||||||
|
//
|
||||||
|
const BOPTools_Pave& aPave11=aPB1.Pave1();
|
||||||
|
nV11=aPave11.Index();
|
||||||
|
aT11=aPave11.Param();
|
||||||
|
//
|
||||||
|
const BOPTools_Pave& aPave12=aPB1.Pave2();
|
||||||
|
aT12=aPave12.Param();
|
||||||
|
nV12=aPave12.Index();
|
||||||
|
//
|
||||||
|
const BOPTools_Pave& aPave21=aPB2.Pave1();
|
||||||
|
nV21=aPave21.Index();
|
||||||
|
aT21=aPave21.Param();
|
||||||
|
//
|
||||||
|
const BOPTools_Pave& aPave22=aPB2.Pave2();
|
||||||
|
nV22=aPave22.Index();
|
||||||
|
aT22=aPave22.Param();
|
||||||
|
//
|
||||||
|
bRet=((nV11==nV21 && nV12==nV22) || (nV11==nV22 && nV12==nV21));
|
||||||
|
if (!bRet) {
|
||||||
|
return bRet;
|
||||||
|
}
|
||||||
|
//
|
||||||
|
nE1=aPB1.OriginalEdge();
|
||||||
|
const TopoDS_Edge& aE1=*((TopoDS_Edge*)&(myDS->Shape(nE1)));
|
||||||
|
aTolE1=BRep_Tool::Tolerance(aE1);
|
||||||
|
//
|
||||||
|
nE2=aPB2.OriginalEdge();
|
||||||
|
const TopoDS_Edge& aE2=*((TopoDS_Edge*)&(myDS->Shape(nE2)));
|
||||||
|
//
|
||||||
|
aTM=IntTools_Tools::IntermediatePoint (aT11, aT12);
|
||||||
|
BOPTools_Tools::PointOnEdge(aE1, aTM, aPM);
|
||||||
|
//
|
||||||
|
aBB.MakeVertex (aVM, aPM, aTolE1);
|
||||||
|
//
|
||||||
|
iFlag=myContext->ComputeVE(aVM, aE2, aTN);
|
||||||
|
if (iFlag) {
|
||||||
|
bRet=!bRet; //False
|
||||||
|
}
|
||||||
|
//
|
||||||
|
if (aT21 <aT22) {
|
||||||
|
bRet=(aTN>aT21 && aTN<aT22);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
bRet=(aTN>aT22 && aTN<aT21);
|
||||||
|
}
|
||||||
|
return bRet;
|
||||||
|
}
|
@ -4,3 +4,4 @@ BOPTools_PaveFiller_1.cxx
|
|||||||
BOPTools_PaveFiller_2.cxx
|
BOPTools_PaveFiller_2.cxx
|
||||||
BOPTools_PaveFiller_3.cxx
|
BOPTools_PaveFiller_3.cxx
|
||||||
BOPTools_PaveFiller_4.cxx
|
BOPTools_PaveFiller_4.cxx
|
||||||
|
BOPTools_PaveFiller_5.cxx
|
||||||
|
Loading…
x
Reference in New Issue
Block a user