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
9 // under the terms of the GNU Lesser General Public 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 <IGESConvGeom.ixx>
25 #include <IGESData_ToolLocation.hxx>
27 #include <BSplCLib.hxx>
29 #include <BSplSLib.hxx>
31 #include <gp_GTrsf.hxx>
32 #include <gp_Trsf.hxx>
33 #include <GeomConvert_CompCurveToBSplineCurve.hxx>
36 #include <TColgp_HArray1OfPnt.hxx>
37 #include <TColgp_HArray2OfPnt.hxx>
39 #include <TColStd_Array1OfInteger.hxx>
40 #include <TColStd_Array1OfReal.hxx>
41 #include <TColStd_HArray1OfReal.hxx>
45 //=======================================================================
46 //function : IGESConvGeom::SplineCurveFromIGES
48 //=======================================================================
49 Standard_Integer IGESConvGeom::SplineCurveFromIGES
50 (const Handle(IGESGeom_SplineCurve)& st,
51 const Standard_Real /*epscoef*/, const Standard_Real epsgeom,
52 Handle(Geom_BSplineCurve)& res)
54 Standard_Integer returned = 0;
56 // on recupere le degre
57 Standard_Integer degree = st->SplineType();
58 if (degree > 3) degree = 3;
60 // on recupere le nombre de segments.
61 Standard_Integer nbSegs = st->NbSegments();
62 if (nbSegs < 1) return 5; // FAIL : no segment
64 Standard_Integer nbKnots = nbSegs+1;
66 // Array of multiplicities.
67 TColStd_Array1OfInteger multi(1, nbKnots);
69 multi.SetValue(multi.Lower(), degree+1);
70 multi.SetValue(multi.Upper(), degree+1);
73 TColStd_Array1OfReal knots(1, nbKnots);
74 TColStd_Array1OfReal delta(1, nbSegs);
75 Standard_Integer i; // svv Jan 10 2000 : porting on DEC
76 for (i = 1; i<= nbKnots; i++)
77 knots.SetValue(i, st->BreakPoint(i));
79 for (i = 1; i <= nbSegs; i++)
80 delta.SetValue(i, st->BreakPoint(i+1) - st->BreakPoint(i));
82 TColgp_Array1OfPnt bspoles(1, nbSegs*degree+1);
83 Standard_Integer ibspole = bspoles.Lower()-1; // Bspole Index.
84 // il faut reparametrer avant de passer dans PLib.
85 // on est entre[0, T(i+1)-T(i)] et on veut [0,1]
87 for (i = 1; i <= nbSegs; i++) {
88 Standard_Real AX,BX,CX,DX,AY,BY,CY,DY,AZ,BZ,CZ,DZ;
89 st->XCoordPolynomial(i, AX, BX, CX, DX);
90 st->YCoordPolynomial(i, AY, BY, CY, DY);
91 st->ZCoordPolynomial(i, AZ, BZ, CZ, DZ);
92 if (st->NbDimensions() == 2 ) BZ=0.,CZ=0.,DZ=0.;
93 Standard_Real Di = delta(i);
94 Standard_Real Di2 = delta(i)*delta(i);
95 Standard_Real Di3 = delta(i)*delta(i)*delta(i);
97 TColgp_Array1OfPnt coeff(0, degree);
100 coeff.SetValue(coeff.Lower()+3, gp_Pnt(DX*Di3, DY*Di3, DZ*Di3));
102 coeff.SetValue(coeff.Lower()+2, gp_Pnt(CX*Di2, CY*Di2, CZ*Di2));
104 coeff.SetValue(coeff.Lower()+1, gp_Pnt(BX*Di, BY*Di, BZ*Di));
105 coeff.SetValue(coeff.Lower()+0, gp_Pnt(AX, AY, AZ));
112 TColgp_Array1OfPnt bzpoles(0, degree);
113 PLib::CoefficientsPoles(coeff,PLib::NoWeights(),bzpoles,PLib::NoWeights());
116 // Not to check the first pole of the first segment.
117 if (ibspole > bspoles.Lower()) {
118 Standard_Integer bzlow = bzpoles.Lower();
119 if (!(bspoles.Value(ibspole).IsEqual(bzpoles.Value(bzlow), epsgeom))) {
121 // Medium point computing.
122 bspoles.SetValue (ibspole,
123 gp_Pnt((bspoles.Value(ibspole).X() + bzpoles.Value(bzlow).X())/2.,
124 (bspoles.Value(ibspole).Y() + bzpoles.Value(bzlow).Y())/2.,
125 (bspoles.Value(ibspole).Z() + bzpoles.Value(bzlow).Z())/2.));
128 if (i == 1) bspoles.SetValue(++ibspole, bzpoles.Value(bzpoles.Lower()));
130 for (Standard_Integer j = bzpoles.Lower()+1; j <= bzpoles.Upper(); j++)
131 bspoles.SetValue(++ibspole, bzpoles.Value(j));
133 if (ibspole != bspoles.Upper()) {
135 return 3; // FAIL : Error during creation of control points
138 // Building result taking into account transformation if any :
139 // ===========================================================
141 //%13 pdn 12.02.99 USA60293
142 // if (st->HasTransf()) {
144 // Standard_Real epsilon = 1.E-04;
145 // if (IGESData_ToolLocation::ConvertLocation
146 // (epsilon,st->CompoundLocation(),trsf)) {
147 // for (Standard_Integer i = bspoles.Lower(); i <= bspoles.Upper(); i++)
148 // bspoles.SetValue(i, bspoles.Value(i).Transformed(trsf));
151 // AddFail(st, "Transformation : not a similarity");
153 res = new Geom_BSplineCurve (bspoles, knots, multi, degree);
154 // GeomConvert_CompCurveToBSplineCurve CompCurve =
155 // GeomConvert_CompCurveToBSplineCurve(res);
156 // res = CompCurve.BSplineCurve();
162 //=======================================================================
163 //function : IGESConvGeom::IncreaseCurveContinuity
165 //=======================================================================
166 Standard_Integer IGESConvGeom::IncreaseCurveContinuity (const Handle(Geom_BSplineCurve)& res,
167 const Standard_Real epsgeom,
168 const Standard_Integer continuity)
170 if (continuity < 1) return continuity;
171 Standard_Boolean isC1 = Standard_True, isC2 = Standard_True;
172 Standard_Integer degree = res->Degree();
175 Standard_Boolean isModified;
177 isModified = Standard_False;
178 for (Standard_Integer i = res->FirstUKnotIndex()+1; i < res->LastUKnotIndex(); i++)
179 if(degree - res->Multiplicity(i) < continuity) {
180 if (continuity >= 2) {
181 if (!res->RemoveKnot(i, degree-2, epsgeom)) {
182 isC2 = Standard_False;
183 Standard_Boolean locOK = res->RemoveKnot(i, degree-1, epsgeom); // is C1 ?
188 isModified = Standard_True;
191 Standard_Boolean locOK = res->RemoveKnot(i, degree-1, epsgeom); // is C1 ?
200 if (continuity >= 2 && !isC2) return 1;
204 //=======================================================================
205 //function : IncreaseCurveContinuity
207 //=======================================================================
209 Standard_Integer IGESConvGeom::IncreaseCurveContinuity (const Handle(Geom2d_BSplineCurve)& res,
210 const Standard_Real epsgeom,
211 const Standard_Integer continuity)
213 if (continuity < 1) return continuity;
214 Standard_Boolean isC1 = Standard_True, isC2 = Standard_True;
215 Standard_Integer degree = res->Degree();
217 Standard_Boolean isModified;
219 isModified = Standard_False;
220 for (Standard_Integer i = res->FirstUKnotIndex()+1; i < res->LastUKnotIndex(); i++)
221 if(degree - res->Multiplicity(i) < continuity) {
222 if (continuity >= 2) {
223 if (!res->RemoveKnot(i, degree-2, epsgeom)) {
224 isC2 = Standard_False;
225 Standard_Boolean locOK = res->RemoveKnot(i, degree-1, epsgeom); // is C1 ?
230 isModified = Standard_True;
233 Standard_Boolean locOK = res->RemoveKnot(i, degree-1, epsgeom); // is C1 ?
242 if (continuity >= 2 && !isC2) return 1;
247 //=======================================================================
248 //function : IGESConvGeom::SplineSurfaceFromIGES
250 //=======================================================================
251 Standard_Integer IGESConvGeom::SplineSurfaceFromIGES
252 (const Handle(IGESGeom_SplineSurface)& st,
253 const Standard_Real /*epscoef*/, const Standard_Real epsgeom,
254 Handle(Geom_BSplineSurface)& res)
256 Standard_Integer returned = 0;
257 Standard_Integer degree = st->BoundaryType();
258 if (degree > 3) degree = 3;
259 Standard_Integer DegreeU = degree;
260 Standard_Integer DegreeV = degree;
262 Standard_Integer NbUSeg = st->NbUSegments();
263 Standard_Integer NbVSeg = st->NbVSegments();
265 if ((NbUSeg < 1) || (NbVSeg < 1)) return 5;
267 // Output BSpline knots & multiplicities arraies for U & V :
268 // =========================================================
270 TColStd_Array1OfReal UKnot(1,NbUSeg+1);
271 TColStd_Array1OfReal VKnot(1,NbVSeg+1);
272 TColStd_Array1OfReal deltaU(1,NbUSeg);
273 TColStd_Array1OfReal deltaV(1,NbVSeg);
275 Standard_Integer i; // svv Jan 10 2000 : porting on DEC
276 for (i=1; i <= NbUSeg+1; i++)
277 UKnot.SetValue(i, st->UBreakPoint(i));
279 for (i=1; i <= NbUSeg; i++)
280 deltaU.SetValue(i, st->UBreakPoint(i+1)- st->UBreakPoint(i));
282 for (i=1; i <= NbVSeg+1; i++)
283 VKnot.SetValue(i, st->VBreakPoint(i));
285 for (i=1; i <= NbVSeg; i++)
286 deltaV.SetValue(i, st->VBreakPoint(i+1)- st->VBreakPoint(i));
288 TColStd_Array1OfInteger UMult(1,NbUSeg+1); UMult.Init(DegreeU);
289 UMult.SetValue(UMult.Lower(),DegreeU+1);
290 UMult.SetValue(UMult.Upper(),DegreeU+1);
292 TColStd_Array1OfInteger VMult(1,NbVSeg+1); VMult.Init(DegreeV);
293 VMult.SetValue(VMult.Lower(),DegreeV+1);
294 VMult.SetValue(VMult.Upper(),DegreeV+1);
300 Standard_Integer NbUPoles = NbUSeg * DegreeU + 1;
301 Standard_Integer NbVPoles = NbVSeg * DegreeV + 1;
303 TColgp_Array2OfPnt BsPole(1, NbUPoles, 1, NbVPoles);
305 Standard_Integer iBs, jBs, iBz, jBz;
306 Standard_Boolean wasC0 = Standard_True;
310 Standard_Integer USeg, VSeg, j;
314 Handle(TColStd_HArray1OfReal) XPoly = st->XPolynomial(USeg, VSeg);
315 Handle(TColStd_HArray1OfReal) YPoly = st->YPolynomial(USeg, VSeg);
316 Handle(TColStd_HArray1OfReal) ZPoly = st->ZPolynomial(USeg, VSeg);
318 TColgp_Array2OfPnt Coef(1, DegreeU+1, 1, DegreeV+1);
319 Standard_Real ParamU, ParamV;
321 for (i=1; i<=DegreeU+1; i++) {
323 for (j=1; j<=DegreeV+1; j++) {
324 Standard_Integer PolyIndex = i + 4*(j-1);
325 gp_Pnt aPoint(XPoly->Value(PolyIndex)*ParamU*ParamV,
326 YPoly->Value(PolyIndex)*ParamU*ParamV,
327 ZPoly->Value(PolyIndex)*ParamU*ParamV);
328 Coef.SetValue(i, j, aPoint);
329 ParamV = ParamV *deltaV(VSeg);
331 ParamU = ParamU * deltaU(USeg);
333 TColgp_Array2OfPnt BzPole(1, DegreeU+1, 1, DegreeV+1);
334 PLib::CoefficientsPoles(Coef,PLib::NoWeights2(),BzPole,PLib::NoWeights2());
336 iBs = BsPole.LowerRow();
337 jBs = BsPole.LowerCol();
339 // Making output BSpline poles array :
340 for (iBz=BzPole.LowerRow(); iBz<=BzPole.UpperRow(); iBz++) {
341 for (jBz=BzPole.LowerCol(); jBz<=BzPole.UpperCol(); jBz++)
342 BsPole.SetValue(iBs, jBs++, BzPole.Value(iBz,jBz));
343 jBs = BsPole.LowerCol();
348 // Patches (1<USeg<NbUSeg, 1)
349 // ==========================
352 for (USeg=2; USeg<=NbUSeg; USeg++) {
353 XPoly = st->XPolynomial(USeg, VSeg);
354 YPoly = st->YPolynomial(USeg, VSeg);
355 ZPoly = st->ZPolynomial(USeg, VSeg);
356 Standard_Real ParamU, ParamV;
358 for (i=Coef.LowerRow(); i<=Coef.UpperRow(); i++) {
360 for (j=Coef.LowerCol(); j<=Coef.UpperCol(); j++) {
361 Standard_Integer PolyIndex = i + 4*(j-1);
363 aPoint.SetCoord(XPoly->Value(PolyIndex)*ParamU*ParamV,
364 YPoly->Value(PolyIndex)*ParamU*ParamV,
365 ZPoly->Value(PolyIndex)*ParamU*ParamV);
366 Coef.SetValue(i, j, aPoint);
367 ParamV = ParamV *deltaV(VSeg);
369 ParamU = ParamU * deltaU(USeg);
371 PLib::CoefficientsPoles(Coef,PLib::NoWeights2(),BzPole,PLib::NoWeights2());
373 // C0 check and correction for poles lying on isoparametrics U=0 & V=0
374 Standard_Integer iBs = BsPole.LowerRow() + (USeg-1)*DegreeU;
375 Standard_Integer jBs = BsPole.LowerCol();
376 iBz = BzPole.LowerRow();
377 for (jBz=BzPole.LowerCol(); jBz<=BzPole.UpperCol(); jBz++) {
378 if (!BzPole.Value(iBz,jBz).IsEqual(BsPole.Value(iBs,jBs), epsgeom)) {
379 wasC0=Standard_False;
381 Standard_Real XCoord =
382 0.5 * (BzPole.Value(iBz,jBz).X() + BsPole.Value(iBs,jBs).X());
383 Standard_Real YCoord =
384 0.5 * (BzPole.Value(iBz,jBz).Y() + BsPole.Value(iBs,jBs).Y());
385 Standard_Real ZCoord =
386 0.5 * (BzPole.Value(iBz,jBz).Z() + BsPole.Value(iBs,jBs).Z());
387 MidPoint.SetCoord(XCoord, YCoord, ZCoord);
388 BsPole.SetValue(iBs, jBs++, MidPoint);
391 BsPole.SetValue(iBs, jBs++, BzPole.Value(iBz,jBz));
395 // Other poles (no check about C0) :
397 jBs = BsPole.LowerCol();
398 for (iBz=BzPole.LowerRow()+1; iBz<=BzPole.UpperRow(); iBz++) {
399 for (jBz=BzPole.LowerCol(); jBz<=BzPole.UpperCol(); jBz++)
400 BsPole.SetValue(iBs, jBs++, BzPole.Value(iBz,jBz));
402 jBs = BsPole.LowerCol();
408 // Patches (1, 1<VSeg<NbVSeg)
409 // ==========================
412 for (VSeg=2; VSeg <= NbVSeg; VSeg++) {
413 XPoly = st->XPolynomial(USeg, VSeg);
414 YPoly = st->YPolynomial(USeg, VSeg);
415 ZPoly = st->ZPolynomial(USeg, VSeg);
416 Standard_Real ParamU, ParamV;
418 for (i=Coef.LowerRow(); i<=Coef.UpperRow(); i++) {
420 for (j=Coef.LowerCol(); j<=Coef.UpperCol(); j++) {
421 Standard_Integer PolyIndex = i + 4*(j-1);
423 aPoint.SetCoord(XPoly->Value(PolyIndex)*ParamU*ParamV,
424 YPoly->Value(PolyIndex)*ParamU*ParamV,
425 ZPoly->Value(PolyIndex)*ParamU*ParamV);
426 Coef.SetValue(i, j, aPoint);
427 ParamV = ParamV *deltaV(VSeg);
429 ParamU = ParamU * deltaU(USeg);
431 PLib::CoefficientsPoles(Coef,PLib::NoWeights2(),BzPole,PLib::NoWeights2());
433 // C0 check and correction for poles lying on isoparametrics U=0 & V=0
434 iBs = BsPole.LowerRow();
435 jBs = BsPole.LowerCol() + (VSeg-1)*DegreeV;
436 jBz = BzPole.LowerCol();
437 for (iBz=BzPole.LowerRow(); iBz<=BzPole.UpperRow(); iBz++) {
438 if (!BzPole.Value(iBz,jBz).IsEqual(BsPole.Value(iBs,jBs), epsgeom)) {
439 wasC0=Standard_False;
441 Standard_Real XCoord = 0.5 *
442 (BzPole.Value(iBz,jBz).X() + BsPole.Value(iBs,jBs).X());
443 Standard_Real YCoord = 0.5 *
444 (BzPole.Value(iBz,jBz).Y() + BsPole.Value(iBs,jBs).Y());
445 Standard_Real ZCoord = 0.5 *
446 (BzPole.Value(iBz,jBz).Z() + BsPole.Value(iBs,jBs).Z());
447 MidPoint.SetCoord(XCoord, YCoord, ZCoord);
448 BsPole.SetValue(iBs++, jBs, MidPoint);
451 BsPole.SetValue(iBs++, jBs, BzPole.Value(iBz,jBz));
456 iBs = BsPole.LowerRow();
457 for (jBz=BzPole.LowerCol()+1; jBz<=BzPole.UpperCol(); jBz++) {
458 for (iBz=BzPole.LowerRow(); iBz<=BzPole.UpperRow(); iBz++)
459 BsPole.SetValue(iBs++, jBs, BzPole.Value(iBz,jBz));
460 iBs = BsPole.LowerRow();
466 // Patches (1<USeg<NbUSeg, 1<VSeg<NbVSeg)
467 // ======================================
469 for (VSeg=2; VSeg <= NbVSeg; VSeg++) {
470 for (USeg=2; USeg <= NbUSeg; USeg++) {
471 XPoly = st->XPolynomial(USeg, VSeg);
472 YPoly = st->YPolynomial(USeg, VSeg);
473 ZPoly = st->ZPolynomial(USeg, VSeg);
474 Standard_Real ParamU, ParamV;
476 for (i=Coef.LowerRow(); i<=Coef.UpperRow(); i++) {
478 for (j=Coef.LowerCol(); j<=Coef.UpperCol(); j++) {
479 Standard_Integer PolyIndex = i + 4*(j-1);
481 aPoint.SetCoord(XPoly->Value(PolyIndex)*ParamU*ParamV,
482 YPoly->Value(PolyIndex)*ParamU*ParamV,
483 ZPoly->Value(PolyIndex)*ParamU*ParamV);
484 Coef.SetValue(i, j, aPoint);
485 ParamV = ParamV *deltaV(VSeg);
487 ParamU = ParamU * deltaU(USeg);
489 PLib::CoefficientsPoles(Coef,PLib::NoWeights2(),BzPole,PLib::NoWeights2());
491 // C0 check and correction for poles lying on isoparametrics U=0 & V=0
492 iBs = (USeg-1)*DegreeU + BsPole.LowerRow();
493 jBs = (VSeg-1)*DegreeV + BsPole.LowerCol();
494 jBz = BzPole.LowerCol();
495 for (iBz=BzPole.LowerRow(); iBz<=BzPole.UpperRow(); iBz++) {
496 if (!BzPole.Value(iBz,jBz).IsEqual(BsPole.Value(iBs,jBs), epsgeom)) {
497 wasC0=Standard_False;
499 Standard_Real XCoord = 0.5 *
500 (BzPole.Value(iBz,jBz).X() + BsPole.Value(iBs,jBs).X());
501 Standard_Real YCoord = 0.5 *
502 (BzPole.Value(iBz,jBz).Y() + BsPole.Value(iBs,jBs).Y());
503 Standard_Real ZCoord = 0.5 *
504 (BzPole.Value(iBz,jBz).Z() + BsPole.Value(iBs,jBs).Z());
505 MidPoint.SetCoord(XCoord, YCoord, ZCoord);
506 BsPole.SetValue(iBs++, jBs, MidPoint);
509 BsPole.SetValue(iBs++, jBs, BzPole.Value(iBz,jBz));
512 iBs = (USeg-1)*DegreeU + BsPole.LowerRow();
513 iBz = BzPole.LowerRow();
514 for (jBz=BzPole.LowerCol(); jBz<=BzPole.UpperCol(); jBz++) {
515 // C0 check and correction for poles lying on isoparametrics U=0 & V=0
516 if (!BzPole.Value(iBz,jBz).IsEqual(BsPole.Value(iBs,jBs), epsgeom)) {
517 wasC0=Standard_False;
519 Standard_Real XCoord = 0.5 *
520 (BzPole.Value(iBz,jBz).X() + BsPole.Value(iBs,jBs).X());
521 Standard_Real YCoord = 0.5 *
522 (BzPole.Value(iBz,jBz).Y() + BsPole.Value(iBs,jBs).Y());
523 Standard_Real ZCoord = 0.5 *
524 (BzPole.Value(iBz,jBz).Z() + BsPole.Value(iBs,jBs).Z());
525 MidPoint.SetCoord(XCoord, YCoord, ZCoord);
526 BsPole.SetValue(iBs, jBs++, MidPoint);
529 BsPole.SetValue(iBs, jBs++, BzPole.Value(iBz,jBz));
532 iBs = BsPole.LowerRow() + (USeg-1)*DegreeU + 1;
533 jBs = BsPole.LowerCol() + (VSeg-1)*DegreeV + 1;
534 for (iBz=BzPole.LowerRow()+1; iBz<=BzPole.UpperRow(); iBz++) {
535 for (jBz=BzPole.LowerCol()+1; jBz<=BzPole.UpperCol(); jBz++)
536 BsPole.SetValue(iBs, jBs++, BzPole.Value(iBz,jBz));
537 jBs = BsPole.LowerCol() + (VSeg-1)*DegreeV + 1;
543 // Building result taking into account transformation if any :
544 // ===========================================================
546 if (st->HasTransf()) {
547 gp_GTrsf GSplTrsf(st->CompoundLocation());
549 Standard_Real epsilon = 1.E-04;
550 if (IGESData_ToolLocation::ConvertLocation(epsilon,GSplTrsf,SplTrsf))
551 for (iBs=BsPole.LowerRow(); iBs<=BsPole.UpperRow(); iBs++)
552 for (jBs=BsPole.LowerCol(); jBs<=BsPole.UpperCol(); jBs++)
553 BsPole.SetValue(iBs, jBs, BsPole.Value(iBs,jBs).Transformed(SplTrsf));
555 // AddWarning(start, "Transformation skipped : Not a similarity");
558 res = new Geom_BSplineSurface
559 (BsPole, UKnot, VKnot, UMult, VMult, DegreeU, DegreeV);
560 if (wasC0) returned += 1;
565 //=======================================================================
566 //function : IGESConvGeom::IncreaseSurfaceContinuity
568 //=======================================================================
569 Standard_Integer IGESConvGeom::IncreaseSurfaceContinuity (const Handle(Geom_BSplineSurface)& res,
570 const Standard_Real epsgeom,
571 const Standard_Integer continuity)
573 if (continuity < 1) return continuity;
574 Standard_Boolean isC1 = Standard_True, isC2 = Standard_True;
575 Standard_Integer DegreeU = res->UDegree();
577 Standard_Boolean isModified;
579 isModified = Standard_False;
580 for (Standard_Integer i = res->FirstUKnotIndex()+1; i < res->LastUKnotIndex(); i++)
581 if(DegreeU - res->UMultiplicity(i) < continuity) {
582 if (continuity >= 2) {
583 if (!res->RemoveUKnot(i, DegreeU-2, epsgeom)) {
584 isC2 = Standard_False;
585 Standard_Boolean locOK = res->RemoveUKnot(i, DegreeU-1, epsgeom); // is C1 ?
590 isModified = Standard_True;
593 Standard_Boolean locOK = res->RemoveUKnot(i, DegreeU-1, epsgeom); // is C1 ?
601 Standard_Integer DegreeV = res->VDegree();
603 isModified = Standard_False;
604 for (Standard_Integer i = res->FirstVKnotIndex()+1; i < res->LastVKnotIndex(); i++)
605 if(DegreeV - res->VMultiplicity(i) < continuity) {
606 if (continuity >= 2) {
607 if (!res->RemoveVKnot(i, DegreeV-2, epsgeom)) {
608 isC2 = Standard_False;
609 Standard_Boolean locOK = res->RemoveVKnot(i, DegreeV-1, epsgeom); // is C1 ?
614 isModified = Standard_True;
617 Standard_Boolean locOK = res->RemoveVKnot(i, DegreeV-1, epsgeom); // is C1 ?
626 while (--i > j) { // from 2 to NbKnots-1
627 if (continuity >= 2) {
628 if (!res->RemoveUKnot(i, DegreeU-2, epsgeom)) { // is C2 ?
629 isC2 = Standard_False;
630 isC1 &= res->RemoveUKnot(i, DegreeU-1, epsgeom); // is C1 ?
634 isC1 &= res->RemoveUKnot(i, DegreeU-1, epsgeom); // is C1 ?
638 i = res->LastVKnotIndex(); //knots.Upper();
639 j = res->FirstVKnotIndex(); //knots.Lower();
640 Standard_Integer DegreeV = res->VDegree();
641 while (--i > j) { // from 2 to NbKnots-1
642 if (continuity >= 2) {
643 if (!res->RemoveVKnot(i, DegreeV-2, epsgeom)) { // is C2 ?
644 isC2 = Standard_False;
645 isC1 &= res->RemoveVKnot(i, DegreeV-1, epsgeom); // is C1 ?
649 isC1 &= res->RemoveVKnot(i, DegreeV-1, epsgeom); // is C1 ?
655 if (continuity >= 2 && !isC2) return 1;