1 // Created on: 1993-08-12
2 // Created by: Bruno DUMORTIER
3 // Copyright (c) 1993-1999 Matra Datavision
4 // Copyright (c) 1999-2012 OPEN CASCADE SAS
6 // The content of this file is subject to the Open CASCADE Technology Public
7 // License Version 6.5 (the "License"). You may not use the content of this file
8 // except in compliance with the License. Please obtain a copy of the License
9 // at http://www.opencascade.org and read it completely before using this file.
11 // The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
12 // main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
14 // The Original Code and all software distributed under the License is
15 // distributed on an "AS IS" basis, without warranty of any kind, and the
16 // Initial Developer hereby disclaims all such warranties, including without
17 // limitation, any warranties of merchantability, fitness for a particular
18 // purpose or non-infringement. Please see the License for the specific terms
19 // and conditions governing the rights and limitations under the License.
25 #include <GeomliteTest.hxx>
26 #include <DrawTrSurf.hxx>
28 #include <Draw_Interpretor.hxx>
29 #include <Draw_Appli.hxx>
30 #include <Draw_Display.hxx>
32 #include <GeomAbs_SurfaceType.hxx>
33 #include <GeomAbs_IsoType.hxx>
34 #include <GeomAbs_Shape.hxx>
36 #include <Geom_Plane.hxx>
37 #include <Geom_CylindricalSurface.hxx>
38 #include <Geom_ConicalSurface.hxx>
39 #include <Geom_SphericalSurface.hxx>
40 #include <Geom_ToroidalSurface.hxx>
41 #include <Geom_BezierSurface.hxx>
42 #include <Geom_BSplineSurface.hxx>
43 #include <Geom_SurfaceOfLinearExtrusion.hxx>
44 #include <Geom_SurfaceOfRevolution.hxx>
45 #include <Geom_RectangularTrimmedSurface.hxx>
46 #include <Geom_OffsetSurface.hxx>
47 #include <Geom_Surface.hxx>
49 #include <Geom_TrimmedCurve.hxx>
50 #include <Geom_OffsetCurve.hxx>
51 #include <Geom_BezierCurve.hxx>
52 #include <Geom_BSplineCurve.hxx>
54 #include <Geom2d_TrimmedCurve.hxx>
55 #include <Geom2d_OffsetCurve.hxx>
57 #include <GeomAdaptor_Surface.hxx>
58 #include <GeomAdaptor_HSurface.hxx>
59 #include <GeomAdaptor_Curve.hxx>
60 #include <Geom2dAdaptor_Curve.hxx>
62 #include <TColGeom_Array2OfBezierSurface.hxx>
63 #include <TColgp_Array1OfPnt.hxx>
64 #include <TColgp_Array2OfPnt.hxx>
65 #include <TColStd_Array1OfReal.hxx>
66 #include <TColStd_Array2OfReal.hxx>
67 #include <TColStd_Array1OfInteger.hxx>
68 #include <TColStd_HArray1OfInteger.hxx>
69 #include <TColStd_HArray1OfReal.hxx>
70 #include <TColStd_HArray2OfReal.hxx>
74 #include <Precision.hxx>
75 #include <Convert_CompBezierCurvesToBSplineCurve.hxx>
76 #include <GeomConvert.hxx>
77 #include <GeomConvert_BSplineCurveToBezierCurve.hxx>
78 #include <GeomConvert_BSplineSurfaceToBezierSurface.hxx>
79 #include <GeomConvert_CompBezierSurfacesToBSplineSurface.hxx>
80 #include <Geom2dConvert.hxx>
81 #include <Geom2dConvert_BSplineCurveToBezierCurve.hxx>
82 #include <GeomLProp_SLProps.hxx>
85 #include <DrawTrSurf_BezierSurface.hxx>
86 #include <DrawTrSurf_BSplineSurface.hxx>
87 #include <GeomConvert_ApproxSurface.hxx>
88 #include <GeomLib_Tool.hxx>
89 #include <TopoDS_Shape.hxx>
95 //#define strcasecmp strcmp Already defined
96 Standard_IMPORT Draw_Viewer dout;
105 //=======================================================================
106 //function : compute min max radius of curvature on a surface
108 //=======================================================================
109 static Standard_Integer surface_radius (Draw_Interpretor& di,
113 Standard_Integer report_curvature = 0 ;
114 Standard_Real UParameter,VParameter,radius,tolerance = 1.0e-7 ;
117 if (n >= 6) report_curvature = 1 ;
119 UParameter = Draw::Atof(a[2]);
120 VParameter = Draw::Atof(a[3]);
121 Handle(Geom_Surface) SurfacePtr = DrawTrSurf::GetSurface(a[1]);
122 if (!SurfacePtr.IsNull()) {
123 GeomLProp_SLProps myProperties(SurfacePtr,
128 if (myProperties.IsCurvatureDefined()) {
129 radius = myProperties.MinCurvature();
131 if (report_curvature) Draw::Set(a[4],radius);
133 if (Abs(radius) > tolerance) {
134 radius = 1.0e0/ radius ;
135 di << "Min Radius of Curvature : " << radius << "\n";
138 di << "Min Radius of Curvature : infinite" << "\n";
141 radius = myProperties.MaxCurvature();
142 if (report_curvature) Draw::Set(a[5],radius);
143 if (Abs(radius) > tolerance) {
144 radius = 1.0e0/ radius;
145 di << "Max Radius of Curvature : " << radius << "\n";
148 di << "Min Radius of Curvature : infinite" << "\n";
151 di << "Curvature not defined." << "\n";
161 //=======================================================================
162 //function : anasurface
164 //=======================================================================
166 static Standard_Integer anasurface (Draw_Interpretor& ,
176 loc = gp_Ax3(gp_Pnt(0,0,0),gp_Dir(0,0,1),gp_Dir(1,0,0));
180 loc = gp_Ax3(gp_Pnt(Draw::Atof(a[2]),Draw::Atof(a[3]),Draw::Atof(a[4])),
181 gp_Dir(0,0,1),gp_Dir(1,0,0));
185 loc = gp_Ax3(gp_Pnt(Draw::Atof(a[2]),Draw::Atof(a[3]),Draw::Atof(a[4])),
186 gp_Dir(Draw::Atof(a[5]),Draw::Atof(a[6]),Draw::Atof(a[7])));
190 loc = gp_Ax3(gp_Pnt(Draw::Atof(a[2]),Draw::Atof(a[3]),Draw::Atof(a[4])),
191 gp_Dir(Draw::Atof(a[5]),Draw::Atof(a[6]),Draw::Atof(a[7])),
192 gp_Dir(Draw::Atof(a[8]),Draw::Atof(a[9]),Draw::Atof(a[10])));
198 Handle(Geom_Geometry) result;
200 if (!strcasecmp(a[0],"plane")) {
201 Handle(Geom_Plane) C = new Geom_Plane(loc);
205 if (i >= n) return 1;
206 Standard_Real par1 = Draw::Atof(a[i]);
208 if (!strcasecmp(a[0],"cylinder")) {
209 Handle(Geom_CylindricalSurface) C =
210 new Geom_CylindricalSurface(loc,par1);
214 else if (!strcasecmp(a[0],"sphere")) {
215 Handle(Geom_SphericalSurface) C =
216 new Geom_SphericalSurface(loc,par1);
221 if (i+1 >= n) return 1;
222 Standard_Real par2 = Draw::Atof(a[i+1]);
224 if (!strcasecmp(a[0],"cone")) {
225 par1 *= (M_PI / 180.0);
226 Handle(Geom_ConicalSurface) C =
227 new Geom_ConicalSurface(loc,par1,par2);
231 else if (!strcasecmp(a[0],"torus")) {
232 Handle(Geom_ToroidalSurface) C =
233 new Geom_ToroidalSurface(loc,par1,par2);
239 DrawTrSurf::Set(a[1],result);
244 //=======================================================================
245 //function : polesurface
247 //=======================================================================
249 static Standard_Integer polesurface (Draw_Interpretor& , Standard_Integer n, const char** a)
251 Standard_Integer k,j,i;
256 if (!strcasecmp(a[0],"beziersurf")) {
258 Standard_Integer nup = Draw::Atoi(a[2]);
259 Standard_Integer nvp = Draw::Atoi(a[3]);
260 if (nup * nvp == 0) return 1;
262 i = (n - 4) / (nup * nvp);
263 if (i < 3 || i > 4) return 1;
264 Standard_Boolean hasw = i == 4;
266 TColgp_Array2OfPnt poles(1,nup,1,nvp);
267 TColStd_Array2OfReal weights(1,nup,1,nvp);
270 for (j = 1; j <= nvp; j++) {
271 for (i = 1; i <= nup; i++) {
272 poles(i, j).SetCoord(Draw::Atof(a[k]),Draw::Atof(a[k+1]),Draw::Atof(a[k+2]));
275 weights(i, j) = Draw::Atof(a[k]);
281 Handle(Geom_BezierSurface) result;
283 result = new Geom_BezierSurface(poles,weights);
285 result = new Geom_BezierSurface(poles);
287 DrawTrSurf::Set(a[1],result);
291 Standard_Integer udeg = Draw::Atoi(a[2]);
292 Standard_Integer nbuk = Draw::Atoi(a[3]);
294 Standard_Boolean uper = (*a[0] == 'u') || (*(a[0]+1) == 'u');
295 Standard_Boolean vper = (*a[0] == 'v') || (*(a[0]+1) == 'v');
297 TColStd_Array1OfReal uk (1, nbuk);
298 TColStd_Array1OfInteger umult(1, nbuk);
300 Standard_Integer SigmaU = 0;
301 for (i = 1; i<=nbuk; i++) {
302 uk( i) = Draw::Atof(a[k]);
304 umult( i) = Draw::Atoi(a[k]);
309 Standard_Integer vdeg = Draw::Atoi(a[k]);
311 Standard_Integer nbvk = Draw::Atoi(a[k]);
314 TColStd_Array1OfReal vk (1, nbvk);
315 TColStd_Array1OfInteger vmult(1, nbvk);
316 Standard_Integer SigmaV = 0;
317 for (i = 1; i<=nbvk; i++) {
318 vk( i) = Draw::Atof(a[k]);
320 vmult( i) = Draw::Atoi(a[k]);
325 Standard_Integer nup,nvp;
327 nup = SigmaU - umult(nbuk);
329 nup = SigmaU - udeg -1;
331 nvp = SigmaV - vmult(nbvk);
333 nvp = SigmaV - vdeg -1;
334 TColgp_Array2OfPnt poles (1, nup, 1, nvp);
335 TColStd_Array2OfReal weights(1, nup, 1, nvp);
337 for (j = 1; j <= nvp; j++) {
338 for (i = 1; i <= nup; i++) {
339 poles(i, j).SetCoord(Draw::Atof(a[k]),Draw::Atof(a[k+1]),Draw::Atof(a[k+2]));
341 weights(i, j) = Draw::Atof(a[k]);
346 Handle(Geom_BSplineSurface) result =
347 new Geom_BSplineSurface(poles, weights,
353 DrawTrSurf::Set(a[1],result);
359 //=======================================================================
360 //function : algosurface
362 //=======================================================================
364 static Standard_Integer algosurface (Draw_Interpretor& , Standard_Integer n, const char** a)
368 Handle(Geom_Curve) GC = DrawTrSurf::GetCurve(a[2]);
369 if (GC.IsNull()) return 1;
374 if (!strcasecmp(a[0],"extsurf")) {
375 D.SetCoord(Draw::Atof(a[3]),Draw::Atof(a[4]),Draw::Atof(a[5]));
376 Handle(Geom_SurfaceOfLinearExtrusion) result =
377 new Geom_SurfaceOfLinearExtrusion(GC,D);
379 DrawTrSurf::Set(a[1],result);
382 else if (!strcasecmp(a[0],"revsurf")) {
384 P.SetCoord(Draw::Atof(a[3]),Draw::Atof(a[4]),Draw::Atof(a[5]));
385 D.SetCoord(Draw::Atof(a[6]),Draw::Atof(a[7]),Draw::Atof(a[8]));
387 Handle(Geom_SurfaceOfRevolution) result =
388 new Geom_SurfaceOfRevolution(GC,gp_Ax1(P,D));
390 DrawTrSurf::Set(a[1],result);
400 //=======================================================================
401 //function : trimming
403 //=======================================================================
405 static Standard_Integer trimming (Draw_Interpretor& ,
406 Standard_Integer n, const char** a)
410 Handle(Geom_Curve) GC = DrawTrSurf::GetCurve(a[2]);
411 Handle(Geom2d_Curve) GC2d = DrawTrSurf::GetCurve2d(a[2]);
412 Handle(Geom_Surface) GS = DrawTrSurf::GetSurface(a[2]);
416 Handle(Geom_TrimmedCurve) T = Handle(Geom_TrimmedCurve)::DownCast(GC);
417 if (!T.IsNull()) GC = T->BasisCurve();
418 DrawTrSurf::Set(a[1],GC);
420 else if (!GC2d.IsNull()) {
421 Handle(Geom2d_TrimmedCurve) T = Handle(Geom2d_TrimmedCurve)::DownCast(GC2d);
422 if (!T.IsNull()) GC2d = T->BasisCurve();
423 DrawTrSurf::Set(a[1],GC2d);
425 else if (!GS.IsNull()) {
426 Handle(Geom_RectangularTrimmedSurface) T = Handle(Geom_RectangularTrimmedSurface)::DownCast(GS);
427 if (!T.IsNull()) GS = T->BasisSurface();
428 DrawTrSurf::Set(a[1],GS);
435 Standard_Real u1 = Draw::Atof(a[3]);
436 Standard_Real u2 = Draw::Atof(a[4]);
438 Handle(Geom_Geometry) result;
439 Handle(Geom2d_Curve) result2d;
441 if (!strcasecmp(a[0],"trim")) {
445 new Geom_RectangularTrimmedSurface(GS,u1,u2,Draw::Atof(a[5]),Draw::Atof(a[6]));
447 else if (!GC.IsNull()) {
448 result = new Geom_TrimmedCurve(GC, u1, u2);
450 else if (!GC2d.IsNull()) {
451 result2d = new Geom2d_TrimmedCurve(GC2d, u1, u2);
457 if (GS.IsNull()) return 1;
458 result = new Geom_RectangularTrimmedSurface(GS,u1,u2,
459 !strcasecmp(a[0],"trimu"));
462 if (!result.IsNull())
463 DrawTrSurf::Set(a[1], result);
465 DrawTrSurf::Set(a[1],result2d);
470 //=======================================================================
471 //function : converting
473 //=======================================================================
475 static Standard_Integer converting(Draw_Interpretor& , Standard_Integer n, const char ** a)
477 if ( n < 3) return 1;
479 Convert_ParameterisationType
480 Parameterisation = Convert_TgtThetaOver2 ;
481 if (strcmp(a[n-1], "qa") == 0) {
482 Parameterisation = Convert_QuasiAngular ;
484 else if (strcmp(a[n-1], "c1") == 0) {
485 Parameterisation = Convert_RationalC1 ;
487 else if (strcmp (a[n-1], "s1") == 0) {
488 Parameterisation = Convert_TgtThetaOver2_1 ;
490 else if (strcmp (a[n-1], "s2") == 0) {
491 Parameterisation = Convert_TgtThetaOver2_2;
493 else if (strcmp (a[n-1], "s3") == 0) {
494 Parameterisation = Convert_TgtThetaOver2_3 ;
496 else if (strcmp (a[n-1], "s4") == 0) {
497 Parameterisation = Convert_TgtThetaOver2_4 ;
499 else if (strcmp (a[n-1], "po") == 0) {
500 Parameterisation = Convert_Polynomial;
503 Handle(Geom_Curve) GC = DrawTrSurf::GetCurve(a[2]);
505 Handle(Geom_Surface) GS = DrawTrSurf::GetSurface(a[2]);
507 Handle(Geom2d_Curve) G2d = DrawTrSurf::GetCurve2d(a[2]);
512 G2d = Geom2dConvert::CurveToBSplineCurve(G2d,
514 DrawTrSurf::Set(a[1], G2d);
518 GS = GeomConvert::SurfaceToBSplineSurface( GS);
519 DrawTrSurf::Set(a[1], GS);
523 GC = GeomConvert::CurveToBSplineCurve( GC,
525 DrawTrSurf::Set(a[1], GC);
532 //=======================================================================
533 //function : tobezier
535 //=======================================================================
537 static Standard_Integer tobezier(Draw_Interpretor& di,
538 Standard_Integer n, const char** a)
540 if ( n < 3) return 1;
541 Standard_Integer i,j,NbU,NbV,NbArc;
542 char* name = new char[100];
544 Handle(Geom2d_BSplineCurve) C2d =
545 DrawTrSurf::GetBSplineCurve2d(a[2]);
547 Handle(Geom_BSplineCurve) C3d =
548 DrawTrSurf::GetBSplineCurve(a[2]);
550 Handle(Geom_BSplineSurface) S =
551 DrawTrSurf::GetBSplineSurface(a[2]);
552 if ( S.IsNull()) return 1;
554 Standard_Real U1, U2, V1, V2;
555 U1 = Draw::Atof(a[3]);
556 U2 = Draw::Atof(a[4]);
557 V1 = Draw::Atof(a[5]);
558 V2 = Draw::Atof(a[6]);
559 GeomConvert_BSplineSurfaceToBezierSurface
560 Conv(S, U1, U2, V1, V2, Precision::PConfusion());
561 NbU = Conv.NbUPatches();
562 NbV = Conv.NbVPatches();
563 di << NbU << " X " << NbV << " patches in the result" << "\n";
564 for (i = 1; i <= NbU; i++) {
565 for (j = 1; j <= NbV; j++) {
566 Sprintf(name,"%s_%i_%i",a[1],i,j);
568 DrawTrSurf::Set(temp,Conv.Patch(i,j));
573 GeomConvert_BSplineSurfaceToBezierSurface Conv(S);
574 NbU = Conv.NbUPatches();
575 NbV = Conv.NbVPatches();
576 di << NbU << " X " << NbV << " patches in the result" << "\n";
577 for (i = 1; i <= NbU; i++) {
578 for (j = 1; j <= NbV; j++) {
579 Sprintf(name,"%s_%i_%i",a[1],i,j);
581 DrawTrSurf::Set(temp,Conv.Patch(i,j));
588 Standard_Real U1, U2;
589 U1 = Draw::Atof(a[3]);
590 U2 = Draw::Atof(a[4]);
591 GeomConvert_BSplineCurveToBezierCurve Conv(C3d, U1, U2,
592 Precision::PConfusion());
593 NbArc = Conv.NbArcs();
594 di << NbArc << " arcs in the result" << "\n";
595 for (i = 1; i <= NbArc; i++) {
596 Sprintf(name,"%s_%i",a[1],i);
598 DrawTrSurf::Set(temp,Conv.Arc(i));
602 GeomConvert_BSplineCurveToBezierCurve Conv(C3d);
603 NbArc = Conv.NbArcs();
604 di << NbArc << " arcs in the result" << "\n";
605 for (i = 1; i <= NbArc; i++) {
606 Sprintf(name,"%s_%i",a[1],i);
608 DrawTrSurf::Set(temp,Conv.Arc(i));
615 Standard_Real U1, U2;
616 U1 = Draw::Atof(a[3]);
617 U2 = Draw::Atof(a[4]);
618 Geom2dConvert_BSplineCurveToBezierCurve Conv(C2d, U1, U2,
619 Precision::PConfusion());
620 NbArc = Conv.NbArcs();
621 di << NbArc << " arcs in the result" << "\n";
622 for (i = 1; i <= NbArc; i++) {
623 Sprintf(name,"%s_%i",a[1],i);
625 DrawTrSurf::Set(temp,Conv.Arc(i));
629 Geom2dConvert_BSplineCurveToBezierCurve Conv(C2d);
630 NbArc = Conv.NbArcs();
631 di << NbArc << " arcs in the result" << "\n";
632 for (i = 1; i <= NbArc; i++) {
633 Sprintf(name,"%s_%i",a[1],i);
635 DrawTrSurf::Set(temp,Conv.Arc(i));
643 //=======================================================================
646 //=======================================================================
648 static Standard_Integer convbz(Draw_Interpretor& di,
649 Standard_Integer n, const char** a)
651 if ( n < 4) return 1;
653 Standard_Integer ii, jj, kk=0, NbU, NbV;
654 Standard_Real Tol = Precision::Confusion();
656 NbU = Draw::Atoi(a[2]);
657 if ( (Handle(Geom_Curve)::
658 DownCast(DrawTrSurf::Get(a[3]))).IsNull()) {
660 NbV = Draw::Atoi(a[3]);
662 di << "The number of bezier surface have to be " << NbU*NbV << "\n";
665 TColGeom_Array2OfBezierSurface BZ(1, NbU, 1, NbV);
667 for (jj=1; jj<=NbV; jj++)
668 for(ii=1;ii<=NbU; ii++) {
670 Handle(Geom_BezierSurface)::DownCast(DrawTrSurf::Get(a[kk]));
671 if (BZ(ii,jj).IsNull()) {
672 di << "the Surface " << kk <<"is not a BezierSurface" << "\n";
677 if (kk<n) Tol = Draw::Atof(a[kk]);
679 GeomConvert_CompBezierSurfacesToBSplineSurface Conv(BZ, Tol);
681 if (! Conv.IsDone()) {
682 di << "Convert Not Done" << "\n";
686 Handle(Geom_BSplineSurface) BSurf =
687 new Geom_BSplineSurface(Conv.Poles()->Array2(),
688 Conv.UKnots()->Array1(),
689 Conv.VKnots()->Array1(),
690 Conv.UMultiplicities()->Array1(),
691 Conv.VMultiplicities()->Array1(),
695 DrawTrSurf::Set(a[1], BSurf);
697 else { // cas de courbes
698 Convert_CompBezierCurvesToBSplineCurve Conv;
699 Handle(Geom_BezierCurve) BZ;
700 for (ii=1, kk=3; ii<=NbU; ii++,kk++) {
701 BZ = Handle(Geom_BezierCurve)::DownCast(DrawTrSurf::Get(a[kk]));
703 di << "the curve " << kk <<"is not a BezierCurve" << "\n";
706 TColgp_Array1OfPnt Poles(1, BZ->NbPoles());
708 Conv.AddCurve(Poles);
713 TColgp_Array1OfPnt Poles(1, Conv.NbPoles());
715 TColStd_Array1OfInteger Mults(1, Conv.NbKnots());
716 TColStd_Array1OfReal Knots(1, Conv.NbKnots());
717 Conv.KnotsAndMults(Knots, Mults);
718 Handle(Geom_BSplineCurve) BS =
719 new (Geom_BSplineCurve) (Poles, Knots, Mults,
721 DrawTrSurf::Set(a[1], BS);
727 //=======================================================================
728 //function : approxsurf
729 //purpose : Approximation d'une Surface par une BSpline non rationnelle
730 //=======================================================================
733 static Standard_Integer approxsurf(Draw_Interpretor& di, Standard_Integer n, const char** a)
735 // " Tolerance (par defaut 0.1mm) "
736 Standard_Real Tol = 1.e-4;
737 // " Ordres de continuites : 0, 1 ou 2 (par defaut 1)"
738 GeomAbs_Shape myUCont = GeomAbs_C1, myVCont = GeomAbs_C1;
739 // " Degre maximum des carreaux de Bezier 14 par defaut "
740 Standard_Integer degU = 14, degV = 14;
741 // " Nombre max de carreaux (par defaut 10)"
742 Standard_Integer nmax = 16;
743 // "Code de precision par defaults"
744 Standard_Integer myPrec = 1;
746 if ( n>10 || n<3) return 1;
748 if (n>3) Tol = Max(Draw::Atof(a[3]),1.e-10);
753 if (Draw::Atoi(a[4]) == 0) myUCont = GeomAbs_C0;
754 if (Draw::Atoi(a[4]) == 2) myUCont = GeomAbs_C2;
755 if (Draw::Atoi(a[5]) == 0) myVCont = GeomAbs_C0;
756 if (Draw::Atoi(a[5]) == 2) myVCont = GeomAbs_C2;
762 ( degU = (Draw::Atoi(a[6])));
763 ( degV = (Draw::Atoi(a[7])));
764 if ((degU<1) || (degU>24)) degU = 14;
765 if ((degV<1) || (degV>24)) degV = 14;
768 if (n>8) nmax = Draw::Atoi(a[8]);
769 if (n>9) myPrec = Draw::Atoi(a[9]);
771 Handle(Geom_Surface) surf = DrawTrSurf::GetSurface(a[2]);
772 if (surf.IsNull()) return 1;
773 GeomConvert_ApproxSurface myApprox(surf,Tol,myUCont,myVCont,degU,degV,nmax,myPrec);
774 if ( myApprox.HasResult()) DrawTrSurf::Set(a[1], myApprox.Surface());
779 //=======================================================================
780 //function : offseting
782 //=======================================================================
784 static Standard_Integer offseting (Draw_Interpretor& ,
785 Standard_Integer n, const char** a)
789 // test the Geom2d curve
790 Handle(Geom2d_Curve) C2d = DrawTrSurf::GetCurve2d(a[2]);
792 Handle(Geom2d_OffsetCurve) OC = new Geom2d_OffsetCurve(C2d,Draw::Atof(a[3]));
793 DrawTrSurf::Set(a[1],OC);
797 Standard_Boolean yasurf = Standard_False;
799 Handle(Geom_Curve) GC = DrawTrSurf::GetCurve(a[2]);
800 Handle(Geom_Surface) GS;
802 GS = DrawTrSurf::GetSurface(a[2]);
805 yasurf = Standard_True;
808 Standard_Real dist = Draw::Atof(a[3]);
810 Handle(Geom_Geometry) result;
813 Handle(Geom_OffsetSurface) GO = new Geom_OffsetSurface(GS,dist);
818 gp_Dir D(Draw::Atof(a[4]),Draw::Atof(a[5]),Draw::Atof(a[6]));
819 Handle(Geom_OffsetCurve) GT = new Geom_OffsetCurve(GC, dist, D);
823 DrawTrSurf::Set(a[1], result);
827 //=======================================================================
828 //function : sreverse
830 //=======================================================================
832 static Standard_Integer sreverse (Draw_Interpretor& , Standard_Integer n, const char** a)
837 for (i = 1; i < n; i++) {
839 Handle(Geom_Surface) GS = DrawTrSurf::GetSurface(a[i]);
852 //=======================================================================
855 //=======================================================================
857 static Standard_Integer iso (Draw_Interpretor& , Standard_Integer n, const char** a)
861 Handle(Geom_Curve) C;
862 Standard_Real par = Draw::Atof(a[3]);
863 Handle(Geom_Surface) GS = DrawTrSurf::GetSurface(a[2]);
869 DrawTrSurf::Set(a[1],C);
876 //=======================================================================
879 //=======================================================================
881 static Standard_Integer value (Draw_Interpretor& ,
882 Standard_Integer n, const char** a)
886 Handle(Geom_Surface) GS = DrawTrSurf::GetSurface(a[1]);
887 if (GS.IsNull()) return 1;
889 Standard_Real U = Draw::Atof(a[2]);
890 Standard_Real V = Draw::Atof(a[3]);
892 Standard_Boolean DrawPoint = ( n%3 == 2);
900 GS->D2(U,V,P,DU,DV,D2U,D2V,D2UV);
901 Draw::Set(a[13],D2U.X());
902 Draw::Set(a[14],D2U.Y());
903 Draw::Set(a[15],D2U.Z());
904 Draw::Set(a[16],D2V.X());
905 Draw::Set(a[17],D2V.Y());
906 Draw::Set(a[18],D2V.Z());
907 Draw::Set(a[19],D2UV.X());
908 Draw::Set(a[20],D2UV.Y());
909 Draw::Set(a[21],D2UV.Z());
914 Draw::Set(a[7],DU.X());
915 Draw::Set(a[8],DU.Y());
916 Draw::Set(a[9],DU.Z());
917 Draw::Set(a[10],DV.X());
918 Draw::Set(a[11],DV.Y());
919 Draw::Set(a[12],DV.Z());
925 Draw::Set(a[4],P.X());
926 Draw::Set(a[5],P.Y());
927 Draw::Set(a[6],P.Z());
930 DrawTrSurf::Set(a[n],P);
936 //=======================================================================
937 //function : movepole
939 //=======================================================================
941 static Standard_Integer movepole (Draw_Interpretor& , Standard_Integer n, const char** a)
944 Standard_Boolean BSpline = Standard_False;
946 Handle(Geom_BezierSurface) GBz = DrawTrSurf::GetBezierSurface(a[1]);
947 Handle(Geom_BSplineSurface) GBs;
949 GBs = DrawTrSurf::GetBSplineSurface(a[1]);
952 BSpline = Standard_True;
955 Standard_Real dx = Draw::Atof(a[n-3]);
956 Standard_Real dy = Draw::Atof(a[n-2]);
957 Standard_Real dz = Draw::Atof(a[n-1]);
959 Standard_Integer nup, nvp;
961 nup = GBz->NbUPoles();
962 nvp = GBz->NbVPoles();
965 nup = GBs->NbUPoles();
966 nvp = GBs->NbVPoles();
969 Standard_Integer FirstRow=0, LastRow=0, FirstCol=0, LastCol=0;
970 // Rem : Row = indice ligne. -> variation en U.
971 // Col = indice colonne.-> variation en V.
973 if (!strcasecmp(a[0],"movep")) {
975 FirstRow = Draw::Atoi(a[2]);
976 FirstCol = Draw::Atoi(a[3]);
977 if ( FirstRow < 1 || FirstRow > nup ||
978 FirstCol < 1 || FirstCol > nvp ) return 1;
982 else if (!strcasecmp(a[0],"moverowp")) {
983 FirstRow = Draw::Atoi(a[2]);
984 if ( FirstRow < 1 || FirstRow > nup ) return 1;
989 else if (!strcasecmp(a[0],"movecolp")) {
990 FirstCol = Draw::Atoi(a[2]);
991 if ( FirstCol < 1 || FirstCol > nvp ) return 1;
999 for ( Standard_Integer i = FirstRow; i<= LastRow; i++) {
1000 for ( Standard_Integer j = FirstCol; j<= LastCol; j++) {
1003 P.SetCoord(P.X()+dx, P.Y()+dy, P.Z()+dz);
1004 GBz->SetPole(i,j,P);
1008 P.SetCoord(P.X()+dx, P.Y()+dy, P.Z()+dz);
1009 GBs->SetPole(i,j,P);
1020 //=======================================================================
1021 //function : movepoint
1023 //=======================================================================
1025 static Standard_Integer movepoint (Draw_Interpretor& , Standard_Integer n, const char** a)
1027 if (n < 7) return 1;
1029 Handle(Geom_BSplineSurface) GBs = DrawTrSurf::GetBSplineSurface(a[1]);
1034 Standard_Real u = Draw::Atof(a[2]);
1035 Standard_Real v = Draw::Atof(a[3]);
1037 Standard_Real dx = Draw::Atof(a[4]);
1038 Standard_Real dy = Draw::Atof(a[5]);
1039 Standard_Real dz = Draw::Atof(a[6]);
1041 Standard_Integer index1u = 0;
1042 Standard_Integer index2u = 0;
1043 Standard_Integer index1v = 0;
1044 Standard_Integer index2v = 0;
1046 Standard_Integer fmodifu, lmodifu, fmodifv, lmodifv;
1048 index1u = Draw::Atoi(a[7]);
1049 index2u = Draw::Atoi(a[8]);
1050 index1v = Draw::Atoi(a[9]);
1051 index2v = Draw::Atoi(a[10]);
1055 index2u = GBs->NbUPoles()-1;
1057 index2v = GBs->NbVPoles()-1;
1062 p.SetCoord(p.X()+dx, p.Y()+dy, p.Z()+dz);
1063 GBs->MovePoint(u, v, p, index1u, index2u, index1v, index2v, fmodifu, lmodifu, fmodifv, lmodifv);
1069 //=======================================================================
1070 //function : insertknot
1072 //=======================================================================
1074 static Standard_Integer insertknot (Draw_Interpretor& , Standard_Integer n, const char** a)
1076 if (n < 3) return 1;
1078 Handle(Geom_BSplineSurface) GBs = DrawTrSurf::GetBSplineSurface(a[1]);
1080 if (GBs.IsNull()) return 1;
1082 Standard_Real knot=0;
1083 Standard_Integer mult = 0;
1084 Standard_Integer index=0;
1085 if ( !strcasecmp(a[0],"insertuknot") ||
1086 !strcasecmp(a[0],"insertvknot") ) {
1088 knot = Draw::Atof(a[2]);
1089 mult = Draw::Atoi(a[3]);
1091 else if ( !strcasecmp(a[0],"remuknot") ||
1092 !strcasecmp(a[0],"remvknot") ) {
1093 index = Draw::Atoi(a[2]);
1094 if (n>=4) mult = Draw::Atoi(a[3]);
1097 Standard_Real tol = RealLast();
1099 if (!strcasecmp(a[0],"insertuknot")) {
1100 GBs->InsertUKnot(knot,mult,Precision::PConfusion());
1102 else if (!strcasecmp(a[0],"insertvknot")) {
1103 GBs->InsertVKnot(knot,mult,Precision::PConfusion());
1105 else if (!strcasecmp(a[0],"remuknot")) {
1106 if (n>=5) tol = Draw::Atof(a[4]);
1107 if (!GBs->RemoveUKnot(index,mult,tol))
1110 else if (!strcasecmp(a[0],"remvknot")) {
1111 if (n>=5) tol = Draw::Atof(a[4]);
1112 if (!GBs->RemoveVKnot(index,mult,tol))
1120 //=======================================================================
1121 //function : incdegree
1123 //=======================================================================
1125 static Standard_Integer incdegree (Draw_Interpretor& di, Standard_Integer n, const char** a)
1127 if (n < 3) return 1;
1129 Standard_Integer NewDeg = Draw::Atoi(a[2]);
1130 Standard_Boolean BSpline = Standard_False;
1132 Standard_Integer UDeg=0, VDeg=0;
1134 Handle(Geom_BezierSurface) GBz = DrawTrSurf::GetBezierSurface(a[1]);
1135 Handle(Geom_BSplineSurface) GBs;
1138 GBs = DrawTrSurf::GetBSplineSurface(a[1]);
1141 BSpline = Standard_True;
1144 Standard_Integer Degree=0;
1145 if ( !strcasecmp(a[0],"incudeg")) {
1148 Degree = GBs->UDegree();
1149 VDeg = GBs->VDegree();
1152 Degree = GBz->UDegree();
1153 VDeg = GBz->VDegree();
1156 else if ( !strcasecmp(a[0],"incvdeg")) {
1159 Degree = GBs->VDegree();
1160 UDeg = GBs->UDegree();
1163 Degree = GBz->VDegree();
1164 UDeg = GBz->UDegree();
1168 if (Degree > NewDeg) {
1169 di<<"The Degree must be greater than " << Degree <<"\n";
1174 GBs->IncreaseDegree(UDeg, VDeg);
1177 GBz->Increase(UDeg, VDeg);
1184 //=======================================================================
1185 //function : rempole
1187 //=======================================================================
1189 static Standard_Integer rempole (Draw_Interpretor& di, Standard_Integer n, const char** a)
1191 if (n < 3) return 1;
1193 Standard_Integer NewIndex = Draw::Atoi(a[2]);
1194 Standard_Boolean BSpline = Standard_False;
1196 Handle(Geom_BezierSurface) GBz = DrawTrSurf::GetBezierSurface(a[1]);
1197 Handle(Geom_BSplineSurface) GBs;
1200 GBs = DrawTrSurf::GetBSplineSurface(a[1]);
1203 BSpline = Standard_True;
1206 Standard_Integer Index;
1207 if ( !strcasecmp(a[0],"remrowpole")) {
1209 Index = GBs->UDegree();
1211 Index = GBz->UDegree();
1213 else if ( !strcasecmp(a[0],"remcolpole")) {
1215 Index = GBs->VDegree();
1217 Index = GBz->VDegree();
1220 if ( !strcasecmp(a[0],"remrowpole")) {
1222 di << " Error : Cannot remove a polerow on a BSplineSurface " << "\n";
1225 GBz->RemovePoleRow(NewIndex);
1228 else if ( !strcasecmp(a[0],"remcolpole")) {
1230 di << " Error : Cannot remove a polecol on a BSplineSurface " << "\n";
1233 GBz->RemovePoleCol(NewIndex);
1241 //=======================================================================
1244 //=======================================================================
1246 static Standard_Integer sfindp (Draw_Interpretor& , Standard_Integer n, const char** a)
1248 if (n < 7) return 1;
1249 Standard_Boolean BSpline = Standard_False;
1251 Handle(Geom_BezierSurface) GBz = DrawTrSurf::GetBezierSurface(a[1]);
1252 Handle(Geom_BSplineSurface) GBs;
1254 GBs = DrawTrSurf::GetBSplineSurface(a[1]);
1257 BSpline = Standard_True;
1260 Standard_Integer UIndex = 0;
1261 Standard_Integer VIndex = 0;
1262 Standard_Integer view = Draw::Atoi(a[2]);
1263 Standard_Real x = Draw::Atof(a[3]);
1264 Standard_Real y = Draw::Atof(a[4]);
1266 Draw_Display d = dout.MakeDisplay(view);
1269 Handle(DrawTrSurf_BezierSurface) DBz =
1270 new DrawTrSurf_BezierSurface(GBz);
1271 DBz->FindPole( x, y, d, 5, UIndex,VIndex);
1274 Handle(DrawTrSurf_BSplineSurface) DBs =
1275 new DrawTrSurf_BSplineSurface(GBs);
1276 DBs->FindPole( x, y, d, 5, UIndex,VIndex);
1279 Draw::Set(a[5],UIndex);
1280 Draw::Set(a[6],VIndex);
1286 //=======================================================================
1287 //function : ssetperiodic
1289 //=======================================================================
1291 static Standard_Integer ssetperiodic (Draw_Interpretor& , Standard_Integer n, const char** a)
1293 if (n < 2) return 1;
1297 if (!strcasecmp(a[0],"setuperiodic")) {
1298 for (i = 1; i < n; i++) {
1299 Handle(Geom_BSplineSurface)
1300 GBs = DrawTrSurf::GetBSplineSurface(a[i]);
1301 if (!GBs.IsNull()) {
1302 GBs->SetUPeriodic();
1307 else if (!strcasecmp(a[0],"setvperiodic")){
1308 for (i = 1; i < n; i++) {
1309 Handle(Geom_BSplineSurface)
1310 GBs = DrawTrSurf::GetBSplineSurface(a[i]);
1311 if (!GBs.IsNull()) {
1312 GBs->SetVPeriodic();
1317 else if (!strcasecmp(a[0],"setunotperiodic")){
1318 for (i = 1; i < n; i++) {
1319 Handle(Geom_BSplineSurface)
1320 GBs = DrawTrSurf::GetBSplineSurface(a[i]);
1321 if (!GBs.IsNull()) {
1322 GBs->SetUNotPeriodic();
1327 else if (!strcasecmp(a[0],"setvnotperiodic")){
1328 for (i = 1; i < n; i++) {
1329 Handle(Geom_BSplineSurface)
1330 GBs = DrawTrSurf::GetBSplineSurface(a[i]);
1331 if (!GBs.IsNull()) {
1332 GBs->SetVNotPeriodic();
1340 //=======================================================================
1343 //=======================================================================
1345 static Standard_Integer exchuv (Draw_Interpretor& , Standard_Integer n, const char** a)
1347 if (n < 2) return 1;
1350 for (i = 1; i < n; i++) {
1352 Handle(Geom_BSplineSurface) GBs = DrawTrSurf::GetBSplineSurface(a[i]);
1353 if (!GBs.IsNull()) {
1358 Handle(Geom_BezierSurface) GBz = DrawTrSurf::GetBezierSurface(a[i]);
1359 if (!GBz.IsNull()) {
1369 //=======================================================================
1372 //=======================================================================
1374 static Standard_Integer segsur (Draw_Interpretor& , Standard_Integer n, const char** a)
1376 if (n < 6) return 1;
1378 Handle(Geom_BezierSurface) GBz = DrawTrSurf::GetBezierSurface(a[1]);
1379 Handle(Geom_BSplineSurface) GBs;
1381 GBs = DrawTrSurf::GetBSplineSurface(a[1]);
1384 GBs->Segment(Draw::Atof(a[2]),Draw::Atof(a[3]),Draw::Atof(a[4]),Draw::Atof(a[5]));
1387 GBz->Segment(Draw::Atof(a[2]),Draw::Atof(a[3]),Draw::Atof(a[4]),Draw::Atof(a[5]));
1394 static Standard_Integer compBsplSur (Draw_Interpretor& , Standard_Integer n, const char** a)
1398 cout<<"Invalid number of parameters"<<endl;
1402 Handle(Geom_BSplineSurface) GBs1 = DrawTrSurf::GetBSplineSurface(a[1]);
1403 Handle(Geom_BSplineSurface) GBs2 = DrawTrSurf::GetBSplineSurface(a[2]);
1404 if (GBs1.IsNull() || GBs2.IsNull()) {
1405 cout<<"Invalid surface"<<endl;
1409 Standard_Real aU11,aU12,aV11,aV12;
1410 GBs1->Bounds(aU11,aU12,aV11,aV12);
1412 Standard_Real aU21,aU22,aV21,aV22;
1413 GBs2->Bounds(aU21,aU22,aV21,aV22);
1415 Standard_Real aUmin = Max(aU11,aU21);
1416 Standard_Real aUmax = Min(aU12,aU22);
1418 Standard_Real aVmin = Max(aV11,aV21);
1419 Standard_Real aVmax = Min(aV12,aV22);
1421 Standard_Integer nbP = 100;
1422 Standard_Real aStepU = (aUmax - aUmin)/nbP;
1423 Standard_Real aStepV = (aVmax - aVmin)/nbP;
1424 Standard_Integer nbErr =0;
1425 Standard_Integer i =1;
1426 for( ; i <= nbP +1; i++)
1428 Standard_Real aU = aUmin + aStepU*(i-1);
1429 Standard_Integer j =1;
1430 for( ; j <= nbP +1; j++)
1432 Standard_Real aV = aVmin + aStepV*(j-1);
1433 gp_Pnt aP1 = GBs1->Value(aU,aV);
1434 gp_Pnt aP2 = GBs2->Value(aU,aV);
1435 Standard_Real aDist = aP1.SquareDistance(aP2);
1436 if(aDist > Precision::SquareConfusion())
1439 Standard_Real aD = sqrt(aDist);
1440 cout<<"Surfaces differ for U,V,Dist: "<<aU<<" "<<aV<<" "<<aD<<endl;
1450 //=======================================================================
1451 //function : setuvorigin
1453 //=======================================================================
1455 static Standard_Integer setuvorigin (Draw_Interpretor& , Standard_Integer n, const char** a)
1457 if (n < 3) return 1;
1459 Handle(Geom_BSplineSurface) GBs = DrawTrSurf::GetBSplineSurface(a[1]);
1462 if ( !strcasecmp(a[0],"setuorigin")) {
1463 GBs->SetUOrigin(Draw::Atoi(a[2]));
1465 else if ( !strcasecmp(a[0],"setvorigin")) {
1466 GBs->SetVOrigin(Draw::Atoi(a[2]));
1476 //=======================================================================
1477 //function : parameters
1479 //=======================================================================
1481 static Standard_Integer parameters (Draw_Interpretor& di, Standard_Integer n, const char** a)
1485 // try to find parameters on a Surface
1486 Handle(Geom_Surface) S = DrawTrSurf::GetSurface(a[1]);
1487 if( S.IsNull() ) { di << "Unknown surface" << "\n"; return 1; }
1488 gp_Pnt P(Draw::Atof(a[2]), Draw::Atof(a[3]), Draw::Atof(a[4]));
1489 Standard_Real Tol = Draw::Atof(a[5]), U = 0., V = 0.;
1490 Standard_Boolean res = GeomLib_Tool::Parameters(S,P,Tol,U,V);
1495 if( !res ) { di << "Wrong point" << "\n"; return 1; }
1499 // try to find parameters on a 3d Curve
1500 Handle(Geom_Curve) C = DrawTrSurf::GetCurve(a[1]);
1501 if( C.IsNull() ) { di << "Unknown curve" << "\n"; return 1; }
1502 gp_Pnt P(Draw::Atof(a[2]), Draw::Atof(a[3]), Draw::Atof(a[4]));
1503 Standard_Real Tol = Draw::Atof(a[5]), U = 0.;
1504 Standard_Boolean res = GeomLib_Tool::Parameter(C,P,Tol,U);
1508 if( !res ) { di << "Wrong point" << "\n"; return 1; }
1512 // try to find parameters on a 2d Curve
1513 Handle(Geom2d_Curve) C = DrawTrSurf::GetCurve2d(a[1]);
1514 if( C.IsNull() ) { di << "Unknown curve 2d" << "\n"; return 1; }
1515 gp_Pnt2d P(Draw::Atof(a[2]), Draw::Atof(a[3]));
1516 Standard_Real Tol = Draw::Atof(a[4]), U = 0.;
1517 Standard_Boolean res = GeomLib_Tool::Parameter(C,P,Tol,U);
1521 if( !res ) { di << "Wrong point" << "\n"; return 1; }
1525 di << "Invalid parameters!" << "\n";
1526 di << "Usage:" << "\n";
1527 di << "parameters Surf X Y Z Tol U V" << "\n";
1528 di << "parameters Curv X Y Z Tol U" << "\n";
1529 di << "parameters Curv2d X Y Tol U" << "\n";
1537 //=======================================================================
1540 //=======================================================================
1542 Standard_Integer bounds(Draw_Interpretor&, Standard_Integer n, const char** a)
1544 Standard_Real U1, U2, V1, V2;
1545 if ( n == 4) { // compute on a curve or a 2d curve
1546 Handle(Geom_Curve) C3d = DrawTrSurf::GetCurve(a[1]);
1547 if ( C3d.IsNull()) { // 2dcurve
1548 Handle(Geom2d_Curve) C2d = DrawTrSurf::GetCurve2d(a[1]);
1549 if ( C2d.IsNull()) return 1;
1550 U1 = C2d->FirstParameter();
1551 U2 = C2d->LastParameter();
1554 U1 = C3d->FirstParameter();
1555 U2 = C3d->LastParameter();
1560 else if ( n == 6) { // compute on a Surface
1561 Handle(Geom_Surface) S = DrawTrSurf::GetSurface(a[1]);
1562 if ( S.IsNull()) return 1;
1563 S->Bounds(U1,U2,V1,V2);
1574 //=======================================================================
1575 //function : SurfaceCommands
1577 //=======================================================================
1580 void GeomliteTest::SurfaceCommands(Draw_Interpretor& theCommands)
1582 static Standard_Boolean loaded = Standard_False;
1584 loaded = Standard_True;
1586 DrawTrSurf::BasicCommands(theCommands);
1589 // analytic surfaces
1590 g = "GEOMETRY surfaces creation";
1592 theCommands.Add("plane",
1593 "plane name [x y z [dx dy dz [ux uy uz]]]",
1597 theCommands.Add("cone",
1598 "cone name [x y z [dx dy dz [ux uy uz]]] semi-angle radius",
1602 theCommands.Add("cylinder",
1603 "cylinder name [x y z [dx dy dz [ux uy uz]]] radius",
1607 theCommands.Add("sphere",
1608 "sphere name [x y z [dx dy dz [ux uy uz]]] radius",
1612 theCommands.Add("torus",
1613 "torus name [x y z [dx dy dz [ux uy uz]]] major minor",
1617 theCommands.Add("beziersurf",
1618 "beziersurf name nbupoles nbvpoles pole, [weight]",
1622 theCommands.Add("bsplinesurf",
1623 "bsplinesurf name udegree nbuknots uknot, umult vdegree nbvknots vknot, vmult pole, weight",
1627 theCommands.Add("upbsplinesurf",
1628 "bsplinesurf name udegree nbuknots uknot, umult vdegree nbvknots vknot, vmult pole, weight",
1632 theCommands.Add("vpbsplinesurf",
1633 "bsplinesurf name udegree nbuknots uknot, umult vdegree nbvknots vknot, vmult pole, weight",
1637 theCommands.Add("uvpbsplinesurf",
1638 "bsplinesurf name udegree nbuknots uknot, umult vdegree nbvknots vknot, vmult pole, weight",
1642 theCommands.Add("extsurf",
1643 "extsurf name curvename dx dy dz",
1647 theCommands.Add("revsurf",
1648 "revsurf name curvename x y z dx dy dz",
1652 theCommands.Add("offset",
1653 "offset name basename distance [dx dy dz]",
1657 theCommands.Add("trim",
1658 "trim newname name [u1 u2 [v1 v2]], no args remove trim",
1662 theCommands.Add("trimu",
1663 "trim newname name u1 u2",
1667 theCommands.Add("trimv",
1668 "trim newname name v1 v2",
1672 theCommands.Add("convert",
1673 "convert result c2d/c3d/surf [qa,c1,s1,s2,s3,s4,po]",
1677 theCommands.Add("tobezier",
1678 "tobezier result c2d/c3d/surf [ufirst, ulast / ufirst, ulast, vfirst, vlast]",
1682 theCommands.Add("convertfrombezier",
1683 "convertfrombezier result nbu [nbv] bz1 [bz2 .... bzn] [tol]",
1687 theCommands.Add("approxsurf",
1688 "approxsurf name surf [Tol [CnU CnV [degU degV [nmax]]]] ",
1692 g = "GEOMETRY Curves and Surfaces modification";
1694 theCommands.Add("ureverse",
1695 "ureverse name ... ",
1699 theCommands.Add("vreverse",
1700 "vreverse name ... ",
1704 theCommands.Add("movep",
1705 "movep name row col dx dy dz",
1709 theCommands.Add("moverowp",
1710 "moverowp name row dx dy dz",
1714 theCommands.Add("movecolp",
1715 "movecolp name col dx dy dz",
1719 theCommands.Add("movepoint",
1720 "movepoint name u v dx dy dz [index1u index2u index2v index2v",
1724 theCommands.Add("insertuknot",
1725 "insertuknot name knot mult",
1729 theCommands.Add("insertvknot",
1730 "insertvknot name knot mult",
1734 theCommands.Add("remuknot",
1735 "remuknot name index [mult] [tol]",
1739 theCommands.Add("remvknot",
1740 "remvknot name index [mult] [tol]",
1744 theCommands.Add("incudeg",
1745 "incudeg name degree",
1749 theCommands.Add("incvdeg",
1750 "incvdeg name degree",
1754 theCommands.Add("remrowpole",
1755 "remrowpole name index",
1759 theCommands.Add("remcolpole",
1760 "remcolpole name index",
1764 theCommands.Add("sfindp",
1765 "sfindp name view x y Uindex Vindex",
1769 theCommands.Add("setuperiodic",
1770 "setuperiodic name ...",
1774 theCommands.Add("setvperiodic",
1775 "setvperiodic name ...",
1779 theCommands.Add("setunotperiodic",
1780 "setunotperiodic name ...",
1784 theCommands.Add("setvnotperiodic",
1785 "setvnotperiodic name ...",
1789 theCommands.Add("exchuv",
1794 theCommands.Add("segsur",
1795 "segsur name Ufirst Ulast Vfirst Vlast",
1799 theCommands.Add("setuorigin",
1800 "setuorigin name knotindex",
1804 theCommands.Add("setvorigin",
1805 "setvorigin name knotindex",
1809 g = "GEOMETRY curves creation";
1812 theCommands.Add("uiso",
1813 "uiso curvename surfacename u",
1817 theCommands.Add("viso",
1818 "viso curvename surfacename v",
1823 g = "GEOMETRY curves and surfaces analysis";
1825 theCommands.Add("svalue",
1826 "svalue surfname U V X Y Z [DUX DUY DUZ DVX DVY DVZ [D2UX D2UY D2UZ D2VX D2VY D2VZ D2UVX D2UVY D2UVZ]]",
1830 theCommands.Add("parameters",
1831 "parameters surf/curve X Y [Z] Tol U [V] : {X Y Z} point, {U V} output parameter(s)",
1835 theCommands.Add("bounds",
1836 "bounds S/C/C2d U1 U2 [V1 V2]",
1840 theCommands.Add("surface_radius",
1841 "surface_radius surface Uvalue <Real> Vvalue <Real> returns min max radius of curvature",
1844 theCommands.Add("compBsplSur","BsplSurf1 BSplSurf2",__FILE__,compBsplSur,g);