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);
354 for (i=Coef.LowerRow(); i<=Coef.UpperRow(); i++) {
356 for (j=Coef.LowerCol(); j<=Coef.UpperCol(); j++) {
357 Standard_Integer PolyIndex = i + 4*(j-1);
359 aPoint.SetCoord(XPoly->Value(PolyIndex)*ParamU*ParamV,
360 YPoly->Value(PolyIndex)*ParamU*ParamV,
361 ZPoly->Value(PolyIndex)*ParamU*ParamV);
362 Coef.SetValue(i, j, aPoint);
363 ParamV = ParamV *deltaV(VSeg);
365 ParamU = ParamU * deltaU(USeg);
367 PLib::CoefficientsPoles(Coef,PLib::NoWeights2(),BzPole,PLib::NoWeights2());
369 // C0 check and correction for poles lying on isoparametrics U=0 & V=0
370 Standard_Integer iBsPole = BsPole.LowerRow() + (USeg-1)*DegreeU;
371 Standard_Integer jBsPole = BsPole.LowerCol();
372 iBz = BzPole.LowerRow();
373 for (jBz=BzPole.LowerCol(); jBz<=BzPole.UpperCol(); jBz++) {
374 if (!BzPole.Value(iBz,jBz).IsEqual(BsPole.Value(iBsPole,jBsPole), epsgeom)) {
375 wasC0=Standard_False;
377 Standard_Real XCoord =
378 0.5 * (BzPole.Value(iBz,jBz).X() + BsPole.Value(iBsPole,jBsPole).X());
379 Standard_Real YCoord =
380 0.5 * (BzPole.Value(iBz,jBz).Y() + BsPole.Value(iBsPole,jBsPole).Y());
381 Standard_Real ZCoord =
382 0.5 * (BzPole.Value(iBz,jBz).Z() + BsPole.Value(iBsPole,jBsPole).Z());
383 MidPoint.SetCoord(XCoord, YCoord, ZCoord);
384 BsPole.SetValue(iBsPole, jBsPole++, MidPoint);
387 BsPole.SetValue(iBsPole, jBsPole++, BzPole.Value(iBz,jBz));
391 // Other poles (no check about C0) :
393 jBsPole = BsPole.LowerCol();
394 for (iBz=BzPole.LowerRow()+1; iBz<=BzPole.UpperRow(); iBz++) {
395 for (jBz=BzPole.LowerCol(); jBz<=BzPole.UpperCol(); jBz++)
396 BsPole.SetValue(iBsPole, jBsPole++, BzPole.Value(iBz,jBz));
398 jBsPole = BsPole.LowerCol();
404 // Patches (1, 1<VSeg<NbVSeg)
405 // ==========================
408 for (VSeg=2; VSeg <= NbVSeg; VSeg++) {
409 XPoly = st->XPolynomial(USeg, VSeg);
410 YPoly = st->YPolynomial(USeg, VSeg);
411 ZPoly = st->ZPolynomial(USeg, VSeg);
413 for (i=Coef.LowerRow(); i<=Coef.UpperRow(); i++) {
415 for (j=Coef.LowerCol(); j<=Coef.UpperCol(); j++) {
416 Standard_Integer PolyIndex = i + 4*(j-1);
418 aPoint.SetCoord(XPoly->Value(PolyIndex)*ParamU*ParamV,
419 YPoly->Value(PolyIndex)*ParamU*ParamV,
420 ZPoly->Value(PolyIndex)*ParamU*ParamV);
421 Coef.SetValue(i, j, aPoint);
422 ParamV = ParamV *deltaV(VSeg);
424 ParamU = ParamU * deltaU(USeg);
426 PLib::CoefficientsPoles(Coef,PLib::NoWeights2(),BzPole,PLib::NoWeights2());
428 // C0 check and correction for poles lying on isoparametrics U=0 & V=0
429 iBs = BsPole.LowerRow();
430 jBs = BsPole.LowerCol() + (VSeg-1)*DegreeV;
431 jBz = BzPole.LowerCol();
432 for (iBz=BzPole.LowerRow(); iBz<=BzPole.UpperRow(); iBz++) {
433 if (!BzPole.Value(iBz,jBz).IsEqual(BsPole.Value(iBs,jBs), epsgeom)) {
434 wasC0=Standard_False;
436 Standard_Real XCoord = 0.5 *
437 (BzPole.Value(iBz,jBz).X() + BsPole.Value(iBs,jBs).X());
438 Standard_Real YCoord = 0.5 *
439 (BzPole.Value(iBz,jBz).Y() + BsPole.Value(iBs,jBs).Y());
440 Standard_Real ZCoord = 0.5 *
441 (BzPole.Value(iBz,jBz).Z() + BsPole.Value(iBs,jBs).Z());
442 MidPoint.SetCoord(XCoord, YCoord, ZCoord);
443 BsPole.SetValue(iBs++, jBs, MidPoint);
446 BsPole.SetValue(iBs++, jBs, BzPole.Value(iBz,jBz));
451 iBs = BsPole.LowerRow();
452 for (jBz=BzPole.LowerCol()+1; jBz<=BzPole.UpperCol(); jBz++) {
453 for (iBz=BzPole.LowerRow(); iBz<=BzPole.UpperRow(); iBz++)
454 BsPole.SetValue(iBs++, jBs, BzPole.Value(iBz,jBz));
455 iBs = BsPole.LowerRow();
461 // Patches (1<USeg<NbUSeg, 1<VSeg<NbVSeg)
462 // ======================================
464 for (VSeg=2; VSeg <= NbVSeg; VSeg++) {
465 for (USeg=2; USeg <= NbUSeg; USeg++) {
466 XPoly = st->XPolynomial(USeg, VSeg);
467 YPoly = st->YPolynomial(USeg, VSeg);
468 ZPoly = st->ZPolynomial(USeg, VSeg);
470 for (i=Coef.LowerRow(); i<=Coef.UpperRow(); i++) {
472 for (j=Coef.LowerCol(); j<=Coef.UpperCol(); j++) {
473 Standard_Integer PolyIndex = i + 4*(j-1);
475 aPoint.SetCoord(XPoly->Value(PolyIndex)*ParamU*ParamV,
476 YPoly->Value(PolyIndex)*ParamU*ParamV,
477 ZPoly->Value(PolyIndex)*ParamU*ParamV);
478 Coef.SetValue(i, j, aPoint);
479 ParamV = ParamV *deltaV(VSeg);
481 ParamU = ParamU * deltaU(USeg);
483 PLib::CoefficientsPoles(Coef,PLib::NoWeights2(),BzPole,PLib::NoWeights2());
485 // C0 check and correction for poles lying on isoparametrics U=0 & V=0
486 iBs = (USeg-1)*DegreeU + BsPole.LowerRow();
487 jBs = (VSeg-1)*DegreeV + BsPole.LowerCol();
488 jBz = BzPole.LowerCol();
489 for (iBz=BzPole.LowerRow(); iBz<=BzPole.UpperRow(); iBz++) {
490 if (!BzPole.Value(iBz,jBz).IsEqual(BsPole.Value(iBs,jBs), epsgeom)) {
491 wasC0=Standard_False;
493 Standard_Real XCoord = 0.5 *
494 (BzPole.Value(iBz,jBz).X() + BsPole.Value(iBs,jBs).X());
495 Standard_Real YCoord = 0.5 *
496 (BzPole.Value(iBz,jBz).Y() + BsPole.Value(iBs,jBs).Y());
497 Standard_Real ZCoord = 0.5 *
498 (BzPole.Value(iBz,jBz).Z() + BsPole.Value(iBs,jBs).Z());
499 MidPoint.SetCoord(XCoord, YCoord, ZCoord);
500 BsPole.SetValue(iBs++, jBs, MidPoint);
503 BsPole.SetValue(iBs++, jBs, BzPole.Value(iBz,jBz));
506 iBs = (USeg-1)*DegreeU + BsPole.LowerRow();
507 iBz = BzPole.LowerRow();
508 for (jBz=BzPole.LowerCol(); jBz<=BzPole.UpperCol(); jBz++) {
509 // C0 check and correction for poles lying on isoparametrics U=0 & V=0
510 if (!BzPole.Value(iBz,jBz).IsEqual(BsPole.Value(iBs,jBs), epsgeom)) {
511 wasC0=Standard_False;
513 Standard_Real XCoord = 0.5 *
514 (BzPole.Value(iBz,jBz).X() + BsPole.Value(iBs,jBs).X());
515 Standard_Real YCoord = 0.5 *
516 (BzPole.Value(iBz,jBz).Y() + BsPole.Value(iBs,jBs).Y());
517 Standard_Real ZCoord = 0.5 *
518 (BzPole.Value(iBz,jBz).Z() + BsPole.Value(iBs,jBs).Z());
519 MidPoint.SetCoord(XCoord, YCoord, ZCoord);
520 BsPole.SetValue(iBs, jBs++, MidPoint);
523 BsPole.SetValue(iBs, jBs++, BzPole.Value(iBz,jBz));
526 iBs = BsPole.LowerRow() + (USeg-1)*DegreeU + 1;
527 jBs = BsPole.LowerCol() + (VSeg-1)*DegreeV + 1;
528 for (iBz=BzPole.LowerRow()+1; iBz<=BzPole.UpperRow(); iBz++) {
529 for (jBz=BzPole.LowerCol()+1; jBz<=BzPole.UpperCol(); jBz++)
530 BsPole.SetValue(iBs, jBs++, BzPole.Value(iBz,jBz));
531 jBs = BsPole.LowerCol() + (VSeg-1)*DegreeV + 1;
537 // Building result taking into account transformation if any :
538 // ===========================================================
540 if (st->HasTransf()) {
541 gp_GTrsf GSplTrsf(st->CompoundLocation());
543 Standard_Real epsilon = 1.E-04;
544 if (IGESData_ToolLocation::ConvertLocation(epsilon,GSplTrsf,SplTrsf))
545 for (iBs=BsPole.LowerRow(); iBs<=BsPole.UpperRow(); iBs++)
546 for (jBs=BsPole.LowerCol(); jBs<=BsPole.UpperCol(); jBs++)
547 BsPole.SetValue(iBs, jBs, BsPole.Value(iBs,jBs).Transformed(SplTrsf));
549 // AddWarning(start, "Transformation skipped : Not a similarity");
552 res = new Geom_BSplineSurface
553 (BsPole, UKnot, VKnot, UMult, VMult, DegreeU, DegreeV);
554 if (wasC0) returned += 1;
559 //=======================================================================
560 //function : IGESConvGeom::IncreaseSurfaceContinuity
562 //=======================================================================
563 Standard_Integer IGESConvGeom::IncreaseSurfaceContinuity (const Handle(Geom_BSplineSurface)& res,
564 const Standard_Real epsgeom,
565 const Standard_Integer continuity)
567 if (continuity < 1) return continuity;
568 Standard_Boolean isC1 = Standard_True, isC2 = Standard_True;
569 Standard_Integer DegreeU = res->UDegree();
571 Standard_Boolean isModified;
573 isModified = Standard_False;
574 for (Standard_Integer i = res->FirstUKnotIndex()+1; i < res->LastUKnotIndex(); i++)
575 if(DegreeU - res->UMultiplicity(i) < continuity) {
576 if (continuity >= 2) {
577 if (!res->RemoveUKnot(i, DegreeU-2, epsgeom)) {
578 isC2 = Standard_False;
579 Standard_Boolean locOK = res->RemoveUKnot(i, DegreeU-1, epsgeom); // is C1 ?
584 isModified = Standard_True;
587 Standard_Boolean locOK = res->RemoveUKnot(i, DegreeU-1, epsgeom); // is C1 ?
595 Standard_Integer DegreeV = res->VDegree();
597 isModified = Standard_False;
598 for (Standard_Integer i = res->FirstVKnotIndex()+1; i < res->LastVKnotIndex(); i++)
599 if(DegreeV - res->VMultiplicity(i) < continuity) {
600 if (continuity >= 2) {
601 if (!res->RemoveVKnot(i, DegreeV-2, epsgeom)) {
602 isC2 = Standard_False;
603 Standard_Boolean locOK = res->RemoveVKnot(i, DegreeV-1, epsgeom); // is C1 ?
608 isModified = Standard_True;
611 Standard_Boolean locOK = res->RemoveVKnot(i, DegreeV-1, epsgeom); // is C1 ?
620 while (--i > j) { // from 2 to NbKnots-1
621 if (continuity >= 2) {
622 if (!res->RemoveUKnot(i, DegreeU-2, epsgeom)) { // is C2 ?
623 isC2 = Standard_False;
624 isC1 &= res->RemoveUKnot(i, DegreeU-1, epsgeom); // is C1 ?
628 isC1 &= res->RemoveUKnot(i, DegreeU-1, epsgeom); // is C1 ?
632 i = res->LastVKnotIndex(); //knots.Upper();
633 j = res->FirstVKnotIndex(); //knots.Lower();
634 Standard_Integer DegreeV = res->VDegree();
635 while (--i > j) { // from 2 to NbKnots-1
636 if (continuity >= 2) {
637 if (!res->RemoveVKnot(i, DegreeV-2, epsgeom)) { // is C2 ?
638 isC2 = Standard_False;
639 isC1 &= res->RemoveVKnot(i, DegreeV-1, epsgeom); // is C1 ?
643 isC1 &= res->RemoveVKnot(i, DegreeV-1, epsgeom); // is C1 ?
649 if (continuity >= 2 && !isC2) return 1;