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