0024624: Lost word in license statement in source files
[occt.git] / src / BRepTopAdaptor / BRepTopAdaptor_FClass2d.cxx
CommitLineData
b311480e 1// Created on: 1995-03-22
2// Created by: Laurent BUCHARD
3// Copyright (c) 1995-1999 Matra Datavision
973c2be1 4// Copyright (c) 1999-2014 OPEN CASCADE SAS
b311480e 5//
973c2be1 6// This file is part of Open CASCADE Technology software library.
b311480e 7//
d5f74e42 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
973c2be1 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.
b311480e 13//
973c2be1 14// Alternatively, this file may be used under the terms of Open CASCADE
15// commercial license or contractual agreement.
7fd59977 16
17#define AFFICHAGE 0
18
19#define No_Standard_OutOfRange
20
21#include <BRepTopAdaptor_FClass2d.ixx>
22
23#include <TopoDS_Edge.hxx>
24#include <TopoDS.hxx>
25#include <BRep_Tool.hxx>
26#include <TopAbs_Orientation.hxx>
27#include <TopExp_Explorer.hxx>
28#include <TColgp_SequenceOfPnt2d.hxx>
29#include <BRepTools_WireExplorer.hxx>
30#include <Geom2dInt_Geom2dCurveTool.hxx>
31#include <BRepAdaptor_Curve2d.hxx>
32#include <TColgp_Array1OfPnt2d.hxx>
33#include <BRepClass_FaceClassifier.hxx>
34#include <CSLib_Class2d.hxx>
35#include <GeomAbs_SurfaceType.hxx>
36#include <BRepAdaptor_HSurface.hxx>
37#include <TopExp.hxx>
38#include <BRepAdaptor_Curve.hxx>
39
40#include <gp_Pnt.hxx>
41#include <ElCLib.hxx>
42
43#include <Precision.hxx>
44
45#ifdef WNT
46#include <stdio.h>
47#endif
48
49
50#ifdef DEB
51#define LBRCOMPT 0
52#else
53#define LBRCOMPT 0
54#endif
55
56
57#if LBRCOMPT
58class StatistiquesFClass2d {
59public:
60 long unsigned NbConstrShape;
61 long unsigned NbPerformInfinitePoint;
62 long unsigned NbPerform;
63 long unsigned NbTestOnRestriction;
64 long unsigned NbDestroy;
65public:
66 StatistiquesFClass2d() {
67 NbConstrShape=NbPerform=NbPerformInfinitePoint=NbDestroy=0;
68 }
69 ~StatistiquesFClass2d() {
70 printf("\n--- Statistiques BRepTopAdaptor:\n");
71 printf("\nConstructeur(Shape) : %10lu",NbConstrShape);
72 printf("\nPerformInfinitePoint: %10lu",NbPerformInfinitePoint);
73 printf("\nTestOnRestriction : %10lu",NbTestOnRestriction);
74 printf("\nPerform(pnt2d) : %10lu",NbPerform);
75 printf("\nDestroy : %10lu",NbDestroy);
76 }
77};
78
79static StatistiquesFClass2d STAT;
80#endif
81
82
83
84
85BRepTopAdaptor_FClass2d::BRepTopAdaptor_FClass2d(const TopoDS_Face& aFace,const Standard_Real TolUV)
86: Toluv(TolUV), Face(aFace) {
87
88#if LBRCOMPT
89 STAT.NbConstrShape++;
90#endif
91
0d969553 92 //-- dead end on surfaces defined on more than one period
7fd59977 93
94 Face.Orientation(TopAbs_FORWARD);
95 Handle(BRepAdaptor_HSurface) surf = new BRepAdaptor_HSurface();
96 surf->ChangeSurface().Initialize(aFace,Standard_False);
97
98 TopoDS_Edge edge;
99 TopAbs_Orientation Or;
100 Standard_Real u,du,Tole = 0.0,Tol=0.0;
101 BRepTools_WireExplorer WireExplorer;
102 TopExp_Explorer FaceExplorer;
103
104 Umin = Vmin = 0.0; //RealLast();
105 Umax = Vmax = -Umin;
106
107 Standard_Integer BadWire=0;
108 for( FaceExplorer.Init(Face,TopAbs_WIRE); (FaceExplorer.More() && BadWire==0); FaceExplorer.Next() )
109 {
110 Standard_Integer nbpnts = 0;
111 TColgp_SequenceOfPnt2d SeqPnt2d;
112 Standard_Integer firstpoint = 1;
113 Standard_Real FlecheU = 0.0;
114 Standard_Real FlecheV = 0.0;
115 Standard_Boolean WireIsNotEmpty = Standard_False;
116 Standard_Integer NbEdges = 0;
117
118 TopExp_Explorer Explorer;
119 for( Explorer.Init(FaceExplorer.Current(),TopAbs_EDGE); Explorer.More(); Explorer.Next() ) NbEdges++;
120
121 gp_Pnt Ancienpnt3d(0,0,0);
122 Standard_Boolean Ancienpnt3dinitialise = Standard_False;
123
124 for( WireExplorer.Init(TopoDS::Wire(FaceExplorer.Current()),Face); WireExplorer.More(); WireExplorer.Next() )
125 {
126
127 NbEdges--;
128 edge = WireExplorer.Current();
129 Or = edge.Orientation();
130 if(Or == TopAbs_FORWARD || Or == TopAbs_REVERSED)
131 {
132 Standard_Real pfbid,plbid;
133 if(BRep_Tool::CurveOnSurface(edge,Face,pfbid,plbid).IsNull()) return;
134 BRepAdaptor_Curve2d C(edge,Face);
135
136 //-- ----------------------------------------
137 Standard_Boolean degenerated=Standard_False;
138 if(BRep_Tool::Degenerated(edge)) degenerated=Standard_True;
139 if(BRep_Tool::IsClosed(edge,Face)) degenerated=Standard_True;
140 TopoDS_Vertex Va,Vb;
141 TopExp::Vertices(edge,Va,Vb);
142 Standard_Real TolVertex1=0.,TolVertex=0.;
143 if (Va.IsNull()) degenerated=Standard_True;
144 else TolVertex1=BRep_Tool::Tolerance(Va);
145 if (Vb.IsNull()) degenerated=Standard_True;
146 else TolVertex=BRep_Tool::Tolerance(Vb);
147 if(TolVertex<TolVertex1) TolVertex=TolVertex1;
148 BRepAdaptor_Curve C3d;
149
150 if(Abs(plbid-pfbid) < 1.e-9) continue;
151
152 //if(degenerated==Standard_False)
153 // C3d.Initialize(edge,Face);
154
0d969553 155 //-- Check cases when it was forgotten to code degenerated : PRO17410 (janv 99)
7fd59977 156 if(degenerated == Standard_False)
157 {
158 C3d.Initialize(edge,Face);
159 du=(plbid-pfbid)*0.1;
160 u=pfbid+du;
161 gp_Pnt P3da=C3d.Value(u);
162 degenerated=Standard_True;
163 u+=du;
164 do
165 {
166
167 gp_Pnt P3db=C3d.Value(u);
168 // if(P3da.SquareDistance(P3db)) { degenerated=Standard_False; break; }
169 if(P3da.SquareDistance(P3db) > Precision::Confusion()) { degenerated=Standard_False; break; }
170 u+=du;
171 }
172 while(u<plbid);
173 }
174
175 //-- ----------------------------------------
176
177 Tole = BRep_Tool::Tolerance(edge);
178 if(Tole>Tol) Tol=Tole;
179
180 //Standard_Integer nbs = 1 + Geom2dInt_Geom2dCurveTool::NbSamples(C);
181 Standard_Integer nbs = Geom2dInt_Geom2dCurveTool::NbSamples(C);
0d969553 182 //-- Attention to rational bsplines of degree 3. (ends of circles among others)
7fd59977 183 if (nbs > 2) nbs*=4;
184 du = (plbid-pfbid)/(Standard_Real)(nbs-1);
185
186 if(Or==TopAbs_FORWARD) u = pfbid;
187 else { u = plbid; du=-du; }
188
189 //-- ------------------------------------------------------------
0d969553
Y
190 //-- Check distance uv between the start point of the edge
191 //-- and the last point registered in SeqPnt2d
192 //-- Try to remote the first point of the current edge
193 //-- from the last saved point
7fd59977 194#ifdef DEB
195 gp_Pnt2d Pnt2dDebutEdgeCourant=
196#endif
197 C.Value(u);
198
199 //Standard_Real Baillement2dU=0;
200 //Standard_Real Baillement2dV=0;
201#if AFFICHAGE
202 if(nbpnts>1) printf("\nTolVertex %g ",TolVertex);
203#endif
204
205 if(firstpoint==2) u+=du;
206 Standard_Integer Avant = nbpnts;
207 for(Standard_Integer e = firstpoint; e<=nbs; e++)
208 {
209 gp_Pnt2d P2d = C.Value(u);
210 if(P2d.X()<Umin) Umin = P2d.X();
211 if(P2d.X()>Umax) Umax = P2d.X();
212 if(P2d.Y()<Vmin) Vmin = P2d.Y();
213 if(P2d.Y()>Vmax) Vmax = P2d.Y();
214
215 Standard_Real dist3dptcourant_ancienpnt=1e+20;//RealLast();
216 gp_Pnt P3d;
217 if(degenerated==Standard_False)
218 {
219 P3d=C3d.Value(u);
220 if(nbpnts>1 && Ancienpnt3dinitialise) dist3dptcourant_ancienpnt = P3d.Distance(Ancienpnt3d);
221 }
222 Standard_Boolean IsRealCurve3d = Standard_True; //patch
223 if(dist3dptcourant_ancienpnt < Precision::Confusion())
224 {
225 gp_Pnt MidP3d = C3d.Value( u-du/2. );
226 if (P3d.Distance( MidP3d ) < Precision::Confusion()) IsRealCurve3d = Standard_False;
227 }
228 if(IsRealCurve3d)
229 {
230 if(degenerated==Standard_False) { Ancienpnt3d=P3d; Ancienpnt3dinitialise=Standard_True; }
231 nbpnts++;
232 SeqPnt2d.Append(P2d);
233 }
234#if AFFICHAGE
235 else { static int mm=0; printf("\npoint p%d %g %g %g",++mm,P3d.X(),P3d.Y(),P3d.Z()); }
236#endif
237 u+=du;
238 Standard_Integer ii = nbpnts;
239 //-- printf("\n nbpnts:%4d u=%7.5g FlecheU=%7.5g FlecheV=%7.5g ii=%3d Avant=%3d ",nbpnts,u,FlecheU,FlecheV,ii,Avant);
240// if(ii>(Avant+4))
241// Modified by Sergey KHROMOV - Fri Apr 19 09:46:12 2002 Begin
242 if(ii>(Avant+4) && SeqPnt2d(ii-2).SquareDistance(SeqPnt2d(ii)))
243// Modified by Sergey KHROMOV - Fri Apr 19 09:46:13 2002 End
244 {
245 gp_Lin2d Lin(SeqPnt2d(ii-2),gp_Dir2d(gp_Vec2d(SeqPnt2d(ii-2),SeqPnt2d(ii))));
246 Standard_Real ul = ElCLib::Parameter(Lin,SeqPnt2d(ii-1));
247 gp_Pnt2d Pp = ElCLib::Value(ul,Lin);
248 Standard_Real dU = Abs(Pp.X()-SeqPnt2d(ii-1).X());
249 Standard_Real dV = Abs(Pp.Y()-SeqPnt2d(ii-1).Y());
250 //-- printf(" (du=%7.5g dv=%7.5g)",dU,dV);
251 if(dU>FlecheU) FlecheU = dU;
252 if(dV>FlecheV) FlecheV = dV;
253 }
254 }//for(e=firstpoint
255 if(firstpoint==1) firstpoint=2;
256 WireIsNotEmpty = Standard_True;
257 }//if(Or==FORWARD,REVERSED
258 } //-- Edges -> for(Ware.Explorer
259
260 if(NbEdges)
0d969553 261 { //-- on compte ++ with a normal explorer and with the Wire Explorer
7fd59977 262/*
263#ifdef DEB
264
265 cout << endl;
266 cout << "*** BRepTopAdaptor_Fclass2d ** Wire Probablement FAUX **" << endl;
0d969553
Y
267 cout << "*** WireExplorer does not find all edges " << endl;
268 cout << "*** Connect old classifier" << endl;
7fd59977 269#endif
270*/
271 TColgp_Array1OfPnt2d PClass(1,2);
272 //// modified by jgv, 28.04.2009 ////
273 PClass.Init(gp_Pnt2d(0.,0.));
274 /////////////////////////////////////
275 TabClass.Append((void *)new CSLib_Class2d(PClass,FlecheU,FlecheV,Umin,Vmin,Umax,Vmax));
276 BadWire=1;
277 TabOrien.Append(-1);
278 }
279 else if(WireIsNotEmpty)
280 {
281 //Standard_Real anglep=0,anglem=0;
282 TColgp_Array1OfPnt2d PClass(1,nbpnts);
6e6cd5d9 283 Standard_Real square = 0.0;
7fd59977 284
285 //-------------------------------------------------------------------
0d969553
Y
286 //-- ** The mode of calculation was somewhat changed
287 //-- Before Oct 31 97 , the total angle of
288 //-- rotation of the wire was evaluated on all angles except for the last
289 //-- ** Now, exactly the angle of rotation is evaluated
290 //-- If a value remote from 2PI or -2PI is found, it means that there is
291 //-- an uneven number of loops
7fd59977 292
293 if(nbpnts>3)
294 {
295// Standard_Integer im2=nbpnts-2;
296 Standard_Integer im1=nbpnts-1;
297 Standard_Integer im0=1;
298// PClass(im2)=SeqPnt2d.Value(im2);
299 PClass(im1)=SeqPnt2d.Value(im1);
300 PClass(nbpnts)=SeqPnt2d.Value(nbpnts);
301
302
303// for(Standard_Integer ii=1; ii<nbpnts; ii++,im0++,im1++,im2++)
304 for(Standard_Integer ii=1; ii<nbpnts; ii++,im0++,im1++)
305 {
306// if(im2>=nbpnts) im2=1;
307 if(im1>=nbpnts) im1=1;
308 PClass(ii)=SeqPnt2d.Value(ii);
309// gp_Vec2d A(PClass(im2),PClass(im1));
310// gp_Vec2d B(PClass(im1),PClass(im0));
311// Standard_Real N = A.Magnitude() * B.Magnitude();
312
313 square += (PClass(im0).X()-PClass(im1).X())*(PClass(im0).Y()+PClass(im1).Y())*.5;
314
315// if(N>1e-16){ Standard_Real a=A.Angle(B); angle+=a; }
316 }
317
318
319 //-- FlecheU*=10.0;
320 //-- FlecheV*=10.0;
321 if(FlecheU<Toluv) FlecheU = Toluv;
322 if(FlecheV<Toluv) FlecheV = Toluv;
323 //-- cout<<" U:"<<FlecheU<<" V:"<<FlecheV<<endl;
324 TabClass.Append((void *)new CSLib_Class2d(PClass,FlecheU,FlecheV,Umin,Vmin,Umax,Vmax));
325
326// if((angle<2 && angle>-2)||(angle>10)||(angle<-10))
327// {
328// BadWire=1;
329// TabOrien.Append(-1);
330//#ifdef DEB
331// cout << endl;
0d969553
Y
332// cout << "*** BRepTopAdaptor_Fclass2d ** Wire Probably FALSE **" << endl;
333// cout << "*** Total rotation angle of the wire : " << angle << endl;
334// cout << "*** Connect the old classifier" << endl;
7fd59977 335//#endif
336// }
337// else TabOrien.Append(((angle>0.0)? 1 : 0));
338 TabOrien.Append(((square < 0.0)? 1 : 0));
339 }//if(nbpoints>3
340 else
341 {
342#ifdef DEB
343 cout << endl;
0d969553
Y
344 cout << "*** BRepTopAdaptor_Fclass2d ** Wire Probably FALSE **" << endl;
345 cout << "*** The sample wire contains less than 3 points" << endl;
346 cout << "*** Connect the old classifier" << endl;
7fd59977 347#endif
348 BadWire=1;
349 TabOrien.Append(-1);
350 TColgp_Array1OfPnt2d xPClass(1,2);
351 xPClass(1) = SeqPnt2d(1);
352 xPClass(2) = SeqPnt2d(2);
353 TabClass.Append((void *)new CSLib_Class2d(xPClass,FlecheU,FlecheV,Umin,Vmin,Umax,Vmax));
354 }
355 }//else if(WareIsNotEmpty
356 }//for(FaceExplorer
357
358 Standard_Integer nbtabclass = TabClass.Length();
359
360 if(nbtabclass>0)
361 {
0d969553 362 //-- If an error was detected on a wire: set all TabOrien to -1
7fd59977 363 if(BadWire) TabOrien(1)=-1;
364
365 if( surf->GetType()==GeomAbs_Cone
366 || surf->GetType()==GeomAbs_Cylinder
367 || surf->GetType()==GeomAbs_Torus
368 || surf->GetType()==GeomAbs_Sphere
369 || surf->GetType()==GeomAbs_SurfaceOfRevolution)
370
371 {
c6541a0c 372 Standard_Real uuu=M_PI+M_PI-(Umax-Umin);
7fd59977 373 if(uuu<0) uuu=0;
374 U1 = 0.0; // modified by NIZHNY-OFV Thu May 31 14:24:10 2001 ---> //Umin-uuu*0.5;
c6541a0c 375 U2 = 2*M_PI; // modified by NIZHNY-OFV Thu May 31 14:24:35 2001 ---> //U1+M_PI+M_PI;
7fd59977 376 }
377 else { U1=U2=0.0; }
378
379 if(surf->GetType()==GeomAbs_Torus)
380 {
c6541a0c 381 Standard_Real uuu=M_PI+M_PI-(Vmax-Vmin);
7fd59977 382 if(uuu<0) uuu=0;
383 V1 = 0.0; // modified by NIZHNY-OFV Thu May 31 14:24:55 2001 ---> //Vmin-uuu*0.5;
c6541a0c 384 V2 = 2*M_PI; // modified by NIZHNY-OFV Thu May 31 14:24:59 2001 ---> //V1+M_PI+M_PI;
7fd59977 385 }
386 else { V1=V2=0.0; }
387 }
388}
389
390TopAbs_State BRepTopAdaptor_FClass2d::PerformInfinitePoint() const {
391#if LBRCOMPT
392 STAT.NbPerformInfinitePoint++;
393#endif
394
395 if(Umax==-RealLast() || Vmax==-RealLast() || Umin==RealLast() || Vmin==RealLast()) {
396 return(TopAbs_IN);
397 }
398 gp_Pnt2d P(Umin-(Umax-Umin),Vmin-(Vmax-Vmin));
399 return(Perform(P,Standard_False));
400}
401
402TopAbs_State BRepTopAdaptor_FClass2d::Perform(const gp_Pnt2d& _Puv,
403 const Standard_Boolean RecadreOnPeriodic) const
404{
405#if LBRCOMPT
406 STAT.NbPerform++;
407#endif
408
409 Standard_Integer dedans;
410 Standard_Integer nbtabclass = TabClass.Length();
411
412 if(nbtabclass==0) {
413 return(TopAbs_IN);
414 }
415
0d969553 416 //-- U1 is the First Param and U2 in this case is U1+Period
7fd59977 417 Standard_Real u=_Puv.X();
418 Standard_Real v=_Puv.Y();
419 Standard_Real uu = u, vv = v;
420
421 Handle(BRepAdaptor_HSurface) surf = new BRepAdaptor_HSurface();
422 surf->ChangeSurface().Initialize( Face, Standard_False );
773f53f1 423 const Standard_Boolean IsUPer = surf->IsUPeriodic();
424 const Standard_Boolean IsVPer = surf->IsVPeriodic();
425 const Standard_Real uperiod = IsUPer ? surf->UPeriod() : 0.0;
426 const Standard_Real vperiod = IsVPer ? surf->VPeriod() : 0.0;
7fd59977 427 TopAbs_State Status = TopAbs_UNKNOWN;
428 Standard_Boolean urecadre = Standard_False, vrecadre = Standard_False;
429
430 if (RecadreOnPeriodic)
431 {
432 if (IsUPer)
433 {
434 if (uu < Umin)
435 while (uu < Umin)
436 uu += uperiod;
437 else
438 {
439 while (uu >= Umin)
440 uu -= uperiod;
441 uu += uperiod;
442 }
443 }
444 if (IsVPer)
445 {
446 if (vv < Vmin)
447 while (vv < Vmin)
448 vv += vperiod;
449 else
450 {
451 while (vv >= Vmin)
452 vv -= vperiod;
453 vv += vperiod;
454 }
455 }
456 }
457
458 for (;;)
459 {
460 dedans = 1;
461 gp_Pnt2d Puv(u,v);
462
463 if(TabOrien(1)!=-1) {
464 for(Standard_Integer n=1; n<=nbtabclass; n++) {
465 Standard_Integer cur = ((CSLib_Class2d *)TabClass(n))->SiDans(Puv);
466 if(cur==1) {
467 if(TabOrien(n)==0) {
468 dedans = -1;
469 break;
470 }
471 }
472 else if(cur==-1) {
473 if(TabOrien(n)==1) {
474 dedans = -1;
475 break;
476 }
477 }
478 else {
479 dedans = 0;
480 break;
481 }
482 }
483 if(dedans==0) {
484 BRepClass_FaceClassifier aClassifier;
485 Standard_Real m_Toluv = (Toluv > 4.0) ? 4.0 : Toluv;
486 //aClassifier.Perform(Face,Puv,Toluv);
487 aClassifier.Perform(Face,Puv,m_Toluv);
488 Status = aClassifier.State();
489 }
490 if(dedans == 1) {
491 Status = TopAbs_IN;
492 }
493 if(dedans == -1) {
494 Status = TopAbs_OUT;
495 }
496 }
0d969553 497 else { //-- TabOrien(1)=-1 False Wire
7fd59977 498 BRepClass_FaceClassifier aClassifier;
499 aClassifier.Perform(Face,Puv,Toluv);
500 Status = aClassifier.State();
501 }
502
0ebaa4db 503 if (!RecadreOnPeriodic || (!IsUPer && !IsVPer))
7fd59977 504 return Status;
505 if (Status == TopAbs_IN || Status == TopAbs_ON)
506 return Status;
507
508 if (!urecadre)
509 {
510 u = uu;
511 urecadre = Standard_True;
512 }
513 else
514 if (IsUPer)
515 u += uperiod;
516 if (u > Umax || !IsUPer)
517 {
518 if (!vrecadre)
519 {
520 v = vv;
521 vrecadre = Standard_True;
522 }
523 else
524 if (IsVPer)
525 v += vperiod;
526
527 u = uu;
528
529 if (v > Vmax || !IsVPer)
530 return Status;
531 }
532 } //for (;;)
533}
534
535TopAbs_State BRepTopAdaptor_FClass2d::TestOnRestriction(const gp_Pnt2d& _Puv,
536 const Standard_Real Tol,
537 const Standard_Boolean RecadreOnPeriodic) const
538{
539#if LBRCOMPT
540 STAT.NbConstrShape++;
541#endif
542
543 Standard_Integer dedans;
544 Standard_Integer nbtabclass = TabClass.Length();
545
546 if(nbtabclass==0) {
547 return(TopAbs_IN);
548 }
549
0d969553 550 //-- U1 is the First Param and U2 in this case is U1+Period
7fd59977 551 Standard_Real u=_Puv.X();
552 Standard_Real v=_Puv.Y();
553 Standard_Real uu = u, vv = v;
554
555 Handle(BRepAdaptor_HSurface) surf = new BRepAdaptor_HSurface();
556 surf->ChangeSurface().Initialize( Face, Standard_False );
773f53f1 557 const Standard_Boolean IsUPer = surf->IsUPeriodic();
558 const Standard_Boolean IsVPer = surf->IsVPeriodic();
559 const Standard_Real uperiod = IsUPer ? surf->UPeriod() : 0.0;
560 const Standard_Real vperiod = IsVPer ? surf->VPeriod() : 0.0;
7fd59977 561 TopAbs_State Status = TopAbs_UNKNOWN;
562 Standard_Boolean urecadre = Standard_False, vrecadre = Standard_False;
563
564 if (RecadreOnPeriodic)
565 {
566 if (IsUPer)
567 {
568 if (uu < Umin)
569 while (uu < Umin)
570 uu += uperiod;
571 else
572 {
573 while (uu >= Umin)
574 uu -= uperiod;
575 uu += uperiod;
576 }
577 }
578 if (IsVPer)
579 {
580 if (vv < Vmin)
581 while (vv < Vmin)
582 vv += vperiod;
583 else
584 {
585 while (vv >= Vmin)
586 vv -= vperiod;
587 vv += vperiod;
588 }
589 }
590 }
591
592 for (;;)
593 {
594 dedans = 1;
595 gp_Pnt2d Puv(u,v);
596
597 if(TabOrien(1)!=-1) {
598 for(Standard_Integer n=1; n<=nbtabclass; n++) {
599 Standard_Integer cur = ((CSLib_Class2d *)TabClass(n))->SiDans_OnMode(Puv,Tol);
600 if(cur==1) {
601 if(TabOrien(n)==0) {
602 dedans = -1;
603 break;
604 }
605 }
606 else if(cur==-1) {
607 if(TabOrien(n)==1) {
608 dedans = -1;
609 break;
610 }
611 }
612 else {
613 dedans = 0;
614 break;
615 }
616 }
617 if(dedans==0) {
618 Status = TopAbs_ON;
619 }
620 if(dedans == 1) {
621 Status = TopAbs_IN;
622 }
623 if(dedans == -1) {
624 Status = TopAbs_OUT;
625 }
626 }
0d969553 627 else { //-- TabOrien(1)=-1 False Wire
7fd59977 628 BRepClass_FaceClassifier aClassifier;
629 aClassifier.Perform(Face,Puv,Tol);
630 Status = aClassifier.State();
631 }
632
0ebaa4db 633 if (!RecadreOnPeriodic || (!IsUPer && !IsVPer))
7fd59977 634 return Status;
635 if (Status == TopAbs_IN || Status == TopAbs_ON)
636 return Status;
637
638 if (!urecadre)
639 {
640 u = uu;
641 urecadre = Standard_True;
642 }
643 else
644 if (IsUPer)
645 u += uperiod;
646 if (u > Umax || !IsUPer)
647 {
648 if (!vrecadre)
649 {
650 v = vv;
651 vrecadre = Standard_True;
652 }
653 else
654 if (IsVPer)
655 v += vperiod;
656
657 u = uu;
658
659 if (v > Vmax || !IsVPer)
660 return Status;
661 }
662 } //for (;;)
663}
664
665
666void BRepTopAdaptor_FClass2d::Destroy() {
667#if LBRCOMPT
668 STAT.NbDestroy++;
669#endif
670
671 Standard_Integer nbtabclass = TabClass.Length();
672 for(Standard_Integer d=1; d<=nbtabclass;d++) {
673 if(TabClass(d)) {
674 delete ((CSLib_Class2d *)TabClass(d));
675 TabClass(d)=NULL;
676 }
677 }
678}
679
680
681
682#include <Standard_ConstructionError.hxx>
683
684
685//const BRepTopAdaptor_FClass2d & BRepTopAdaptor_FClass2d::Copy(const BRepTopAdaptor_FClass2d& Other) const {
686const BRepTopAdaptor_FClass2d & BRepTopAdaptor_FClass2d::Copy(const BRepTopAdaptor_FClass2d& ) const {
687 cerr<<"Copy not allowed in BRepTopAdaptor_FClass2d"<<endl;
688 Standard_ConstructionError::Raise();
689 return(*this);
690}