1 // Created on: 1994-09-01
2 // Created by: Christian CAILLET
3 // Copyright (c) 1994-1999 Matra Datavision
4 // Copyright (c) 1999-2014 OPEN CASCADE SAS
6 // This file is part of Open CASCADE Technology software library.
8 // This library is free software; you can redistribute it and/or modify it under
9 // the terms of the GNU Lesser General Public License version 2.1 as published
10 // by the Free Software Foundation, with special exception defined in the file
11 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
12 // distribution for complete text of the license and disclaimer of any warranty.
14 // Alternatively, this file may be used under the terms of Open CASCADE
15 // commercial license or contractual agreement.
17 // modif du 31/01/97 : mjm
18 // on commence par les SplineCurves.
19 // modif du 17/03/97 : mjm
21 //%13 pdn 12.02.99: USA60293 avoid applying transformation twice
23 #include <BSplCLib.hxx>
24 #include <BSplSLib.hxx>
25 #include <Geom2d_BSplineCurve.hxx>
26 #include <Geom_BSplineCurve.hxx>
27 #include <Geom_BSplineSurface.hxx>
28 #include <GeomConvert_CompCurveToBSplineCurve.hxx>
29 #include <gp_GTrsf.hxx>
30 #include <gp_Trsf.hxx>
31 #include <IGESConvGeom.hxx>
32 #include <IGESData_ToolLocation.hxx>
33 #include <IGESGeom_SplineCurve.hxx>
34 #include <IGESGeom_SplineSurface.hxx>
36 #include <TColgp_HArray1OfPnt.hxx>
37 #include <TColgp_HArray2OfPnt.hxx>
38 #include <TColStd_Array1OfInteger.hxx>
39 #include <TColStd_Array1OfReal.hxx>
40 #include <TColStd_HArray1OfReal.hxx>
42 //=======================================================================
43 //function : IGESConvGeom::SplineCurveFromIGES
45 //=======================================================================
46 Standard_Integer IGESConvGeom::SplineCurveFromIGES
47 (const Handle(IGESGeom_SplineCurve)& st,
48 const Standard_Real /*epscoef*/, const Standard_Real epsgeom,
49 Handle(Geom_BSplineCurve)& res)
51 Standard_Integer returned = 0;
53 // on recupere le degre
54 Standard_Integer degree = st->SplineType();
55 if (degree > 3) degree = 3;
57 // on recupere le nombre de segments.
58 Standard_Integer nbSegs = st->NbSegments();
59 if (nbSegs < 1) return 5; // FAIL : no segment
61 Standard_Integer nbKnots = nbSegs+1;
63 // Array of multiplicities.
64 TColStd_Array1OfInteger multi(1, nbKnots);
66 multi.SetValue(multi.Lower(), degree+1);
67 multi.SetValue(multi.Upper(), degree+1);
70 TColStd_Array1OfReal knots(1, nbKnots);
71 TColStd_Array1OfReal delta(1, nbSegs);
72 Standard_Integer i; // svv Jan 10 2000 : porting on DEC
73 for (i = 1; i<= nbKnots; i++)
74 knots.SetValue(i, st->BreakPoint(i));
76 for (i = 1; i <= nbSegs; i++)
77 delta.SetValue(i, st->BreakPoint(i+1) - st->BreakPoint(i));
79 TColgp_Array1OfPnt bspoles(1, nbSegs*degree+1);
80 Standard_Integer ibspole = bspoles.Lower()-1; // Bspole Index.
81 // il faut reparametrer avant de passer dans PLib.
82 // on est entre[0, T(i+1)-T(i)] et on veut [0,1]
84 for (i = 1; i <= nbSegs; i++) {
85 Standard_Real AX,BX,CX,DX,AY,BY,CY,DY,AZ,BZ,CZ,DZ;
86 st->XCoordPolynomial(i, AX, BX, CX, DX);
87 st->YCoordPolynomial(i, AY, BY, CY, DY);
88 st->ZCoordPolynomial(i, AZ, BZ, CZ, DZ);
89 if (st->NbDimensions() == 2 ) BZ=0.,CZ=0.,DZ=0.;
90 Standard_Real Di = delta(i);
91 Standard_Real Di2 = delta(i)*delta(i);
92 Standard_Real Di3 = delta(i)*delta(i)*delta(i);
94 TColgp_Array1OfPnt coeff(0, degree);
97 coeff.SetValue(coeff.Lower()+3, gp_Pnt(DX*Di3, DY*Di3, DZ*Di3));
99 coeff.SetValue(coeff.Lower()+2, gp_Pnt(CX*Di2, CY*Di2, CZ*Di2));
101 coeff.SetValue(coeff.Lower()+1, gp_Pnt(BX*Di, BY*Di, BZ*Di));
102 coeff.SetValue(coeff.Lower()+0, gp_Pnt(AX, AY, AZ));
109 TColgp_Array1OfPnt bzpoles(0, degree);
110 PLib::CoefficientsPoles(coeff,PLib::NoWeights(),bzpoles,PLib::NoWeights());
113 // Not to check the first pole of the first segment.
114 if (ibspole > bspoles.Lower()) {
115 Standard_Integer bzlow = bzpoles.Lower();
116 if (!(bspoles.Value(ibspole).IsEqual(bzpoles.Value(bzlow), epsgeom))) {
118 // Medium point computing.
119 bspoles.SetValue (ibspole,
120 gp_Pnt((bspoles.Value(ibspole).X() + bzpoles.Value(bzlow).X())/2.,
121 (bspoles.Value(ibspole).Y() + bzpoles.Value(bzlow).Y())/2.,
122 (bspoles.Value(ibspole).Z() + bzpoles.Value(bzlow).Z())/2.));
125 if (i == 1) bspoles.SetValue(++ibspole, bzpoles.Value(bzpoles.Lower()));
127 for (Standard_Integer j = bzpoles.Lower()+1; j <= bzpoles.Upper(); j++)
128 bspoles.SetValue(++ibspole, bzpoles.Value(j));
130 if (ibspole != bspoles.Upper()) {
132 return 3; // FAIL : Error during creation of control points
135 // Building result taking into account transformation if any :
136 // ===========================================================
138 //%13 pdn 12.02.99 USA60293
139 // if (st->HasTransf()) {
141 // Standard_Real epsilon = 1.E-04;
142 // if (IGESData_ToolLocation::ConvertLocation
143 // (epsilon,st->CompoundLocation(),trsf)) {
144 // for (Standard_Integer i = bspoles.Lower(); i <= bspoles.Upper(); i++)
145 // bspoles.SetValue(i, bspoles.Value(i).Transformed(trsf));
148 // AddFail(st, "Transformation : not a similarity");
150 res = new Geom_BSplineCurve (bspoles, knots, multi, degree);
151 // GeomConvert_CompCurveToBSplineCurve CompCurve =
152 // GeomConvert_CompCurveToBSplineCurve(res);
153 // res = CompCurve.BSplineCurve();
159 //=======================================================================
160 //function : IGESConvGeom::IncreaseCurveContinuity
162 //=======================================================================
163 Standard_Integer IGESConvGeom::IncreaseCurveContinuity (const Handle(Geom_BSplineCurve)& res,
164 const Standard_Real epsgeom,
165 const Standard_Integer continuity)
167 if (continuity < 1) return continuity;
168 Standard_Boolean isC1 = Standard_True, isC2 = Standard_True;
169 Standard_Integer degree = res->Degree();
172 Standard_Boolean isModified;
174 isModified = Standard_False;
175 for (Standard_Integer i = res->FirstUKnotIndex()+1; i < res->LastUKnotIndex(); i++)
176 if(degree - res->Multiplicity(i) < continuity) {
177 if (continuity >= 2) {
178 if (!res->RemoveKnot(i, degree-2, epsgeom)) {
179 isC2 = Standard_False;
180 Standard_Boolean locOK = res->RemoveKnot(i, degree-1, epsgeom); // is C1 ?
185 isModified = Standard_True;
188 Standard_Boolean locOK = res->RemoveKnot(i, degree-1, epsgeom); // is C1 ?
197 if (continuity >= 2 && !isC2) return 1;
201 //=======================================================================
202 //function : IncreaseCurveContinuity
204 //=======================================================================
206 Standard_Integer IGESConvGeom::IncreaseCurveContinuity (const Handle(Geom2d_BSplineCurve)& res,
207 const Standard_Real epsgeom,
208 const Standard_Integer continuity)
210 if (continuity < 1) return continuity;
211 Standard_Boolean isC1 = Standard_True, isC2 = Standard_True;
212 Standard_Integer degree = res->Degree();
214 Standard_Boolean isModified;
216 isModified = Standard_False;
217 for (Standard_Integer i = res->FirstUKnotIndex()+1; i < res->LastUKnotIndex(); i++)
218 if(degree - res->Multiplicity(i) < continuity) {
219 if (continuity >= 2) {
220 if (!res->RemoveKnot(i, degree-2, epsgeom)) {
221 isC2 = Standard_False;
222 Standard_Boolean locOK = res->RemoveKnot(i, degree-1, epsgeom); // is C1 ?
227 isModified = Standard_True;
230 Standard_Boolean locOK = res->RemoveKnot(i, degree-1, epsgeom); // is C1 ?
239 if (continuity >= 2 && !isC2) return 1;
244 //=======================================================================
245 //function : IGESConvGeom::SplineSurfaceFromIGES
247 //=======================================================================
248 Standard_Integer IGESConvGeom::SplineSurfaceFromIGES
249 (const Handle(IGESGeom_SplineSurface)& st,
250 const Standard_Real /*epscoef*/, const Standard_Real epsgeom,
251 Handle(Geom_BSplineSurface)& res)
253 Standard_Integer returned = 0;
254 Standard_Integer degree = st->BoundaryType();
255 if (degree > 3) degree = 3;
256 Standard_Integer DegreeU = degree;
257 Standard_Integer DegreeV = degree;
259 Standard_Integer NbUSeg = st->NbUSegments();
260 Standard_Integer NbVSeg = st->NbVSegments();
262 if ((NbUSeg < 1) || (NbVSeg < 1)) return 5;
264 // Output BSpline knots & multiplicities arraies for U & V :
265 // =========================================================
267 TColStd_Array1OfReal UKnot(1,NbUSeg+1);
268 TColStd_Array1OfReal VKnot(1,NbVSeg+1);
269 TColStd_Array1OfReal deltaU(1,NbUSeg);
270 TColStd_Array1OfReal deltaV(1,NbVSeg);
272 Standard_Integer i; // svv Jan 10 2000 : porting on DEC
273 for (i=1; i <= NbUSeg+1; i++)
274 UKnot.SetValue(i, st->UBreakPoint(i));
276 for (i=1; i <= NbUSeg; i++)
277 deltaU.SetValue(i, st->UBreakPoint(i+1)- st->UBreakPoint(i));
279 for (i=1; i <= NbVSeg+1; i++)
280 VKnot.SetValue(i, st->VBreakPoint(i));
282 for (i=1; i <= NbVSeg; i++)
283 deltaV.SetValue(i, st->VBreakPoint(i+1)- st->VBreakPoint(i));
285 TColStd_Array1OfInteger UMult(1,NbUSeg+1); UMult.Init(DegreeU);
286 UMult.SetValue(UMult.Lower(),DegreeU+1);
287 UMult.SetValue(UMult.Upper(),DegreeU+1);
289 TColStd_Array1OfInteger VMult(1,NbVSeg+1); VMult.Init(DegreeV);
290 VMult.SetValue(VMult.Lower(),DegreeV+1);
291 VMult.SetValue(VMult.Upper(),DegreeV+1);
297 Standard_Integer NbUPoles = NbUSeg * DegreeU + 1;
298 Standard_Integer NbVPoles = NbVSeg * DegreeV + 1;
300 TColgp_Array2OfPnt BsPole(1, NbUPoles, 1, NbVPoles);
302 Standard_Integer iBs, jBs, iBz, jBz;
303 Standard_Boolean wasC0 = Standard_True;
307 Standard_Integer USeg, VSeg, j;
311 Handle(TColStd_HArray1OfReal) XPoly = st->XPolynomial(USeg, VSeg);
312 Handle(TColStd_HArray1OfReal) YPoly = st->YPolynomial(USeg, VSeg);
313 Handle(TColStd_HArray1OfReal) ZPoly = st->ZPolynomial(USeg, VSeg);
315 TColgp_Array2OfPnt Coef(1, DegreeU+1, 1, DegreeV+1);
316 Standard_Real ParamU, ParamV;
318 for (i=1; i<=DegreeU+1; i++) {
320 for (j=1; j<=DegreeV+1; j++) {
321 Standard_Integer PolyIndex = i + 4*(j-1);
322 gp_Pnt aPoint(XPoly->Value(PolyIndex)*ParamU*ParamV,
323 YPoly->Value(PolyIndex)*ParamU*ParamV,
324 ZPoly->Value(PolyIndex)*ParamU*ParamV);
325 Coef.SetValue(i, j, aPoint);
326 ParamV = ParamV *deltaV(VSeg);
328 ParamU = ParamU * deltaU(USeg);
330 TColgp_Array2OfPnt BzPole(1, DegreeU+1, 1, DegreeV+1);
331 PLib::CoefficientsPoles(Coef,PLib::NoWeights2(),BzPole,PLib::NoWeights2());
333 iBs = BsPole.LowerRow();
334 jBs = BsPole.LowerCol();
336 // Making output BSpline poles array :
337 for (iBz=BzPole.LowerRow(); iBz<=BzPole.UpperRow(); iBz++) {
338 for (jBz=BzPole.LowerCol(); jBz<=BzPole.UpperCol(); jBz++)
339 BsPole.SetValue(iBs, jBs++, BzPole.Value(iBz,jBz));
340 jBs = BsPole.LowerCol();
345 // Patches (1<USeg<NbUSeg, 1)
346 // ==========================
349 for (USeg=2; USeg<=NbUSeg; USeg++) {
350 XPoly = st->XPolynomial(USeg, VSeg);
351 YPoly = st->YPolynomial(USeg, VSeg);
352 ZPoly = st->ZPolynomial(USeg, VSeg);
353 Standard_Real ParamU, ParamV;
355 for (i=Coef.LowerRow(); i<=Coef.UpperRow(); i++) {
357 for (j=Coef.LowerCol(); j<=Coef.UpperCol(); j++) {
358 Standard_Integer PolyIndex = i + 4*(j-1);
360 aPoint.SetCoord(XPoly->Value(PolyIndex)*ParamU*ParamV,
361 YPoly->Value(PolyIndex)*ParamU*ParamV,
362 ZPoly->Value(PolyIndex)*ParamU*ParamV);
363 Coef.SetValue(i, j, aPoint);
364 ParamV = ParamV *deltaV(VSeg);
366 ParamU = ParamU * deltaU(USeg);
368 PLib::CoefficientsPoles(Coef,PLib::NoWeights2(),BzPole,PLib::NoWeights2());
370 // C0 check and correction for poles lying on isoparametrics U=0 & V=0
371 Standard_Integer iBs = BsPole.LowerRow() + (USeg-1)*DegreeU;
372 Standard_Integer jBs = BsPole.LowerCol();
373 iBz = BzPole.LowerRow();
374 for (jBz=BzPole.LowerCol(); jBz<=BzPole.UpperCol(); jBz++) {
375 if (!BzPole.Value(iBz,jBz).IsEqual(BsPole.Value(iBs,jBs), epsgeom)) {
376 wasC0=Standard_False;
378 Standard_Real XCoord =
379 0.5 * (BzPole.Value(iBz,jBz).X() + BsPole.Value(iBs,jBs).X());
380 Standard_Real YCoord =
381 0.5 * (BzPole.Value(iBz,jBz).Y() + BsPole.Value(iBs,jBs).Y());
382 Standard_Real ZCoord =
383 0.5 * (BzPole.Value(iBz,jBz).Z() + BsPole.Value(iBs,jBs).Z());
384 MidPoint.SetCoord(XCoord, YCoord, ZCoord);
385 BsPole.SetValue(iBs, jBs++, MidPoint);
388 BsPole.SetValue(iBs, jBs++, BzPole.Value(iBz,jBz));
392 // Other poles (no check about C0) :
394 jBs = BsPole.LowerCol();
395 for (iBz=BzPole.LowerRow()+1; iBz<=BzPole.UpperRow(); iBz++) {
396 for (jBz=BzPole.LowerCol(); jBz<=BzPole.UpperCol(); jBz++)
397 BsPole.SetValue(iBs, jBs++, BzPole.Value(iBz,jBz));
399 jBs = BsPole.LowerCol();
405 // Patches (1, 1<VSeg<NbVSeg)
406 // ==========================
409 for (VSeg=2; VSeg <= NbVSeg; VSeg++) {
410 XPoly = st->XPolynomial(USeg, VSeg);
411 YPoly = st->YPolynomial(USeg, VSeg);
412 ZPoly = st->ZPolynomial(USeg, VSeg);
413 Standard_Real ParamU, ParamV;
415 for (i=Coef.LowerRow(); i<=Coef.UpperRow(); i++) {
417 for (j=Coef.LowerCol(); j<=Coef.UpperCol(); j++) {
418 Standard_Integer PolyIndex = i + 4*(j-1);
420 aPoint.SetCoord(XPoly->Value(PolyIndex)*ParamU*ParamV,
421 YPoly->Value(PolyIndex)*ParamU*ParamV,
422 ZPoly->Value(PolyIndex)*ParamU*ParamV);
423 Coef.SetValue(i, j, aPoint);
424 ParamV = ParamV *deltaV(VSeg);
426 ParamU = ParamU * deltaU(USeg);
428 PLib::CoefficientsPoles(Coef,PLib::NoWeights2(),BzPole,PLib::NoWeights2());
430 // C0 check and correction for poles lying on isoparametrics U=0 & V=0
431 iBs = BsPole.LowerRow();
432 jBs = BsPole.LowerCol() + (VSeg-1)*DegreeV;
433 jBz = BzPole.LowerCol();
434 for (iBz=BzPole.LowerRow(); iBz<=BzPole.UpperRow(); iBz++) {
435 if (!BzPole.Value(iBz,jBz).IsEqual(BsPole.Value(iBs,jBs), epsgeom)) {
436 wasC0=Standard_False;
438 Standard_Real XCoord = 0.5 *
439 (BzPole.Value(iBz,jBz).X() + BsPole.Value(iBs,jBs).X());
440 Standard_Real YCoord = 0.5 *
441 (BzPole.Value(iBz,jBz).Y() + BsPole.Value(iBs,jBs).Y());
442 Standard_Real ZCoord = 0.5 *
443 (BzPole.Value(iBz,jBz).Z() + BsPole.Value(iBs,jBs).Z());
444 MidPoint.SetCoord(XCoord, YCoord, ZCoord);
445 BsPole.SetValue(iBs++, jBs, MidPoint);
448 BsPole.SetValue(iBs++, jBs, BzPole.Value(iBz,jBz));
453 iBs = BsPole.LowerRow();
454 for (jBz=BzPole.LowerCol()+1; jBz<=BzPole.UpperCol(); jBz++) {
455 for (iBz=BzPole.LowerRow(); iBz<=BzPole.UpperRow(); iBz++)
456 BsPole.SetValue(iBs++, jBs, BzPole.Value(iBz,jBz));
457 iBs = BsPole.LowerRow();
463 // Patches (1<USeg<NbUSeg, 1<VSeg<NbVSeg)
464 // ======================================
466 for (VSeg=2; VSeg <= NbVSeg; VSeg++) {
467 for (USeg=2; USeg <= NbUSeg; USeg++) {
468 XPoly = st->XPolynomial(USeg, VSeg);
469 YPoly = st->YPolynomial(USeg, VSeg);
470 ZPoly = st->ZPolynomial(USeg, VSeg);
471 Standard_Real ParamU, ParamV;
473 for (i=Coef.LowerRow(); i<=Coef.UpperRow(); i++) {
475 for (j=Coef.LowerCol(); j<=Coef.UpperCol(); j++) {
476 Standard_Integer PolyIndex = i + 4*(j-1);
478 aPoint.SetCoord(XPoly->Value(PolyIndex)*ParamU*ParamV,
479 YPoly->Value(PolyIndex)*ParamU*ParamV,
480 ZPoly->Value(PolyIndex)*ParamU*ParamV);
481 Coef.SetValue(i, j, aPoint);
482 ParamV = ParamV *deltaV(VSeg);
484 ParamU = ParamU * deltaU(USeg);
486 PLib::CoefficientsPoles(Coef,PLib::NoWeights2(),BzPole,PLib::NoWeights2());
488 // C0 check and correction for poles lying on isoparametrics U=0 & V=0
489 iBs = (USeg-1)*DegreeU + BsPole.LowerRow();
490 jBs = (VSeg-1)*DegreeV + BsPole.LowerCol();
491 jBz = BzPole.LowerCol();
492 for (iBz=BzPole.LowerRow(); iBz<=BzPole.UpperRow(); iBz++) {
493 if (!BzPole.Value(iBz,jBz).IsEqual(BsPole.Value(iBs,jBs), epsgeom)) {
494 wasC0=Standard_False;
496 Standard_Real XCoord = 0.5 *
497 (BzPole.Value(iBz,jBz).X() + BsPole.Value(iBs,jBs).X());
498 Standard_Real YCoord = 0.5 *
499 (BzPole.Value(iBz,jBz).Y() + BsPole.Value(iBs,jBs).Y());
500 Standard_Real ZCoord = 0.5 *
501 (BzPole.Value(iBz,jBz).Z() + BsPole.Value(iBs,jBs).Z());
502 MidPoint.SetCoord(XCoord, YCoord, ZCoord);
503 BsPole.SetValue(iBs++, jBs, MidPoint);
506 BsPole.SetValue(iBs++, jBs, BzPole.Value(iBz,jBz));
509 iBs = (USeg-1)*DegreeU + BsPole.LowerRow();
510 iBz = BzPole.LowerRow();
511 for (jBz=BzPole.LowerCol(); jBz<=BzPole.UpperCol(); jBz++) {
512 // C0 check and correction for poles lying on isoparametrics U=0 & V=0
513 if (!BzPole.Value(iBz,jBz).IsEqual(BsPole.Value(iBs,jBs), epsgeom)) {
514 wasC0=Standard_False;
516 Standard_Real XCoord = 0.5 *
517 (BzPole.Value(iBz,jBz).X() + BsPole.Value(iBs,jBs).X());
518 Standard_Real YCoord = 0.5 *
519 (BzPole.Value(iBz,jBz).Y() + BsPole.Value(iBs,jBs).Y());
520 Standard_Real ZCoord = 0.5 *
521 (BzPole.Value(iBz,jBz).Z() + BsPole.Value(iBs,jBs).Z());
522 MidPoint.SetCoord(XCoord, YCoord, ZCoord);
523 BsPole.SetValue(iBs, jBs++, MidPoint);
526 BsPole.SetValue(iBs, jBs++, BzPole.Value(iBz,jBz));
529 iBs = BsPole.LowerRow() + (USeg-1)*DegreeU + 1;
530 jBs = BsPole.LowerCol() + (VSeg-1)*DegreeV + 1;
531 for (iBz=BzPole.LowerRow()+1; iBz<=BzPole.UpperRow(); iBz++) {
532 for (jBz=BzPole.LowerCol()+1; jBz<=BzPole.UpperCol(); jBz++)
533 BsPole.SetValue(iBs, jBs++, BzPole.Value(iBz,jBz));
534 jBs = BsPole.LowerCol() + (VSeg-1)*DegreeV + 1;
540 // Building result taking into account transformation if any :
541 // ===========================================================
543 if (st->HasTransf()) {
544 gp_GTrsf GSplTrsf(st->CompoundLocation());
546 Standard_Real epsilon = 1.E-04;
547 if (IGESData_ToolLocation::ConvertLocation(epsilon,GSplTrsf,SplTrsf))
548 for (iBs=BsPole.LowerRow(); iBs<=BsPole.UpperRow(); iBs++)
549 for (jBs=BsPole.LowerCol(); jBs<=BsPole.UpperCol(); jBs++)
550 BsPole.SetValue(iBs, jBs, BsPole.Value(iBs,jBs).Transformed(SplTrsf));
552 // AddWarning(start, "Transformation skipped : Not a similarity");
555 res = new Geom_BSplineSurface
556 (BsPole, UKnot, VKnot, UMult, VMult, DegreeU, DegreeV);
557 if (wasC0) returned += 1;
562 //=======================================================================
563 //function : IGESConvGeom::IncreaseSurfaceContinuity
565 //=======================================================================
566 Standard_Integer IGESConvGeom::IncreaseSurfaceContinuity (const Handle(Geom_BSplineSurface)& res,
567 const Standard_Real epsgeom,
568 const Standard_Integer continuity)
570 if (continuity < 1) return continuity;
571 Standard_Boolean isC1 = Standard_True, isC2 = Standard_True;
572 Standard_Integer DegreeU = res->UDegree();
574 Standard_Boolean isModified;
576 isModified = Standard_False;
577 for (Standard_Integer i = res->FirstUKnotIndex()+1; i < res->LastUKnotIndex(); i++)
578 if(DegreeU - res->UMultiplicity(i) < continuity) {
579 if (continuity >= 2) {
580 if (!res->RemoveUKnot(i, DegreeU-2, epsgeom)) {
581 isC2 = Standard_False;
582 Standard_Boolean locOK = res->RemoveUKnot(i, DegreeU-1, epsgeom); // is C1 ?
587 isModified = Standard_True;
590 Standard_Boolean locOK = res->RemoveUKnot(i, DegreeU-1, epsgeom); // is C1 ?
598 Standard_Integer DegreeV = res->VDegree();
600 isModified = Standard_False;
601 for (Standard_Integer i = res->FirstVKnotIndex()+1; i < res->LastVKnotIndex(); i++)
602 if(DegreeV - res->VMultiplicity(i) < continuity) {
603 if (continuity >= 2) {
604 if (!res->RemoveVKnot(i, DegreeV-2, epsgeom)) {
605 isC2 = Standard_False;
606 Standard_Boolean locOK = res->RemoveVKnot(i, DegreeV-1, epsgeom); // is C1 ?
611 isModified = Standard_True;
614 Standard_Boolean locOK = res->RemoveVKnot(i, DegreeV-1, epsgeom); // is C1 ?
623 while (--i > j) { // from 2 to NbKnots-1
624 if (continuity >= 2) {
625 if (!res->RemoveUKnot(i, DegreeU-2, epsgeom)) { // is C2 ?
626 isC2 = Standard_False;
627 isC1 &= res->RemoveUKnot(i, DegreeU-1, epsgeom); // is C1 ?
631 isC1 &= res->RemoveUKnot(i, DegreeU-1, epsgeom); // is C1 ?
635 i = res->LastVKnotIndex(); //knots.Upper();
636 j = res->FirstVKnotIndex(); //knots.Lower();
637 Standard_Integer DegreeV = res->VDegree();
638 while (--i > j) { // from 2 to NbKnots-1
639 if (continuity >= 2) {
640 if (!res->RemoveVKnot(i, DegreeV-2, epsgeom)) { // is C2 ?
641 isC2 = Standard_False;
642 isC1 &= res->RemoveVKnot(i, DegreeV-1, epsgeom); // is C1 ?
646 isC1 &= res->RemoveVKnot(i, DegreeV-1, epsgeom); // is C1 ?
652 if (continuity >= 2 && !isC2) return 1;