1 // Created on: 1994-10-07
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 #ifdef DRAW
CurveToString(const GeomAbs_CurveType t,TCollection_AsciiString & N)18 static void CurveToString(const GeomAbs_CurveType t, TCollection_AsciiString& N)
19 {
20 switch(t) {
21 case GeomAbs_Line : N = "LINE"; break;
22 case GeomAbs_Circle : N = "CIRCLE"; break;
23 case GeomAbs_Ellipse : N = "ELLIPSE"; break;
24 case GeomAbs_Hyperbola : N = "HYPERBOLA"; break;
25 case GeomAbs_Parabola : N = "PARABOLA"; break;
26 case GeomAbs_BezierCurve : N = "BEZIER"; break;
27 case GeomAbs_BSplineCurve : N = "BSPLINE"; break;
28 case GeomAbs_OffsetCurve : N = "OFFSET"; break;
29 case GeomAbs_OtherCurve : N = "OTHER"; break;
30 default : N = "UNKNOWN"; break;
31 }
32 }
33 #endif
34
35 #include <Bnd_Box.hxx>
36 #include <BRep_Tool.hxx>
37 #include <BRepAdaptor_Surface.hxx>
38 #include <Geom2dAdaptor_Curve.hxx>
39 #include <Geom_Curve.hxx>
40 #include <Geom_Surface.hxx>
41 #include <GeomTools_Curve2dSet.hxx>
42 #include <GeomTools_CurveSet.hxx>
43 #include <GeomTools_SurfaceSet.hxx>
44 #include <gp_Circ2d.hxx>
45 #include <gp_Pnt.hxx>
46 #include <gp_Pnt2d.hxx>
47 #include <IntRes2d_IntersectionPoint.hxx>
48 #include <IntRes2d_IntersectionSegment.hxx>
49 #include <Precision.hxx>
50 #include <Standard_Failure.hxx>
51 #include <TCollection_AsciiString.hxx>
52 #include <TopExp.hxx>
53 #include <TopExp_Explorer.hxx>
54 #include <TopLoc_Location.hxx>
55 #include <TopoDS.hxx>
56 #include <TopoDS_Shape.hxx>
57 #include <TopoDS_Vertex.hxx>
58 #include <TopOpeBRep_define.hxx>
59 #include <TopOpeBRep_EdgesIntersector.hxx>
60 #include <TopOpeBRep_Point2d.hxx>
61 #include <TopOpeBRepDS_Transition.hxx>
62 #include <TopOpeBRepTool_2d.hxx>
63 #include <TopOpeBRepTool_CurveTool.hxx>
64 #include <TopOpeBRepTool_EXPORT.hxx>
65 #include <TopOpeBRepTool_ShapeTool.hxx>
66 #include <TopOpeBRepTool_tol.hxx>
67 #include <TopOpeBRepTool_TOOL.hxx>
68
69 #ifdef OCCT_DEBUG
70 extern Standard_Boolean TopOpeBRepTool_GettraceNYI();
71 extern Standard_Boolean TopOpeBRepTool_GettraceKRO();
72 extern Standard_Boolean TopOpeBRep_GettracePROEDG();
73 extern Standard_Boolean TopOpeBRep_GetcontextTOL0();
74 extern Standard_Boolean TopOpeBRep_GetcontextNOFEI();
75 extern Standard_Boolean TopOpeBRep_GettraceFITOL();
76 extern Standard_Boolean TopOpeBRep_GettraceEEFF();
77 extern void debeeff();
78 #include <TopOpeBRepTool_KRO.hxx>
79 Standard_EXPORT TOPKRO KRO_DSFILLER_INTEE("intersection edge/edge");
80 #endif
81
82 // la surface de reference peut etre celle de la 1ere ou la 2eme face
83 // de l'appel de SetFaces. Ces deux faces sont "SameDomain".
84 // Leurs normales geometriques sont SurfacesSameOriented()
85 // Leurs normales topologiques sont FacesSameOriented()
86 // cas type 1 :
87 // face1 FORWARD, normale geometrique Ng1 en +Z
88 // face2 REVERSED, normale geometrique Ng2 en -Z
89 // ==> SurfaceSameOriented = 0, FacesSameOriented = 1
90
91 //=======================================================================
92 //function : TopOpeBRep_EdgesIntersector
93 //purpose :
94 //=======================================================================
TopOpeBRep_EdgesIntersector()95 TopOpeBRep_EdgesIntersector::TopOpeBRep_EdgesIntersector()
96 {
97 mySurface1 = new BRepAdaptor_Surface();
98 mySurface2 = new BRepAdaptor_Surface();
99 mySurfacesSameOriented = Standard_False;
100 myFacesSameOriented = Standard_False;
101 myTol1 = 0.; // Precision::PConfusion();
102 myTol2 = 0.; // Precision::PIntersection();
103 myDimension = 2;
104 myTolForced = Standard_False;
105 myf1surf1F_sameoriented = Standard_True;
106 myf2surf1F_sameoriented = Standard_True;
107
108 myNbSegments = 0;
109 myHasSegment = Standard_False;
110 SetSameDomain(Standard_False);
111
112 myNbPoints = 0;
113 myTrueNbPoints = 0;
114 myPointIndex = 0;
115 myip2d = mynp2d = 0;
116 myselectkeep = Standard_True;
117 }
118
~TopOpeBRep_EdgesIntersector()119 TopOpeBRep_EdgesIntersector::~TopOpeBRep_EdgesIntersector()
120 {}
121
122 //=======================================================================
123 //function : SetFaces
124 //purpose :
125 //=======================================================================
SetFaces(const TopoDS_Shape & F1,const TopoDS_Shape & F2)126 void TopOpeBRep_EdgesIntersector::SetFaces(const TopoDS_Shape& F1,const TopoDS_Shape& F2)
127 {
128 Bnd_Box B1,B2;
129 SetFaces(F1,F2,B1,B2);
130 }
131
132 //=======================================================================
133 //function : SetFaces
134 //purpose :
135 //=======================================================================
SetFaces(const TopoDS_Shape & F1,const TopoDS_Shape & F2,const Bnd_Box & B1,const Bnd_Box & B2)136 void TopOpeBRep_EdgesIntersector::SetFaces(const TopoDS_Shape& F1,const TopoDS_Shape& F2,const Bnd_Box& B1,const Bnd_Box& B2)
137 {
138 Standard_Boolean computerestriction = Standard_False;
139
140 Standard_Boolean so11 = Standard_True;
141 Standard_Boolean so21 = Standard_True;
142 myf1surf1F_sameoriented = so11;
143 myf2surf1F_sameoriented = so21;
144 mySurfacesSameOriented = Standard_True;
145 myFacesSameOriented = Standard_True;
146
147 myFace1 = TopoDS::Face(F1);
148 BRepAdaptor_Surface& S1 = *mySurface1; S1.Initialize(myFace1,computerestriction);
149 mySurfaceType1 = S1.GetType();
150
151 myFace2 = TopoDS::Face(F2);
152 BRepAdaptor_Surface& S2 = *mySurface2; S2.Initialize(myFace2,computerestriction);
153 mySurfaceType2 = S2.GetType();
154
155 TopoDS_Face face1forward = myFace1;
156 face1forward.Orientation(TopAbs_FORWARD);
157
158 so11 = TopOpeBRepTool_ShapeTool::FacesSameOriented(face1forward,myFace1);
159 myf1surf1F_sameoriented = so11;
160
161 so21 = TopOpeBRepTool_ShapeTool::FacesSameOriented(face1forward,myFace2);
162 myf2surf1F_sameoriented = so21;
163
164 mySurfacesSameOriented = TopOpeBRepTool_ShapeTool::SurfacesSameOriented(S1,S2);
165 myFacesSameOriented = TopOpeBRepTool_ShapeTool::FacesSameOriented(myFace1,myFace2);
166
167 if ( !myTolForced ) {
168 FTOL_FaceTolerances2d(B1,B2,myFace1,myFace2,S1,S2,myTol1,myTol2);
169 myTol1 = (myTol1 > 1.e-4)? 1.e-4: myTol1;
170 myTol2 = (myTol2 > 1.e-4)? 1.e-4: myTol2;
171 }
172
173 #ifdef OCCT_DEBUG
174 Standard_Integer DEBi = 0;
175 if ( DEBi ) {
176 std::cout<<"TopOpeBRep_EdgesIntersector::SetFaces : ";
177 std::cout<<"f1 "; TopAbs::Print(myFace1.Orientation(),std::cout);
178 std::cout<< " / f1F : ";
179 if (so11) std::cout<<"sameoriented"; else std::cout<<"difforiented"; std::cout<<std::endl;
180 std::cout <<" ";
181 std::cout<<"f2 "; TopAbs::Print(myFace2.Orientation(),std::cout);
182 std::cout<< " / f1F : ";
183 if (so21) std::cout<<"sameoriented"; else std::cout<<"difforiented"; std::cout<<std::endl;
184 }
185 #endif
186 }
187
188 //=======================================================================
189 //function : ForceTolerances
190 //purpose :
191 //=======================================================================
ForceTolerances(const Standard_Real Tol1,const Standard_Real Tol2)192 void TopOpeBRep_EdgesIntersector::ForceTolerances(const Standard_Real Tol1,const Standard_Real Tol2)
193 {
194 myTol1 = Tol1;
195 myTol2 = Tol2;
196 myTolForced = Standard_True;
197 }
198
199 #include <IntRes2d_Transition.hxx>
TransitionEqualAndExtremity(const IntRes2d_Transition & T1,const IntRes2d_Transition & T2)200 static Standard_Boolean TransitionEqualAndExtremity( const IntRes2d_Transition& T1
201 ,const IntRes2d_Transition& T2) {
202 if( T1.PositionOnCurve() == IntRes2d_Head
203 || T1.PositionOnCurve() == IntRes2d_End) {
204 if(T1.PositionOnCurve() == T2.PositionOnCurve()) {
205 if(T1.TransitionType() == T2.TransitionType()) {
206 if(T1.TransitionType() == IntRes2d_Touch) {
207 if(T1.IsTangent()==T2.IsTangent()) {
208 if(T1.Situation() == T2.Situation()) {
209 if(T1.IsOpposite() == T2.IsOpposite()) {
210 return(Standard_True);
211 }
212 }
213 }
214 }
215 else {
216 return(Standard_True);
217 }
218 }
219 }
220 }
221 return(Standard_False);
222 }
223
224 // Modified by Sergey KHROMOV - Fri Jan 11 14:49:48 2002 Begin
IsTangentSegment(const IntRes2d_IntersectionPoint & P1,const IntRes2d_IntersectionPoint & P2,const Geom2dAdaptor_Curve & aC1,const Geom2dAdaptor_Curve & aC2,const Standard_Real aTolConf)225 static Standard_Boolean IsTangentSegment(const IntRes2d_IntersectionPoint &P1,
226 const IntRes2d_IntersectionPoint &P2,
227 const Geom2dAdaptor_Curve &aC1,
228 const Geom2dAdaptor_Curve &aC2,
229 const Standard_Real aTolConf) {
230 const gp_Pnt2d &aP2d1 = P1.Value();
231 const gp_Pnt2d &aP2d2 = P2.Value();
232 const IntRes2d_Transition &aTrans1 = P1.TransitionOfFirst();
233 const IntRes2d_Transition &aTrans2 = P2.TransitionOfFirst();
234
235 if (aTrans1.TransitionType() == IntRes2d_Touch ||
236 aTrans2.TransitionType() == IntRes2d_Touch) {
237 Standard_Real aSqrDistPP = aP2d1.SquareDistance(aP2d2);
238
239 if (aSqrDistPP <= aTolConf) {
240 Standard_Real aParDist1 = Abs(P1.ParamOnFirst() - P2.ParamOnFirst());
241 Standard_Real aParDist2 = Abs(P1.ParamOnSecond() - P2.ParamOnSecond());
242 Standard_Real aResol1 = aC1.Resolution(aTolConf);
243 Standard_Real aResol2 = aC2.Resolution(aTolConf);
244
245 if (aParDist1*aParDist1 <= aResol1 &&
246 aParDist2*aParDist2 <= aResol2)
247 return Standard_True;
248 }
249 }
250
251 return Standard_False;
252 }
253 // Modified by Sergey KHROMOV - Fri Jan 11 14:49:49 2002 End
254
255
256 //------------------------------------------------------------------------
EdgesIntersector_checkT1D(const TopoDS_Edge & E1,const TopoDS_Edge & E2,const TopoDS_Vertex & vG,TopOpeBRepDS_Transition & newT)257 Standard_Boolean EdgesIntersector_checkT1D(const TopoDS_Edge& E1,const TopoDS_Edge& E2,const TopoDS_Vertex& vG,
258 TopOpeBRepDS_Transition& newT)
259 //------------------------------------------------------------------------
260 // E1 sdm E2, interfers with E2 at vertex vG
261 // vG is vertex of E2, but not vertex of E1
262 // purpose : get newT / attached to E1, I1d=(newT(E2),G,E2)
263 {
264 #define FIRST (1)
265 #define LAST (2)
266 #define CLOSING (3)
267
268 newT.Set(TopAbs_UNKNOWN,TopAbs_UNKNOWN);
269 Standard_Integer ovine = FUN_tool_orientVinE(vG,E2);
270 if (ovine == 0) {
271 return Standard_False;
272 }
273 else if (ovine == CLOSING) {
274 newT.Set(TopAbs_INTERNAL);
275 return Standard_True;
276 }
277
278 Standard_Boolean first = (ovine == FIRST);
279 Standard_Boolean last = (ovine == LAST);
280
281 TopOpeBRepDS_Config C = TopOpeBRepDS_SAMEORIENTED;
282 Standard_Boolean sso = TopOpeBRepTool_ShapeTool::ShapesSameOriented(E1,E2);
283 if (!sso) C = TopOpeBRepDS_DIFFORIENTED;
284
285 Standard_Boolean SO = (C == TopOpeBRepDS_SAMEORIENTED);
286 Standard_Boolean DO = (C == TopOpeBRepDS_DIFFORIENTED);
287 TopAbs_Orientation o1 = E1.Orientation();
288 if (o1 == TopAbs_REVERSED) {SO = !SO; DO = !DO;} // relative to E1 FORWARD
289
290 Standard_Boolean reversed = (SO && first) || (DO && last);
291 Standard_Boolean forward = (SO && last) || (DO && first);
292 if (reversed) newT.Set(TopAbs_REVERSED);
293 if (forward) newT.Set(TopAbs_FORWARD);
294 return (reversed || forward);
295 } // EdgesIntersector_checkT1D
296
297
298 //modified by NIZNHY-PKV Fri Nov 5 12:27:07 1999 from
299 #include <BRepAdaptor_Surface.hxx>
300 //modified by NIZNHY-PKV Fri Nov 5 12:27:10 1999 to
301 //=======================================================================
302 //function : Perform
303 //purpose :
304 //=======================================================================
Perform(const TopoDS_Shape & E1,const TopoDS_Shape & E2,const Standard_Boolean ReduceSegment)305 void TopOpeBRep_EdgesIntersector::Perform(const TopoDS_Shape& E1,const TopoDS_Shape& E2,const Standard_Boolean ReduceSegment)
306 {
307 mysp2d.Clear();
308 myip2d = 1; mynp2d = 0;
309
310 myEdge1 = TopoDS::Edge(E1);
311 myEdge2 = TopoDS::Edge(E2);
312
313 Standard_Real first,last,tole,tolpc;
314 gp_Pnt2d pfirst,plast;
315 Handle(Geom2d_Curve) PC1;
316 //modified by NIZNHY-PKV Thu Nov 4 16:08:05 1999 f
317
318 BRepAdaptor_Surface aSurface1(myFace1), aSurface2(myFace2);
319 GeomAbs_SurfaceType aSurfaceType1=aSurface1.GetType(),
320 aSurfaceType2=aSurface2.GetType();
321
322 if (aSurfaceType1==GeomAbs_Sphere && aSurfaceType2==GeomAbs_Sphere) {
323 PC1 = FC2D_MakeCurveOnSurface (myEdge1,myFace1,first,last,tolpc, Standard_True);
324 }
325 else {
326 PC1 = FC2D_CurveOnSurface(myEdge1,myFace1,first,last,tolpc);
327 }
328 //modified by NIZNHY-PKV Thu Nov 4 15:44:13 1999 to
329
330 if (PC1.IsNull())
331 throw Standard_Failure("EdgesIntersector::Perform : no 2d curve");
332
333 myCurve1.Load(PC1);
334 BRep_Tool::UVPoints(myEdge1,myFace1,pfirst,plast);
335 tole = BRep_Tool::Tolerance(myEdge1);
336 myDomain1.SetValues(pfirst,first,tole,plast,last,tole);
337
338 #ifdef OCCT_DEBUG
339 Standard_Boolean trc = Standard_False;
340 if (trc) {
341 std::cout<<"ed1 on fa1 : {pfirst=("<<pfirst.X()<<" "<<pfirst.Y()<<"), first="<<first<<"\n";
342 std::cout<<" plast =("<<plast.X()<<" "<<plast.Y()<<"),last="<<last<<"}"<<std::endl;}
343 #endif
344
345 Standard_Boolean memesfaces = myFace1.IsSame(myFace2);
346 Standard_Boolean memesupport = Standard_False;
347 TopLoc_Location L1,L2;
348 const Handle(Geom_Surface) S1 = BRep_Tool::Surface(myFace1,L1);
349 const Handle(Geom_Surface) S2 = BRep_Tool::Surface(myFace2,L2);
350 if (S1 == S2 && L1 == L2) memesupport=Standard_True;
351
352 if ( mySurfaceType1 == GeomAbs_Plane || memesfaces || memesupport) {
353 Handle(Geom2d_Curve) PC2 = FC2D_CurveOnSurface(myEdge2,myFace1,first,last,tolpc);
354 myCurve2.Load(PC2);
355 BRep_Tool::UVPoints(myEdge2,myFace1,pfirst,plast);
356 tole = BRep_Tool::Tolerance(myEdge2);
357 myDomain2.SetValues(pfirst,first,tole,plast,last,tole);
358
359 #ifdef OCCT_DEBUG
360 if (trc) {
361 std::cout<<"ed2 on fa1 : {pfirst=("<<pfirst.X()<<" "<<pfirst.Y()<<"), first="<<first<<"\n";
362 std::cout<<" plast =("<<plast.X()<<" "<<plast.Y()<<"),last="<<last<<"}"<<std::endl;}
363 #endif
364
365 }
366
367 else {
368
369 Handle(Geom2d_Curve) PC2on1; Handle(Geom_Curve) NC;
370 Standard_Boolean dgE2 = BRep_Tool::Degenerated(myEdge2);
371 if (dgE2) { //xpu210998 : cto900Q3
372 TopExp_Explorer exv(myEdge2, TopAbs_VERTEX);
373 const TopoDS_Vertex& v2 = TopoDS::Vertex(exv.Current());
374 gp_Pnt pt2 = BRep_Tool::Pnt(v2);
375 gp_Pnt2d uv2; Standard_Real d; Standard_Boolean ok = FUN_tool_projPonF(pt2,myFace1,uv2,d);
376 if (!ok)
377 return;//nyiRaise
378
379 Handle(Geom_Surface) aSurf1 = BRep_Tool::Surface(myFace1);
380 Standard_Boolean apex = FUN_tool_onapex(uv2, aSurf1);
381 if (apex) {
382 TopoDS_Vertex vf,vl; TopExp::Vertices(myEdge1,vf,vl);
383 gp_Pnt ptf = BRep_Tool::Pnt(vf); Standard_Real df = pt2.Distance(ptf);
384
385 Standard_Real tolf = BRep_Tool::Tolerance(vf);
386
387 Standard_Boolean onf = (df < tolf);
388 TopoDS_Vertex v1 = onf ? vf : vl;
389 TopTools_IndexedDataMapOfShapeListOfShape mapVE; TopExp::MapShapesAndAncestors(myFace1,TopAbs_VERTEX,TopAbs_EDGE,mapVE);
390 const TopTools_ListOfShape& Edsanc = mapVE.FindFromKey(v1);
391 TopTools_ListIteratorOfListOfShape it(Edsanc);
392 for (; it.More(); it.Next()){
393 const TopoDS_Edge& ee = TopoDS::Edge(it.Value());
394 Standard_Boolean dgee = BRep_Tool::Degenerated(ee);
395 if (!dgee) continue;
396 // Standard_Real f,l;
397 PC2on1 = BRep_Tool::CurveOnSurface(ee,myFace1,first,last);
398 }
399 }
400 else {} // NYIxpu210998
401 } //dgE2
402 else {
403 // project curve of edge 2 on surface of face 1
404 TopLoc_Location loc ;
405 Handle(Geom_Curve) C = BRep_Tool::Curve(myEdge2,loc,first,last);
406 NC = Handle(Geom_Curve)::DownCast(C->Transformed(loc.Transformation()));
407 Standard_Real tolreached2d;
408
409 //modified by NIZNHY-PKV Fri Nov 5 12:29:13 1999 from
410 if (aSurfaceType1==GeomAbs_Sphere && aSurfaceType2==GeomAbs_Sphere) {
411 PC2on1 = FC2D_MakeCurveOnSurface (myEdge2, myFace1, first, last, tolpc, Standard_True);
412 }
413 else {
414 PC2on1 = TopOpeBRepTool_CurveTool::MakePCurveOnFace(myFace1,NC,tolreached2d);
415 }
416 //modified by NIZNHY-PKV Thu Nov 4 14:52:25 1999 t
417
418 }
419
420 if (!PC2on1.IsNull()) {
421 myCurve2.Load(PC2on1);
422 tole = BRep_Tool::Tolerance(myEdge2);
423 PC2on1->D0(first,pfirst);
424 PC2on1->D0(last,plast);
425 myDomain2.SetValues(pfirst,first,tole,plast,last,tole);
426 #ifdef OCCT_DEBUG
427 if ( TopOpeBRep_GettracePROEDG() ) {
428 std::cout<<"------------ projection de curve"<<std::endl;
429 std::cout<<"--- Curve : "<<std::endl;
430 GeomTools_CurveSet::PrintCurve(NC,std::cout);
431 std::cout<<"--- nouvelle PCurve : "<<std::endl;
432 GeomTools_Curve2dSet::PrintCurve2d(PC2on1,std::cout);
433 Handle(Geom_Surface) aS1 = BRep_Tool::Surface(myFace1);
434 std::cout<<"--- sur surface : "<<std::endl;
435 GeomTools_SurfaceSet::PrintSurface(aS1,std::cout);
436 std::cout<<std::endl;
437 }
438 #endif
439 }
440 else return;
441 }
442
443 // compute the intersection
444 #ifdef OCCT_DEBUG
445 if (TopOpeBRepTool_GettraceKRO()) KRO_DSFILLER_INTEE.Start();
446 #endif
447
448 Standard_Real tol1 = myTol1, tol2 = myTol2;
449 // Wrong !!!
450 /* if ( !myTolForced ) {
451 if ( t1 != t2 ) {
452 //#ifdef OCCT_DEBUG // JYL 28/09/98 : temporaire
453 //if ( TopOpeBRep_GetcontextTOL0() ) { // JYL 28/09/98 : temporaire
454 tol1 = 0.; // JYL 28/09/98 : temporaire
455 tol2 = 0.; // JYL 28/09/98 : temporaire
456 //} // JYL 28/09/98 : temporaire
457 //#endif // JYL 28/09/98 : temporaire
458 }
459 }
460 */
461
462 #ifdef OCCT_DEBUG
463 if (TopOpeBRep_GettraceFITOL()) {
464 std::cout<<"EdgesIntersector : Perform";
465 #ifdef DRAW
466 GeomAbs_CurveType t1 = myCurve1.GetType();
467 GeomAbs_CurveType t2 = myCurve2.GetType();
468 TCollection_AsciiString s1;CurveToString(t1,s1);std::cout<<" "<<s1;
469 TCollection_AsciiString s2;CurveToString(t2,s2);std::cout<<" "<<s2;
470 #endif
471 std::cout<<std::endl;
472 std::cout<<" tol1 = "<<tol1<<std::endl;
473 std::cout<<" tol2 = "<<tol2<<std::endl;
474 }
475 #endif
476
477 myIntersector.Perform(myCurve1,myDomain1,myCurve2,myDomain2,tol1,tol2);
478
479 Standard_Integer nbp = myIntersector.NbPoints();
480 Standard_Integer nbs = myIntersector.NbSegments();
481
482 mylpnt.Clear(); mylseg.Clear();
483 // for (Standard_Integer p=1; p<=nbp; p++) mylpnt.Append(myIntersector.Point(p));
484 Standard_Integer p ;
485 for ( p=1; p<=nbp; p++) mylpnt.Append(myIntersector.Point(p));
486 for (Standard_Integer s=1; s<=nbs; s++) mylseg.Append(myIntersector.Segment(s));
487
488 Standard_Boolean filter = Standard_True;
489 #ifdef OCCT_DEBUG
490 Standard_Boolean nofilter = TopOpeBRep_GetcontextNOFEI(); if (nofilter) filter = Standard_False;
491 #endif
492
493 //-- Filter :
494 if (filter) {
495 Standard_Boolean fin;
496 do {
497 fin=Standard_True;
498 for(p=1;p<nbp && fin ;p++) {
499 const IntRes2d_IntersectionPoint& P1=mylpnt.Value(p);
500 const IntRes2d_IntersectionPoint& P2=mylpnt.Value(p+1);
501 if( TransitionEqualAndExtremity(P1.TransitionOfFirst(),P2.TransitionOfFirst())
502 || TransitionEqualAndExtremity(P1.TransitionOfSecond(),P2.TransitionOfSecond()) ) {
503 #ifdef OCCT_DEBUG
504 Standard_Boolean TRC = Standard_True;
505 if (TRC) std::cout<<"\n Egalite de transitions \n"<<std::endl;
506 #endif
507 fin = Standard_False;
508 mylpnt.Remove(p);
509 nbp--;
510 }
511 // Modified by Sergey KHROMOV - Fri Jan 11 10:31:38 2002 Begin
512 else if (IsTangentSegment(P1, P2, myCurve1, myCurve2, Max(tol1, tol2))) {
513 const IntRes2d_Transition &aTrans = P2.TransitionOfFirst();
514
515 fin = Standard_False;
516 if (aTrans.TransitionType() == IntRes2d_Touch)
517 mylpnt.Remove(p);
518 else
519 mylpnt.Remove(p + 1);
520 nbp--;
521 }
522 // Modified by Sergey KHROMOV - Fri Jan 11 10:31:39 2002 End
523 }
524 }
525 while(fin==Standard_False);
526 }
527 //-- End filter
528
529 myNbSegments = mylseg.Length();
530 myHasSegment = (myNbSegments != 0);
531 ComputeSameDomain();
532
533 myNbPoints = mylpnt.Length();
534 myTrueNbPoints = myNbPoints + 2 * myNbSegments;
535 myPointIndex = 0;
536
537 #ifdef OCCT_DEBUG
538 if (TopOpeBRep_GettraceEEFF()) debeeff();
539 #endif
540
541 MakePoints2d();
542 if (ReduceSegment) ReduceSegments();
543
544 // xpu010998 : cto900J1, e5 sdm e13, IntPatch (Touch,Inside) ->
545 // faulty INTERNAL transition at G=v9 :
546 // xpu281098 : cto019D2, e3 sdm e9, faulty EXTERNAL transition
547 Standard_Boolean esd = SameDomain();
548 for (InitPoint();MorePoint();NextPoint()) {
549 TopOpeBRep_Point2d& P2D = mysp2d(myip2d);
550 Standard_Boolean isvertex1 = P2D.IsVertex(1);
551 Standard_Boolean isvertex2 = P2D.IsVertex(2);
552 Standard_Boolean isvertex = isvertex1 || isvertex2;
553
554 if (isvertex && esd) {
555 TopOpeBRepDS_Transition& T1 = P2D.ChangeTransition(1);
556 TopOpeBRepDS_Transition& T2 = P2D.ChangeTransition(2);
557
558 Standard_Boolean isvertex12 = isvertex1 && isvertex2;
559 Standard_Boolean isvertex22 = isvertex2 && !isvertex12;
560 Standard_Boolean isvertex11 = isvertex1 && !isvertex12;
561
562 Standard_Boolean T1INT = (T1.Orientation(TopAbs_IN) == TopAbs_INTERNAL);
563
564 if (T1INT && isvertex2 && !isvertex1) {
565 const TopoDS_Vertex& V2 = P2D.Vertex(2);
566 TopOpeBRepDS_Transition newT; Standard_Boolean computed = ::EdgesIntersector_checkT1D(myEdge1,myEdge2,V2,newT);
567 if (computed) T1.Set(newT.Orientation(TopAbs_IN));
568 }
569
570 Standard_Boolean T2INT = (T2.Orientation(TopAbs_IN) == TopAbs_INTERNAL);
571 Standard_Boolean T2EXT = (T2.Orientation(TopAbs_IN) == TopAbs_EXTERNAL);
572 Standard_Boolean INTEXT2 = T2INT || T2EXT;
573 if (INTEXT2 && isvertex1 && !isvertex2) {
574 const TopoDS_Vertex& V1 = P2D.Vertex(1);
575 TopOpeBRepDS_Transition newT; Standard_Boolean computed = ::EdgesIntersector_checkT1D(myEdge2,myEdge1,V1,newT);
576 if (computed) T2.Set(newT.Orientation(TopAbs_IN));
577 }
578
579 // xpu121098 : cto900I7 (e12on,vG14)
580 TopoDS_Vertex vcl2; Standard_Boolean clE2 = TopOpeBRepTool_TOOL::ClosedE(myEdge2,vcl2);
581 Standard_Boolean nT1 = ( !T1INT && clE2 && isvertex22 && vcl2.IsSame(P2D.Vertex(2)) );
582 if (nT1) T1.Set(TopAbs_INTERNAL);
583 TopoDS_Vertex vcl1; Standard_Boolean clE1 = TopOpeBRepTool_TOOL::ClosedE(myEdge1,vcl1);
584 Standard_Boolean nT2 = ( !T2INT && clE1 && isvertex11 && vcl1.IsSame(P2D.Vertex(1)) );
585 if (nT2) T2.Set(TopAbs_INTERNAL);
586
587 } // (isvertex && esd)
588 } // MorePoint
589
590
591 #ifdef OCCT_DEBUG
592 if (TopOpeBRepTool_GettraceKRO()) KRO_DSFILLER_INTEE.Stop();
593 #endif
594 } // Perform
595
596 //=======================================================================
597 //function : Dimension
598 //purpose :
599 //=======================================================================
Dimension(const Standard_Integer Dim)600 void TopOpeBRep_EdgesIntersector::Dimension(const Standard_Integer Dim)
601 {
602 if (Dim == 1 || Dim == 2) {
603 myDimension = Dim;
604 }
605 }
606
607 //=======================================================================
608 //function : Dimension
609 //purpose :
610 //=======================================================================
Dimension() const611 Standard_Integer TopOpeBRep_EdgesIntersector::Dimension() const
612 {
613 return myDimension;
614 }
615
616 //=======================================================================
617 //function : ComputeSameDomain
618 //purpose :
619 //=======================================================================
ComputeSameDomain()620 Standard_Boolean TopOpeBRep_EdgesIntersector::ComputeSameDomain()
621 {
622 const Geom2dAdaptor_Curve& C1 = Curve(1);
623 const Geom2dAdaptor_Curve& C2 = Curve(2);
624 GeomAbs_CurveType t1 = C1.GetType();
625 GeomAbs_CurveType t2 = C2.GetType();
626
627 if (!myHasSegment)
628 return SetSameDomain(Standard_False);
629
630 Standard_Boolean tt = (t1 == t2);
631 if (!tt)
632 return SetSameDomain(Standard_False);
633
634 if (t1 == GeomAbs_Line)
635 return SetSameDomain(Standard_True);
636
637 if (t1 != GeomAbs_Circle) {
638 #ifdef OCCT_DEBUG
639 if (TopOpeBRepTool_GettraceNYI())
640 std::cout<<"TopOpeBRep_EdgesIntersector : EdgesSameDomain on NYI curve type"<<std::endl;
641 #endif
642 return SetSameDomain(Standard_False);
643 }
644
645 gp_Circ2d c1 = C1.Circle();
646 gp_Circ2d c2 = C2.Circle();
647 Standard_Real r1 = c1.Radius();
648 Standard_Real r2 = c2.Radius();
649 // Standard_Boolean rr = (r1 == r2);
650 Standard_Boolean rr = (Abs(r1-r2) < Precision::Confusion()); //xpu281098 (cto019D2) tolerance a revoir
651 if (!rr) return SetSameDomain(Standard_False);
652
653 const gp_Pnt2d& p1 = c1.Location();
654 const gp_Pnt2d& p2 = c2.Location();
655
656 const BRepAdaptor_Surface& BAS1 = Surface(1);
657 Standard_Real u1,v1; p1.Coord(u1,v1); gp_Pnt P1 = BAS1.Value(u1,v1);
658 Standard_Real u2,v2; p2.Coord(u2,v2); gp_Pnt P2 = BAS1.Value(u2,v2);// recall myCurve2=C2d(myEdge2,myFace1);
659 Standard_Real dpp = P1.Distance(P2);
660 Standard_Real tol1 = BRep_Tool::Tolerance(TopoDS::Edge(Edge(1)));
661 Standard_Real tol2 = BRep_Tool::Tolerance(TopoDS::Edge(Edge(2)));
662 Standard_Real tol = tol1 + tol2;
663 Standard_Boolean esd = (dpp <= tol);
664 if (esd) return SetSameDomain(Standard_True);
665
666 return SetSameDomain(Standard_False);
667 } // ComputeSameDomain
668
669 //=======================================================================
670 //function : SetSameDomain
671 //purpose :
672 //=======================================================================
SetSameDomain(const Standard_Boolean B)673 Standard_Boolean TopOpeBRep_EdgesIntersector::SetSameDomain(const Standard_Boolean B)
674 {
675 mySameDomain = B;
676 return B;
677 }
678
679 //=======================================================================
680 //function : MakePoints2d
681 //purpose :
682 //=======================================================================
MakePoints2d()683 void TopOpeBRep_EdgesIntersector::MakePoints2d()
684 {
685 mysp2d.Clear();
686 TopAbs_Orientation E1ori = myEdge1.Orientation();
687 TopAbs_Orientation E2ori = myEdge2.Orientation();
688 for (InitPoint1();MorePoint1();NextPoint1()) {
689 const IntRes2d_IntersectionPoint& IP = Point1();
690 TopOpeBRep_Point2d p2d;
691 p2d.SetPint(IP);
692 p2d.SetTransition(1,Transition1(1,E2ori));
693 p2d.SetTransition(2,Transition1(2,E1ori));
694 p2d.SetParameter(1,Parameter1(1));
695 p2d.SetParameter(2,Parameter1(2));
696 Standard_Boolean isv1 = IsVertex1(1); p2d.SetIsVertex(1,isv1);
697 if (isv1) p2d.SetVertex(1,TopoDS::Vertex(Vertex1(1)));
698 Standard_Boolean isv2 = IsVertex1(2); p2d.SetIsVertex(2,isv2);
699 if (isv2) p2d.SetVertex(2,TopoDS::Vertex(Vertex1(2)));
700 p2d.SetIsPointOfSegment(IsPointOfSegment1());
701 p2d.SetSegmentAncestors(0,0);
702 p2d.SetStatus(Status1());
703 p2d.SetValue(Value1());
704 p2d.SetValue2d(IP.Value());
705 p2d.SetTolerance(ToleranceMax());
706 p2d.SetEdgesConfig(EdgesConfig1());
707 p2d.SetIndex(Index1());
708 mysp2d.Append(p2d);
709 }
710 myip2d = 1; mynp2d = mysp2d.Length();
711 }
712
713 //=======================================================================
714 //function : ReduceSegment
715 //purpose :
716 //=======================================================================
ReduceSegment(TopOpeBRep_Point2d & psa,TopOpeBRep_Point2d & psb,TopOpeBRep_Point2d & Pn) const717 Standard_Boolean TopOpeBRep_EdgesIntersector::ReduceSegment(TopOpeBRep_Point2d& psa,
718 TopOpeBRep_Point2d& psb,
719 TopOpeBRep_Point2d& Pn) const
720 {
721 Standard_Boolean reduced = Standard_False;
722 Standard_Integer ixpsa = psa.Index();
723 Standard_Integer ixpsb = psb.Index();
724
725 Standard_Boolean pospsa = psa.IsPointOfSegment();
726 TopOpeBRep_P2Dstatus stspsa = psa.Status();
727 Standard_Real tpsa1 = psa.Parameter(1);
728 Standard_Real tpsa2 = psa.Parameter(2);
729 const TopOpeBRepDS_Transition& Tpsa1 = psa.Transition(1);
730 const TopOpeBRepDS_Transition& Tpsa2 = psa.Transition(2);
731
732 Standard_Boolean pospsb = psb.IsPointOfSegment();
733 TopOpeBRep_P2Dstatus stspsb = psb.Status();
734 Standard_Real tpsb1 = psb.Parameter(1);
735 Standard_Real tpsb2 = psb.Parameter(2);
736 const TopOpeBRepDS_Transition& Tpsb1 = psb.Transition(1);
737 const TopOpeBRepDS_Transition& Tpsb2 = psb.Transition(2);
738
739 Standard_Boolean conda = (pospsa && (stspsa == TopOpeBRep_P2DSGF));
740 Standard_Boolean condb = (pospsb && (stspsb == TopOpeBRep_P2DSGL));
741 Standard_Boolean cond = (conda && condb);
742
743 if (cond) {
744 reduced = Standard_True;
745
746 Standard_Real tm1 = (tpsa1 + tpsb1)/2.; Pn.SetParameter(1,tm1);
747 Standard_Real tm2 = (tpsa2 + tpsb2)/2.; Pn.SetParameter(2,tm2);
748
749 TopOpeBRepDS_Transition Tn1;
750 Tn1.Before(Tpsa1.Before(),Tpsa1.ShapeBefore());
751 Tn1.After (Tpsb1.After(),Tpsb1.ShapeAfter());
752 Pn.SetTransition(1,Tn1);
753 TopOpeBRepDS_Transition Tn2;
754 Tn2.Before(Tpsa2.Before(),Tpsa2.ShapeBefore());
755 Tn2.After (Tpsb2.After(),Tpsb2.ShapeAfter());
756 Pn.SetTransition(2,Tn2);
757
758 const gp_Pnt& P3Dpsa = psa.Value();
759 const gp_Pnt& P3Dpsb = psb.Value();
760 gp_Pnt P3Dn((P3Dpsa.X()+P3Dpsb.X())/2,
761 (P3Dpsa.Y()+P3Dpsb.Y())/2,
762 (P3Dpsa.Z()+P3Dpsb.Z())/2);
763 Pn.SetValue(P3Dn);
764 const gp_Pnt2d& P2Dpsa = psa.Value2d();
765 const gp_Pnt2d& P2Dpsb = psb.Value2d();
766 gp_Pnt2d P2Dn((P2Dpsa.X()+P2Dpsb.X())/2,
767 (P2Dpsa.Y()+P2Dpsb.Y())/2);
768 Pn.SetValue2d(P2Dn);
769
770 Standard_Real tolpsa = psa.Tolerance();
771 Standard_Real tolpsb = psb.Tolerance();
772 Standard_Real toln = (tolpsa + tolpsb)*1.5;
773 Pn.SetTolerance(toln);
774
775 Pn.SetIsPointOfSegment(Standard_False);
776 Pn.SetSegmentAncestors(ixpsa,ixpsb);
777 psa.SetKeep(Standard_False);
778 psb.SetKeep(Standard_False);
779
780 TopOpeBRepDS_Config cpsa = psa.EdgesConfig();
781
782 Pn.SetEdgesConfig(cpsa);
783
784 Standard_Boolean isvpsa1 = psa.IsVertex(1);if (isvpsa1) Pn.SetVertex(1,psa.Vertex(1));
785 Standard_Boolean isvpsa2 = psa.IsVertex(2);if (isvpsa2) Pn.SetVertex(2,psa.Vertex(2));
786 Standard_Boolean isvpsb1 = psb.IsVertex(1);if (isvpsb1) Pn.SetVertex(1,psb.Vertex(1));
787 Standard_Boolean isvpsb2 = psb.IsVertex(2);if (isvpsb2) Pn.SetVertex(2,psb.Vertex(2));
788 }
789
790 return reduced;
791 } // ReduceSegment
792
793 //=======================================================================
794 //function : ReduceSegments
795 //purpose :
796 //=======================================================================
ReduceSegments()797 void TopOpeBRep_EdgesIntersector::ReduceSegments()
798 {
799 Standard_Boolean condredu = (myHasSegment && !mySameDomain);
800 if (!condredu) return;
801
802 Standard_Integer ip = 1;Standard_Integer np = mynp2d;
803 while (ip < np) {
804 TopOpeBRep_Point2d& psa = mysp2d(ip);
805 TopOpeBRep_Point2d& psb = mysp2d(ip+1);
806 TopOpeBRep_Point2d pn;
807 Standard_Boolean reduced = ReduceSegment(psa,psb,pn);
808 if (reduced) {
809 pn.SetIndex(++mynp2d);
810 mysp2d.Append(pn);
811 }
812 ip++;
813 }
814
815 mylseg.Clear();
816 myNbSegments = mylseg.Length();
817 myHasSegment = (myNbSegments != 0);
818 myTrueNbPoints = myNbPoints + 2 * myNbSegments;
819
820 } // ReduceSegments
821
822
823 //=======================================================================
824 //function : IsEmpty
825 //purpose :
826 //=======================================================================
IsEmpty()827 Standard_Boolean TopOpeBRep_EdgesIntersector::IsEmpty ()
828 {
829 return (mynp2d == 0);
830 }
831
832 //=======================================================================
833 //function : HasSegment
834 //purpose :
835 //=======================================================================
HasSegment() const836 Standard_Boolean TopOpeBRep_EdgesIntersector::HasSegment () const
837 {
838 return myHasSegment;
839 }
840
841 //=======================================================================
842 //function : SameDomain
843 //purpose :
844 //=======================================================================
SameDomain() const845 Standard_Boolean TopOpeBRep_EdgesIntersector::SameDomain() const
846 {
847 return mySameDomain;
848 }
849
850 //=======================================================================
851 //function : Edge
852 //purpose :
853 //=======================================================================
Edge(const Standard_Integer Index) const854 const TopoDS_Shape& TopOpeBRep_EdgesIntersector::Edge(const Standard_Integer Index) const
855 {
856 if ( Index == 1 ) return myEdge1;
857 else if ( Index == 2 ) return myEdge2;
858 else throw Standard_Failure("TopOpeBRep_EdgesIntersector::Edge");
859 }
860
861 //=======================================================================
862 //function : Curve
863 //purpose :
864 //=======================================================================
Curve(const Standard_Integer Index) const865 const Geom2dAdaptor_Curve& TopOpeBRep_EdgesIntersector::Curve(const Standard_Integer Index) const
866 {
867 if ( Index == 1 ) return myCurve1;
868 else if ( Index == 2 ) return myCurve2;
869 else throw Standard_Failure("TopOpeBRep_EdgesIntersector::Curve");
870 }
871
872 //=======================================================================
873 //function : Face
874 //purpose :
875 //=======================================================================
Face(const Standard_Integer Index) const876 const TopoDS_Shape& TopOpeBRep_EdgesIntersector::Face(const Standard_Integer Index) const
877 {
878 if ( Index == 1 ) return myFace1;
879 else if ( Index == 2 ) return myFace2;
880 else throw Standard_Failure("TopOpeBRep_EdgesIntersector::Face");
881 }
882
883 //=======================================================================
884 //function : Surface
885 //purpose :
886 //=======================================================================
Surface(const Standard_Integer Index) const887 const BRepAdaptor_Surface& TopOpeBRep_EdgesIntersector::Surface(const Standard_Integer Index) const
888 {
889 if ( Index == 1 ) return *mySurface1;
890 else if ( Index == 2 ) return *mySurface2;
891 else throw Standard_Failure("TopOpeBRep_EdgesIntersector::Surface");
892 }
893
894 //=======================================================================
895 //function : SurfacesSameOriented
896 //purpose :
897 //=======================================================================
SurfacesSameOriented() const898 Standard_Boolean TopOpeBRep_EdgesIntersector::SurfacesSameOriented () const
899 {
900 return mySurfacesSameOriented;
901 }
902
903 //=======================================================================
904 //function : FacesSameOriented
905 //purpose :
906 //=======================================================================
FacesSameOriented() const907 Standard_Boolean TopOpeBRep_EdgesIntersector::FacesSameOriented () const
908 {
909 return myFacesSameOriented;
910 }
911
912 //=======================================================================
913 //function : InitPoint
914 //purpose :
915 //=======================================================================
InitPoint(const Standard_Boolean selectkeep)916 void TopOpeBRep_EdgesIntersector::InitPoint(const Standard_Boolean selectkeep)
917 {
918 myselectkeep = selectkeep;
919 myip2d = 1; mynp2d = mysp2d.Length();
920 Find();
921 }
922
923 //=======================================================================
924 //function : MorePoint
925 //purpose :
926 //=======================================================================
MorePoint() const927 Standard_Boolean TopOpeBRep_EdgesIntersector::MorePoint() const
928 {
929 Standard_Boolean b = (myip2d <= mynp2d);
930 return b;
931 }
932
933 //=======================================================================
934 //function : NextPoint
935 //purpose :
936 //=======================================================================
NextPoint()937 void TopOpeBRep_EdgesIntersector::NextPoint()
938 {
939 myip2d++;
940 Find();
941 }
942
943 //=======================================================================
944 //function : Find
945 //purpose :
946 //=======================================================================
Find()947 void TopOpeBRep_EdgesIntersector::Find()
948 {
949 while (myip2d <= mynp2d) {
950 if (myselectkeep) {
951 Standard_Boolean kf = mysp2d(myip2d).Keep();
952 if (kf) break;
953 else myip2d++;
954 }
955 else {
956 break;
957 }
958 }
959 }
960
961 //=======================================================================
962 //function : Points
963 //purpose :
964 //=======================================================================
Points() const965 const TopOpeBRep_SequenceOfPoint2d& TopOpeBRep_EdgesIntersector::Points() const
966 {
967 return mysp2d;
968 }
969
970 //=======================================================================
971 //function : Point
972 //purpose :
973 //=======================================================================
Point() const974 const TopOpeBRep_Point2d& TopOpeBRep_EdgesIntersector::Point() const
975 {
976 return mysp2d(myip2d);
977 }
978
979 //=======================================================================
980 //function : Point
981 //purpose :
982 //=======================================================================
Point(const Standard_Integer I) const983 const TopOpeBRep_Point2d& TopOpeBRep_EdgesIntersector::Point(const Standard_Integer I) const
984 {
985 if (I<1 || I>mysp2d.Length()) throw Standard_Failure("TopOpeBRep_EdgesIntersector::Point(I)");
986 return mysp2d(I);
987 }
988
989 //=======================================================================
990 //function : ToleranceMax
991 //purpose :
992 //=======================================================================
ToleranceMax() const993 Standard_Real TopOpeBRep_EdgesIntersector::ToleranceMax() const
994 {
995 Standard_Real tol = Max(myTol1,myTol2);
996 return tol;
997 }
998
999 //=======================================================================
1000 //function : Tolerances
1001 //purpose :
1002 //=======================================================================
Tolerances(Standard_Real & tol1,Standard_Real & tol2) const1003 void TopOpeBRep_EdgesIntersector::Tolerances(Standard_Real& tol1, Standard_Real& tol2) const
1004 {
1005 tol1 = myTol1;
1006 tol2 = myTol2;
1007 }
1008
1009 //=======================================================================
1010 //function : NbPoints
1011 //purpose : (debug)
1012 //=======================================================================
NbPoints() const1013 Standard_Integer TopOpeBRep_EdgesIntersector::NbPoints() const
1014 {
1015 return myNbPoints;
1016 }
1017
1018 //=======================================================================
1019 //function : NbSegments
1020 //purpose : (debug)
1021 //=======================================================================
NbSegments() const1022 Standard_Integer TopOpeBRep_EdgesIntersector::NbSegments() const
1023 {
1024 return myNbSegments;
1025 }
1026
1027 //=======================================================================
1028 //function : Dump
1029 //purpose :
1030 //=======================================================================
1031 #ifndef OCCT_DEBUG
Dump(const TCollection_AsciiString &,const Standard_Integer,const Standard_Integer)1032 void TopOpeBRep_EdgesIntersector::Dump(const TCollection_AsciiString& ,const Standard_Integer ,const Standard_Integer )
1033 {
1034 #else
1035 void TopOpeBRep_EdgesIntersector::Dump(const TCollection_AsciiString& str,const Standard_Integer E1index,const Standard_Integer E2index)
1036 {
1037 InitPoint();if (!MorePoint()) return;
1038 std::cout<<std::endl<<"---- "<<str<<" ---- E/E : "<<NbPoints()<<" p , ";
1039 std::cout<<NbSegments()<<" s : "<<myTrueNbPoints<<" true points"<<std::endl;
1040 std::cout<<"E1 = "<<E1index<<" ";TopAbs::Print(Edge(1).Orientation(),std::cout)<<", ";
1041 std::cout<<"E2 = "<<E2index<<" ";TopAbs::Print(Edge(2).Orientation(),std::cout)<<" ";
1042 std::cout<<"hs="<<HasSegment()<<" hsd="<<SameDomain()<<std::endl;
1043
1044 for (InitPoint(); MorePoint(); NextPoint()) {
1045 const TopOpeBRep_Point2d P2d = Point();
1046 P2d.Dump(E1index,E2index);
1047 if (P2d.Status() == TopOpeBRep_P2DNEW) {
1048 Standard_Integer ip1,ip2; P2d.SegmentAncestors(ip1,ip2);
1049 Standard_Real d1 = Point(ip1).Value().Distance(Point(ip2).Value());
1050 Standard_Real d2 = d1 + Point(ip1).Tolerance()/2. + Point(ip2).Tolerance()/2.;
1051 std::cout<<"ancestor segment : d P"<<ip1<<",P"<<ip2<<" = "<<d1<<std::endl;
1052 std::cout<<" t1/2 + d + t2/2 P"<<ip1<<",P"<<ip2<<" = "<<d2<<std::endl;
1053 }
1054 }
1055 std::cout<<std::endl;
1056 #endif
1057 }
1058
1059
1060