0024060: Wrong result done by general fuse algorithm.
[occt.git] / src / BOPAlgo / BOPAlgo_PaveFiller_2.cxx
CommitLineData
4e57c75e 1// Created by: Peter KURNEV
2// Copyright (c) 2010-2012 OPEN CASCADE SAS
3// Copyright (c) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE
4// Copyright (c) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, CEDRAT,
5// EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
6//
7// The content of this file is subject to the Open CASCADE Technology Public
8// License Version 6.5 (the "License"). You may not use the content of this file
9// except in compliance with the License. Please obtain a copy of the License
10// at http://www.opencascade.org and read it completely before using this file.
11//
12// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
13// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
14//
15// The Original Code and all software distributed under the License is
16// distributed on an "AS IS" basis, without warranty of any kind, and the
17// Initial Developer hereby disclaims all such warranties, including without
18// limitation, any warranties of merchantability, fitness for a particular
19// purpose or non-infringement. Please see the License for the specific terms
20// and conditions governing the rights and limitations under the License.
21
22
23#include <BOPAlgo_PaveFiller.ixx>
24
25#include <TopoDS_Vertex.hxx>
26#include <TopoDS_Edge.hxx>
27#include <BRep_Tool.hxx>
28
29#include <BOPInt_Context.hxx>
30
31#include <BOPDS_Iterator.hxx>
32#include <BOPDS_VectorOfInterfVE.hxx>
33#include <BOPDS_Interf.hxx>
34#include <BOPDS_PassKey.hxx>
35#include <BOPDS_MapOfPassKey.hxx>
36#include <BRepBndLib.hxx>
37#include <BRep_Builder.hxx>
38
39
40//=======================================================================
41// function: PerformVE
42// purpose:
43//=======================================================================
44 void BOPAlgo_PaveFiller::PerformVE()
45{
46 Standard_Boolean bJustAdd;
47 Standard_Integer iSize, nV, nE, nVSD, iFlag, nVx, i;
48 Standard_Real aT, aTolE, aTolV;
49 BOPDS_Pave aPave;
50 BOPDS_PassKey aPK;
51 BOPDS_MapOfPassKey aMPK;
52 BRep_Builder aBB;
53 //
54 myErrorStatus=0;
55 //
56 myIterator->Initialize(TopAbs_VERTEX, TopAbs_EDGE);
57 iSize=myIterator->ExpectedLength();
58 if (!iSize) {
59 return;
60 }
61 //
62 BOPDS_VectorOfInterfVE& aVEs=myDS->InterfVE();
63 aVEs.SetStartSize(iSize);
64 aVEs.SetIncrement(iSize);
65 aVEs.Init();
66 //
67 for (; myIterator->More(); myIterator->Next()) {
68 myIterator->Value(nV, nE, bJustAdd);
69 if(bJustAdd) {
70 continue;
71 }
72 //
73 const BOPDS_ShapeInfo& aSIE=myDS->ShapeInfo(nE);
74 if (aSIE.HasSubShape(nV)) {
75 continue;
76 }
77 //
78 if (aSIE.HasFlag()){
79 continue;
80 }
81 //
82 if (myDS->HasInterfShapeSubShapes(nV, nE)) {
c1746a0a 83 myDS->ChangePaveBlocks(nE);
4e57c75e 84 continue;
85 }
86 //
87 nVx=nV;
88 if (myDS->HasShapeSD(nV, nVSD)) {
89 nVx=nVSD;
90 }
91 //
92 aPK.SetIds(nVx, nE);
93 if (!aMPK.Add(aPK)) {
94 continue;
95 }
96 //
97 const TopoDS_Edge& aE=(*(TopoDS_Edge *)(&aSIE.Shape()));
98 const TopoDS_Vertex& aV=(*(TopoDS_Vertex *)(&myDS->Shape(nVx)));
99 //
100 iFlag=myContext->ComputeVE (aV, aE, aT);
101 if (!iFlag) {
102 // 1
103 i=aVEs.Append()-1;
104 BOPDS_InterfVE& aVE=aVEs(i);
105 aVE.SetIndices(nV, nE);
106 aVE.SetParameter(aT);
107 // 2
108 myDS->AddInterf(nV, nE);
109 // 3
110 BOPDS_ListOfPaveBlock& aLPB=myDS->ChangePaveBlocks(nE);
111 Handle(BOPDS_PaveBlock)& aPB=*((Handle_BOPDS_PaveBlock*)&aLPB.First());
112 //
113 aPave.SetIndex(nVx);
114 aPave.SetParameter(aT);
115 aPB->AppendExtPave(aPave);
116 aTolV = BRep_Tool::Tolerance(aV);
117 aTolE = BRep_Tool::Tolerance(aE);
118 if ( aTolV < aTolE) {
119 aBB.UpdateVertex(aV, aTolE);
120 BOPDS_ShapeInfo& aSIDS=myDS->ChangeShapeInfo(nVx);
121 Bnd_Box& aBoxDS=aSIDS.ChangeBox();
122 BRepBndLib::Add(aV, aBoxDS);
123 }
124 }
125 }//for (; myIterator->More(); myIterator->Next()) {
126}