0033661: Data Exchange, Step Import - Tessellated GDTs are not imported
[occt.git] / src / ShapeAlgo / ShapeAlgo_AlgoContainer.cxx
CommitLineData
b311480e 1// Created on: 2000-02-07
2// Created by: data exchange team
973c2be1 3// Copyright (c) 2000-2014 OPEN CASCADE SAS
b311480e 4//
973c2be1 5// This file is part of Open CASCADE Technology software library.
b311480e 6//
d5f74e42 7// This library is free software; you can redistribute it and/or modify it under
8// the terms of the GNU Lesser General Public License version 2.1 as published
973c2be1 9// by the Free Software Foundation, with special exception defined in the file
10// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
11// distribution for complete text of the license and disclaimer of any warranty.
b311480e 12//
973c2be1 13// Alternatively, this file may be used under the terms of Open CASCADE
14// commercial license or contractual agreement.
7fd59977 15
7fd59977 16
17#include <BRep_Builder.hxx>
18#include <BRep_Tool.hxx>
19#include <BRepBuilderAPI_MakeEdge.hxx>
42cf5bc1 20#include <BRepTools.hxx>
21#include <Geom2d_BSplineCurve.hxx>
22#include <Geom_BSplineCurve.hxx>
23#include <Geom_BSplineSurface.hxx>
24#include <Geom_Curve.hxx>
25#include <Geom_Surface.hxx>
26#include <GeomInt_WLApprox.hxx>
27#include <gp_Pnt.hxx>
28#include <IntPatch_WLine.hxx>
29#include <IntSurf_LineOn2S.hxx>
30#include <IntSurf_PntOn2S.hxx>
7fd59977 31#include <Precision.hxx>
42cf5bc1 32#include <ShapeAlgo_AlgoContainer.hxx>
33#include <ShapeAlgo_ToolContainer.hxx>
34#include <ShapeAnalysis.hxx>
7fd59977 35#include <ShapeConstruct.hxx>
7fd59977 36#include <ShapeCustom_Surface.hxx>
42cf5bc1 37#include <ShapeFix_Wire.hxx>
7fd59977 38#include <ShapeUpgrade.hxx>
39#include <ShapeUpgrade_ShapeDivideContinuity.hxx>
42cf5bc1 40#include <Standard_Type.hxx>
41#include <TColgp_Array1OfPnt.hxx>
42#include <TColgp_Array1OfPnt2d.hxx>
43#include <TColStd_Array1OfInteger.hxx>
44#include <TColStd_Array1OfReal.hxx>
42cf5bc1 45#include <TopoDS.hxx>
46#include <TopoDS_Edge.hxx>
47#include <TopoDS_Face.hxx>
48#include <TopoDS_Iterator.hxx>
49#include <TopoDS_Shape.hxx>
50#include <TopoDS_Wire.hxx>
7fd59977 51
25e59720 52IMPLEMENT_STANDARD_RTTIEXT(ShapeAlgo_AlgoContainer,Standard_Transient)
92efcf78 53
7fd59977 54//=======================================================================
55//function : ShapeAlgo_AlgoContainer
56//purpose :
57//=======================================================================
7fd59977 58ShapeAlgo_AlgoContainer::ShapeAlgo_AlgoContainer()
59{
60 myTC = new ShapeAlgo_ToolContainer;
61}
62
63//=======================================================================
64//function : ConnectNextWire
65//purpose :
66//=======================================================================
67
68Standard_Boolean ShapeAlgo_AlgoContainer::ConnectNextWire (const Handle(ShapeAnalysis_Wire)& saw,
69 const Handle(ShapeExtend_WireData)& nextsewd,
70 const Standard_Real maxtol,
71 Standard_Real& distmin,
72 Standard_Boolean& revsewd,
73 Standard_Boolean& revnextsewd) const
74{
75 distmin = 0;
76 revsewd = revnextsewd = Standard_False;
77 if (nextsewd->NbEdges() == 0) return Standard_True;
78
79 Handle(ShapeExtend_WireData) sewd = saw->WireData();
80 //add edges into empty WireData
81 if(sewd->NbEdges() == 0) {
82 sewd->Add (nextsewd);
83 return Standard_True;
84 }
85
86 Standard_Real tailhead, tailtail, headtail, headhead;
87 saw->CheckShapeConnect (tailhead, tailtail, headtail, headhead, nextsewd->Wire(), maxtol);
88 distmin = tailhead;
89 Standard_Real precision = saw->Precision();
90
91 if ( tailhead > precision && tailtail > precision &&
92 ( saw->LastCheckStatus (ShapeExtend_DONE4) ||
93 saw->LastCheckStatus (ShapeExtend_DONE3) ) ) {
94 sewd->Reverse();
95 distmin = headhead;
96 revsewd = Standard_True;
97 if (saw->LastCheckStatus (ShapeExtend_DONE3)) {
98 nextsewd->Reverse();
99 revnextsewd = Standard_True;
100 distmin = headtail;
101 }
102 }
103 else if (!saw->LastCheckStatus (ShapeExtend_FAIL) && !saw->LastCheckStatus (ShapeExtend_DONE5)) {
104 nextsewd->Reverse();
105 revnextsewd = Standard_True;
106 distmin = tailtail;
107 }
108 Standard_Boolean OK = !saw->LastCheckStatus (ShapeExtend_FAIL);
109 if (OK) sewd->Add (nextsewd);
110 return OK;
111}
112
113//=======================================================================
114//function : ApproxBSplineCurve
115//purpose :
116//=======================================================================
117
118void ShapeAlgo_AlgoContainer::ApproxBSplineCurve (const Handle(Geom_BSplineCurve)& bspline,
119 TColGeom_SequenceOfCurve& seq) const
120{
121 seq.Clear();
122 Handle(Geom_BSplineCurve) res, modifCurve;
123 TColGeom_SequenceOfCurve SCurve;
124
125 // si la BSpline est de degre 1 , on approxime .
126 // on passe par le programme des intersections ou tout le travail
127 // est deja fait !!! ( il faut faire des paquets de 30 points
128 // maximum , travailler dans un espace 0,1 pour tenir la precision)
129
130 if (bspline->Degree() != 1) {
131 seq.Append(bspline);
132 return;
133 }
134
135 // on detecte d`eventuelles cassures par la multiplicite des poles.
136 // Puis on approxime chaque "partie" de BSpline
137
138 Standard_Integer NbKnots = bspline->NbKnots();
139 Standard_Integer NbPoles = bspline->NbPoles();
140 TColgp_Array1OfPnt Poles(1,NbPoles);
141 TColStd_Array1OfReal Weigs(1,NbPoles); Weigs.Init(1.);
142 TColStd_Array1OfReal Knots(1,NbKnots);
143 TColStd_Array1OfInteger Mults(1,NbKnots);
144
145 bspline->Poles(Poles);
146 if ( bspline->IsRational()) bspline->Weights(Weigs);
147 bspline->Knots(Knots);
148 bspline->Multiplicities(Mults);
149 Standard_Integer deg = bspline->Degree();
150
151 Standard_Integer jpole = 1;
152 Standard_Integer j, PoleIndex, I1;
153 PoleIndex = 1;
154 I1 = 1;
155 for ( Standard_Integer ipole = 1; ipole < NbPoles; ipole++) {
156 if (Poles(ipole).IsEqual(Poles(ipole+1),Precision::Confusion())) {
157 if (jpole == 1) {
158 PoleIndex++;
159 }
160 else {
161 TColgp_Array1OfPnt newPoles(1,jpole);
162 TColStd_Array1OfReal newWeigs(1,jpole); Weigs.Init(1.);
163 Standard_Integer NbNew = jpole - deg + 1;
164 TColStd_Array1OfReal newKnots(1,NbNew);
165 TColStd_Array1OfInteger newMults(1,NbNew);
166 for ( j = 1; j <= NbNew; j++) {
167 newKnots(j) = Knots(I1+j-1);
168 newMults(j) = Mults(I1+j-1);
169 }
170 newMults(1) = newMults(NbNew) = deg+1;
171 for ( j = 1; j <= jpole; j++) {
172 newWeigs(j) = Weigs(PoleIndex );
173 newPoles(j) = Poles(PoleIndex++);
174 }
175
176 Handle(Geom_BSplineCurve) newC = new Geom_BSplineCurve
177 (newPoles, newWeigs, newKnots, newMults, deg);
178 SCurve.Append(newC);
179 I1 = ipole+1;
180 jpole = 1;
181 }
182 }
183 else {
184 jpole++;
185 }
186 }
187
188
189 Handle(Geom_BSplineCurve) mycurve;
190 Standard_Integer nbcurves = SCurve.Length();
191 if (nbcurves == 0) {
192 nbcurves = 1;
193 SCurve.Append(bspline);
194 }
195
196 for (Standard_Integer itab = 1; itab <= nbcurves; itab++) {
197 mycurve = Handle(Geom_BSplineCurve)::DownCast(SCurve.Value(itab));
198 jpole = mycurve->NbPoles();
199 if ( jpole > 2) {
200 TColgp_Array1OfPnt newP(1,jpole);
201 mycurve->Poles(newP);
202 Handle(IntSurf_LineOn2S) R = new IntSurf_LineOn2S();
203 Standard_Real u1,v1,u2,v2;
204 u1 = v1 = 0.;
205 u2 = v2 = 1.;
206 for( j=1; j<=jpole; j++) {
207 IntSurf_PntOn2S POn2S;
208 POn2S.SetValue(newP(j),u1,v1,u2,v2);
209 R->Add(POn2S);
210 }
211 GeomInt_WLApprox theapp3d;
212 Standard_Real Tol = Precision::Approximation();
4e14c88f 213 theapp3d.SetParameters(Tol, Tol, 4, 8, 0, 30, Standard_True);
7fd59977 214 Handle(IntPatch_WLine) WL = new IntPatch_WLine(R, Standard_False);
215 Standard_Integer indicemin = 1;
216 Standard_Integer indicemax = jpole;
217 theapp3d.Perform(WL, Standard_True, Standard_False,
218 Standard_False, indicemin, indicemax);
219 if (!theapp3d.IsDone()) {
220 modifCurve = mycurve;
221 }
222 else if (theapp3d.NbMultiCurves() != 1) {
223 modifCurve = mycurve;
224 }
225 else {
226 const AppParCurves_MultiBSpCurve& mbspc = theapp3d.Value(1);
227 Standard_Integer nbpoles = mbspc.NbPoles();
228 TColgp_Array1OfPnt tpoles(1,nbpoles);
229 mbspc.Curve(1,tpoles);
230 modifCurve = new Geom_BSplineCurve(tpoles,
231 mbspc.Knots(),
232 mbspc.Multiplicities(),
233 mbspc.Degree());
234 }
235 }
236 else {
237 modifCurve = mycurve;
238 }
239 seq.Append(modifCurve);
240 }
241}
242
243//=======================================================================
244//function : ApproxBSplineCurve
245//purpose :
246//=======================================================================
247
248void ShapeAlgo_AlgoContainer::ApproxBSplineCurve (const Handle(Geom2d_BSplineCurve)& bspline,
249 TColGeom2d_SequenceOfCurve& seq) const
250{
251 seq.Clear();
252 Handle(Geom2d_BSplineCurve) res, modifCurve;
253 TColGeom2d_SequenceOfCurve SCurve;
254
255 // si la BSpline est de degre 1 , on approxime .
256 // on passe par le programme des intersections ou tout le travail
257 // est deja fait !!! ( il faut faire des paquets de 30 points
258 // maximum , travailler dans un espace 0,1 pour tenir la precision
259 // puis reconstruire une BSpline somme des toutes les Bspline).
260
261 if (bspline->Degree() != 1) {
262 seq.Append(bspline);
263 return;
264 }
265
266 // on detecte d`eventuelles cassures par la multiplicite des poles.
267 // Puis on approxime chaque "partie" de BSpline et on reconstruit
268 // une BSpline = somme des BSplines traitees
269
270 Standard_Integer NbKnots = bspline->NbKnots();
271 Standard_Integer NbPoles = bspline->NbPoles();
272 TColgp_Array1OfPnt2d Poles(1,NbPoles);
273 TColStd_Array1OfReal Weigs(1,NbPoles); Weigs.Init(1.);
274 TColStd_Array1OfReal Knots(1,NbKnots);
275 TColStd_Array1OfInteger Mults(1,NbKnots);
276
277 bspline->Poles(Poles);
278 if ( bspline->IsRational()) bspline->Weights(Weigs);
279 bspline->Knots(Knots);
280 bspline->Multiplicities(Mults);
281 Standard_Integer deg = bspline->Degree();
282
283 Standard_Integer jpole = 1;
284 Standard_Integer j, PoleIndex, I1;
285 PoleIndex = 1;
286 I1 = 1;
287 for ( Standard_Integer ipole = 1; ipole < NbPoles; ipole++) {
288 if (Poles(ipole).IsEqual(Poles(ipole+1),Precision::PConfusion())) {
289 if (jpole == 1) {
290 PoleIndex++;
291 }
292 else {
293 TColgp_Array1OfPnt2d newPoles(1,jpole);
294 TColStd_Array1OfReal newWeigs(1,jpole); Weigs.Init(1.);
295 Standard_Integer NbNew = jpole - deg + 1;
296 TColStd_Array1OfReal newKnots(1,NbNew);
297 TColStd_Array1OfInteger newMults(1,NbNew);
298 for ( j = 1; j <= NbNew; j++) {
299 newKnots(j) = Knots(I1+j-1);
300 newMults(j) = Mults(I1+j-1);
301 }
302 newMults(1) = newMults(NbNew) = deg+1;
303 for ( j = 1; j <= jpole; j++) {
304 newWeigs(j) = Weigs(PoleIndex );
305 newPoles(j) = Poles(PoleIndex++);
306 }
307
308 Handle(Geom2d_BSplineCurve) newC = new Geom2d_BSplineCurve
309 (newPoles, newWeigs, newKnots, newMults, deg);
310 SCurve.Append(newC);
311 I1 = ipole+1;
312 jpole = 1;
313 }
314 }
315 else {
316 jpole++;
317 }
318 }
319
320
321 Handle(Geom2d_BSplineCurve) mycurve;
322 Standard_Integer nbcurves = SCurve.Length();
323 if (nbcurves == 0) {
324 nbcurves = 1;
325 SCurve.Append(bspline);
326 }
327
328 for (Standard_Integer itab = 1; itab <= nbcurves; itab++) {
329 mycurve = Handle(Geom2d_BSplineCurve)::DownCast(SCurve.Value(itab));
330 jpole = mycurve->NbPoles();
331 if ( jpole > 10) {
332 TColgp_Array1OfPnt P(1,jpole);
333 TColgp_Array1OfPnt2d newP(1,jpole);
334 mycurve->Poles(newP);
335 Handle(IntSurf_LineOn2S) R = new IntSurf_LineOn2S();
336 Standard_Real u2,v2;
337 u2 = v2 = 1.;
338 for( j=1; j<=jpole; j++) {
339 IntSurf_PntOn2S POn2S;
340 POn2S.SetValue(P(j),newP(j).X(),newP(j).Y(),u2,v2);
341 R->Add(POn2S);
342 }
343 GeomInt_WLApprox theapp3d;
344 Standard_Real Tol = Precision::PApproximation();
4e14c88f 345 theapp3d.SetParameters(Tol, Tol, 4, 8, 0, 30, Standard_True);
7fd59977 346 Handle(IntPatch_WLine) WL = new IntPatch_WLine(R, Standard_False);
347 Standard_Integer indicemin = 1;
348 Standard_Integer indicemax = jpole;
349 theapp3d.Perform(WL, Standard_False, Standard_True,
350 Standard_False, indicemin, indicemax);
351 if (!theapp3d.IsDone()) {
352 modifCurve = mycurve;
353 }
354 else if (theapp3d.NbMultiCurves() != 1) {
355 modifCurve = mycurve;
356 }
357 else {
358 const AppParCurves_MultiBSpCurve& mbspc = theapp3d.Value(1);
359 Standard_Integer nbpoles = mbspc.NbPoles();
360 TColgp_Array1OfPnt2d tpoles(1,nbpoles);
361 mbspc.Curve(1,tpoles);
362 for( j=1; j<=jpole; j++) {
363 }
364 modifCurve = new Geom2d_BSplineCurve(tpoles,
365 mbspc.Knots(),
366 mbspc.Multiplicities(),
367 mbspc.Degree());
368 }
369 }
370 else {
371 modifCurve = mycurve;
372 }
373 seq.Append(modifCurve);
374 }
375}
376
377//=======================================================================
378//function : C0ShapeToC1Shape
379//purpose :
380//=======================================================================
381
382 TopoDS_Shape ShapeAlgo_AlgoContainer::C0ShapeToC1Shape (const TopoDS_Shape& shape,
383 const Standard_Real tol) const
384{
385 ShapeUpgrade_ShapeDivideContinuity sdc(shape);
386 sdc.SetTolerance(tol);
387 sdc.SetBoundaryCriterion(GeomAbs_C1);
388 sdc.SetSurfaceCriterion(GeomAbs_C1);
389 sdc.Perform();
390 return sdc.Result();
391}
392
393//=======================================================================
394//function : ConvertSurfaceToBSpline
395//purpose :
396//=======================================================================
397
398 Handle(Geom_BSplineSurface) ShapeAlgo_AlgoContainer::ConvertSurfaceToBSpline(const Handle(Geom_Surface)& surf,
399 const Standard_Real UF,
400 const Standard_Real UL,
401 const Standard_Real VF,
402 const Standard_Real VL) const
403{
404 return ShapeConstruct::ConvertSurfaceToBSpline(surf, UF, UL, VF, VL,
405 Precision::Confusion(), GeomAbs_C1, 100,
406 Geom_BSplineSurface::MaxDegree());
407}
408
409//=======================================================================
410//function : HomoWires
411//purpose :
412//=======================================================================
413
414 Standard_Boolean ShapeAlgo_AlgoContainer::HomoWires(const TopoDS_Wire& wireIn1,
415 const TopoDS_Wire& wireIn2,
416 TopoDS_Wire& wireOut1,
417 TopoDS_Wire& wireOut2,
418 const Standard_Boolean) const
419{
420 //Standard_Boolean res = Standard_False; //szv#4:S4163:12Mar99 not needed
421 TopoDS_Iterator Cook, Perry;
422 TopoDS_Edge edge1, edge2;
423 TopLoc_Location loc1, loc2;
424// BRepBuilderAPI_MakeWire makeWire1, makeWire2;
425 ShapeExtend_WireData makeWire1, makeWire2;
426 Standard_Boolean iterCook, iterPerry;
427 Standard_Integer nEdges1, nEdges2;
428 Standard_Real length1, length2;
429 Standard_Real first1, first2;
430 Standard_Real last1, last2;
431 Standard_Real delta1, delta2;
432
433 Handle (Geom_Curve) crv1;
434 Handle (Geom_Curve) crv2;
435
436 //Standard_Boolean notEnd = Standard_True; //szv#4:S4163:12Mar99 unused
437 Standard_Integer nbCreatedEdges = 0;
438 // gka
439 //TopoDS_Vertex v11,v12,v21,v22
440 Handle(ShapeFix_Wire) sfw = new ShapeFix_Wire();
441 sfw->Load(wireIn1);
442 sfw->FixReorder();
443 TopoDS_Wire wireIn11 = sfw->Wire() ;
444 sfw->Load(wireIn2);
445 sfw->FixReorder();
446 TopoDS_Wire wireIn22 = sfw->Wire() ;
447
448 iterCook = iterPerry = Standard_True;
449 length1 = length2 = 0.;
450 nEdges1 = nEdges2 = 0;
451 for (Cook.Initialize(wireIn11); Cook.More(); Cook.Next()) {
452 nEdges1++;
453 edge1 = TopoDS::Edge(Cook.Value());
454 crv1 = BRep_Tool::Curve(edge1, loc1, first1, last1);
455 length1 += last1 - first1;
456 }
457 for (Perry.Initialize(wireIn22); Perry.More(); Perry.Next()) {
458 nEdges2++;
459 edge2 = TopoDS::Edge(Perry.Value());
460 crv2 = BRep_Tool::Curve(edge2, loc2, first2, last2);
461 length2 += last2 - first2;
462 }
463 Standard_Real epsilon = Precision::PConfusion() * (length1 + length2);
464 if (nEdges1 == 1 && nEdges2 == 1){
465 wireOut1 = wireIn11;
466 wireOut2 = wireIn22;
467 return Standard_True; //szv#4:S4163:12Mar99 `res=` not needed
468 }
469
470 if (length1 < epsilon) {
471 Cook.Initialize(wireIn11);
472 for (Perry.Initialize(wireIn22); Perry.More(); Perry.Next()) {
473 edge1 = TopoDS::Edge(Cook.Value());
474 makeWire1.Add(edge1);
475 }
476 wireOut1 = makeWire1.Wire();
477 wireOut2 = wireIn22;
478 return Standard_True; //szv#4:S4163:12Mar99 `res=` not needed
479 }
480 if (length2 < epsilon) {
481 Perry.Initialize(wireIn22);
482 for (Cook.Initialize(wireIn11); Cook.More(); Cook.Next()) {
483 edge2 = TopoDS::Edge(Perry.Value());
484 makeWire2.Add(edge2);
485 }
486 wireOut1 = wireIn11;
487 wireOut2 = makeWire2.Wire();
488 return Standard_True; //szv#4:S4163:12Mar99 `res=` not needed
489 }
490
491
492 Standard_Real ratio = length2 / length1;
493
494 Cook.Initialize(wireIn11);
495 Perry.Initialize(wireIn22);
496 edge1 = TopoDS::Edge(Cook.Value());
497 edge2 = TopoDS::Edge(Perry.Value());
498 // essai mjm du 22/05/97
499 Standard_Boolean IsToReverse1 = Standard_False;
500 Standard_Boolean IsToReverse2 = Standard_False;
501 if (edge1.Orientation() == TopAbs_REVERSED)
502 IsToReverse1 = Standard_True;
503 if (edge2.Orientation() == TopAbs_REVERSED)
504 IsToReverse2 = Standard_True;
505 crv1 = BRep_Tool::Curve(edge1, loc1, first1, last1);
506 crv2 = BRep_Tool::Curve(edge2, loc2, first2, last2);
507 delta1 = last1 - first1;
508 delta2 = last2 - first2;
509 while (nbCreatedEdges < (nEdges1 + nEdges2-1)) { /*just a security. */
510
511 if ((delta1*ratio - delta2) > epsilon) {
512 BRepBuilderAPI_MakeEdge makeEdge1;
513 if(!IsToReverse1) {
514 makeEdge1.Init(crv1, first1, first1 + delta2/ratio);
515 first1+= delta2/ratio;
516 }
517 else { // gka BUC60685
518 makeEdge1.Init(crv1, last1 - delta2/ratio , last1);
519 last1 -= delta2/ratio;
520 }
521 BRepBuilderAPI_MakeEdge makeEdge2(crv2, first2, last2);
522 edge1 = makeEdge1.Edge();
523 edge2 = makeEdge2.Edge();
524// essai mjm du 22/05/97
525 iterCook = Standard_False;
526 //first1 += delta2/ratio;
527 delta1 = last1 - first1;
528 iterPerry = Standard_True;
529 nbCreatedEdges++;
530 }
531 else if (Abs(delta1*ratio - delta2) <= epsilon) {
532 BRepBuilderAPI_MakeEdge makeEdge1(crv1, first1, last1);
533 BRepBuilderAPI_MakeEdge makeEdge2(crv2, first2, last2);
534 edge1 = makeEdge1.Edge();
535 edge2 = makeEdge2.Edge();
536 iterCook = Standard_True;
537 iterPerry = Standard_True;
538 nbCreatedEdges += 2;
539 }
540 else /*((delta1*ratio - delta2) < -epsilon)*/ {
541 BRepBuilderAPI_MakeEdge makeEdge1(crv1, first1, last1);
542 edge1 = makeEdge1.Edge();
543 BRepBuilderAPI_MakeEdge makeEdge2;
544 if(!IsToReverse2) {
545 makeEdge2.Init(crv2, first2, first2 + delta1*ratio);
546 first2 += delta1*ratio;
547 }
548 else { // gka BUC60685
549 makeEdge2.Init(crv2, last2 - delta1*ratio, last2);
550 last2 -= delta1*ratio;
551 }
552 edge1 = makeEdge1.Edge();
553 edge2 = makeEdge2.Edge();
554 iterCook = Standard_True;
555 iterPerry = Standard_False;
556 //first2 += delta1*ratio;
557 delta2 = last2 - first2;
558 nbCreatedEdges++;
559 }
560 edge1.Move(loc1);
561 edge2.Move(loc2);
562 if ( IsToReverse1) edge1.Reverse();
563 if ( IsToReverse2) edge2.Reverse();
564 makeWire1.Add(edge1);
565 makeWire2.Add(edge2);
566
567 if (iterCook && iterPerry) {
568 TopoDS_Iterator Copernic = Cook;
569 if (Copernic.More())
570 Copernic.Next();
571 if (!Copernic.More()) {
572 wireOut1 = makeWire1.Wire();
573 wireOut2 = makeWire2.Wire();
574 return Standard_True; //szv#4:S4163:12Mar99 `res=` not needed
575 }
576 }
577 if (iterCook) {
578 Cook.Next();
579 edge1 = TopoDS::Edge(Cook.Value());
580 if (edge1.Orientation() == TopAbs_REVERSED)
581 IsToReverse1 = Standard_True;
582 else IsToReverse1 = Standard_False;
583 crv1 = BRep_Tool::Curve(edge1, loc1, first1, last1);
584 delta1 = last1 - first1;
585 }
586 if (iterPerry) {
587 Perry.Next();
588 edge2 = TopoDS::Edge(Perry.Value());
589 if (edge2.Orientation() == TopAbs_REVERSED)
590 IsToReverse2 = Standard_True;
591 else IsToReverse2 = Standard_False;
592 crv2 = BRep_Tool::Curve(edge2, loc2, first2, last2);
593 delta2 = last2 - first2;
594 }
595
596 }
597 return Standard_False; //szv#4:S4163:12Mar99 `res=` not needed
598}
599
600//=======================================================================
601//function : C0BSplineToSequenceOfC1BSplineCurve
602//purpose :
603//=======================================================================
604
605 Standard_Boolean ShapeAlgo_AlgoContainer::C0BSplineToSequenceOfC1BSplineCurve(const Handle(Geom_BSplineCurve)& BS,
606 Handle(TColGeom_HSequenceOfBoundedCurve)& seqBS) const
607{
608 return ShapeUpgrade::C0BSplineToSequenceOfC1BSplineCurve (BS, seqBS);
609}
610
611//=======================================================================
612//function : C0BSplineToSequenceOfC1BSplineCurve
613//purpose :
614//=======================================================================
615
616 Standard_Boolean ShapeAlgo_AlgoContainer::C0BSplineToSequenceOfC1BSplineCurve(const Handle(Geom2d_BSplineCurve)& BS,
617 Handle(TColGeom2d_HSequenceOfBoundedCurve)& seqBS) const
618{
619 return ShapeUpgrade::C0BSplineToSequenceOfC1BSplineCurve (BS, seqBS);
620}
621
622//=======================================================================
623//function : OuterWire
624//purpose :
625//=======================================================================
626
627TopoDS_Wire ShapeAlgo_AlgoContainer::OuterWire(const TopoDS_Face& face) const
628{
629 return ShapeAnalysis::OuterWire(face);
630}
631
632//=======================================================================
633//function : ConvertToPeriodic
634//purpose :
635//=======================================================================
636
637 Handle(Geom_Surface) ShapeAlgo_AlgoContainer::ConvertToPeriodic (const Handle(Geom_Surface)& surf) const
638{
639 ShapeCustom_Surface scs (surf);
640 return scs.ConvertToPeriodic (Standard_False);
641}
642
643//=======================================================================
644//function : GetFaceUVBounds
645//purpose :
646//=======================================================================
647
648 void ShapeAlgo_AlgoContainer::GetFaceUVBounds (const TopoDS_Face& F,
649 Standard_Real& Umin,
650 Standard_Real& Umax,
651 Standard_Real& Vmin,
652 Standard_Real& Vmax) const
653{
654 ShapeAnalysis::GetFaceUVBounds (F, Umin, Umax, Vmin, Vmax);
655}
656
657//=======================================================================
658//function : ConvertCurveToBSpline
659//purpose :
660//=======================================================================
661
662Handle(Geom_BSplineCurve) ShapeAlgo_AlgoContainer::ConvertCurveToBSpline(const Handle(Geom_Curve)& C3D,
663 const Standard_Real First,
664 const Standard_Real Last,
665 const Standard_Real Tol3d,
666 const GeomAbs_Shape Continuity,
667 const Standard_Integer MaxSegments,
668 const Standard_Integer MaxDegree) const
669{
670 return ShapeConstruct::ConvertCurveToBSpline(C3D, First, Last, Tol3d, Continuity, MaxSegments, MaxDegree);
671}