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));
100 coeff.SetValue(coeff.Lower()+2, gp_Pnt(CX*Di2, CY*Di2, CZ*Di2));
103 coeff.SetValue(coeff.Lower()+1, gp_Pnt(BX*Di, BY*Di, BZ*Di));
104 coeff.SetValue(coeff.Lower()+0, gp_Pnt(AX, AY, AZ));
111 TColgp_Array1OfPnt bzpoles(0, degree);
112 PLib::CoefficientsPoles(coeff,PLib::NoWeights(),bzpoles,PLib::NoWeights());
115 // Not to check the first pole of the first segment.
116 if (ibspole > bspoles.Lower()) {
117 Standard_Integer bzlow = bzpoles.Lower();
118 if (!(bspoles.Value(ibspole).IsEqual(bzpoles.Value(bzlow), epsgeom))) {
120 // Medium point computing.
121 bspoles.SetValue (ibspole,
122 gp_Pnt((bspoles.Value(ibspole).X() + bzpoles.Value(bzlow).X())/2.,
123 (bspoles.Value(ibspole).Y() + bzpoles.Value(bzlow).Y())/2.,
124 (bspoles.Value(ibspole).Z() + bzpoles.Value(bzlow).Z())/2.));
127 if (i == 1) bspoles.SetValue(++ibspole, bzpoles.Value(bzpoles.Lower()));
129 for (Standard_Integer j = bzpoles.Lower()+1; j <= bzpoles.Upper(); j++)
130 bspoles.SetValue(++ibspole, bzpoles.Value(j));
132 if (ibspole != bspoles.Upper()) {
134 return 3; // FAIL : Error during creation of control points
137 // Building result taking into account transformation if any :
138 // ===========================================================
140 //%13 pdn 12.02.99 USA60293
141 // if (st->HasTransf()) {
143 // Standard_Real epsilon = 1.E-04;
144 // if (IGESData_ToolLocation::ConvertLocation
145 // (epsilon,st->CompoundLocation(),trsf)) {
146 // for (Standard_Integer i = bspoles.Lower(); i <= bspoles.Upper(); i++)
147 // bspoles.SetValue(i, bspoles.Value(i).Transformed(trsf));
150 // AddFail(st, "Transformation : not a similarity");
152 res = new Geom_BSplineCurve (bspoles, knots, multi, degree);
153 // GeomConvert_CompCurveToBSplineCurve CompCurve =
154 // GeomConvert_CompCurveToBSplineCurve(res);
155 // res = CompCurve.BSplineCurve();
161 //=======================================================================
162 //function : IGESConvGeom::IncreaseCurveContinuity
164 //=======================================================================
165 Standard_Integer IGESConvGeom::IncreaseCurveContinuity (const Handle(Geom_BSplineCurve)& res,
166 const Standard_Real epsgeom,
167 const Standard_Integer continuity)
169 if (continuity < 1) return continuity;
170 Standard_Boolean isC1 = Standard_True, isC2 = Standard_True;
171 Standard_Integer degree = res->Degree();
174 Standard_Boolean isModified;
176 isModified = Standard_False;
177 for (Standard_Integer i = res->FirstUKnotIndex()+1; i < res->LastUKnotIndex(); i++)
178 if(degree - res->Multiplicity(i) < continuity) {
179 if (continuity >= 2) {
180 if (!res->RemoveKnot(i, degree-2, epsgeom)) {
181 isC2 = Standard_False;
182 Standard_Boolean locOK = res->RemoveKnot(i, degree-1, epsgeom); // is C1 ?
187 isModified = Standard_True;
190 Standard_Boolean locOK = res->RemoveKnot(i, degree-1, epsgeom); // is C1 ?
199 if (continuity >= 2 && !isC2) return 1;
203 //=======================================================================
204 //function : IncreaseCurveContinuity
206 //=======================================================================
208 Standard_Integer IGESConvGeom::IncreaseCurveContinuity (const Handle(Geom2d_BSplineCurve)& res,
209 const Standard_Real epsgeom,
210 const Standard_Integer continuity)
212 if (continuity < 1) return continuity;
213 Standard_Boolean isC1 = Standard_True, isC2 = Standard_True;
214 Standard_Integer degree = res->Degree();
216 Standard_Boolean isModified;
218 isModified = Standard_False;
219 for (Standard_Integer i = res->FirstUKnotIndex()+1; i < res->LastUKnotIndex(); i++)
220 if(degree - res->Multiplicity(i) < continuity) {
221 if (continuity >= 2) {
222 if (!res->RemoveKnot(i, degree-2, epsgeom)) {
223 isC2 = Standard_False;
224 Standard_Boolean locOK = res->RemoveKnot(i, degree-1, epsgeom); // is C1 ?
229 isModified = Standard_True;
232 Standard_Boolean locOK = res->RemoveKnot(i, degree-1, epsgeom); // is C1 ?
241 if (continuity >= 2 && !isC2) return 1;
246 //=======================================================================
247 //function : IGESConvGeom::SplineSurfaceFromIGES
249 //=======================================================================
250 Standard_Integer IGESConvGeom::SplineSurfaceFromIGES
251 (const Handle(IGESGeom_SplineSurface)& st,
252 const Standard_Real /*epscoef*/, const Standard_Real epsgeom,
253 Handle(Geom_BSplineSurface)& res)
255 Standard_Integer returned = 0;
256 Standard_Integer degree = st->BoundaryType();
257 if (degree > 3) degree = 3;
258 Standard_Integer DegreeU = degree;
259 Standard_Integer DegreeV = degree;
261 Standard_Integer NbUSeg = st->NbUSegments();
262 Standard_Integer NbVSeg = st->NbVSegments();
264 if ((NbUSeg < 1) || (NbVSeg < 1)) return 5;
266 // Output BSpline knots & multiplicities arraies for U & V :
267 // =========================================================
269 TColStd_Array1OfReal UKnot(1,NbUSeg+1);
270 TColStd_Array1OfReal VKnot(1,NbVSeg+1);
271 TColStd_Array1OfReal deltaU(1,NbUSeg);
272 TColStd_Array1OfReal deltaV(1,NbVSeg);
274 Standard_Integer i; // svv Jan 10 2000 : porting on DEC
275 for (i=1; i <= NbUSeg+1; i++)
276 UKnot.SetValue(i, st->UBreakPoint(i));
278 for (i=1; i <= NbUSeg; i++)
279 deltaU.SetValue(i, st->UBreakPoint(i+1)- st->UBreakPoint(i));
281 for (i=1; i <= NbVSeg+1; i++)
282 VKnot.SetValue(i, st->VBreakPoint(i));
284 for (i=1; i <= NbVSeg; i++)
285 deltaV.SetValue(i, st->VBreakPoint(i+1)- st->VBreakPoint(i));
287 TColStd_Array1OfInteger UMult(1,NbUSeg+1); UMult.Init(DegreeU);
288 UMult.SetValue(UMult.Lower(),DegreeU+1);
289 UMult.SetValue(UMult.Upper(),DegreeU+1);
291 TColStd_Array1OfInteger VMult(1,NbVSeg+1); VMult.Init(DegreeV);
292 VMult.SetValue(VMult.Lower(),DegreeV+1);
293 VMult.SetValue(VMult.Upper(),DegreeV+1);
299 Standard_Integer NbUPoles = NbUSeg * DegreeU + 1;
300 Standard_Integer NbVPoles = NbVSeg * DegreeV + 1;
302 TColgp_Array2OfPnt BsPole(1, NbUPoles, 1, NbVPoles);
304 Standard_Integer iBs, jBs, iBz, jBz;
305 Standard_Boolean wasC0 = Standard_True;
309 Standard_Integer USeg, VSeg, j;
313 Handle(TColStd_HArray1OfReal) XPoly = st->XPolynomial(USeg, VSeg);
314 Handle(TColStd_HArray1OfReal) YPoly = st->YPolynomial(USeg, VSeg);
315 Handle(TColStd_HArray1OfReal) ZPoly = st->ZPolynomial(USeg, VSeg);
317 TColgp_Array2OfPnt Coef(1, DegreeU+1, 1, DegreeV+1);
318 Standard_Real ParamU, ParamV;
320 for (i=1; i<=DegreeU+1; i++) {
322 for (j=1; j<=DegreeV+1; j++) {
323 Standard_Integer PolyIndex = i + 4*(j-1);
324 gp_Pnt aPoint(XPoly->Value(PolyIndex)*ParamU*ParamV,
325 YPoly->Value(PolyIndex)*ParamU*ParamV,
326 ZPoly->Value(PolyIndex)*ParamU*ParamV);
327 Coef.SetValue(i, j, aPoint);
328 ParamV = ParamV *deltaV(VSeg);
330 ParamU = ParamU * deltaU(USeg);
332 TColgp_Array2OfPnt BzPole(1, DegreeU+1, 1, DegreeV+1);
333 PLib::CoefficientsPoles(Coef,PLib::NoWeights2(),BzPole,PLib::NoWeights2());
335 iBs = BsPole.LowerRow();
336 jBs = BsPole.LowerCol();
338 // Making output BSpline poles array :
339 for (iBz=BzPole.LowerRow(); iBz<=BzPole.UpperRow(); iBz++) {
340 for (jBz=BzPole.LowerCol(); jBz<=BzPole.UpperCol(); jBz++)
341 BsPole.SetValue(iBs, jBs++, BzPole.Value(iBz,jBz));
342 jBs = BsPole.LowerCol();
347 // Patches (1<USeg<NbUSeg, 1)
348 // ==========================
351 for (USeg=2; USeg<=NbUSeg; USeg++) {
352 XPoly = st->XPolynomial(USeg, VSeg);
353 YPoly = st->YPolynomial(USeg, VSeg);
354 ZPoly = st->ZPolynomial(USeg, VSeg);
356 for (i=Coef.LowerRow(); i<=Coef.UpperRow(); i++) {
358 for (j=Coef.LowerCol(); j<=Coef.UpperCol(); j++) {
359 Standard_Integer PolyIndex = i + 4*(j-1);
361 aPoint.SetCoord(XPoly->Value(PolyIndex)*ParamU*ParamV,
362 YPoly->Value(PolyIndex)*ParamU*ParamV,
363 ZPoly->Value(PolyIndex)*ParamU*ParamV);
364 Coef.SetValue(i, j, aPoint);
365 ParamV = ParamV *deltaV(VSeg);
367 ParamU = ParamU * deltaU(USeg);
369 PLib::CoefficientsPoles(Coef,PLib::NoWeights2(),BzPole,PLib::NoWeights2());
371 // C0 check and correction for poles lying on isoparametrics U=0 & V=0
372 Standard_Integer iBsPole = BsPole.LowerRow() + (USeg-1)*DegreeU;
373 Standard_Integer jBsPole = BsPole.LowerCol();
374 iBz = BzPole.LowerRow();
375 for (jBz=BzPole.LowerCol(); jBz<=BzPole.UpperCol(); jBz++) {
376 if (!BzPole.Value(iBz,jBz).IsEqual(BsPole.Value(iBsPole,jBsPole), epsgeom)) {
377 wasC0=Standard_False;
379 Standard_Real XCoord =
380 0.5 * (BzPole.Value(iBz,jBz).X() + BsPole.Value(iBsPole,jBsPole).X());
381 Standard_Real YCoord =
382 0.5 * (BzPole.Value(iBz,jBz).Y() + BsPole.Value(iBsPole,jBsPole).Y());
383 Standard_Real ZCoord =
384 0.5 * (BzPole.Value(iBz,jBz).Z() + BsPole.Value(iBsPole,jBsPole).Z());
385 MidPoint.SetCoord(XCoord, YCoord, ZCoord);
386 BsPole.SetValue(iBsPole, jBsPole++, MidPoint);
389 BsPole.SetValue(iBsPole, jBsPole++, BzPole.Value(iBz,jBz));
393 // Other poles (no check about C0) :
395 jBsPole = BsPole.LowerCol();
396 for (iBz=BzPole.LowerRow()+1; iBz<=BzPole.UpperRow(); iBz++) {
397 for (jBz=BzPole.LowerCol(); jBz<=BzPole.UpperCol(); jBz++)
398 BsPole.SetValue(iBsPole, jBsPole++, BzPole.Value(iBz,jBz));
400 jBsPole = BsPole.LowerCol();
406 // Patches (1, 1<VSeg<NbVSeg)
407 // ==========================
410 for (VSeg=2; VSeg <= NbVSeg; VSeg++) {
411 XPoly = st->XPolynomial(USeg, VSeg);
412 YPoly = st->YPolynomial(USeg, VSeg);
413 ZPoly = st->ZPolynomial(USeg, VSeg);
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);
472 for (i=Coef.LowerRow(); i<=Coef.UpperRow(); i++) {
474 for (j=Coef.LowerCol(); j<=Coef.UpperCol(); j++) {
475 Standard_Integer PolyIndex = i + 4*(j-1);
477 aPoint.SetCoord(XPoly->Value(PolyIndex)*ParamU*ParamV,
478 YPoly->Value(PolyIndex)*ParamU*ParamV,
479 ZPoly->Value(PolyIndex)*ParamU*ParamV);
480 Coef.SetValue(i, j, aPoint);
481 ParamV = ParamV *deltaV(VSeg);
483 ParamU = ParamU * deltaU(USeg);
485 PLib::CoefficientsPoles(Coef,PLib::NoWeights2(),BzPole,PLib::NoWeights2());
487 // C0 check and correction for poles lying on isoparametrics U=0 & V=0
488 iBs = (USeg-1)*DegreeU + BsPole.LowerRow();
489 jBs = (VSeg-1)*DegreeV + BsPole.LowerCol();
490 jBz = BzPole.LowerCol();
491 for (iBz=BzPole.LowerRow(); iBz<=BzPole.UpperRow(); iBz++) {
492 if (!BzPole.Value(iBz,jBz).IsEqual(BsPole.Value(iBs,jBs), epsgeom)) {
493 wasC0=Standard_False;
495 Standard_Real XCoord = 0.5 *
496 (BzPole.Value(iBz,jBz).X() + BsPole.Value(iBs,jBs).X());
497 Standard_Real YCoord = 0.5 *
498 (BzPole.Value(iBz,jBz).Y() + BsPole.Value(iBs,jBs).Y());
499 Standard_Real ZCoord = 0.5 *
500 (BzPole.Value(iBz,jBz).Z() + BsPole.Value(iBs,jBs).Z());
501 MidPoint.SetCoord(XCoord, YCoord, ZCoord);
502 BsPole.SetValue(iBs++, jBs, MidPoint);
505 BsPole.SetValue(iBs++, jBs, BzPole.Value(iBz,jBz));
508 iBs = (USeg-1)*DegreeU + BsPole.LowerRow();
509 iBz = BzPole.LowerRow();
510 for (jBz=BzPole.LowerCol(); jBz<=BzPole.UpperCol(); jBz++) {
511 // C0 check and correction for poles lying on isoparametrics U=0 & V=0
512 if (!BzPole.Value(iBz,jBz).IsEqual(BsPole.Value(iBs,jBs), epsgeom)) {
513 wasC0=Standard_False;
515 Standard_Real XCoord = 0.5 *
516 (BzPole.Value(iBz,jBz).X() + BsPole.Value(iBs,jBs).X());
517 Standard_Real YCoord = 0.5 *
518 (BzPole.Value(iBz,jBz).Y() + BsPole.Value(iBs,jBs).Y());
519 Standard_Real ZCoord = 0.5 *
520 (BzPole.Value(iBz,jBz).Z() + BsPole.Value(iBs,jBs).Z());
521 MidPoint.SetCoord(XCoord, YCoord, ZCoord);
522 BsPole.SetValue(iBs, jBs++, MidPoint);
525 BsPole.SetValue(iBs, jBs++, BzPole.Value(iBz,jBz));
528 iBs = BsPole.LowerRow() + (USeg-1)*DegreeU + 1;
529 jBs = BsPole.LowerCol() + (VSeg-1)*DegreeV + 1;
530 for (iBz=BzPole.LowerRow()+1; iBz<=BzPole.UpperRow(); iBz++) {
531 for (jBz=BzPole.LowerCol()+1; jBz<=BzPole.UpperCol(); jBz++)
532 BsPole.SetValue(iBs, jBs++, BzPole.Value(iBz,jBz));
533 jBs = BsPole.LowerCol() + (VSeg-1)*DegreeV + 1;
539 // Building result taking into account transformation if any :
540 // ===========================================================
542 if (st->HasTransf()) {
543 gp_GTrsf GSplTrsf(st->CompoundLocation());
545 Standard_Real epsilon = 1.E-04;
546 if (IGESData_ToolLocation::ConvertLocation(epsilon,GSplTrsf,SplTrsf))
547 for (iBs=BsPole.LowerRow(); iBs<=BsPole.UpperRow(); iBs++)
548 for (jBs=BsPole.LowerCol(); jBs<=BsPole.UpperCol(); jBs++)
549 BsPole.SetValue(iBs, jBs, BsPole.Value(iBs,jBs).Transformed(SplTrsf));
551 // AddWarning(start, "Transformation skipped : Not a similarity");
554 res = new Geom_BSplineSurface
555 (BsPole, UKnot, VKnot, UMult, VMult, DegreeU, DegreeV);
556 if (wasC0) returned += 1;
561 //=======================================================================
562 //function : IGESConvGeom::IncreaseSurfaceContinuity
564 //=======================================================================
565 Standard_Integer IGESConvGeom::IncreaseSurfaceContinuity (const Handle(Geom_BSplineSurface)& res,
566 const Standard_Real epsgeom,
567 const Standard_Integer continuity)
569 if (continuity < 1) return continuity;
570 Standard_Boolean isC1 = Standard_True, isC2 = Standard_True;
571 Standard_Integer DegreeU = res->UDegree();
573 Standard_Boolean isModified;
575 isModified = Standard_False;
576 for (Standard_Integer i = res->FirstUKnotIndex()+1; i < res->LastUKnotIndex(); i++)
577 if(DegreeU - res->UMultiplicity(i) < continuity) {
578 if (continuity >= 2) {
579 if (!res->RemoveUKnot(i, DegreeU-2, epsgeom)) {
580 isC2 = Standard_False;
581 Standard_Boolean locOK = res->RemoveUKnot(i, DegreeU-1, epsgeom); // is C1 ?
586 isModified = Standard_True;
589 Standard_Boolean locOK = res->RemoveUKnot(i, DegreeU-1, epsgeom); // is C1 ?
597 Standard_Integer DegreeV = res->VDegree();
599 isModified = Standard_False;
600 for (Standard_Integer i = res->FirstVKnotIndex()+1; i < res->LastVKnotIndex(); i++)
601 if(DegreeV - res->VMultiplicity(i) < continuity) {
602 if (continuity >= 2) {
603 if (!res->RemoveVKnot(i, DegreeV-2, epsgeom)) {
604 isC2 = Standard_False;
605 Standard_Boolean locOK = res->RemoveVKnot(i, DegreeV-1, epsgeom); // is C1 ?
610 isModified = Standard_True;
613 Standard_Boolean locOK = res->RemoveVKnot(i, DegreeV-1, epsgeom); // is C1 ?
622 while (--i > j) { // from 2 to NbKnots-1
623 if (continuity >= 2) {
624 if (!res->RemoveUKnot(i, DegreeU-2, epsgeom)) { // is C2 ?
625 isC2 = Standard_False;
626 isC1 &= res->RemoveUKnot(i, DegreeU-1, epsgeom); // is C1 ?
630 isC1 &= res->RemoveUKnot(i, DegreeU-1, epsgeom); // is C1 ?
634 i = res->LastVKnotIndex(); //knots.Upper();
635 j = res->FirstVKnotIndex(); //knots.Lower();
636 Standard_Integer DegreeV = res->VDegree();
637 while (--i > j) { // from 2 to NbKnots-1
638 if (continuity >= 2) {
639 if (!res->RemoveVKnot(i, DegreeV-2, epsgeom)) { // is C2 ?
640 isC2 = Standard_False;
641 isC1 &= res->RemoveVKnot(i, DegreeV-1, epsgeom); // is C1 ?
645 isC1 &= res->RemoveVKnot(i, DegreeV-1, epsgeom); // is C1 ?
651 if (continuity >= 2 && !isC2) return 1;