b311480e |
1 | // Created by: Modelization |
973c2be1 |
2 | // Copyright (c) 1999-2014 OPEN CASCADE SAS |
b311480e |
3 | // |
973c2be1 |
4 | // This file is part of Open CASCADE Technology software library. |
b311480e |
5 | // |
d5f74e42 |
6 | // This library is free software; you can redistribute it and/or modify it under |
7 | // the terms of the GNU Lesser General Public License version 2.1 as published |
973c2be1 |
8 | // by the Free Software Foundation, with special exception defined in the file |
9 | // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT |
10 | // distribution for complete text of the license and disclaimer of any warranty. |
b311480e |
11 | // |
973c2be1 |
12 | // Alternatively, this file may be used under the terms of Open CASCADE |
13 | // commercial license or contractual agreement. |
7fd59977 |
14 | |
4e14c88f |
15 | #include <IntPatch_Intersection.hxx> |
7fd59977 |
16 | |
42cf5bc1 |
17 | #include <Adaptor3d_HSurface.hxx> |
18 | #include <Adaptor3d_TopolTool.hxx> |
19 | #include <IntPatch_ALine.hxx> |
7fd59977 |
20 | #include <IntPatch_ALineToWLine.hxx> |
21 | #include <IntPatch_GLine.hxx> |
7fd59977 |
22 | #include <IntPatch_ImpImpIntersection.hxx> |
42cf5bc1 |
23 | #include <IntPatch_ImpPrmIntersection.hxx> |
42cf5bc1 |
24 | #include <IntPatch_Line.hxx> |
25 | #include <IntPatch_Point.hxx> |
26 | #include <IntPatch_PrmPrmIntersection.hxx> |
27 | #include <IntPatch_RLine.hxx> |
28 | #include <IntPatch_WLine.hxx> |
4e14c88f |
29 | #include <IntPatch_WLineTool.hxx> |
7fd59977 |
30 | #include <IntSurf_Quadric.hxx> |
42cf5bc1 |
31 | #include <Standard_ConstructionError.hxx> |
32 | #include <Standard_DomainError.hxx> |
33 | #include <Standard_OutOfRange.hxx> |
34 | #include <StdFail_NotDone.hxx> |
4e14c88f |
35 | #include <IntPatch_LineConstructor.hxx> |
7fd59977 |
36 | |
37 | #include <stdio.h> |
7fd59977 |
38 | #define DEBUG 0 |
788cbaf4 |
39 | static const Standard_Integer aNbPointsInALine = 200; |
7fd59977 |
40 | |
41 | //====================================================================== |
42 | // function: SequenceOfLine |
43 | //====================================================================== |
44 | const IntPatch_SequenceOfLine& IntPatch_Intersection::SequenceOfLine() const { return(slin); } |
45 | |
46 | //====================================================================== |
47 | // function: IntPatch_Intersection |
48 | //====================================================================== |
49 | IntPatch_Intersection::IntPatch_Intersection () |
50 | : done(Standard_False), |
51 | //empt, tgte, oppo, |
52 | myTolArc(0.0), myTolTang(0.0), |
53 | myUVMaxStep(0.0), myFleche(0.0), |
54 | myIsStartPnt(Standard_False) |
55 | //myU1Start, myV1Start, myU2Start, myV2Start |
56 | { |
57 | } |
58 | |
59 | //====================================================================== |
60 | // function: IntPatch_Intersection |
61 | //====================================================================== |
62 | IntPatch_Intersection::IntPatch_Intersection(const Handle(Adaptor3d_HSurface)& S1, |
63 | const Handle(Adaptor3d_TopolTool)& D1, |
64 | const Handle(Adaptor3d_HSurface)& S2, |
65 | const Handle(Adaptor3d_TopolTool)& D2, |
66 | const Standard_Real TolArc, |
67 | const Standard_Real TolTang) |
68 | : done(Standard_False), |
69 | //empt, tgte, oppo, |
70 | myTolArc(TolArc), myTolTang(TolTang), |
71 | myUVMaxStep(0.0), myFleche(0.0), |
72 | myIsStartPnt(Standard_False) |
73 | //myU1Start, myV1Start, myU2Start, myV2Start |
74 | { |
75 | if(myTolArc<1e-8) myTolArc=1e-8; |
76 | if(myTolTang<1e-8) myTolTang=1e-8; |
77 | if(myTolArc>0.5) myTolArc=0.5; |
78 | if(myTolTang>0.5) myTolTang=0.5; |
79 | Perform(S1,D1,S2,D2,TolArc,TolTang); |
80 | } |
81 | |
82 | //====================================================================== |
83 | // function: IntPatch_Intersection |
84 | //====================================================================== |
85 | IntPatch_Intersection::IntPatch_Intersection(const Handle(Adaptor3d_HSurface)& S1, |
86 | const Handle(Adaptor3d_TopolTool)& D1, |
87 | const Standard_Real TolArc, |
88 | const Standard_Real TolTang) |
89 | : done(Standard_False), |
90 | //empt, tgte, oppo, |
91 | myTolArc(TolArc), myTolTang(TolTang), |
92 | myUVMaxStep(0.0), myFleche(0.0), |
93 | myIsStartPnt(Standard_False) |
94 | //myU1Start, myV1Start, myU2Start, myV2Start |
95 | { |
96 | Perform(S1,D1,TolArc,TolTang); |
97 | } |
98 | |
99 | //====================================================================== |
100 | // function: SetTolerances |
101 | //====================================================================== |
102 | void IntPatch_Intersection::SetTolerances(const Standard_Real TolArc, |
103 | const Standard_Real TolTang, |
104 | const Standard_Real UVMaxStep, |
105 | const Standard_Real Fleche) |
106 | { |
107 | myTolArc = TolArc; |
108 | myTolTang = TolTang; |
109 | myUVMaxStep = UVMaxStep; |
110 | myFleche = Fleche; |
111 | if(myTolArc<1e-8) myTolArc=1e-8; |
112 | if(myTolTang<1e-8) myTolTang=1e-8; |
113 | if(myTolArc>0.5) myTolArc=0.5; |
114 | if(myTolTang>0.5) myTolTang=0.5; |
115 | if(myFleche<1.0e-3) myFleche=1e-3; |
116 | if(myUVMaxStep<1.0e-3) myUVMaxStep=1e-3; |
117 | if(myFleche>10) myFleche=10; |
118 | if(myUVMaxStep>0.5) myUVMaxStep=0.5; |
119 | } |
120 | |
121 | //====================================================================== |
122 | // function: Perform |
123 | //====================================================================== |
124 | void IntPatch_Intersection::Perform(const Handle(Adaptor3d_HSurface)& S1, |
125 | const Handle(Adaptor3d_TopolTool)& D1, |
126 | const Standard_Real TolArc, |
127 | const Standard_Real TolTang) |
128 | { |
129 | myTolArc = TolArc; |
130 | myTolTang = TolTang; |
131 | if(myFleche == 0.0) myFleche = 0.01; |
132 | if(myUVMaxStep==0.0) myUVMaxStep = 0.01; |
133 | |
134 | done = Standard_True; |
135 | spnt.Clear(); |
136 | slin.Clear(); |
137 | |
138 | empt = Standard_True; |
139 | tgte = Standard_False; |
140 | oppo = Standard_False; |
141 | |
142 | switch (S1->GetType()) |
143 | { |
144 | case GeomAbs_Plane: |
145 | case GeomAbs_Cylinder: |
146 | case GeomAbs_Sphere: |
147 | case GeomAbs_Cone: |
148 | case GeomAbs_Torus: break; |
149 | default: |
150 | { |
1d18c75e |
151 | IntPatch_PrmPrmIntersection interpp; |
714c3bfc |
152 | interpp.Perform(S1,D1,TolTang,TolArc,myFleche,myUVMaxStep); |
1d18c75e |
153 | if (interpp.IsDone()) |
154 | { |
155 | done = Standard_True; |
156 | tgte = Standard_False; |
157 | empt = interpp.IsEmpty(); |
158 | const Standard_Integer nblm = interpp.NbLines(); |
159 | for (Standard_Integer i=1; i<=nblm; i++) slin.Append(interpp.Line(i)); |
160 | } |
7fd59977 |
161 | } |
162 | break; |
163 | } |
164 | } |
165 | |
166 | ///////////////////////////////////////////////////////////////////////////// |
167 | // These several support functions provide methods which can help basic // |
168 | // algorithm to intersect infinite surfaces of the following types: // |
169 | // // |
170 | // a.) SurfaceOfExtrusion; // |
171 | // b.) SurfaceOfRevolution; // |
172 | // c.) OffsetSurface. // |
173 | // // |
174 | ///////////////////////////////////////////////////////////////////////////// |
175 | #include <TColgp_Array1OfXYZ.hxx> |
176 | #include <TColgp_Array1OfPnt.hxx> |
177 | #include <TColgp_SequenceOfPnt.hxx> |
178 | #include <Extrema_ExtPS.hxx> |
179 | #include <Extrema_POnSurf.hxx> |
180 | #include <Geom2d_Curve.hxx> |
181 | #include <Geom2dAPI_InterCurveCurve.hxx> |
182 | #include <GeomAdaptor.hxx> |
183 | #include <GeomAdaptor_HCurve.hxx> |
184 | #include <GeomAdaptor_Curve.hxx> |
185 | #include <GeomAdaptor_Surface.hxx> |
cb389a77 |
186 | #include <GeomAdaptor_HSurface.hxx> |
7fd59977 |
187 | #include <Geom_Plane.hxx> |
188 | #include <ProjLib_ProjectOnPlane.hxx> |
189 | #include <GeomProjLib.hxx> |
190 | #include <ElCLib.hxx> |
191 | #include <Geom_TrimmedCurve.hxx> |
192 | #include <Geom_Surface.hxx> |
193 | #include <Geom_SurfaceOfLinearExtrusion.hxx> |
194 | #include <Geom_OffsetSurface.hxx> |
195 | #include <Geom_SurfaceOfRevolution.hxx> |
196 | #include <Geom_RectangularTrimmedSurface.hxx> |
197 | |
198 | //=============================================================== |
199 | //function: FUN_GetMinMaxXYZPnt |
200 | //=============================================================== |
201 | static void FUN_GetMinMaxXYZPnt( const Handle(Adaptor3d_HSurface)& S, |
202 | gp_Pnt& pMin, gp_Pnt& pMax ) |
203 | { |
204 | const Standard_Real DU = 0.25 * Abs(S->LastUParameter() - S->FirstUParameter()); |
205 | const Standard_Real DV = 0.25 * Abs(S->LastVParameter() - S->FirstVParameter()); |
206 | Standard_Real tMinXYZ = RealLast(); |
207 | Standard_Real tMaxXYZ = -tMinXYZ; |
208 | gp_Pnt PUV, ptMax, ptMin; |
209 | for(Standard_Real U = S->FirstUParameter(); U <= S->LastUParameter(); U += DU) |
210 | { |
211 | for(Standard_Real V = S->FirstVParameter(); V <= S->LastVParameter(); V += DV) |
1d18c75e |
212 | { |
213 | S->D0(U,V,PUV); |
7fd59977 |
214 | const Standard_Real cXYZ = PUV.XYZ().Modulus(); |
1d18c75e |
215 | if(cXYZ > tMaxXYZ) { tMaxXYZ = cXYZ; ptMax = PUV; } |
216 | if(cXYZ < tMinXYZ) { tMinXYZ = cXYZ; ptMin = PUV; } |
217 | } |
7fd59977 |
218 | } |
219 | pMin = ptMin; |
220 | pMax = ptMax; |
221 | } |
222 | //========================================================================== |
223 | //function: FUN_TrimInfSurf |
224 | //========================================================================== |
225 | static void FUN_TrimInfSurf(const gp_Pnt& Pmin, |
226 | const gp_Pnt& Pmax, |
227 | const Handle(Adaptor3d_HSurface)& InfSurf, |
228 | const Standard_Real& AlternativeTrimPrm, |
229 | Handle(Adaptor3d_HSurface)& TrimS) |
230 | { |
231 | Standard_Real TP = AlternativeTrimPrm; |
232 | Extrema_ExtPS ext1(Pmin, InfSurf->Surface(), 1.e-7, 1.e-7); |
233 | Extrema_ExtPS ext2(Pmax, InfSurf->Surface(), 1.e-7, 1.e-7); |
234 | if(ext1.IsDone() || ext2.IsDone()) |
235 | { |
236 | Standard_Real Umax = -1.e+100, Umin = 1.e+100, Vmax = -1.e+100, Vmin = 1.e+100, cU, cV; |
237 | if(ext1.IsDone()) |
1d18c75e |
238 | { |
7fd59977 |
239 | for(Standard_Integer i = 1; i <= ext1.NbExt(); i++) |
240 | { |
1d18c75e |
241 | const Extrema_POnSurf & pons = ext1.Point(i); |
242 | pons.Parameter(cU,cV); |
243 | if(cU > Umax) Umax = cU; |
244 | if(cU < Umin) Umin = cU; |
245 | if(cV > Vmax) Vmax = cV; |
246 | if(cV < Vmin) Vmin = cV; |
7fd59977 |
247 | } |
1d18c75e |
248 | } |
7fd59977 |
249 | if(ext2.IsDone()) |
1d18c75e |
250 | { |
7fd59977 |
251 | for(Standard_Integer i = 1; i <= ext2.NbExt(); i++) |
252 | { |
253 | const Extrema_POnSurf & pons = ext2.Point(i); |
254 | pons.Parameter(cU,cV); |
255 | if(cU > Umax) Umax = cU; |
256 | if(cU < Umin) Umin = cU; |
257 | if(cV > Vmax) Vmax = cV; |
258 | if(cV < Vmin) Vmin = cV; |
259 | } |
1d18c75e |
260 | } |
7fd59977 |
261 | TP = Max(Abs(Umin),Max(Abs(Umax),Max(Abs(Vmin),Abs(Vmax)))); |
262 | } |
263 | if(TP == 0.) { TrimS = InfSurf; return; } |
264 | else |
265 | { |
266 | const Standard_Boolean Uinf = Precision::IsNegativeInfinite(InfSurf->FirstUParameter()); |
267 | const Standard_Boolean Usup = Precision::IsPositiveInfinite(InfSurf->LastUParameter()); |
268 | const Standard_Boolean Vinf = Precision::IsNegativeInfinite(InfSurf->FirstVParameter()); |
269 | const Standard_Boolean Vsup = Precision::IsPositiveInfinite(InfSurf->LastVParameter()); |
270 | Handle(Adaptor3d_HSurface) TmpSS; |
271 | Standard_Integer IsTrimed = 0; |
272 | const Standard_Real tp = 1000.0 * TP; |
273 | if(Vinf && Vsup) { TrimS = InfSurf->VTrim(-tp, tp, 1.0e-7); IsTrimed = 1; } |
274 | if(Vinf && !Vsup){ TrimS = InfSurf->VTrim(-tp, InfSurf->LastVParameter(), 1.0e-7); IsTrimed = 1; } |
275 | if(!Vinf && Vsup){ TrimS = InfSurf->VTrim(InfSurf->FirstVParameter(), tp, 1.0e-7); IsTrimed = 1; } |
276 | if(IsTrimed) |
1d18c75e |
277 | { |
278 | TmpSS = TrimS; |
279 | if(Uinf && Usup) TrimS = TmpSS->UTrim(-tp, tp, 1.0e-7); |
280 | if(Uinf && !Usup) TrimS = TmpSS->UTrim(-tp, InfSurf->LastUParameter(), 1.0e-7); |
281 | if(!Uinf && Usup) TrimS = TmpSS->UTrim(InfSurf->FirstUParameter(), tp, 1.0e-7); |
282 | } |
7fd59977 |
283 | else |
1d18c75e |
284 | { |
285 | if(Uinf && Usup) TrimS = InfSurf->UTrim(-tp, tp, 1.0e-7); |
286 | if(Uinf && !Usup) TrimS = InfSurf->UTrim(-tp, InfSurf->LastUParameter(), 1.0e-7); |
287 | if(!Uinf && Usup) TrimS = InfSurf->UTrim(InfSurf->FirstUParameter(), tp, 1.0e-7); |
288 | } |
7fd59977 |
289 | } |
290 | } |
291 | //================================================================================ |
292 | //function: FUN_GetUiso |
293 | //================================================================================ |
294 | static void FUN_GetUiso(const Handle(Geom_Surface)& GS, |
295 | const GeomAbs_SurfaceType& T, |
296 | const Standard_Real& FirstV, |
297 | const Standard_Real& LastV, |
298 | const Standard_Boolean& IsVC, |
299 | const Standard_Boolean& IsVP, |
300 | const Standard_Real& U, |
301 | Handle(Geom_Curve)& I) |
302 | { |
303 | if(T != GeomAbs_OffsetSurface) |
304 | { |
305 | Handle(Geom_Curve) gc = GS->UIso(U); |
c6541a0c |
306 | if(IsVP && (FirstV == 0.0 && LastV == (2.*M_PI))) I = gc; |
7fd59977 |
307 | else |
1d18c75e |
308 | { |
309 | Handle(Geom_TrimmedCurve) gtc = new Geom_TrimmedCurve(gc,FirstV,LastV); |
310 | //szv:I = Handle(Geom_Curve)::DownCast(gtc); |
311 | I = gtc; |
312 | } |
7fd59977 |
313 | } |
314 | else//OffsetSurface |
315 | { |
c5f3a425 |
316 | const Handle(Geom_OffsetSurface) gos = Handle(Geom_OffsetSurface)::DownCast (GS); |
7fd59977 |
317 | const Handle(Geom_Surface) bs = gos->BasisSurface(); |
318 | Handle(Geom_Curve) gcbs = bs->UIso(U); |
319 | GeomAdaptor_Curve gac(gcbs); |
320 | const GeomAbs_CurveType GACT = gac.GetType(); |
321 | if(IsVP || IsVC || GACT == GeomAbs_BSplineCurve || GACT == GeomAbs_BezierCurve || Abs(LastV - FirstV) < 1.e+5) |
1d18c75e |
322 | { |
323 | Handle(Geom_Curve) gc = gos->UIso(U); |
324 | if(IsVP && (FirstV == 0.0 && LastV == (2*M_PI))) I = gc; |
325 | else |
7fd59977 |
326 | { |
1d18c75e |
327 | Handle(Geom_TrimmedCurve) gtc = new Geom_TrimmedCurve(gc,FirstV,LastV); |
328 | //szv:I = Handle(Geom_Curve)::DownCast(gtc); |
329 | I = gtc; |
330 | } |
331 | } |
7fd59977 |
332 | else//Offset Line, Parab, Hyperb |
1d18c75e |
333 | { |
334 | Standard_Real VmTr, VMTr; |
335 | if(GACT != GeomAbs_Hyperbola) |
7fd59977 |
336 | { |
1d18c75e |
337 | if(FirstV >= 0. && LastV >= 0.){ VmTr = FirstV; VMTr = ((LastV - FirstV) > 1.e+4) ? (FirstV + 1.e+4) : LastV; } |
338 | else if(FirstV < 0. && LastV < 0.){ VMTr = LastV; VmTr = ((FirstV - LastV) < -1.e+4) ? (LastV - 1.e+4) : FirstV; } |
339 | else { VmTr = (FirstV < -1.e+4) ? -1.e+4 : FirstV; VMTr = (LastV > 1.e+4) ? 1.e+4 : LastV; } |
340 | } |
341 | else//Hyperbola |
342 | { |
343 | if(FirstV >= 0. && LastV >= 0.) |
344 | { |
345 | if(FirstV > 4.) return; |
346 | VmTr = FirstV; VMTr = (LastV > 4.) ? 4. : LastV; |
347 | } |
348 | else if(FirstV < 0. && LastV < 0.) |
349 | { |
350 | if(LastV < -4.) return; |
351 | VMTr = LastV; VmTr = (FirstV < -4.) ? -4. : FirstV; |
352 | } |
353 | else { VmTr = (FirstV < -4.) ? -4. : FirstV; VMTr = (LastV > 4.) ? 4. : LastV; } |
354 | } |
355 | //Make trimmed surface |
356 | Handle(Geom_RectangularTrimmedSurface) rts = new Geom_RectangularTrimmedSurface(gos,VmTr,VMTr,Standard_True); |
357 | I = rts->UIso(U); |
358 | } |
7fd59977 |
359 | } |
360 | } |
361 | //================================================================================ |
362 | //function: FUN_GetViso |
363 | //================================================================================ |
364 | static void FUN_GetViso(const Handle(Geom_Surface)& GS, |
365 | const GeomAbs_SurfaceType& T, |
366 | const Standard_Real& FirstU, |
367 | const Standard_Real& LastU, |
368 | const Standard_Boolean& IsUC, |
369 | const Standard_Boolean& IsUP, |
370 | const Standard_Real& V, |
371 | Handle(Geom_Curve)& I) |
372 | { |
373 | if(T != GeomAbs_OffsetSurface) |
374 | { |
375 | Handle(Geom_Curve) gc = GS->VIso(V); |
c6541a0c |
376 | if(IsUP && (FirstU == 0.0 && LastU == (2*M_PI))) I = gc; |
7fd59977 |
377 | else |
1d18c75e |
378 | { |
379 | Handle(Geom_TrimmedCurve) gtc = new Geom_TrimmedCurve(gc,FirstU,LastU); |
380 | //szv:I = Handle(Geom_Curve)::DownCast(gtc); |
381 | I = gtc; |
382 | } |
7fd59977 |
383 | } |
384 | else//OffsetSurface |
385 | { |
c5f3a425 |
386 | const Handle(Geom_OffsetSurface) gos = Handle(Geom_OffsetSurface)::DownCast (GS); |
7fd59977 |
387 | const Handle(Geom_Surface) bs = gos->BasisSurface(); |
388 | Handle(Geom_Curve) gcbs = bs->VIso(V); |
389 | GeomAdaptor_Curve gac(gcbs); |
390 | const GeomAbs_CurveType GACT = gac.GetType(); |
391 | if(IsUP || IsUC || GACT == GeomAbs_BSplineCurve || GACT == GeomAbs_BezierCurve || Abs(LastU - FirstU) < 1.e+5) |
1d18c75e |
392 | { |
393 | Handle(Geom_Curve) gc = gos->VIso(V); |
394 | if(IsUP && (FirstU == 0.0 && LastU == (2*M_PI))) I = gc; |
395 | else |
396 | { |
397 | Handle(Geom_TrimmedCurve) gtc = new Geom_TrimmedCurve(gc,FirstU,LastU); |
398 | //szv:I = Handle(Geom_Curve)::DownCast(gtc); |
399 | I = gtc; |
400 | } |
401 | } |
7fd59977 |
402 | else//Offset Line, Parab, Hyperb |
1d18c75e |
403 | { |
404 | Standard_Real UmTr, UMTr; |
405 | if(GACT != GeomAbs_Hyperbola) |
406 | { |
407 | if(FirstU >= 0. && LastU >= 0.){ UmTr = FirstU; UMTr = ((LastU - FirstU) > 1.e+4) ? (FirstU + 1.e+4) : LastU; } |
408 | else if(FirstU < 0. && LastU < 0.){ UMTr = LastU; UmTr = ((FirstU - LastU) < -1.e+4) ? (LastU - 1.e+4) : FirstU; } |
409 | else { UmTr = (FirstU < -1.e+4) ? -1.e+4 : FirstU; UMTr = (LastU > 1.e+4) ? 1.e+4 : LastU; } |
410 | } |
411 | else//Hyperbola |
412 | { |
413 | if(FirstU >= 0. && LastU >= 0.) |
414 | { |
415 | if(FirstU > 4.) return; |
416 | UmTr = FirstU; UMTr = (LastU > 4.) ? 4. : LastU; |
417 | } |
418 | else if(FirstU < 0. && LastU < 0.) |
419 | { |
420 | if(LastU < -4.) return; |
421 | UMTr = LastU; UmTr = (FirstU < -4.) ? -4. : FirstU; |
422 | } |
423 | else { UmTr = (FirstU < -4.) ? -4. : FirstU; UMTr = (LastU > 4.) ? 4. : LastU; } |
424 | } |
425 | //Make trimmed surface |
426 | Handle(Geom_RectangularTrimmedSurface) rts = new Geom_RectangularTrimmedSurface(gos,UmTr,UMTr,Standard_True); |
427 | I = rts->VIso(V); |
428 | } |
7fd59977 |
429 | } |
430 | } |
431 | //================================================================================ |
432 | //function: FUN_PL_Intersection |
433 | //================================================================================ |
434 | static void FUN_PL_Intersection(const Handle(Adaptor3d_HSurface)& S1, |
435 | const GeomAbs_SurfaceType& T1, |
436 | const Handle(Adaptor3d_HSurface)& S2, |
437 | const GeomAbs_SurfaceType& T2, |
438 | Standard_Boolean& IsOk, |
439 | TColgp_SequenceOfPnt& SP, |
440 | gp_Vec& DV) |
441 | { |
442 | IsOk = Standard_False; |
443 | // 1. Check: both surfaces have U(V)isos - lines. |
444 | DV = gp_Vec(0.,0.,1.); |
445 | Standard_Boolean isoS1isLine[2] = {0, 0}; |
446 | Standard_Boolean isoS2isLine[2] = {0, 0}; |
447 | Handle(Geom_Curve) C1, C2; |
448 | const GeomAdaptor_Surface & gas1 = *(GeomAdaptor_Surface*)(&(S1->Surface())); |
449 | const GeomAdaptor_Surface & gas2 = *(GeomAdaptor_Surface*)(&(S2->Surface())); |
450 | const Handle(Geom_Surface) gs1 = gas1.Surface(); |
451 | const Handle(Geom_Surface) gs2 = gas2.Surface(); |
452 | Standard_Real MS1[2], MS2[2]; |
453 | MS1[0] = 0.5 * (S1->LastUParameter() + S1->FirstUParameter()); |
454 | MS1[1] = 0.5 * (S1->LastVParameter() + S1->FirstVParameter()); |
455 | MS2[0] = 0.5 * (S2->LastUParameter() + S2->FirstUParameter()); |
456 | MS2[1] = 0.5 * (S2->LastVParameter() + S2->FirstVParameter()); |
457 | if(T1 == GeomAbs_SurfaceOfExtrusion) isoS1isLine[0] = Standard_True; |
458 | else if(!S1->IsVPeriodic() && !S1->IsVClosed()) { |
459 | if(T1 != GeomAbs_OffsetSurface) C1 = gs1->UIso(MS1[0]); |
460 | else { |
c5f3a425 |
461 | const Handle(Geom_OffsetSurface) gos = Handle(Geom_OffsetSurface)::DownCast (gs1); |
7fd59977 |
462 | const Handle(Geom_Surface) bs = gos->BasisSurface(); |
463 | C1 = bs->UIso(MS1[0]); |
464 | } |
465 | GeomAdaptor_Curve gac(C1); |
466 | if(gac.GetType() == GeomAbs_Line) isoS1isLine[0] = Standard_True; |
467 | } |
468 | if(!S1->IsUPeriodic() && !S1->IsUClosed()) { |
469 | if(T1 != GeomAbs_OffsetSurface) C1 = gs1->VIso(MS1[1]); |
470 | else { |
c5f3a425 |
471 | const Handle(Geom_OffsetSurface) gos = Handle(Geom_OffsetSurface)::DownCast (gs1); |
7fd59977 |
472 | const Handle(Geom_Surface) bs = gos->BasisSurface(); |
473 | C1 = bs->VIso(MS1[1]); |
474 | } |
475 | GeomAdaptor_Curve gac(C1); |
476 | if(gac.GetType() == GeomAbs_Line) isoS1isLine[1] = Standard_True; |
477 | } |
478 | if(T2 == GeomAbs_SurfaceOfExtrusion) isoS2isLine[0] = Standard_True; |
479 | else if(!S2->IsVPeriodic() && !S2->IsVClosed()) { |
480 | if(T2 != GeomAbs_OffsetSurface) C2 = gs2->UIso(MS2[0]); |
481 | else { |
c5f3a425 |
482 | const Handle(Geom_OffsetSurface) gos = Handle(Geom_OffsetSurface)::DownCast (gs2); |
7fd59977 |
483 | const Handle(Geom_Surface) bs = gos->BasisSurface(); |
484 | C2 = bs->UIso(MS2[0]); |
485 | } |
486 | GeomAdaptor_Curve gac(C2); |
487 | if(gac.GetType() == GeomAbs_Line) isoS2isLine[0] = Standard_True; |
488 | } |
489 | if(!S2->IsUPeriodic() && !S2->IsUClosed()) { |
490 | if(T2 != GeomAbs_OffsetSurface) C2 = gs2->VIso(MS2[1]); |
491 | else { |
c5f3a425 |
492 | const Handle(Geom_OffsetSurface) gos = Handle(Geom_OffsetSurface)::DownCast (gs2); |
7fd59977 |
493 | const Handle(Geom_Surface) bs = gos->BasisSurface(); |
494 | C2 = bs->VIso(MS2[1]); |
495 | } |
496 | GeomAdaptor_Curve gac(C2); |
497 | if(gac.GetType() == GeomAbs_Line) isoS2isLine[1] = Standard_True; |
498 | } |
499 | Standard_Boolean IsBothLines = ((isoS1isLine[0] || isoS1isLine[1]) && |
500 | (isoS2isLine[0] || isoS2isLine[1])); |
501 | if(!IsBothLines){ |
502 | return; |
503 | } |
504 | // 2. Check: Uiso lines of both surfaces are collinear. |
505 | gp_Pnt puvS1, puvS2; |
506 | gp_Vec derS1[2], derS2[2]; |
507 | S1->D1(MS1[0], MS1[1], puvS1, derS1[0], derS1[1]); |
508 | S2->D1(MS2[0], MS2[1], puvS2, derS2[0], derS2[1]); |
509 | C1.Nullify(); C2.Nullify(); |
510 | Standard_Integer iso = 0; |
511 | if(isoS1isLine[0] && isoS2isLine[0] && |
512 | derS1[1].IsParallel(derS2[1],Precision::Angular())) { |
513 | iso = 1; |
514 | FUN_GetViso(gs1,T1,S1->FirstUParameter(),S1->LastUParameter(), |
515 | S1->IsUClosed(),S1->IsUPeriodic(),MS1[1],C1); |
516 | FUN_GetViso(gs2,T2,S2->FirstUParameter(),S2->LastUParameter(), |
517 | S2->IsUClosed(),S2->IsUPeriodic(),MS2[1],C2); |
518 | } |
519 | else if(isoS1isLine[0] && isoS2isLine[1] && |
520 | derS1[1].IsParallel(derS2[0],Precision::Angular())) { |
521 | iso = 1; |
522 | FUN_GetViso(gs1,T1,S1->FirstUParameter(),S1->LastUParameter(), |
523 | S1->IsUClosed(),S1->IsUPeriodic(),MS1[1],C1); |
524 | FUN_GetUiso(gs2,T2,S2->FirstVParameter(),S2->LastVParameter(), |
525 | S2->IsVClosed(),S2->IsVPeriodic(),MS2[0],C2); |
526 | } |
527 | else if(isoS1isLine[1] && isoS2isLine[0] && |
528 | derS1[0].IsParallel(derS2[1],Precision::Angular())) { |
529 | iso = 0; |
530 | FUN_GetUiso(gs1,T1,S1->FirstVParameter(),S1->LastVParameter(), |
531 | S1->IsVClosed(),S1->IsVPeriodic(),MS1[0],C1); |
532 | FUN_GetViso(gs2,T2,S2->FirstUParameter(),S2->LastUParameter(), |
533 | S2->IsUClosed(),S2->IsUPeriodic(),MS2[1],C2); |
534 | } |
535 | else if(isoS1isLine[1] && isoS2isLine[1] && |
536 | derS1[0].IsParallel(derS2[0],Precision::Angular())) { |
537 | iso = 0; |
538 | FUN_GetUiso(gs1,T1,S1->FirstVParameter(),S1->LastVParameter(), |
539 | S1->IsVClosed(),S1->IsVPeriodic(),MS1[0],C1); |
540 | FUN_GetUiso(gs2,T2,S2->FirstVParameter(),S2->LastVParameter(), |
541 | S2->IsVClosed(),S2->IsVPeriodic(),MS2[0],C2); |
542 | } |
543 | else { |
544 | IsOk = Standard_False; |
545 | return; |
546 | } |
547 | IsOk = Standard_True; |
548 | // 3. Make intersections of V(U)isos |
549 | if(C1.IsNull() || C2.IsNull()) return; |
550 | DV = derS1[iso]; |
551 | Handle(Geom_Plane) GPln = new Geom_Plane(gp_Pln(puvS1,gp_Dir(DV))); |
552 | Handle(Geom_Curve) C1Prj = |
553 | GeomProjLib::ProjectOnPlane(C1,GPln,gp_Dir(DV),Standard_True); |
554 | Handle(Geom_Curve) C2Prj = |
555 | GeomProjLib::ProjectOnPlane(C2,GPln,gp_Dir(DV),Standard_True); |
556 | if(C1Prj.IsNull() || C2Prj.IsNull()) return; |
a9dde4a3 |
557 | Handle(Geom2d_Curve) C1Prj2d = GeomProjLib::Curve2d (C1Prj,GPln); |
558 | Handle(Geom2d_Curve) C2Prj2d = GeomProjLib::Curve2d (C2Prj,GPln); |
7fd59977 |
559 | Geom2dAPI_InterCurveCurve ICC(C1Prj2d,C2Prj2d,1.0e-7); |
560 | if(ICC.NbPoints() > 0 ) |
561 | { |
562 | for(Standard_Integer ip = 1; ip <= ICC.NbPoints(); ip++) |
1d18c75e |
563 | { |
564 | gp_Pnt2d P = ICC.Point(ip); |
565 | gp_Pnt P3d = ElCLib::To3d(gp_Ax2(puvS1,gp_Dir(DV)),P); |
566 | SP.Append(P3d); |
567 | } |
7fd59977 |
568 | } |
569 | } |
570 | //================================================================================ |
571 | //function: FUN_NewFirstLast |
572 | //================================================================================ |
573 | static void FUN_NewFirstLast(const GeomAbs_CurveType& ga_ct, |
574 | const Standard_Real& Fst, |
575 | const Standard_Real& Lst, |
576 | const Standard_Real& TrVal, |
577 | Standard_Real& NewFst, |
578 | Standard_Real& NewLst, |
579 | Standard_Boolean& NeedTr) |
580 | { |
581 | NewFst = Fst; NewLst = Lst; NeedTr = Standard_False; |
582 | switch (ga_ct) |
583 | { |
584 | case GeomAbs_Line: |
585 | case GeomAbs_Parabola: |
586 | { |
587 | if(Abs(Lst - Fst) > TrVal) |
1d18c75e |
588 | { |
589 | if(Fst >= 0. && Lst >= 0.) |
7fd59977 |
590 | { |
1d18c75e |
591 | NewFst = Fst; |
592 | NewLst = ((Fst + TrVal) < Lst) ? (Fst + TrVal) : Lst; |
593 | } |
594 | if(Fst < 0. && Lst < 0.) |
595 | { |
596 | NewLst = Lst; |
597 | NewFst = ((Lst - TrVal) > Fst) ? (Lst - TrVal) : Fst; |
598 | } |
599 | else |
600 | { |
601 | NewFst = (Fst < -TrVal) ? -TrVal : Fst; |
602 | NewLst = (Lst > TrVal) ? TrVal : Lst; |
603 | } |
604 | NeedTr = Standard_True; |
605 | } |
606 | break; |
7fd59977 |
607 | } |
1d18c75e |
608 | case GeomAbs_Hyperbola: |
7fd59977 |
609 | { |
610 | if(Abs(Lst - Fst) > 10.) |
1d18c75e |
611 | { |
612 | if(Fst >= 0. && Lst >= 0.) |
613 | { |
614 | if(Fst > 4.) return; |
615 | NewFst = Fst; |
616 | NewLst = (Lst > 4.) ? 4. : Lst; |
617 | } |
618 | if(Fst < 0. && Lst < 0.) |
619 | { |
620 | if(Lst < -4.) return; |
621 | NewLst = Lst; |
622 | NewFst = (Fst < -4.) ? -4. : Fst; |
623 | } |
624 | else |
625 | { |
626 | NewFst = (Fst < -4.) ? -4. : Fst; |
627 | NewLst = (Lst > 4.) ? 4. : Lst; |
628 | } |
629 | NeedTr = Standard_True; |
630 | } |
7fd59977 |
631 | break; |
632 | } |
1d18c75e |
633 | default: |
566f8441 |
634 | break; |
7fd59977 |
635 | } |
636 | } |
637 | //================================================================================ |
638 | //function: FUN_TrimBothSurf |
1d18c75e |
639 | //================================================================================ |
7fd59977 |
640 | static void FUN_TrimBothSurf(const Handle(Adaptor3d_HSurface)& S1, |
641 | const GeomAbs_SurfaceType& T1, |
642 | const Handle(Adaptor3d_HSurface)& S2, |
643 | const GeomAbs_SurfaceType& T2, |
644 | const Standard_Real& TV, |
645 | Handle(Adaptor3d_HSurface)& NS1, |
646 | Handle(Adaptor3d_HSurface)& NS2) |
647 | { |
648 | const GeomAdaptor_Surface & gas1 = *(GeomAdaptor_Surface*)(&(S1->Surface())); |
649 | const GeomAdaptor_Surface & gas2 = *(GeomAdaptor_Surface*)(&(S2->Surface())); |
650 | const Handle(Geom_Surface) gs1 = gas1.Surface(); |
651 | const Handle(Geom_Surface) gs2 = gas2.Surface(); |
652 | const Standard_Real UM1 = 0.5 * (S1->LastUParameter() + S1->FirstUParameter()); |
653 | const Standard_Real UM2 = 0.5 * (S2->LastUParameter() + S2->FirstUParameter()); |
654 | const Standard_Real VM1 = 0.5 * (S1->LastVParameter() + S1->FirstVParameter()); |
655 | const Standard_Real VM2 = 0.5 * (S2->LastVParameter() + S2->FirstVParameter()); |
656 | Handle(Geom_Curve) visoS1, visoS2, uisoS1, uisoS2; |
657 | if(T1 != GeomAbs_OffsetSurface){ visoS1 = gs1->VIso(VM1); uisoS1 = gs1->UIso(UM1); } |
658 | else |
659 | { |
c5f3a425 |
660 | const Handle(Geom_OffsetSurface) gos = Handle(Geom_OffsetSurface)::DownCast (gs1); |
7fd59977 |
661 | const Handle(Geom_Surface) bs = gos->BasisSurface(); |
662 | visoS1 = bs->VIso(VM1); uisoS1 = bs->UIso(UM1); |
663 | } |
664 | if(T2 != GeomAbs_OffsetSurface){ visoS2 = gs2->VIso(VM2); uisoS2 = gs2->UIso(UM2); } |
665 | else |
666 | { |
c5f3a425 |
667 | const Handle(Geom_OffsetSurface) gos = Handle(Geom_OffsetSurface)::DownCast (gs2); |
7fd59977 |
668 | const Handle(Geom_Surface) bs = gos->BasisSurface(); |
669 | visoS2 = bs->VIso(VM2); uisoS2 = bs->UIso(UM2); |
670 | } |
671 | if(uisoS1.IsNull() || uisoS2.IsNull() || visoS1.IsNull() || visoS2.IsNull()){ NS1 = S1; NS2 = S2; return; } |
672 | GeomAdaptor_Curve gau1(uisoS1); |
673 | GeomAdaptor_Curve gav1(visoS1); |
674 | GeomAdaptor_Curve gau2(uisoS2); |
675 | GeomAdaptor_Curve gav2(visoS2); |
676 | GeomAbs_CurveType GA_U1 = gau1.GetType(); |
677 | GeomAbs_CurveType GA_V1 = gav1.GetType(); |
678 | GeomAbs_CurveType GA_U2 = gau2.GetType(); |
679 | GeomAbs_CurveType GA_V2 = gav2.GetType(); |
680 | Standard_Boolean TrmU1 = Standard_False; |
681 | Standard_Boolean TrmV1 = Standard_False; |
682 | Standard_Boolean TrmU2 = Standard_False; |
683 | Standard_Boolean TrmV2 = Standard_False; |
684 | Standard_Real V1S1,V2S1,U1S1,U2S1, V1S2,V2S2,U1S2,U2S2; |
685 | FUN_NewFirstLast(GA_U1,S1->FirstVParameter(),S1->LastVParameter(),TV,V1S1,V2S1,TrmV1); |
686 | FUN_NewFirstLast(GA_V1,S1->FirstUParameter(),S1->LastUParameter(),TV,U1S1,U2S1,TrmU1); |
687 | FUN_NewFirstLast(GA_U2,S2->FirstVParameter(),S2->LastVParameter(),TV,V1S2,V2S2,TrmV2); |
688 | FUN_NewFirstLast(GA_V2,S2->FirstUParameter(),S2->LastUParameter(),TV,U1S2,U2S2,TrmU2); |
689 | if(TrmV1) NS1 = S1->VTrim(V1S1, V2S1, 1.0e-7); |
690 | if(TrmV2) NS2 = S2->VTrim(V1S2, V2S2, 1.0e-7); |
691 | if(TrmU1) |
692 | { |
693 | if(TrmV1) |
1d18c75e |
694 | { |
695 | Handle(Adaptor3d_HSurface) TS = NS1; |
696 | NS1 = TS->UTrim(U1S1, U2S1, 1.0e-7); |
697 | } |
7fd59977 |
698 | else NS1 = S1->UTrim(U1S1, U2S1, 1.0e-7); |
699 | } |
700 | if(TrmU2) |
701 | { |
702 | if(TrmV2) |
1d18c75e |
703 | { |
704 | Handle(Adaptor3d_HSurface) TS = NS2; |
705 | NS2 = TS->UTrim(U1S2, U2S2, 1.0e-7); |
706 | } |
7fd59977 |
707 | else NS2 = S2->UTrim(U1S2, U2S2, 1.0e-7); |
708 | } |
709 | } |
710 | |
711 | //======================================================================= |
712 | //function : Perform |
713 | //purpose : |
714 | //======================================================================= |
788cbaf4 |
715 | void IntPatch_Intersection::Perform(const Handle(Adaptor3d_HSurface)& theS1, |
716 | const Handle(Adaptor3d_TopolTool)& theD1, |
717 | const Handle(Adaptor3d_HSurface)& theS2, |
718 | const Handle(Adaptor3d_TopolTool)& theD2, |
7fd59977 |
719 | const Standard_Real TolArc, |
788cbaf4 |
720 | const Standard_Real TolTang, |
d4b867e6 |
721 | const Standard_Boolean isGeomInt, |
4e14c88f |
722 | const Standard_Boolean theIsReqToKeepRLine, |
723 | const Standard_Boolean theIsReqToPostWLProc) |
788cbaf4 |
724 | { |
7fd59977 |
725 | myTolArc = TolArc; |
726 | myTolTang = TolTang; |
788cbaf4 |
727 | if(myFleche <= Precision::PConfusion()) |
728 | myFleche = 0.01; |
729 | if(myUVMaxStep <= Precision::PConfusion()) |
730 | myUVMaxStep = 0.01; |
731 | |
7fd59977 |
732 | done = Standard_False; |
733 | spnt.Clear(); |
734 | slin.Clear(); |
735 | empt = Standard_True; |
736 | tgte = Standard_False; |
737 | oppo = Standard_False; |
738 | |
788cbaf4 |
739 | GeomAbs_SurfaceType typs1 = theS1->GetType(); |
740 | GeomAbs_SurfaceType typs2 = theS2->GetType(); |
7fd59977 |
741 | |
18d25b93 |
742 | //treatment of the cases with cone or torus |
7fd59977 |
743 | Standard_Boolean TreatAsBiParametric = Standard_False; |
1d18c75e |
744 | Standard_Integer bGeomGeom = 0; |
18d25b93 |
745 | // |
746 | if (typs1 == GeomAbs_Cone || typs2 == GeomAbs_Cone || |
747 | typs1 == GeomAbs_Torus || typs2 == GeomAbs_Torus) { |
748 | gp_Ax1 aCTAx, aGeomAx; |
749 | GeomAbs_SurfaceType aCTType; |
750 | Standard_Boolean bToCheck; |
751 | // |
752 | const Handle(Adaptor3d_HSurface)& aCTSurf = |
753 | (typs1 == GeomAbs_Cone || typs1 == GeomAbs_Torus) ? theS1 : theS2; |
754 | const Handle(Adaptor3d_HSurface)& aGeomSurf = |
755 | (typs1 == GeomAbs_Cone || typs1 == GeomAbs_Torus) ? theS2 : theS1; |
756 | // |
757 | aCTType = aCTSurf->GetType(); |
758 | bToCheck = Standard_False; |
759 | // |
1d18c75e |
760 | if (typs1 == GeomAbs_Cone || typs2 == GeomAbs_Cone) { |
761 | const gp_Cone aCon1 = (aCTType == GeomAbs_Cone) ? |
762 | aCTSurf->Cone() : aGeomSurf->Cone(); |
763 | Standard_Real a1 = Abs(aCon1.SemiAngle()); |
18d25b93 |
764 | bToCheck = (a1 < 0.02) || (a1 > 1.55); |
1d18c75e |
765 | // |
18d25b93 |
766 | if (typs1 == typs2) { |
1d18c75e |
767 | const gp_Cone aCon2 = aGeomSurf->Cone(); |
768 | Standard_Real a2 = Abs(aCon2.SemiAngle()); |
18d25b93 |
769 | bToCheck = bToCheck || (a2 < 0.02) || (a2 > 1.55); |
770 | // |
771 | if (a1 > 1.55 && a2 > 1.55) {//quasi-planes: if same domain, treat as canonic |
18d25b93 |
772 | const gp_Ax1 A1 = aCon1.Axis(), A2 = aCon2.Axis(); |
773 | if (A1.IsParallel(A2,Precision::Angular())) { |
774 | const gp_Pnt Apex1 = aCon1.Apex(), Apex2 = aCon2.Apex(); |
775 | const gp_Pln Plan1( Apex1, A1.Direction() ); |
776 | if (Plan1.Distance( Apex2 ) <= Precision::Confusion()) { |
777 | bToCheck = Standard_False; |
18d25b93 |
778 | } |
788cbaf4 |
779 | } |
780 | } |
7fd59977 |
781 | } |
18d25b93 |
782 | // |
1d18c75e |
783 | TreatAsBiParametric = bToCheck; |
784 | if (aCTType == GeomAbs_Cone) { |
785 | aCTAx = aCon1.Axis(); |
786 | } |
7fd59977 |
787 | } |
1d18c75e |
788 | // |
789 | if (typs1 == GeomAbs_Torus || typs2 == GeomAbs_Torus) { |
790 | const gp_Torus aTor1 = (aCTType == GeomAbs_Torus) ? |
791 | aCTSurf->Torus() : aGeomSurf->Torus(); |
792 | bToCheck = aTor1.MajorRadius() > aTor1.MinorRadius(); |
793 | if (typs1 == typs2) { |
794 | const gp_Torus aTor2 = aGeomSurf->Torus(); |
795 | bToCheck = aTor2.MajorRadius() > aTor2.MinorRadius(); |
796 | } |
797 | // |
798 | if (aCTType == GeomAbs_Torus) { |
799 | aCTAx = aTor1.Axis(); |
18d25b93 |
800 | } |
18d25b93 |
801 | } |
802 | // |
803 | if (bToCheck) { |
804 | const gp_Lin aL1(aCTAx); |
805 | // |
806 | switch (aGeomSurf->GetType()) { |
807 | case GeomAbs_Plane: { |
808 | aGeomAx = aGeomSurf->Plane().Axis(); |
809 | if (aCTType == GeomAbs_Cone) { |
1d18c75e |
810 | bGeomGeom = 1; |
18d25b93 |
811 | if (Abs(aCTSurf->Cone().SemiAngle()) < 0.02) { |
812 | Standard_Real ps = Abs(aCTAx.Direction().Dot(aGeomAx.Direction())); |
813 | if(ps < 0.015) { |
1d18c75e |
814 | bGeomGeom = 0; |
18d25b93 |
815 | } |
788cbaf4 |
816 | } |
817 | } |
18d25b93 |
818 | else { |
819 | if (aCTAx.IsParallel(aGeomAx, Precision::Angular()) || |
820 | (aCTAx.IsNormal(aGeomAx, Precision::Angular()) && |
821 | (aGeomSurf->Plane().Distance(aCTAx.Location()) < Precision::Confusion()))) { |
1d18c75e |
822 | bGeomGeom = 1; |
18d25b93 |
823 | } |
824 | } |
825 | bToCheck = Standard_False; |
826 | break; |
7fd59977 |
827 | } |
18d25b93 |
828 | case GeomAbs_Sphere: { |
829 | if (aL1.Distance(aGeomSurf->Sphere().Location()) < Precision::Confusion()) { |
1d18c75e |
830 | bGeomGeom = 1; |
18d25b93 |
831 | } |
832 | bToCheck = Standard_False; |
833 | break; |
7fd59977 |
834 | } |
18d25b93 |
835 | case GeomAbs_Cylinder: |
836 | aGeomAx = aGeomSurf->Cylinder().Axis(); |
837 | break; |
838 | case GeomAbs_Cone: |
839 | aGeomAx = aGeomSurf->Cone().Axis(); |
840 | break; |
841 | case GeomAbs_Torus: |
842 | aGeomAx = aGeomSurf->Torus().Axis(); |
843 | break; |
844 | default: |
845 | bToCheck = Standard_False; |
846 | break; |
847 | } |
848 | // |
849 | if (bToCheck) { |
850 | if (aCTAx.IsParallel(aGeomAx, Precision::Angular()) && |
851 | (aL1.Distance(aGeomAx.Location()) <= Precision::Confusion())) { |
1d18c75e |
852 | bGeomGeom = 1; |
788cbaf4 |
853 | } |
7fd59977 |
854 | } |
18d25b93 |
855 | // |
1d18c75e |
856 | if (bGeomGeom == 1) { |
857 | TreatAsBiParametric = Standard_False; |
18d25b93 |
858 | } |
859 | } |
860 | } |
861 | // |
788cbaf4 |
862 | |
863 | if(theD1->DomainIsInfinite() || theD2->DomainIsInfinite()) { |
bf0ba813 |
864 | TreatAsBiParametric= Standard_False; |
865 | } |
7fd59977 |
866 | |
867 | // Modified by skv - Mon Sep 26 14:58:30 2005 Begin |
868 | // if(TreatAsBiParametric) { typs1 = typs2 = GeomAbs_BezierSurface; } |
788cbaf4 |
869 | if(TreatAsBiParametric) |
870 | { |
7fd59977 |
871 | if (typs1 == GeomAbs_Cone && typs2 == GeomAbs_Plane) |
872 | typs1 = GeomAbs_BezierSurface; // Using Imp-Prm Intersector |
873 | else if (typs1 == GeomAbs_Plane && typs2 == GeomAbs_Cone) |
874 | typs2 = GeomAbs_BezierSurface; // Using Imp-Prm Intersector |
875 | else { |
876 | // Using Prm-Prm Intersector |
877 | typs1 = GeomAbs_BezierSurface; |
878 | typs2 = GeomAbs_BezierSurface; |
879 | } |
880 | } |
881 | // Modified by skv - Mon Sep 26 14:58:30 2005 End |
882 | |
883 | // Surface type definition |
884 | Standard_Integer ts1 = 0; |
885 | switch (typs1) |
886 | { |
887 | case GeomAbs_Plane: |
888 | case GeomAbs_Cylinder: |
889 | case GeomAbs_Sphere: |
890 | case GeomAbs_Cone: ts1 = 1; break; |
1d18c75e |
891 | case GeomAbs_Torus: ts1 = bGeomGeom; break; |
7fd59977 |
892 | default: break; |
893 | } |
788cbaf4 |
894 | |
7fd59977 |
895 | Standard_Integer ts2 = 0; |
896 | switch (typs2) |
897 | { |
898 | case GeomAbs_Plane: |
899 | case GeomAbs_Cylinder: |
900 | case GeomAbs_Sphere: |
901 | case GeomAbs_Cone: ts2 = 1; break; |
1d18c75e |
902 | case GeomAbs_Torus: ts2 = bGeomGeom; break; |
7fd59977 |
903 | default: break; |
904 | } |
7eed5d29 |
905 | // |
906 | // treatment of the cases with torus and any other geom surface |
7eed5d29 |
907 | // |
7fd59977 |
908 | // Possible intersection types: 1. ts1 == ts2 == 1 <Geom-Geom> |
909 | // 2. ts1 != ts2 <Geom-Param> |
910 | // 3. ts1 == ts2 == 0 <Param-Param> |
911 | |
912 | // Geom - Geom |
5185b161 |
913 | const Standard_Boolean RestrictLine = Standard_True; |
7fd59977 |
914 | if(ts1 == ts2 && ts1 == 1) |
915 | { |
788cbaf4 |
916 | IntSurf_ListOfPntOn2S ListOfPnts; |
917 | ListOfPnts.Clear(); |
918 | if(isGeomInt) |
919 | { |
d30895f5 |
920 | GeomGeomPerfom( theS1, theD1, theS2, theD2, TolArc, |
921 | TolTang, ListOfPnts, RestrictLine, |
922 | typs1, typs2, theIsReqToKeepRLine); |
788cbaf4 |
923 | } |
924 | else |
925 | { |
02effd35 |
926 | ParamParamPerfom(theS1, theD1, theS2, theD2, |
927 | TolArc, TolTang, ListOfPnts, RestrictLine, typs1, typs2); |
788cbaf4 |
928 | } |
7fd59977 |
929 | } |
788cbaf4 |
930 | |
7fd59977 |
931 | // Geom - Param |
932 | if(ts1 != ts2) |
933 | { |
788cbaf4 |
934 | GeomParamPerfom(theS1, theD1, theS2, theD2, ts1 == 0, typs1, typs2); |
7fd59977 |
935 | } |
788cbaf4 |
936 | |
7fd59977 |
937 | // Param - Param |
938 | if(ts1 == ts2 && ts1 == 0) |
939 | { |
788cbaf4 |
940 | IntSurf_ListOfPntOn2S ListOfPnts; |
941 | ListOfPnts.Clear(); |
942 | |
02effd35 |
943 | ParamParamPerfom(theS1, theD1, theS2, theD2, TolArc, |
944 | TolTang, ListOfPnts, RestrictLine, typs1, typs2); |
7fd59977 |
945 | } |
4e14c88f |
946 | |
947 | if(!theIsReqToPostWLProc) |
948 | return; |
949 | |
950 | for(Standard_Integer i = slin.Lower(); i <= slin.Upper(); i++) |
951 | { |
952 | Handle(IntPatch_WLine) aWL = Handle(IntPatch_WLine)::DownCast(slin.Value(i)); |
953 | |
954 | if(aWL.IsNull()) |
955 | continue; |
956 | |
e146ef9a |
957 | if (!aWL->IsPurgingAllowed()) |
958 | continue; |
959 | |
5185b161 |
960 | Handle(IntPatch_WLine) aRW = |
961 | IntPatch_WLineTool::ComputePurgedWLine(aWL, theS1, theS2, theD1, theD2, RestrictLine); |
4e14c88f |
962 | |
963 | if(aRW.IsNull()) |
964 | continue; |
965 | |
966 | slin.InsertAfter(i, aRW); |
967 | slin.Remove(i); |
968 | } |
7fd59977 |
969 | } |
18d25b93 |
970 | |
7fd59977 |
971 | //======================================================================= |
972 | //function : Perform |
973 | //purpose : |
974 | //======================================================================= |
788cbaf4 |
975 | void IntPatch_Intersection::Perform(const Handle(Adaptor3d_HSurface)& theS1, |
976 | const Handle(Adaptor3d_TopolTool)& theD1, |
977 | const Handle(Adaptor3d_HSurface)& theS2, |
978 | const Handle(Adaptor3d_TopolTool)& theD2, |
7fd59977 |
979 | const Standard_Real TolArc, |
980 | const Standard_Real TolTang, |
981 | IntSurf_ListOfPntOn2S& ListOfPnts, |
788cbaf4 |
982 | const Standard_Boolean RestrictLine, |
4e14c88f |
983 | const Standard_Boolean isGeomInt, |
984 | const Standard_Boolean theIsReqToKeepRLine, |
985 | const Standard_Boolean theIsReqToPostWLProc) |
7fd59977 |
986 | { |
987 | myTolArc = TolArc; |
988 | myTolTang = TolTang; |
788cbaf4 |
989 | if(myFleche <= Precision::PConfusion()) |
990 | myFleche = 0.01; |
991 | if(myUVMaxStep <= Precision::PConfusion()) |
992 | myUVMaxStep = 0.01; |
7fd59977 |
993 | |
994 | done = Standard_False; |
995 | spnt.Clear(); |
996 | slin.Clear(); |
997 | empt = Standard_True; |
998 | tgte = Standard_False; |
999 | oppo = Standard_False; |
1000 | |
788cbaf4 |
1001 | GeomAbs_SurfaceType typs1 = theS1->GetType(); |
1002 | GeomAbs_SurfaceType typs2 = theS2->GetType(); |
18d25b93 |
1003 | // |
1004 | //treatment of the cases with cone or torus |
7fd59977 |
1005 | Standard_Boolean TreatAsBiParametric = Standard_False; |
1d18c75e |
1006 | Standard_Integer bGeomGeom = 0; |
18d25b93 |
1007 | // |
1008 | if (typs1 == GeomAbs_Cone || typs2 == GeomAbs_Cone || |
1009 | typs1 == GeomAbs_Torus || typs2 == GeomAbs_Torus) { |
1010 | gp_Ax1 aCTAx, aGeomAx; |
1011 | GeomAbs_SurfaceType aCTType; |
1012 | Standard_Boolean bToCheck; |
1013 | // |
1014 | const Handle(Adaptor3d_HSurface)& aCTSurf = |
1015 | (typs1 == GeomAbs_Cone || typs1 == GeomAbs_Torus) ? theS1 : theS2; |
1016 | const Handle(Adaptor3d_HSurface)& aGeomSurf = |
1017 | (typs1 == GeomAbs_Cone || typs1 == GeomAbs_Torus) ? theS2 : theS1; |
1018 | // |
1019 | aCTType = aCTSurf->GetType(); |
1020 | bToCheck = Standard_False; |
1021 | // |
1d18c75e |
1022 | if (typs1 == GeomAbs_Cone || typs2 == GeomAbs_Cone) { |
1023 | const gp_Cone aCon1 = (aCTType == GeomAbs_Cone) ? |
1024 | aCTSurf->Cone() : aGeomSurf->Cone(); |
1025 | Standard_Real a1 = Abs(aCon1.SemiAngle()); |
18d25b93 |
1026 | bToCheck = (a1 < 0.02) || (a1 > 1.55); |
1d18c75e |
1027 | // |
18d25b93 |
1028 | if (typs1 == typs2) { |
1d18c75e |
1029 | const gp_Cone aCon2 = aGeomSurf->Cone(); |
1030 | Standard_Real a2 = Abs(aCon2.SemiAngle()); |
18d25b93 |
1031 | bToCheck = bToCheck || (a2 < 0.02) || (a2 > 1.55); |
1032 | // |
1033 | if (a1 > 1.55 && a2 > 1.55) {//quasi-planes: if same domain, treat as canonic |
18d25b93 |
1034 | const gp_Ax1 A1 = aCon1.Axis(), A2 = aCon2.Axis(); |
1035 | if (A1.IsParallel(A2,Precision::Angular())) { |
1036 | const gp_Pnt Apex1 = aCon1.Apex(), Apex2 = aCon2.Apex(); |
1037 | const gp_Pln Plan1( Apex1, A1.Direction() ); |
1038 | if (Plan1.Distance( Apex2 ) <= Precision::Confusion()) { |
1039 | bToCheck = Standard_False; |
18d25b93 |
1040 | } |
788cbaf4 |
1041 | } |
1042 | } |
7fd59977 |
1043 | } |
18d25b93 |
1044 | // |
1d18c75e |
1045 | TreatAsBiParametric = bToCheck; |
1046 | if (aCTType == GeomAbs_Cone) { |
1047 | aCTAx = aCon1.Axis(); |
1048 | } |
788cbaf4 |
1049 | } |
1d18c75e |
1050 | // |
1051 | if (typs1 == GeomAbs_Torus || typs2 == GeomAbs_Torus) { |
1052 | const gp_Torus aTor1 = (aCTType == GeomAbs_Torus) ? |
1053 | aCTSurf->Torus() : aGeomSurf->Torus(); |
1054 | bToCheck = aTor1.MajorRadius() > aTor1.MinorRadius(); |
1055 | if (typs1 == typs2) { |
1056 | const gp_Torus aTor2 = aGeomSurf->Torus(); |
1057 | bToCheck = aTor2.MajorRadius() > aTor2.MinorRadius(); |
1058 | } |
1059 | // |
1060 | if (aCTType == GeomAbs_Torus) { |
1061 | aCTAx = aTor1.Axis(); |
18d25b93 |
1062 | } |
18d25b93 |
1063 | } |
1064 | // |
1065 | if (bToCheck) { |
1066 | const gp_Lin aL1(aCTAx); |
1067 | // |
1068 | switch (aGeomSurf->GetType()) { |
1069 | case GeomAbs_Plane: { |
1070 | aGeomAx = aGeomSurf->Plane().Axis(); |
1071 | if (aCTType == GeomAbs_Cone) { |
1d18c75e |
1072 | bGeomGeom = 1; |
18d25b93 |
1073 | if (Abs(aCTSurf->Cone().SemiAngle()) < 0.02) { |
1074 | Standard_Real ps = Abs(aCTAx.Direction().Dot(aGeomAx.Direction())); |
1075 | if(ps < 0.015) { |
1d18c75e |
1076 | bGeomGeom = 0; |
18d25b93 |
1077 | } |
788cbaf4 |
1078 | } |
1079 | } |
18d25b93 |
1080 | else { |
1081 | if (aCTAx.IsParallel(aGeomAx, Precision::Angular()) || |
1082 | (aCTAx.IsNormal(aGeomAx, Precision::Angular()) && |
1083 | (aGeomSurf->Plane().Distance(aCTAx.Location()) < Precision::Confusion()))) { |
1d18c75e |
1084 | bGeomGeom = 1; |
18d25b93 |
1085 | } |
1086 | } |
1087 | bToCheck = Standard_False; |
1088 | break; |
7fd59977 |
1089 | } |
18d25b93 |
1090 | case GeomAbs_Sphere: { |
1091 | if (aL1.Distance(aGeomSurf->Sphere().Location()) < Precision::Confusion()) { |
1d18c75e |
1092 | bGeomGeom = 1; |
18d25b93 |
1093 | } |
1094 | bToCheck = Standard_False; |
1095 | break; |
7fd59977 |
1096 | } |
18d25b93 |
1097 | case GeomAbs_Cylinder: |
1098 | aGeomAx = aGeomSurf->Cylinder().Axis(); |
1099 | break; |
1100 | case GeomAbs_Cone: |
1101 | aGeomAx = aGeomSurf->Cone().Axis(); |
1102 | break; |
1103 | case GeomAbs_Torus: |
1104 | aGeomAx = aGeomSurf->Torus().Axis(); |
1105 | break; |
1106 | default: |
1107 | bToCheck = Standard_False; |
1108 | break; |
1109 | } |
1110 | // |
1111 | if (bToCheck) { |
1112 | if (aCTAx.IsParallel(aGeomAx, Precision::Angular()) && |
1113 | (aL1.Distance(aGeomAx.Location()) <= Precision::Confusion())) { |
1d18c75e |
1114 | bGeomGeom = 1; |
788cbaf4 |
1115 | } |
7fd59977 |
1116 | } |
18d25b93 |
1117 | // |
1d18c75e |
1118 | if (bGeomGeom == 1) { |
1119 | TreatAsBiParametric = Standard_False; |
18d25b93 |
1120 | } |
1121 | } |
1122 | } |
1123 | // |
7fd59977 |
1124 | |
788cbaf4 |
1125 | if(theD1->DomainIsInfinite() || theD2->DomainIsInfinite()) { |
bf0ba813 |
1126 | TreatAsBiParametric= Standard_False; |
1127 | } |
788cbaf4 |
1128 | |
1129 | if(TreatAsBiParametric) |
1130 | { |
1131 | // Using Prm-Prm Intersector |
1132 | typs1 = GeomAbs_BezierSurface; |
1133 | typs2 = GeomAbs_BezierSurface; |
bf0ba813 |
1134 | } |
7fd59977 |
1135 | |
1136 | // Surface type definition |
1137 | Standard_Integer ts1 = 0; |
1138 | switch (typs1) |
1139 | { |
1140 | case GeomAbs_Plane: |
1141 | case GeomAbs_Cylinder: |
1142 | case GeomAbs_Sphere: |
1143 | case GeomAbs_Cone: ts1 = 1; break; |
1d18c75e |
1144 | case GeomAbs_Torus: ts1 = bGeomGeom; break; |
7fd59977 |
1145 | default: break; |
1146 | } |
788cbaf4 |
1147 | |
7fd59977 |
1148 | Standard_Integer ts2 = 0; |
1149 | switch (typs2) |
1150 | { |
1151 | case GeomAbs_Plane: |
1152 | case GeomAbs_Cylinder: |
1153 | case GeomAbs_Sphere: |
1154 | case GeomAbs_Cone: ts2 = 1; break; |
1d18c75e |
1155 | case GeomAbs_Torus: ts2 = bGeomGeom; break; |
7fd59977 |
1156 | default: break; |
1157 | } |
7eed5d29 |
1158 | // |
7fd59977 |
1159 | // Possible intersection types: 1. ts1 == ts2 == 1 <Geom-Geom> |
1160 | // 2. ts1 != ts2 <Geom-Param> |
1161 | // 3. ts1 == ts2 == 0 <Param-Param> |
1162 | |
788cbaf4 |
1163 | if(!isGeomInt) |
7fd59977 |
1164 | { |
02effd35 |
1165 | ParamParamPerfom(theS1, theD1, theS2, theD2, |
1166 | TolArc, TolTang, ListOfPnts, RestrictLine, typs1, typs2); |
7fd59977 |
1167 | } |
788cbaf4 |
1168 | else if(ts1 != ts2) |
1169 | { |
1170 | GeomParamPerfom(theS1, theD1, theS2, theD2, ts1 == 0, typs1, typs2); |
1171 | } |
1172 | else if (ts1 == 0) |
1173 | { |
02effd35 |
1174 | ParamParamPerfom(theS1, theD1, theS2, theD2, |
1175 | TolArc, TolTang, ListOfPnts, RestrictLine, typs1, typs2); |
788cbaf4 |
1176 | } |
1177 | else if(ts1 == 1) |
1178 | { |
d30895f5 |
1179 | GeomGeomPerfom(theS1, theD1, theS2, theD2, TolArc, |
1180 | TolTang, ListOfPnts, RestrictLine, typs1, typs2, theIsReqToKeepRLine); |
788cbaf4 |
1181 | } |
4e14c88f |
1182 | |
1183 | if(!theIsReqToPostWLProc) |
1184 | return; |
1185 | |
1186 | for(Standard_Integer i = slin.Lower(); i <= slin.Upper(); i++) |
1187 | { |
1188 | Handle(IntPatch_WLine) aWL = Handle(IntPatch_WLine)::DownCast(slin.Value(i)); |
1189 | |
1190 | if(aWL.IsNull()) |
1191 | continue; |
1192 | |
716037dd |
1193 | if(!aWL->IsPurgingAllowed()) |
1194 | continue; |
1195 | |
5185b161 |
1196 | Handle(IntPatch_WLine) aRW = |
1197 | IntPatch_WLineTool::ComputePurgedWLine(aWL, theS1, theS2, theD1, theD2, RestrictLine); |
4e14c88f |
1198 | |
1199 | if(aRW.IsNull()) |
1200 | continue; |
1201 | |
1202 | slin.InsertAfter(i, aRW); |
1203 | slin.Remove(i); |
1204 | } |
788cbaf4 |
1205 | } |
1206 | |
1207 | //======================================================================= |
1208 | //function : ParamParamPerfom |
1209 | //purpose : |
1210 | //======================================================================= |
1211 | void IntPatch_Intersection::ParamParamPerfom(const Handle(Adaptor3d_HSurface)& theS1, |
1212 | const Handle(Adaptor3d_TopolTool)& theD1, |
1213 | const Handle(Adaptor3d_HSurface)& theS2, |
1214 | const Handle(Adaptor3d_TopolTool)& theD2, |
1215 | const Standard_Real TolArc, |
1216 | const Standard_Real TolTang, |
1217 | IntSurf_ListOfPntOn2S& ListOfPnts, |
1218 | const Standard_Boolean RestrictLine, |
1219 | const GeomAbs_SurfaceType typs1, |
1220 | const GeomAbs_SurfaceType typs2) |
1221 | { |
1222 | IntPatch_PrmPrmIntersection interpp; |
1223 | if(!theD1->DomainIsInfinite() && !theD2->DomainIsInfinite()) |
7fd59977 |
1224 | { |
788cbaf4 |
1225 | Standard_Boolean ClearFlag = Standard_True; |
1226 | if(!ListOfPnts.IsEmpty()) |
1227 | { |
714c3bfc |
1228 | interpp.Perform(theS1,theD1,theS2,theD2,TolTang,TolArc,myFleche,myUVMaxStep, ListOfPnts, RestrictLine); |
788cbaf4 |
1229 | ClearFlag = Standard_False; |
7fd59977 |
1230 | } |
714c3bfc |
1231 | interpp.Perform(theS1,theD1,theS2,theD2,TolTang,TolArc,myFleche,myUVMaxStep,ClearFlag); //double call!!!!!!! |
7fd59977 |
1232 | } |
788cbaf4 |
1233 | else if((theD1->DomainIsInfinite()) ^ (theD2->DomainIsInfinite())) |
7fd59977 |
1234 | { |
788cbaf4 |
1235 | gp_Pnt pMaxXYZ, pMinXYZ; |
1236 | if(theD1->DomainIsInfinite()) |
1237 | { |
1238 | FUN_GetMinMaxXYZPnt( theS2, pMinXYZ, pMaxXYZ ); |
1239 | const Standard_Real MU = Max(Abs(theS2->FirstUParameter()),Abs(theS2->LastUParameter())); |
1240 | const Standard_Real MV = Max(Abs(theS2->FirstVParameter()),Abs(theS2->LastVParameter())); |
1241 | const Standard_Real AP = Max(MU, MV); |
1242 | Handle(Adaptor3d_HSurface) SS; |
1243 | FUN_TrimInfSurf(pMinXYZ, pMaxXYZ, theS1, AP, SS); |
714c3bfc |
1244 | interpp.Perform(SS,theD1,theS2,theD2,TolTang,TolArc,myFleche,myUVMaxStep); |
788cbaf4 |
1245 | } |
1246 | else |
1247 | { |
1248 | FUN_GetMinMaxXYZPnt( theS1, pMinXYZ, pMaxXYZ ); |
1249 | const Standard_Real MU = Max(Abs(theS1->FirstUParameter()),Abs(theS1->LastUParameter())); |
1250 | const Standard_Real MV = Max(Abs(theS1->FirstVParameter()),Abs(theS1->LastVParameter())); |
1251 | const Standard_Real AP = Max(MU, MV); |
1252 | Handle(Adaptor3d_HSurface) SS; |
1253 | FUN_TrimInfSurf(pMinXYZ, pMaxXYZ, theS2, AP, SS); |
714c3bfc |
1254 | interpp.Perform(theS1, theD1, SS, theD2,TolTang, TolArc,myFleche,myUVMaxStep); |
788cbaf4 |
1255 | } |
1256 | }//(theD1->DomainIsInfinite()) ^ (theD2->DomainIsInfinite()) |
1257 | else |
1258 | { |
1259 | if(typs1 == GeomAbs_OtherSurface || typs2 == GeomAbs_OtherSurface) |
1260 | { |
1261 | done = Standard_False; |
1262 | return; |
1263 | } |
1264 | |
1265 | Standard_Boolean IsPLInt = Standard_False; |
1266 | TColgp_SequenceOfPnt sop; |
1267 | gp_Vec v; |
1268 | FUN_PL_Intersection(theS1,typs1,theS2,typs2,IsPLInt,sop,v); |
1269 | |
1270 | if(IsPLInt) |
1271 | { |
1272 | if(sop.Length() > 0) |
1273 | { |
1274 | for(Standard_Integer ip = 1; ip <= sop.Length(); ip++) |
1275 | { |
1276 | gp_Lin lin(sop.Value(ip),gp_Dir(v)); |
a9dde4a3 |
1277 | Handle(IntPatch_Line) gl = new IntPatch_GLine(lin,Standard_False); |
1278 | slin.Append(gl); |
788cbaf4 |
1279 | } |
1280 | |
1281 | done = Standard_True; |
7fd59977 |
1282 | } |
788cbaf4 |
1283 | else |
1284 | done = Standard_False; |
1285 | |
1286 | return; |
1287 | }// 'COLLINEAR LINES' |
1288 | else |
1289 | { |
1290 | Handle(Adaptor3d_HSurface) nS1 = theS1; |
1291 | Handle(Adaptor3d_HSurface) nS2 = theS2; |
1292 | FUN_TrimBothSurf(theS1,typs1,theS2,typs2,1.e+8,nS1,nS2); |
714c3bfc |
1293 | interpp.Perform(nS1,theD1,nS2,theD2,TolTang,TolArc,myFleche,myUVMaxStep); |
788cbaf4 |
1294 | }// 'NON - COLLINEAR LINES' |
1295 | }// both domains are infinite |
1296 | |
1297 | if (interpp.IsDone()) |
1298 | { |
1299 | done = Standard_True; |
1300 | tgte = Standard_False; |
1301 | empt = interpp.IsEmpty(); |
1302 | |
1303 | for(Standard_Integer i = 1; i <= interpp.NbLines(); i++) |
1304 | { |
1305 | if(interpp.Line(i)->ArcType() != IntPatch_Walking) |
1306 | slin.Append(interpp.Line(i)); |
1307 | } |
1308 | |
1309 | for (Standard_Integer i = 1; i <= interpp.NbLines(); i++) |
1310 | { |
1311 | if(interpp.Line(i)->ArcType() == IntPatch_Walking) |
1312 | slin.Append(interpp.Line(i)); |
1313 | } |
1314 | } |
1315 | } |
1316 | |
1317 | //======================================================================= |
1318 | ////function : GeomGeomPerfom |
1319 | //purpose : |
1320 | //======================================================================= |
1321 | void IntPatch_Intersection::GeomGeomPerfom(const Handle(Adaptor3d_HSurface)& theS1, |
1322 | const Handle(Adaptor3d_TopolTool)& theD1, |
1323 | const Handle(Adaptor3d_HSurface)& theS2, |
1324 | const Handle(Adaptor3d_TopolTool)& theD2, |
1325 | const Standard_Real TolArc, |
1326 | const Standard_Real TolTang, |
1327 | IntSurf_ListOfPntOn2S& ListOfPnts, |
1328 | const Standard_Boolean RestrictLine, |
464cd2fb |
1329 | const GeomAbs_SurfaceType theTyps1, |
1330 | const GeomAbs_SurfaceType theTyps2, |
d4b867e6 |
1331 | const Standard_Boolean theIsReqToKeepRLine) |
788cbaf4 |
1332 | { |
d4b867e6 |
1333 | IntPatch_ImpImpIntersection interii(theS1,theD1,theS2,theD2, |
1334 | myTolArc,myTolTang, theIsReqToKeepRLine); |
e146ef9a |
1335 | if (interii.IsDone()) |
788cbaf4 |
1336 | { |
e146ef9a |
1337 | done = (interii.GetStatus() == IntPatch_ImpImpIntersection::IntStatus_OK); |
788cbaf4 |
1338 | empt = interii.IsEmpty(); |
1339 | if (!empt) |
1340 | { |
1341 | tgte = interii.TangentFaces(); |
1342 | if (tgte) |
1343 | oppo = interii.OppositeFaces(); |
1344 | |
eee615ad |
1345 | Standard_Boolean isQuadSet = Standard_False; |
1346 | IntSurf_Quadric Quad1,Quad2; |
1347 | |
788cbaf4 |
1348 | for (Standard_Integer i = 1; i <= interii.NbLines(); i++) |
1349 | { |
857ffd5e |
1350 | const Handle(IntPatch_Line)& line = interii.Line(i); |
788cbaf4 |
1351 | if (line->ArcType() == IntPatch_Analytic) |
1352 | { |
eee615ad |
1353 | if(!isQuadSet) |
788cbaf4 |
1354 | { |
eee615ad |
1355 | isQuadSet = Standard_True; |
1356 | |
1357 | const GeomAbs_SurfaceType aTyps1 = theS1->GetType(); |
1358 | const GeomAbs_SurfaceType aTyps2 = theS2->GetType(); |
1359 | |
1360 | switch(aTyps1) |
1361 | { |
1362 | case GeomAbs_Plane: |
1363 | Quad1.SetValue(theS1->Plane()); |
1364 | break; |
1365 | |
1366 | case GeomAbs_Cylinder: |
1367 | Quad1.SetValue(theS1->Cylinder()); |
1368 | break; |
1369 | |
1370 | case GeomAbs_Sphere: |
1371 | Quad1.SetValue(theS1->Sphere()); |
1372 | break; |
1373 | |
1374 | case GeomAbs_Cone: |
1375 | Quad1.SetValue(theS1->Cone()); |
1376 | break; |
1377 | |
1378 | case GeomAbs_Torus: |
1379 | Quad1.SetValue(theS1->Torus()); |
1380 | break; |
1381 | |
1382 | default: |
1383 | isQuadSet = Standard_False; |
1384 | break; |
1385 | } |
7eed5d29 |
1386 | |
eee615ad |
1387 | switch(aTyps2) |
1388 | { |
1389 | case GeomAbs_Plane: |
1390 | Quad2.SetValue(theS2->Plane()); |
1391 | break; |
1392 | case GeomAbs_Cylinder: |
1393 | Quad2.SetValue(theS2->Cylinder()); |
1394 | break; |
1395 | |
1396 | case GeomAbs_Sphere: |
1397 | Quad2.SetValue(theS2->Sphere()); |
1398 | break; |
1399 | |
1400 | case GeomAbs_Cone: |
1401 | Quad2.SetValue(theS2->Cone()); |
1402 | break; |
1403 | |
1404 | case GeomAbs_Torus: |
1405 | Quad2.SetValue(theS2->Torus()); |
1406 | break; |
1407 | |
1408 | default: |
1409 | isQuadSet = Standard_False; |
1410 | break; |
1411 | } |
788cbaf4 |
1412 | |
eee615ad |
1413 | if(!isQuadSet) |
1414 | { |
1415 | break; |
1416 | } |
788cbaf4 |
1417 | } |
1418 | |
1419 | IntPatch_ALineToWLine AToW(Quad1,Quad2,0.01,0.05,aNbPointsInALine); |
eee615ad |
1420 | Handle(IntPatch_WLine) wlin = |
1421 | AToW.MakeWLine(Handle(IntPatch_ALine)::DownCast(line)); |
716037dd |
1422 | wlin->EnablePurging(Standard_False); |
788cbaf4 |
1423 | slin.Append(wlin); |
1424 | } |
1425 | else |
d30895f5 |
1426 | { |
1427 | if(line->ArcType() == IntPatch_Walking) |
1428 | { |
1429 | Handle(IntPatch_WLine)::DownCast(line)->EnablePurging(Standard_False); |
1430 | } |
1431 | |
eee615ad |
1432 | slin.Append(line); |
d30895f5 |
1433 | } |
1434 | } |
1435 | |
1436 | for (Standard_Integer i = 1; i <= interii.NbPnts(); i++) |
1437 | { |
1438 | spnt.Append(interii.Point(i)); |
1439 | } |
1440 | |
1441 | if((theTyps1 == GeomAbs_Cylinder) && (theTyps2 == GeomAbs_Cylinder)) |
1442 | { |
1443 | IntPatch_WLineTool::JoinWLines( slin, spnt, TolTang, |
1444 | theS1->IsUPeriodic()? theS1->UPeriod() : 0.0, |
1445 | theS2->IsUPeriodic()? theS2->UPeriod() : 0.0, |
1446 | theS1->IsVPeriodic()? theS1->VPeriod() : 0.0, |
1447 | theS2->IsVPeriodic()? theS2->VPeriod() : 0.0, |
1448 | theS1->FirstUParameter(), |
1449 | theS1->LastUParameter(), |
1450 | theS1->FirstVParameter(), |
1451 | theS1->LastVParameter(), |
1452 | theS2->FirstUParameter(), |
1453 | theS2->LastUParameter(), |
1454 | theS2->FirstVParameter(), |
1455 | theS2->LastVParameter()); |
eee615ad |
1456 | } |
1457 | |
1458 | if(isQuadSet) |
1459 | { |
b8f67cc2 |
1460 | Bnd_Box2d aBx1, aBx2; |
1461 | const Standard_Real aU1F = theS1->FirstUParameter(), |
1462 | aU1L = theS1->LastUParameter(), |
1463 | aV1F = theS1->FirstVParameter(), |
1464 | aV1L = theS1->LastVParameter(), |
1465 | aU2F = theS2->FirstUParameter(), |
1466 | aU2L = theS2->LastUParameter(), |
1467 | aV2F = theS2->FirstVParameter(), |
1468 | aV2L = theS2->LastVParameter(); |
1469 | aBx1.Add(gp_Pnt2d(aU1F, aV1F)); |
1470 | aBx1.Add(gp_Pnt2d(aU1L, aV1F)); |
1471 | aBx1.Add(gp_Pnt2d(aU1L, aV1L)); |
1472 | aBx1.Add(gp_Pnt2d(aU1F, aV1L)); |
1473 | aBx2.Add(gp_Pnt2d(aU2F, aV2F)); |
1474 | aBx2.Add(gp_Pnt2d(aU2L, aV2F)); |
1475 | aBx2.Add(gp_Pnt2d(aU2L, aV2L)); |
1476 | aBx2.Add(gp_Pnt2d(aU2F, aV2L)); |
1477 | |
1478 | aBx1.Enlarge(Precision::PConfusion()); |
1479 | aBx2.Enlarge(Precision::PConfusion()); |
1480 | |
eee615ad |
1481 | IntPatch_WLineTool:: |
1482 | ExtendTwoWlinesToEachOther(slin, Quad1, Quad2, TolTang, |
1483 | theS1->IsUPeriodic()? theS1->UPeriod() : 0.0, |
1484 | theS2->IsUPeriodic()? theS2->UPeriod() : 0.0, |
1485 | theS1->IsVPeriodic()? theS1->VPeriod() : 0.0, |
b8f67cc2 |
1486 | theS2->IsVPeriodic()? theS2->VPeriod() : 0.0, |
1487 | aBx1, aBx2); |
788cbaf4 |
1488 | } |
788cbaf4 |
1489 | } |
1490 | } |
1491 | else |
02effd35 |
1492 | ParamParamPerfom(theS1, theD1, theS2, theD2, |
464cd2fb |
1493 | TolArc, TolTang, ListOfPnts, RestrictLine, theTyps1, theTyps2); |
788cbaf4 |
1494 | } |
1495 | |
1496 | //======================================================================= |
ecc4f148 |
1497 | //function : GeomParamPerfom |
788cbaf4 |
1498 | //purpose : |
1499 | //======================================================================= |
ecc4f148 |
1500 | void IntPatch_Intersection:: |
1501 | GeomParamPerfom(const Handle(Adaptor3d_HSurface)& theS1, |
1502 | const Handle(Adaptor3d_TopolTool)& theD1, |
1503 | const Handle(Adaptor3d_HSurface)& theS2, |
1504 | const Handle(Adaptor3d_TopolTool)& theD2, |
1505 | const Standard_Boolean isNotAnalitical, |
1506 | const GeomAbs_SurfaceType typs1, |
1507 | const GeomAbs_SurfaceType typs2) |
788cbaf4 |
1508 | { |
1509 | IntPatch_ImpPrmIntersection interip; |
1510 | if (myIsStartPnt) |
1511 | { |
1512 | if (isNotAnalitical/*ts1 == 0*/) |
1513 | interip.SetStartPoint(myU1Start,myV1Start); |
1514 | else |
1515 | interip.SetStartPoint(myU2Start,myV2Start); |
1516 | } |
1517 | |
1518 | if(theD1->DomainIsInfinite() && theD2->DomainIsInfinite()) |
1519 | { |
1520 | Standard_Boolean IsPLInt = Standard_False; |
1521 | TColgp_SequenceOfPnt sop; |
1522 | gp_Vec v; |
1523 | FUN_PL_Intersection(theS1,typs1,theS2,typs2,IsPLInt,sop,v); |
1524 | |
1525 | if(IsPLInt) |
1526 | { |
1527 | if(sop.Length() > 0) |
1528 | { |
1529 | for(Standard_Integer ip = 1; ip <= sop.Length(); ip++) |
1530 | { |
1531 | gp_Lin lin(sop.Value(ip),gp_Dir(v)); |
a9dde4a3 |
1532 | Handle(IntPatch_Line) gl = new IntPatch_GLine(lin,Standard_False); |
1533 | slin.Append(gl); |
788cbaf4 |
1534 | } |
1535 | |
1536 | done = Standard_True; |
1537 | } |
1538 | else |
1539 | done = Standard_False; |
1540 | |
1541 | return; |
1542 | } |
1543 | else |
1544 | { |
1545 | Handle(Adaptor3d_HSurface) nS1 = theS1; |
1546 | Handle(Adaptor3d_HSurface) nS2 = theS2; |
1547 | FUN_TrimBothSurf(theS1,typs1,theS2,typs2,1.e+5,nS1,nS2); |
1548 | interip.Perform(nS1,theD1,nS2,theD2,myTolArc,myTolTang,myFleche,myUVMaxStep); |
1549 | } |
1550 | } |
1551 | else |
1552 | interip.Perform(theS1,theD1,theS2,theD2,myTolArc,myTolTang,myFleche,myUVMaxStep); |
1553 | |
1554 | if (interip.IsDone()) |
1555 | { |
1556 | done = Standard_True; |
1557 | empt = interip.IsEmpty(); |
1558 | |
1559 | if (!empt) |
1560 | { |
b92f3572 |
1561 | const Standard_Integer aNbLines = interip.NbLines(); |
1562 | for(Standard_Integer i = 1; i <= aNbLines; i++) |
788cbaf4 |
1563 | { |
1564 | if(interip.Line(i)->ArcType() != IntPatch_Walking) |
1565 | slin.Append(interip.Line(i)); |
1566 | } |
1567 | |
b92f3572 |
1568 | for(Standard_Integer i = 1; i <= aNbLines; i++) |
788cbaf4 |
1569 | { |
1570 | if(interip.Line(i)->ArcType() == IntPatch_Walking) |
1571 | slin.Append(interip.Line(i)); |
1572 | } |
1573 | |
1574 | for (Standard_Integer i = 1; i <= interip.NbPnts(); i++) |
1575 | spnt.Append(interip.Point(i)); |
1576 | } |
7fd59977 |
1577 | } |
1578 | } |
1579 | |
1580 | void IntPatch_Intersection::Perform(const Handle(Adaptor3d_HSurface)& S1, |
1581 | const Handle(Adaptor3d_TopolTool)& D1, |
1582 | const Handle(Adaptor3d_HSurface)& S2, |
1583 | const Handle(Adaptor3d_TopolTool)& D2, |
1584 | const Standard_Real U1, |
1585 | const Standard_Real V1, |
1586 | const Standard_Real U2, |
1587 | const Standard_Real V2, |
1588 | const Standard_Real TolArc, |
1589 | const Standard_Real TolTang) |
1590 | { |
1591 | myTolArc = TolArc; |
1592 | myTolTang = TolTang; |
1593 | if(myFleche == 0.0) { |
1594 | #if DEBUG |
1595 | //cout<<" -- IntPatch_Intersection::myFleche fixe par defaut a 0.01 --"<<endl; |
1596 | //cout<<" -- Utiliser la Methode SetTolerances( ... ) "<<endl; |
1597 | #endif |
1598 | myFleche = 0.01; |
1599 | } |
1600 | if(myUVMaxStep==0.0) { |
1601 | #if DEBUG |
1602 | //cout<<" -- IntPatch_Intersection::myUVMaxStep fixe par defaut a 0.01 --"<<endl; |
1603 | //cout<<" -- Utiliser la Methode SetTolerances( ... ) "<<endl; |
1604 | #endif |
1605 | myUVMaxStep = 0.01; |
1606 | } |
1607 | |
1608 | done = Standard_False; |
1609 | spnt.Clear(); |
1610 | slin.Clear(); |
1611 | |
1612 | empt = Standard_True; |
1613 | tgte = Standard_False; |
1614 | oppo = Standard_False; |
1615 | |
1616 | const GeomAbs_SurfaceType typs1 = S1->GetType(); |
1617 | const GeomAbs_SurfaceType typs2 = S2->GetType(); |
1618 | |
1619 | if( typs1==GeomAbs_Plane |
1620 | || typs1==GeomAbs_Cylinder |
1621 | || typs1==GeomAbs_Sphere |
1622 | || typs1==GeomAbs_Cone |
1623 | || typs2==GeomAbs_Plane |
1624 | || typs2==GeomAbs_Cylinder |
1625 | || typs2==GeomAbs_Sphere |
1626 | || typs2==GeomAbs_Cone) |
1627 | { |
1628 | myIsStartPnt = Standard_True; |
1629 | myU1Start = U1; myV1Start = V1; myU2Start = U2; myV2Start = V2; |
1630 | Perform(S1,D1,S2,D2,TolArc,TolTang); |
1631 | myIsStartPnt = Standard_False; |
1632 | } |
1633 | else |
1634 | { |
1635 | IntPatch_PrmPrmIntersection interpp; |
714c3bfc |
1636 | interpp.Perform(S1,D1,S2,D2,U1,V1,U2,V2,TolTang,TolArc,myFleche,myUVMaxStep); |
7fd59977 |
1637 | if (interpp.IsDone()) |
1d18c75e |
1638 | { |
7fd59977 |
1639 | done = Standard_True; |
1640 | tgte = Standard_False; |
1641 | empt = interpp.IsEmpty(); |
1642 | const Standard_Integer nblm = interpp.NbLines(); |
1643 | Standard_Integer i = 1; |
1644 | for (; i<=nblm; i++) slin.Append(interpp.Line(i)); |
1645 | } |
1646 | } |
4e14c88f |
1647 | |
1648 | for(Standard_Integer i = slin.Lower(); i <= slin.Upper(); i++) |
1649 | { |
1650 | Handle(IntPatch_WLine) aWL = Handle(IntPatch_WLine)::DownCast(slin.Value(i)); |
1651 | |
1652 | if(aWL.IsNull()) |
1653 | continue; |
1654 | |
e146ef9a |
1655 | if (!aWL->IsPurgingAllowed()) |
1656 | continue; |
1657 | |
5185b161 |
1658 | Handle(IntPatch_WLine) aRW = |
1659 | IntPatch_WLineTool::ComputePurgedWLine(aWL, S1, S2, D1, D2, Standard_True); |
4e14c88f |
1660 | |
1661 | if(aRW.IsNull()) |
1662 | continue; |
1663 | |
1664 | slin.InsertAfter(i, aRW); |
1665 | slin.Remove(i); |
1666 | } |
7fd59977 |
1667 | } |
4e14c88f |
1668 | |
1669 | #ifdef DUMPOFIntPatch_Intersection |
1670 | |
1671 | void IntPatch_Intersection__MAJ_R(Handle(Adaptor2d_HCurve2d) *R1, |
857ffd5e |
1672 | Handle(Adaptor2d_HCurve2d) *, |
4e14c88f |
1673 | int *NR1, |
1d18c75e |
1674 | int *, |
4e14c88f |
1675 | Standard_Integer nbR1, |
1d18c75e |
1676 | Standard_Integer , |
4e14c88f |
1677 | const IntPatch_Point& VTX) |
7fd59977 |
1678 | { |
4e14c88f |
1679 | |
7fd59977 |
1680 | if(VTX.IsOnDomS1()) { |
1681 | |
857ffd5e |
1682 | //-- long unsigned ptr= *((long unsigned *)(((Handle(Standard_Transient) *)(&(VTX.ArcOnS1()))))); |
7fd59977 |
1683 | for(Standard_Integer i=0; i<nbR1;i++) { |
1684 | if(VTX.ArcOnS1()==R1[i]) { |
1d18c75e |
1685 | NR1[i]++; |
1686 | printf("\n ******************************"); |
1687 | return; |
7fd59977 |
1688 | } |
1689 | } |
1690 | printf("\n R Pas trouvee (IntPatch)\n"); |
1691 | |
1692 | } |
7fd59977 |
1693 | } |
4e14c88f |
1694 | #endif |
7fd59977 |
1695 | |
4e14c88f |
1696 | void IntPatch_Intersection::Dump(const Standard_Integer /*Mode*/, |
1697 | const Handle(Adaptor3d_HSurface)& /*S1*/, |
1698 | const Handle(Adaptor3d_TopolTool)& /*D1*/, |
1699 | const Handle(Adaptor3d_HSurface)& /*S2*/, |
1700 | const Handle(Adaptor3d_TopolTool)& /*D2*/) const |
7fd59977 |
1701 | { |
4e14c88f |
1702 | #ifdef DUMPOFIntPatch_Intersection |
1703 | const int MAXR = 200; |
7fd59977 |
1704 | //-- ---------------------------------------------------------------------- |
1705 | //-- construction de la liste des restrictions & vertex |
1706 | //-- |
1707 | int NR1[MAXR],NR2[MAXR]; |
857ffd5e |
1708 | Handle(Adaptor2d_HCurve2d) R1[MAXR],R2[MAXR]; |
7fd59977 |
1709 | Standard_Integer nbR1=0,nbR2=0; |
1710 | for(D1->Init();D1->More() && nbR1<MAXR; D1->Next()) { |
1711 | R1[nbR1]=D1->Value(); |
1712 | NR1[nbR1]=0; |
1713 | nbR1++; |
1714 | } |
4e14c88f |
1715 | for(D2->Init();D2->More() && nbR2<MAXR; D2->Next()) { |
7fd59977 |
1716 | R2[nbR2]=D2->Value(); |
1717 | NR2[nbR2]=0; |
1718 | nbR2++; |
1719 | } |
1720 | |
566f8441 |
1721 | printf("\nDUMP_INT: ----empt:%2ud tgte:%2ud oppo:%2ud ---------------------------------",empt,tgte,empt); |
4e14c88f |
1722 | Standard_Integer i,nbr1,nbr2,nbgl,nbgc,nbge,nbgp,nbgh,nbl,nbr,nbg,nbw,nba; |
7fd59977 |
1723 | nbl=nbr=nbg=nbw=nba=nbgl=nbge=nbr1=nbr2=nbgc=nbgp=nbgh=0; |
1724 | nbl=NbLines(); |
1725 | for(i=1;i<=nbl;i++) { |
1726 | const Handle(IntPatch_Line)& line=Line(i); |
1727 | const IntPatch_IType IType=line->ArcType(); |
1728 | if(IType == IntPatch_Walking) nbw++; |
1729 | else if(IType == IntPatch_Restriction) { |
1730 | nbr++; |
a1eb3afd |
1731 | Handle(IntPatch_RLine) rlin (Handle(IntPatch_RLine)::DownCast (line)); |
7fd59977 |
1732 | if(rlin->IsArcOnS1()) nbr1++; |
1733 | if(rlin->IsArcOnS2()) nbr2++; |
1734 | } |
1735 | else if(IType == IntPatch_Analytic) nba++; |
1d18c75e |
1736 | else { |
1737 | nbg++; |
1738 | if(IType == IntPatch_Lin) nbgl++; |
1739 | else if(IType == IntPatch_Circle) nbgc++; |
1740 | else if(IType == IntPatch_Parabola) nbgp++; |
1741 | else if(IType == IntPatch_Hyperbola) nbgh++; |
1742 | else if(IType == IntPatch_Ellipse) nbge++; |
1743 | } |
7fd59977 |
1744 | } |
1745 | |
1746 | |
1747 | printf("\nDUMP_INT:Lines:%2d Wlin:%2d Restr:%2d(On1:%2d On2:%2d) Ana:%2d Geom:%2d(L:%2d C:%2d E:%2d H:%2d P:%2d)", |
1d18c75e |
1748 | nbl,nbw,nbr,nbr1,nbr2,nba,nbg,nbgl,nbgc,nbge,nbgh,nbgp); |
7fd59977 |
1749 | |
1750 | IntPatch_LineConstructor LineConstructor(2); |
1751 | |
1752 | Standard_Integer nbllc=0; |
1753 | nbw=nbr=nbg=nba=0; |
1754 | Standard_Integer nbva,nbvw,nbvr,nbvg; |
1755 | nbva=nbvr=nbvw=nbvg=0; |
1756 | for (j=1; j<=nbl; j++) { |
1757 | Standard_Integer v,nbvtx; |
1758 | const Handle(IntPatch_Line)& intersLinej = Line(j); |
1759 | Standard_Integer NbLines; |
1760 | LineConstructor.Perform(SequenceOfLine(),intersLinej,S1,D1,S2,D2,1e-7); |
1761 | NbLines = LineConstructor.NbLines(); |
1762 | |
1763 | for(Standard_Integer k=1;k<=NbLines;k++) { |
1764 | nbllc++; |
1765 | const Handle(IntPatch_Line)& LineK = LineConstructor.Line(k); |
1766 | if (LineK->ArcType() == IntPatch_Analytic) { |
a1eb3afd |
1767 | Handle(IntPatch_ALine) alin (Handle(IntPatch_ALine)::DownCast (LineK)); |
1d18c75e |
1768 | nbvtx=alin->NbVertex(); |
1769 | nbva+=nbvtx; nba++; |
1770 | for(v=1;v<=nbvtx;v++) { |
1771 | IntPatch_Intersection__MAJ_R(R1,R2,NR1,NR2,nbR1,nbR2,alin->Vertex(v)); |
1772 | } |
7fd59977 |
1773 | } |
1774 | else if (LineK->ArcType() == IntPatch_Restriction) { |
a1eb3afd |
1775 | Handle(IntPatch_RLine) rlin (Handle(IntPatch_RLine)::DownCast (LineK)); |
1d18c75e |
1776 | nbvtx=rlin->NbVertex(); |
1777 | nbvr+=nbvtx; nbr++; |
1778 | for(v=1;v<=nbvtx;v++) { |
1779 | IntPatch_Intersection__MAJ_R(R1,R2,NR1,NR2,nbR1,nbR2,rlin->Vertex(v)); |
1780 | } |
7fd59977 |
1781 | } |
1782 | else if (LineK->ArcType() == IntPatch_Walking) { |
a1eb3afd |
1783 | Handle(IntPatch_WLine) wlin (Handle(IntPatch_WLine)::DownCast (LineK)); |
1d18c75e |
1784 | nbvtx=wlin->NbVertex(); |
1785 | nbvw+=nbvtx; nbw++; |
1786 | for(v=1;v<=nbvtx;v++) { |
1787 | IntPatch_Intersection__MAJ_R(R1,R2,NR1,NR2,nbR1,nbR2,wlin->Vertex(v)); |
1788 | } |
7fd59977 |
1789 | } |
1790 | else { |
a1eb3afd |
1791 | Handle(IntPatch_GLine) glin (Handle(IntPatch_GLine)::DownCast (LineK)); |
1d18c75e |
1792 | nbvtx=glin->NbVertex(); |
1793 | nbvg+=nbvtx; nbg++; |
1794 | for(v=1;v<=nbvtx;v++) { |
1795 | IntPatch_Intersection__MAJ_R(R1,R2,NR1,NR2,nbR1,nbR2,glin->Vertex(v)); |
1796 | } |
7fd59977 |
1797 | } |
1798 | } |
1799 | } |
1800 | printf("\nDUMP_LC :Lines:%2d WLin:%2d Restr:%2d Ana:%2d Geom:%2d", |
1d18c75e |
1801 | nbllc,nbw,nbr,nba,nbg); |
7fd59977 |
1802 | printf("\nDUMP_LC :vtx :%2d r:%2d :%2d :%2d", |
1d18c75e |
1803 | nbvw,nbvr,nbva,nbvg); |
7fd59977 |
1804 | |
4e14c88f |
1805 | printf("\n"); |
7fd59977 |
1806 | |
4e14c88f |
1807 | #endif |
7fd59977 |
1808 | } |