0027525: Coding - eliminate warnings on Windows for OCCT with static type of libraries
[occt.git] / src / TopOpeBRep / TopOpeBRep_FacesFiller.cxx
1 // Created on: 1994-10-10
2 // Created by: Jean Yves LEBEY
3 // Copyright (c) 1994-1999 Matra Datavision
4 // Copyright (c) 1999-2014 OPEN CASCADE SAS
5 //
6 // This file is part of Open CASCADE Technology software library.
7 //
8 // This library is free software; you can redistribute it and/or modify it under
9 // the terms of the GNU Lesser General Public License version 2.1 as published
10 // by the Free Software Foundation, with special exception defined in the file
11 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
12 // distribution for complete text of the license and disclaimer of any warranty.
13 //
14 // Alternatively, this file may be used under the terms of Open CASCADE
15 // commercial license or contractual agreement.
16
17
18 #include <BRep_Tool.hxx>
19 #include <Geom_Circle.hxx>
20 #include <Geom_Line.hxx>
21 #include <Geom_Surface.hxx>
22 #include <GeomProjLib.hxx>
23 #include <gp_Pnt.hxx>
24 #include <gp_Pnt2d.hxx>
25 #include <Precision.hxx>
26 #include <Standard_ProgramError.hxx>
27 #include <TopoDS.hxx>
28 #include <TopoDS_Face.hxx>
29 #include <TopoDS_Shape.hxx>
30 #include <TopOpeBRep.hxx>
31 #include <TopOpeBRep_define.hxx>
32 #include <TopOpeBRep_FacesFiller.hxx>
33 #include <TopOpeBRep_FacesIntersector.hxx>
34 #include <TopOpeBRep_FFDumper.hxx>
35 #include <TopOpeBRep_FFTransitionTool.hxx>
36 #include <TopOpeBRep_LineInter.hxx>
37 #include <TopOpeBRep_PointClassifier.hxx>
38 #include <TopOpeBRep_VPointInter.hxx>
39 #include <TopOpeBRep_VPointInterClassifier.hxx>
40 #include <TopOpeBRep_VPointInterIterator.hxx>
41 #include <TopOpeBRepDS_DataStructure.hxx>
42 #include <TopOpeBRepDS_HDataStructure.hxx>
43 #include <TopOpeBRepDS_Interference.hxx>
44 #include <TopOpeBRepDS_Point.hxx>
45 #include <TopOpeBRepDS_Transition.hxx>
46 #include <TopOpeBRepTool_2d.hxx>
47 #include <TopOpeBRepTool_defineG.hxx>
48 #include <TopOpeBRepTool_EXPORT.hxx>
49 #include <TopOpeBRepTool_SC.hxx>
50
51 //#include <BRepAdaptor_Curve2d.hxx>
52 Standard_EXPORT Standard_Boolean FUN_projPonL(const gp_Pnt& P,const TopOpeBRep_LineInter L,const TopOpeBRep_FacesFiller& FF,
53                                  Standard_Real& paramL)
54 {
55   Standard_Boolean paramLdef = Standard_False;
56   Standard_Integer Esi = (L.ArcIsEdge(1)) ? 1:2;
57   const TopoDS_Edge& E = TopoDS::Edge(L.Arc());
58   Standard_Boolean hasC3D = FC2D_HasC3D(E);
59   Standard_Real dist;
60   if (hasC3D) {
61     BRepAdaptor_Curve BAC(E);
62     paramLdef = FUN_tool_projPonC(P,BAC,paramL,dist);
63   }
64   else {
65     BRepAdaptor_Curve2d BAC2D;
66     if      (Esi == 1)  BAC2D.Initialize(E,FF.Face(1));
67     else if (Esi == 2)  BAC2D.Initialize(E,FF.Face(2));
68     paramLdef = FUN_tool_projPonC2D(P,BAC2D,paramL,dist);
69   }
70   return paramLdef;
71 }
72
73 #ifdef OCCT_DEBUG
74 void debffsamdom(void){}
75 #endif
76
77 static void FUN_MakeERL(TopOpeBRep_FacesIntersector& FI,TopTools_ListOfShape& ERL)
78 {
79   ERL.Clear();
80   const TopTools_IndexedMapOfShape& mer = FI.Restrictions();
81   for ( Standard_Integer ie = 1, ne = mer.Extent(); ie <= ne; ie++) {
82     const TopoDS_Edge& E = TopoDS::Edge(mer.FindKey(ie));
83     ERL.Append(E);
84   }
85 }
86
87 //=======================================================================
88 //function : TopOpeBRep_FacesFiller
89 //purpose  : 
90 //=======================================================================
91 TopOpeBRep_FacesFiller::TopOpeBRep_FacesFiller() : myPShapeClassifier(NULL)
92
93   myexF1 = myexF2 = 0;
94 #ifdef OCCT_DEBUG
95   myHFFD = new TopOpeBRep_FFDumper(this);
96 #endif
97 }
98
99 //=======================================================================
100 //function : PShapeClassifier
101 //purpose  : 
102 //=======================================================================
103 TopOpeBRepTool_PShapeClassifier TopOpeBRep_FacesFiller::PShapeClassifier() const
104 {
105   return myPShapeClassifier;
106 }
107
108 //=======================================================================
109 //function : SetPShapeClassifier
110 //purpose  : 
111 //=======================================================================
112 void TopOpeBRep_FacesFiller::SetPShapeClassifier(const TopOpeBRepTool_PShapeClassifier& PSC) 
113 {
114   myPShapeClassifier = PSC;
115 }
116
117 //=======================================================================
118 //function : Insert
119 //purpose  : 
120 //=======================================================================
121 void TopOpeBRep_FacesFiller::Insert(const TopoDS_Shape& S1,const TopoDS_Shape& S2,TopOpeBRep_FacesIntersector& FACINT,const Handle(TopOpeBRepDS_HDataStructure)& HDS)
122 {
123   myF1 = TopoDS::Face(S1); myF1ori = S1.Orientation();
124   myF2 = TopoDS::Face(S2); myF2ori = S2.Orientation(); 
125   myFacesIntersector = &FACINT;
126   myHDS = HDS;
127   myDS = &(HDS->ChangeDS());
128   if (myPShapeClassifier == NULL) myPShapeClassifier = new TopOpeBRepTool_ShapeClassifier();
129
130 #ifdef OCCT_DEBUG
131   Standard_Integer exF1,exF2; GetTraceIndex(exF1,exF2);
132   myFacesIntersector->InitLine();
133   for (; myFacesIntersector->MoreLine(); myFacesIntersector->NextLine()) myFacesIntersector->CurrentLine().SetTraceIndex(exF1,exF2);
134   myHFFD->Init(this);
135 #endif
136   
137   Standard_Boolean samdom = myFacesIntersector->SameDomain();
138   if ( samdom ) {
139     myDS->FillShapesSameDomain(S1,S2);
140     return;
141   }
142   
143   myFacesIntersector->InitLine();
144   for (; myFacesIntersector->MoreLine(); myFacesIntersector->NextLine()) {
145     TopOpeBRep_LineInter& L = myFacesIntersector->CurrentLine();
146     L.SetFaces(TopoDS::Face(S1),TopoDS::Face(S2));
147   }
148   
149   VP_Position(FACINT);
150
151   myFacesIntersector->InitLine();
152   for (; myFacesIntersector->MoreLine(); myFacesIntersector->NextLine()) {
153     TopOpeBRep_LineInter& L = myFacesIntersector->CurrentLine();
154     L.SetHasVPonR();
155     L.SetINL();
156     L.SetIsVClosed();
157   }
158
159   ProcessSectionEdges();
160   myFFfirstDSP = myDS->NbPoints() + 1;
161
162   FUN_MakeERL((*myFacesIntersector), myERL); // BUG
163
164   myFacesIntersector->InitLine();
165   for (; myFacesIntersector->MoreLine(); myFacesIntersector->NextLine()) {
166     TopOpeBRep_LineInter& L = myFacesIntersector->CurrentLine();
167     LoadLine(L);
168     ProcessLine();
169   }
170   
171 }
172
173 //=======================================================================
174 //function : ChangePointClassifier
175 //purpose  : 
176 //=======================================================================
177 TopOpeBRep_PointClassifier& TopOpeBRep_FacesFiller::ChangePointClassifier()
178 {  
179   return myPointClassifier;
180 }
181
182
183 //=======================================================================
184 //function : LoadLine
185 //purpose  : 
186 //=======================================================================
187 void TopOpeBRep_FacesFiller::LoadLine(TopOpeBRep_LineInter& L)
188 {
189   myLine = &L;
190   Standard_Boolean bchk = CheckLine(L);
191   Standard_Boolean binl = L.INL();
192   myLineINL = binl;
193   {
194     TopOpeBRep_TypeLineCurve t = L.TypeLineCurve();
195     if ( !bchk && binl && t == TopOpeBRep_LINE ) {
196       bchk = Standard_True;
197     }
198   }
199   L.SetOK(bchk);
200   myLineOK = bchk;
201   if (!myLineOK) return;
202   
203   L.ComputeFaceFaceTransition();
204 } // LoadLine
205
206 //=======================================================================
207 //function : CheckLine
208 //purpose  : private
209 //           returns False if L is WALKING line with a number of VPoints < 2
210 //           else returns True 
211 //=======================================================================
212 Standard_Boolean TopOpeBRep_FacesFiller::CheckLine(TopOpeBRep_LineInter& L) const
213 {
214   Standard_Real tol1,tol2;
215   myFacesIntersector->GetTolerances(tol1,tol2);
216   
217   Standard_Boolean check = Standard_True;
218   TopOpeBRep_TypeLineCurve t = L.TypeLineCurve();
219   Standard_Integer nbvp = L.NbVPoint();
220   
221   if ( t == TopOpeBRep_WALKING ) {
222     if ( nbvp < 2 ) {
223 #ifdef OCCT_DEBUG
224       cout<<"\n=== Nb de IntPatch_Point sur WL incorrect : "<<nbvp<<" ===\n";
225 #endif
226       check = Standard_False;
227     }
228   }
229   else if (t == TopOpeBRep_LINE) {
230     Standard_Integer np = 0;
231     TopOpeBRep_VPointInterIterator VPI;
232     
233     for ( VPI.Init(L); VPI.More(); VPI.Next()) {
234       const TopOpeBRep_VPointInter& VP = VPI.CurrentVP();
235       if ( VP.Keep() ) np++;
236     }
237     if ( np != 2 ) {
238       return Standard_True;
239     }
240     
241     TopOpeBRep_VPointInter A,B;
242     np = 0;
243     for ( VPI.Init(L); VPI.More(); VPI.Next()) {
244       const TopOpeBRep_VPointInter& VP = VPI.CurrentVP();
245       if ( !VP.Keep() ) continue;
246       np++;
247       if ( np == 1 ) A = VP;
248       if ( np == 2 ) B = VP;
249     }
250     
251     Standard_Boolean isAV1 = A.IsVertexOnS1();
252     Standard_Boolean isAV2 = A.IsVertexOnS2();
253     TopoDS_Shape V1;
254     if (isAV1) V1 = A.VertexOnS1();
255     if (isAV2) V1 = A.VertexOnS2();
256     Standard_Boolean isBV1 = B.IsVertexOnS1();
257     Standard_Boolean isBV2 = B.IsVertexOnS2();
258     TopoDS_Shape V2;
259     if (isBV1) V2 = B.VertexOnS1();
260     if (isBV2) V2 = B.VertexOnS2();
261     
262     if ( !V1.IsNull() && ( V1.IsSame(V2) ) ) {
263       return Standard_False;      
264     }
265   } // LINE
266   else {
267     Standard_Boolean notrnotw = (t != TopOpeBRep_RESTRICTION && t != TopOpeBRep_WALKING);
268     if (notrnotw) {
269       if (t == TopOpeBRep_CIRCLE) { 
270         // cto 012 D2, faces 6 et 1, line 3 incorrecte.
271         
272         Standard_Integer iINON1,iINONn,nINON;
273         myLine->VPBounds(iINON1,iINONn,nINON);
274         if ( nINON >= 2) {
275           
276           const TopOpeBRep_VPointInter& A = myLine->VPoint(iINON1);
277           const TopOpeBRep_VPointInter& B = myLine->VPoint(iINONn);
278           Standard_Real parA = A.ParameterOnLine();    
279           Standard_Real parB = B.ParameterOnLine();    
280           Standard_Boolean conf = (fabs(parA-parB) < tol1);
281           if (conf) {
282             //modified by NIZHNY-MZV  Wed Dec  1 09:53:08 1999
283             check = Msf;
284 //modified by NIZHNY-MZV  Wed Dec  1 09:53:18 1999          Standard_Boolean isp = L.IsPeriodic();
285 //modified by NIZHNY-MZV  Wed Dec  1 09:53:20 1999          if (isp) {
286 //modified by NIZHNY-MZV  Wed Dec  1 09:53:21 1999            Handle(Geom_Circle) C = Handle(Geom_Circle)::DownCast(L.Curve());
287 //modified by NIZHNY-MZV  Wed Dec  1 09:53:22 1999            Standard_Real per = C->Period();
288 //modified by NIZHNY-MZV  Wed Dec  1 09:53:23 1999            parB = parA + per;
289 //modified by NIZHNY-MZV  Wed Dec  1 09:53:25 1999          }
290           }
291           
292 //modified by NIZHNY-MZV  Wed Dec  1 09:53:32 1999        Standard_Real t = 0.2567899311;
293 //modified by NIZHNY-MZV  Wed Dec  1 09:53:33 1999        Standard_Real p = (1-t)*parA + t*parB;
294 //modified by NIZHNY-MZV  Wed Dec  1 09:53:34 1999        Handle(Geom_Curve) GC = myLine->Curve();
295 //modified by NIZHNY-MZV  Wed Dec  1 09:53:34 1999        const TopoDS_Face& F1 = TopoDS::Face(myF1);
296 //modified by NIZHNY-MZV  Wed Dec  1 09:53:35 1999        const TopoDS_Face& F2 = TopoDS::Face(myF2);
297 //modified by NIZHNY-MZV  Wed Dec  1 09:53:36 1999        Handle(Geom_Surface) GS1 = BRep_Tool::Surface(F1);
298 //modified by NIZHNY-MZV  Wed Dec  1 09:53:36 1999        Handle(Geom_Surface) GS2 = BRep_Tool::Surface(F2);
299 //modified by NIZHNY-MZV  Wed Dec  1 09:53:37 1999        Handle(Geom2d_Curve) C1 = GeomProjLib::Curve2d(GC,parA,parB,GS1);
300 //modified by NIZHNY-MZV  Wed Dec  1 09:53:38 1999        Handle(Geom2d_Curve) C2 = GeomProjLib::Curve2d(GC,parA,parB,GS2);       
301           
302 //modified by NIZHNY-MZV  Wed Dec  1 09:53:39 1999        gp_Pnt2d P1 = C1->Value(p);
303 //modified by NIZHNY-MZV  Wed Dec  1 09:53:44 1999        gp_Pnt2d P2 = C2->Value(p);
304 //modified by NIZHNY-MZV  Wed Dec  1 09:53:45 1999        TopOpeBRep_PointClassifier* pcl = (TopOpeBRep_PointClassifier*)((void*)&myPointClassifier);
305 //modified by NIZHNY-MZV  Wed Dec  1 09:53:46 1999        TopAbs_State staP1 = pcl->Classify(F1,P1,tol1);
306 //modified by NIZHNY-MZV  Wed Dec  1 09:53:47 1999        TopAbs_State staP2 = pcl->Classify(F2,P2,tol1);
307 //modified by NIZHNY-MZV  Wed Dec  1 09:53:48 1999Standard_Boolean ok1 = (staP1 == TopAbs_IN || staP1 == TopAbs_ON);
308 //modified by NIZHNY-MZV  Wed Dec  1 09:53:49 1999        Standard_Boolean ok2 = (staP2 == TopAbs_IN || staP2 == TopAbs_ON);
309 //modified by NIZHNY-MZV  Wed Dec  1 09:53:50 1999        check = (ok1 && ok2);
310           
311         }
312       } // CIRCLE
313       else if (t == TopOpeBRep_HYPERBOLA) {
314         Standard_Integer iINON1,iINONn,nINON;
315         myLine->VPBounds(iINON1,iINONn,nINON);
316         if ( nINON < 2 ) {
317           check = Standard_False;
318         }
319       }
320       else if (t == TopOpeBRep_ELLIPSE) {
321         Standard_Integer iINON1,iINONn,nINON;
322         myLine->VPBounds(iINON1,iINONn,nINON);
323         if ( nINON < 2 ) {
324           check = Standard_False;
325         }
326         else {
327           const TopOpeBRep_VPointInter& A = myLine->VPoint(iINON1);
328           const TopOpeBRep_VPointInter& B = myLine->VPoint(iINONn);
329           Standard_Real parA = A.ParameterOnLine();    
330           Standard_Real parB = B.ParameterOnLine();    
331           Standard_Boolean conf = (fabs(parA-parB) < tol1);
332           if (conf) {
333             check = Standard_False;
334           }
335         }
336       }
337     }
338   }
339   
340 #ifdef OCCT_DEBUG
341   if (!check) { cout<<"# DEB CheckLine : rejet de ";TopOpeBRep::Print(t,cout);cout<<" a "<<nbvp<<" points"<<endl; }
342 #endif
343
344   return check;
345 }
346
347 //=======================================================================
348 //function : VP_Position
349 //purpose  : 
350 //=======================================================================
351 //void TopOpeBRep_FacesFiller::VP_Position(TopOpeBRep_FacesIntersector& FACINT)
352 void TopOpeBRep_FacesFiller::VP_Position(TopOpeBRep_FacesIntersector& )
353 {
354   for (myFacesIntersector->InitLine(); 
355        myFacesIntersector->MoreLine();
356        myFacesIntersector->NextLine()) {
357     TopOpeBRep_LineInter& L = myFacesIntersector->CurrentLine();
358     const TopOpeBRep_TypeLineCurve tl = L.TypeLineCurve();
359     Standard_Boolean ok = (tl == TopOpeBRep_RESTRICTION) ;
360     if ( ok ) VP_Position(L);
361   }
362   
363   for (myFacesIntersector->InitLine(); 
364        myFacesIntersector->MoreLine(); 
365        myFacesIntersector->NextLine()) {
366     TopOpeBRep_LineInter& L = myFacesIntersector->CurrentLine();
367     const TopOpeBRep_TypeLineCurve tl = L.TypeLineCurve();
368     Standard_Boolean ok = (tl != TopOpeBRep_RESTRICTION) ;
369     if ( ok ) VP_Position(L);
370   }
371 }
372
373 //=======================================================================
374 //function : VP_Position
375 //purpose  : 
376 //=======================================================================
377 void TopOpeBRep_FacesFiller::VP_Position(TopOpeBRep_LineInter& L)
378 {
379   myLine = &L;
380   Standard_Boolean isrest = (L.TypeLineCurve() == TopOpeBRep_RESTRICTION) ;
381   
382   if (!isrest) VP_PositionOnL(L);
383   else         VP_PositionOnR(L);
384   
385   L.SetVPBounds();
386 }
387
388 //=======================================================================
389 //function : VP_PositionOnL
390 //purpose  : 
391 //=======================================================================
392 void TopOpeBRep_FacesFiller::VP_PositionOnL(TopOpeBRep_LineInter& L)
393 {
394   TopOpeBRep_VPointInterIterator VPI(L);
395   Standard_Integer Lindex = L.Index();
396   TopOpeBRep_VPointInterClassifier VPC;
397   
398   for (; VPI.More(); VPI.Next()) {
399     TopOpeBRep_VPointInter& VP = VPI.ChangeCurrentVP();
400     Standard_Integer VPsi = VP.ShapeIndex();
401     const gp_Pnt& P3D = VP.Value();
402     
403     Standard_Boolean VPequalVPONRESTRICTION = Standard_False;
404     TopOpeBRep_FacesIntersector& FI = *((TopOpeBRep_FacesIntersector*)((void*)myFacesIntersector));
405     Standard_Integer iOL = 1,n = FI.NbLines(); 
406     for (iOL=1; iOL<=n; iOL++ ) { 
407       if (iOL == Lindex ) continue; 
408       TopOpeBRep_LineInter& OL = FI.ChangeLine(iOL);
409       VPequalVPONRESTRICTION = PequalVPonR(P3D,VPsi,VP,OL);
410       if ( VPequalVPONRESTRICTION ) break;
411     }
412     
413     if ( !VPequalVPONRESTRICTION ) {
414       VP_Position(VP,VPC);
415     }    
416   }
417 }
418
419 //=======================================================================
420 //function : VP_PositionOnR
421 //purpose  : 
422 //=======================================================================
423 void TopOpeBRep_FacesFiller::VP_PositionOnR(TopOpeBRep_LineInter& L)
424 {
425   TopOpeBRep_VPointInterClassifier VPC;
426   
427   TopOpeBRep_VPointInterIterator VPI(L);
428   Standard_Integer Esi   = (L.ArcIsEdge(1)) ? 1:2;
429   Standard_Integer OOEsi = (L.ArcIsEdge(1)) ? 2:1;
430   
431   Standard_Boolean isline = Standard_False;
432   const TopoDS_Edge& earc = TopoDS::Edge(L.Arc());
433   Standard_Boolean hasc3d = FC2D_HasC3D(earc);
434   if (hasc3d) isline = FUN_tool_line(earc);
435   else {
436     BRepAdaptor_Curve2d BAC2D;
437     if      (Esi == 1)  BAC2D.Initialize(earc,myF1);
438     else if (Esi == 2)  BAC2D.Initialize(earc,myF2);
439     GeomAbs_CurveType t = BAC2D.GetType();
440     isline = (t == GeomAbs_Line);
441   }
442   
443   for (; VPI.More(); VPI.Next()) {
444     TopOpeBRep_VPointInter& VP = VPI.ChangeCurrentVP();
445     
446     Standard_Boolean isvertex = VP.IsVertex(Esi);
447     if ( isvertex ) {
448       if (!isline) VP_Position(VP,VPC);
449       continue;
450     }
451     Standard_Boolean OOisvertex = VP.IsVertex(OOEsi);
452     if ( OOisvertex ) {
453       if (!isline) VP_Position(VP,VPC);
454       continue;
455     }
456     
457     const gp_Pnt& P = VP.Value();
458     Standard_Boolean arcisE = L.ArcIsEdge(Esi);
459     Standard_Boolean arcisOOE = L.ArcIsEdge(OOEsi);
460     
461     if (arcisE) {
462       Standard_Real paramC;Standard_Boolean paramCdef = FUN_projPonL(P,L,(*this),paramC);
463       if ( paramCdef ) {
464         const TopoDS_Edge& E = TopoDS::Edge(L.Arc());
465         VP.State(TopAbs_ON,Esi);
466         VP.EdgeON(E,paramC,Esi);
467       }
468       else {
469 //      Standard_ProgramError::Raise("VP_Position projection failed on E");
470         VP.ChangeKeep(Standard_False); // xpu051198
471       }
472     }
473     
474     if (arcisOOE) {
475       Standard_Real paramC;Standard_Boolean paramCdef = FUN_projPonL(P,L,(*this),paramC);
476       if ( paramCdef ) {
477         const TopoDS_Edge& OOE = TopoDS::Edge(L.Arc());
478         VP.State(TopAbs_ON,OOEsi);
479         VP.EdgeON(OOE,paramC,OOEsi);
480       }
481       else {
482 //      Standard_ProgramError::Raise("VP_Position projection failed on OOE");
483         VP.ChangeKeep(Standard_False); // xpu051198
484       }
485     }
486   }
487 }
488
489 //=======================================================================
490 //function : VP_Position
491 //purpose  : 
492 //=======================================================================
493 void TopOpeBRep_FacesFiller::VP_Position(TopOpeBRep_VPointInter& VP,TopOpeBRep_VPointInterClassifier& VPC)
494 {
495   Standard_Integer si = VP.ShapeIndex();
496   Standard_Boolean c1=Standard_False,c2=Standard_False;
497
498   if      (si == 0) { c1 = Standard_True; c2 = Standard_True; }
499   else if (si == 1) { c1 = Standard_False; c2 = Standard_True; }
500   else if (si == 2) { c1 = Standard_True; c2 = Standard_False; }
501   else if (si == 3) { c1 = Standard_True; c2 = Standard_True; }
502   
503   Standard_Boolean AssumeINON = Standard_False;
504   if (myLine) AssumeINON = (myLine->TypeLineCurve() != TopOpeBRep_RESTRICTION);
505
506   // modified by NIZHNY-MKK  Fri Oct 27 14:50:28 2000.BEGIN
507   //   Standard_Real tol = Precision::Confusion();
508   Standard_Real tol1, tol2;
509   tol1 = tol2 = Precision::Confusion();
510   myFacesIntersector->GetTolerances(tol1, tol2);
511   Standard_Real tol = (tol1 > tol2) ? tol1 : tol2;
512   // modified by NIZHNY-MKK  Fri Oct 27 14:50:36 2000.END
513
514   if (c1) VPC.VPointPosition(myF1,VP,1,myPointClassifier,AssumeINON,tol);
515   if (c2) VPC.VPointPosition(myF2,VP,2,myPointClassifier,AssumeINON,tol);
516 }
517
518 //=======================================================================
519 //function : PequalVPonR
520 //purpose  : 
521 //=======================================================================
522 Standard_Boolean TopOpeBRep_FacesFiller::PequalVPonR(const gp_Pnt& P3D,const Standard_Integer VPsi,TopOpeBRep_VPointInter& VP,TopOpeBRep_LineInter& Lrest) const 
523 {
524   const TopOpeBRep_TypeLineCurve tOL = Lrest.TypeLineCurve();
525   Standard_Boolean OLok = (tOL == TopOpeBRep_RESTRICTION) ;
526   if ( !OLok ) return Standard_False;
527   
528   Standard_Boolean VPequalVPONRESTRICTION = Standard_False;
529   const TopoDS_Edge& EOL = TopoDS::Edge(Lrest.Arc());
530   Standard_Integer EOLsi = (Lrest.ArcIsEdge(1)) ? 1:2;
531   
532   TopOpeBRep_VPointInterIterator VPIOL(Lrest);
533   for (; VPIOL.More(); VPIOL.Next()) {
534     TopOpeBRep_VPointInter& VPOL = VPIOL.ChangeCurrentVP();
535     Standard_Integer VPOLsi = VPOL.ShapeIndex();
536     
537     Standard_Boolean VPOLisvertex = Standard_False;
538     VPOLisvertex = VPOL.IsVertex(1);
539     if (VPOLisvertex) continue;
540     
541     Standard_Boolean diffsi = (VPOLsi != VPsi);
542     if ( diffsi ) continue;
543     
544     TopAbs_State stateEsi = VPOL.State(EOLsi);
545     if (stateEsi != TopAbs_ON) continue; 
546     
547     const gp_Pnt& P3DOL = VPOL.Value();
548     Standard_Real tolE = BRep_Tool::Tolerance(EOL);
549     VPequalVPONRESTRICTION = P3DOL.IsEqual(P3D,tolE);
550     
551     if ( VPequalVPONRESTRICTION ) {
552       Standard_Real paramCOL = VPOL.EdgeONParameter(EOLsi);
553       VP.State(TopAbs_ON,EOLsi);
554       VP.EdgeON(EOL,paramCOL,EOLsi);
555       break;
556     }
557   }
558   return VPequalVPONRESTRICTION;
559 }
560
561 //=======================================================================
562 //function : FacesIntersector
563 //purpose  : 
564 //=======================================================================
565 TopOpeBRep_FacesIntersector& TopOpeBRep_FacesFiller::ChangeFacesIntersector()
566 {
567   return (*myFacesIntersector);
568 }
569
570 //=======================================================================
571 //function : HDataStructure
572 //purpose  : 
573 //=======================================================================
574 Handle(TopOpeBRepDS_HDataStructure) TopOpeBRep_FacesFiller::HDataStructure()
575 {
576   return myHDS;
577 }
578
579 //=======================================================================
580 //function : DataStructure
581 //purpose  : 
582 //=======================================================================
583 TopOpeBRepDS_DataStructure& TopOpeBRep_FacesFiller::ChangeDataStructure()
584 {
585   return (*myDS);
586 }
587
588 //=======================================================================
589 //function : Face
590 //purpose  : 
591 //=======================================================================
592 const TopoDS_Face& TopOpeBRep_FacesFiller::Face(const Standard_Integer I) const
593 {
594   if      (I == 1) return myF1;
595   else if (I == 2) return myF2;
596   Standard_ProgramError::Raise("FacesFiller::Face");
597   return myF1;
598 }
599
600 //=======================================================================
601 //function : FaceFaceTransition
602 //purpose  : 
603 //=======================================================================
604 const TopOpeBRepDS_Transition& TopOpeBRep_FacesFiller::FaceFaceTransition(const TopOpeBRep_LineInter& L,const Standard_Integer I) const
605 {
606   const TopOpeBRepDS_Transition& T = L.FaceFaceTransition(I);
607   return T;
608 }
609
610 //=======================================================================
611 //function : FaceFaceTransition
612 //purpose  : 
613 //=======================================================================
614 const TopOpeBRepDS_Transition& TopOpeBRep_FacesFiller::FaceFaceTransition(const Standard_Integer I) const
615 {
616   const TopOpeBRepDS_Transition& T = myLine->FaceFaceTransition(I);
617   return T;
618 }
619
620 TopOpeBRep_PFacesIntersector TopOpeBRep_FacesFiller::PFacesIntersectorDummy() const 
621 {return myFacesIntersector;}
622 TopOpeBRepDS_PDataStructure TopOpeBRep_FacesFiller::PDataStructureDummy() const 
623 {return myDS;}
624 TopOpeBRep_PLineInter TopOpeBRep_FacesFiller::PLineInterDummy() const 
625 {return myLine;}
626
627 //=======================================================================
628 //function : SetTraceIndex
629 //purpose  : 
630 //=======================================================================
631 void TopOpeBRep_FacesFiller::SetTraceIndex(const Standard_Integer exF1,const Standard_Integer exF2)
632
633   myexF1 = exF1;
634   myexF2 = exF2;
635 }
636
637 //=======================================================================
638 //function : GetTraceIndex
639 //purpose  : 
640 //=======================================================================
641 void TopOpeBRep_FacesFiller::GetTraceIndex(Standard_Integer& exF1,Standard_Integer& exF2)const 
642
643   exF1 = myexF1;
644   exF2 = myexF2;
645 }