1 // Created on: 1993-08-12
2 // Created by: Bruno DUMORTIER
3 // Copyright (c) 1993-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 #include <GeomliteTest.hxx>
18 #include <DrawTrSurf.hxx>
20 #include <Draw_Interpretor.hxx>
21 #include <Draw_Appli.hxx>
22 #include <Draw_Display.hxx>
24 #include <GeomAbs_SurfaceType.hxx>
25 #include <GeomAbs_IsoType.hxx>
26 #include <GeomAbs_Shape.hxx>
28 #include <Geom_Plane.hxx>
29 #include <Geom_CylindricalSurface.hxx>
30 #include <Geom_ConicalSurface.hxx>
31 #include <Geom_SphericalSurface.hxx>
32 #include <Geom_ToroidalSurface.hxx>
33 #include <Geom_BezierSurface.hxx>
34 #include <Geom_BSplineSurface.hxx>
35 #include <Geom_SurfaceOfLinearExtrusion.hxx>
36 #include <Geom_SurfaceOfRevolution.hxx>
37 #include <Geom_RectangularTrimmedSurface.hxx>
38 #include <Geom_OffsetSurface.hxx>
39 #include <Geom_Surface.hxx>
41 #include <Geom_TrimmedCurve.hxx>
42 #include <Geom_OffsetCurve.hxx>
43 #include <Geom_BezierCurve.hxx>
44 #include <Geom_BSplineCurve.hxx>
46 #include <Geom2d_TrimmedCurve.hxx>
47 #include <Geom2d_OffsetCurve.hxx>
49 #include <GeomAdaptor_Surface.hxx>
50 #include <GeomAdaptor_HSurface.hxx>
51 #include <GeomAdaptor_Curve.hxx>
52 #include <Geom2dAdaptor_Curve.hxx>
54 #include <TColGeom_Array2OfBezierSurface.hxx>
55 #include <TColgp_Array1OfPnt.hxx>
56 #include <TColgp_Array2OfPnt.hxx>
57 #include <TColStd_Array1OfReal.hxx>
58 #include <TColStd_Array2OfReal.hxx>
59 #include <TColStd_Array1OfInteger.hxx>
60 #include <TColStd_HArray1OfInteger.hxx>
61 #include <TColStd_HArray1OfReal.hxx>
62 #include <TColStd_HArray2OfReal.hxx>
66 #include <Precision.hxx>
67 #include <Convert_CompBezierCurvesToBSplineCurve.hxx>
68 #include <GeomConvert.hxx>
69 #include <GeomConvert_BSplineCurveToBezierCurve.hxx>
70 #include <GeomConvert_BSplineSurfaceToBezierSurface.hxx>
71 #include <GeomConvert_CompBezierSurfacesToBSplineSurface.hxx>
72 #include <Geom2dConvert.hxx>
73 #include <Geom2dConvert_BSplineCurveToBezierCurve.hxx>
74 #include <GeomLProp_SLProps.hxx>
77 #include <DrawTrSurf_BezierSurface.hxx>
78 #include <DrawTrSurf_BSplineSurface.hxx>
79 #include <GeomConvert_ApproxSurface.hxx>
80 #include <GeomLib_Tool.hxx>
81 #include <TopoDS_Shape.hxx>
83 #include <Geom_Curve.hxx>
84 #include <Message.hxx>
88 Standard_IMPORT Draw_Viewer dout;
94 //=======================================================================
95 //function : compute min max radius of curvature on a surface
97 //=======================================================================
98 static Standard_Integer surface_radius (Draw_Interpretor& di,
102 Standard_Integer report_curvature = 0 ;
103 Standard_Real UParameter,VParameter,radius,tolerance = 1.0e-7 ;
106 if (n >= 6) report_curvature = 1 ;
108 UParameter = Draw::Atof(a[2]);
109 VParameter = Draw::Atof(a[3]);
110 Handle(Geom_Surface) SurfacePtr = DrawTrSurf::GetSurface(a[1]);
111 if (!SurfacePtr.IsNull()) {
112 GeomLProp_SLProps myProperties(SurfacePtr,
117 if (myProperties.IsCurvatureDefined()) {
118 radius = myProperties.MinCurvature();
120 if (report_curvature) Draw::Set(a[4],radius);
122 if (Abs(radius) > tolerance) {
123 radius = 1.0e0/ radius ;
124 di << "Min Radius of Curvature : " << radius << "\n";
127 di << "Min Radius of Curvature : infinite\n";
130 radius = myProperties.MaxCurvature();
131 if (report_curvature) Draw::Set(a[5],radius);
132 if (Abs(radius) > tolerance) {
133 radius = 1.0e0/ radius;
134 di << "Max Radius of Curvature : " << radius << "\n";
137 di << "Min Radius of Curvature : infinite\n";
140 di << "Curvature not defined.\n";
150 //=======================================================================
151 //function : anasurface
153 //=======================================================================
155 static Standard_Integer anasurface (Draw_Interpretor& ,
165 loc = gp_Ax3(gp_Pnt(0,0,0),gp_Dir(0,0,1),gp_Dir(1,0,0));
169 loc = gp_Ax3(gp_Pnt(Draw::Atof(a[2]),Draw::Atof(a[3]),Draw::Atof(a[4])),
170 gp_Dir(0,0,1),gp_Dir(1,0,0));
174 loc = gp_Ax3(gp_Pnt(Draw::Atof(a[2]),Draw::Atof(a[3]),Draw::Atof(a[4])),
175 gp_Dir(Draw::Atof(a[5]),Draw::Atof(a[6]),Draw::Atof(a[7])));
179 loc = gp_Ax3(gp_Pnt(Draw::Atof(a[2]),Draw::Atof(a[3]),Draw::Atof(a[4])),
180 gp_Dir(Draw::Atof(a[5]),Draw::Atof(a[6]),Draw::Atof(a[7])),
181 gp_Dir(Draw::Atof(a[8]),Draw::Atof(a[9]),Draw::Atof(a[10])));
187 Handle(Geom_Geometry) result;
189 if (!strcasecmp(a[0],"plane")) {
190 Handle(Geom_Plane) C = new Geom_Plane(loc);
194 if (i >= n) return 1;
195 Standard_Real par1 = Draw::Atof(a[i]);
197 if (!strcasecmp(a[0],"cylinder")) {
198 Handle(Geom_CylindricalSurface) C =
199 new Geom_CylindricalSurface(loc,par1);
203 else if (!strcasecmp(a[0],"sphere")) {
204 Handle(Geom_SphericalSurface) C =
205 new Geom_SphericalSurface(loc,par1);
210 if (i+1 >= n) return 1;
211 Standard_Real par2 = Draw::Atof(a[i+1]);
213 if (!strcasecmp(a[0],"cone")) {
214 par1 *= (M_PI / 180.0);
215 Handle(Geom_ConicalSurface) C =
216 new Geom_ConicalSurface(loc,par1,par2);
220 else if (!strcasecmp(a[0],"torus")) {
221 Handle(Geom_ToroidalSurface) C =
222 new Geom_ToroidalSurface(loc,par1,par2);
228 DrawTrSurf::Set(a[1],result);
233 //=======================================================================
234 //function : polesurface
236 //=======================================================================
238 static Standard_Integer polesurface (Draw_Interpretor& , Standard_Integer n, const char** a)
240 Standard_Integer k,j,i;
245 if (!strcasecmp(a[0],"beziersurf")) {
247 Standard_Integer nup = Draw::Atoi(a[2]);
248 Standard_Integer nvp = Draw::Atoi(a[3]);
249 if (nup * nvp == 0) return 1;
251 i = (n - 4) / (nup * nvp);
252 if (i < 3 || i > 4) return 1;
253 Standard_Boolean hasw = i == 4;
255 TColgp_Array2OfPnt poles(1,nup,1,nvp);
256 TColStd_Array2OfReal weights(1,nup,1,nvp);
259 for (j = 1; j <= nvp; j++) {
260 for (i = 1; i <= nup; i++) {
261 poles(i, j).SetCoord(Draw::Atof(a[k]),Draw::Atof(a[k+1]),Draw::Atof(a[k+2]));
264 weights(i, j) = Draw::Atof(a[k]);
270 Handle(Geom_BezierSurface) result;
272 result = new Geom_BezierSurface(poles,weights);
274 result = new Geom_BezierSurface(poles);
276 DrawTrSurf::Set(a[1],result);
280 Standard_Integer udeg = Draw::Atoi(a[2]);
281 Standard_Integer nbuk = Draw::Atoi(a[3]);
283 Standard_Boolean uper = (*a[0] == 'u') || (*(a[0]+1) == 'u');
284 Standard_Boolean vper = (*a[0] == 'v') || (*(a[0]+1) == 'v');
286 TColStd_Array1OfReal uk (1, nbuk);
287 TColStd_Array1OfInteger umult(1, nbuk);
289 Standard_Integer SigmaU = 0;
290 for (i = 1; i<=nbuk; i++) {
291 uk( i) = Draw::Atof(a[k]);
293 umult( i) = Draw::Atoi(a[k]);
298 Standard_Integer vdeg = Draw::Atoi(a[k]);
300 Standard_Integer nbvk = Draw::Atoi(a[k]);
303 TColStd_Array1OfReal vk (1, nbvk);
304 TColStd_Array1OfInteger vmult(1, nbvk);
305 Standard_Integer SigmaV = 0;
306 for (i = 1; i<=nbvk; i++) {
307 vk( i) = Draw::Atof(a[k]);
309 vmult( i) = Draw::Atoi(a[k]);
314 Standard_Integer nup,nvp;
316 nup = SigmaU - umult(nbuk);
318 nup = SigmaU - udeg -1;
320 nvp = SigmaV - vmult(nbvk);
322 nvp = SigmaV - vdeg -1;
323 TColgp_Array2OfPnt poles (1, nup, 1, nvp);
324 TColStd_Array2OfReal weights(1, nup, 1, nvp);
326 for (j = 1; j <= nvp; j++) {
327 for (i = 1; i <= nup; i++) {
328 poles(i, j).SetCoord(Draw::Atof(a[k]),Draw::Atof(a[k+1]),Draw::Atof(a[k+2]));
330 weights(i, j) = Draw::Atof(a[k]);
335 Handle(Geom_BSplineSurface) result =
336 new Geom_BSplineSurface(poles, weights,
342 DrawTrSurf::Set(a[1],result);
348 //=======================================================================
349 //function : algosurface
351 //=======================================================================
353 static Standard_Integer algosurface (Draw_Interpretor& , Standard_Integer n, const char** a)
357 Handle(Geom_Curve) GC = DrawTrSurf::GetCurve(a[2]);
358 if (GC.IsNull()) return 1;
363 if (!strcasecmp(a[0],"extsurf")) {
364 D.SetCoord(Draw::Atof(a[3]),Draw::Atof(a[4]),Draw::Atof(a[5]));
365 Handle(Geom_SurfaceOfLinearExtrusion) result =
366 new Geom_SurfaceOfLinearExtrusion(GC,D);
368 DrawTrSurf::Set(a[1],result);
371 else if (!strcasecmp(a[0],"revsurf")) {
373 P.SetCoord(Draw::Atof(a[3]),Draw::Atof(a[4]),Draw::Atof(a[5]));
374 D.SetCoord(Draw::Atof(a[6]),Draw::Atof(a[7]),Draw::Atof(a[8]));
376 Handle(Geom_SurfaceOfRevolution) result =
377 new Geom_SurfaceOfRevolution(GC,gp_Ax1(P,D));
379 DrawTrSurf::Set(a[1],result);
389 //=======================================================================
390 //function : trimming
392 //=======================================================================
394 static Standard_Integer trimming (Draw_Interpretor& ,
395 Standard_Integer n, const char** a)
399 Handle(Geom_Curve) GC = DrawTrSurf::GetCurve(a[2]);
400 Handle(Geom2d_Curve) GC2d = DrawTrSurf::GetCurve2d(a[2]);
401 Handle(Geom_Surface) GS = DrawTrSurf::GetSurface(a[2]);
405 Handle(Geom_TrimmedCurve) T = Handle(Geom_TrimmedCurve)::DownCast(GC);
406 if (!T.IsNull()) GC = T->BasisCurve();
407 DrawTrSurf::Set(a[1],GC);
409 else if (!GC2d.IsNull()) {
410 Handle(Geom2d_TrimmedCurve) T = Handle(Geom2d_TrimmedCurve)::DownCast(GC2d);
411 if (!T.IsNull()) GC2d = T->BasisCurve();
412 DrawTrSurf::Set(a[1],GC2d);
414 else if (!GS.IsNull()) {
415 Handle(Geom_RectangularTrimmedSurface) T = Handle(Geom_RectangularTrimmedSurface)::DownCast(GS);
416 if (!T.IsNull()) GS = T->BasisSurface();
417 DrawTrSurf::Set(a[1],GS);
424 Standard_Real u1 = Draw::Atof(a[3]);
425 Standard_Real u2 = Draw::Atof(a[4]);
427 Standard_Real v1 = 0., v2 = 0.;
428 Standard_Boolean USense = Standard_True, VSense = Standard_True;
430 Handle(Geom_Geometry) result;
431 Handle(Geom2d_Curve) result2d;
433 if (!strcasecmp(a[0],"trim")) {
436 v1 = Draw::Atof(a[5]);
437 v2 = Draw::Atof(a[6]);
440 USense = *a[7] != '0';
441 VSense = *a[8] != '0';
444 new Geom_RectangularTrimmedSurface(GS, u1, u2, v1, v2, USense, VSense);
446 else if (!GC.IsNull()) {
449 USense = *a[5] != '0';
451 result = new Geom_TrimmedCurve(GC, u1, u2, USense);
453 else if (!GC2d.IsNull()) {
456 USense = *a[5] != '0';
458 result2d = new Geom2d_TrimmedCurve(GC2d, u1, u2, USense);
464 if (GS.IsNull()) return 1;
465 Standard_Boolean Utrim = !strcasecmp(a[0], "trimu");
467 USense = *a[5] != '0';
468 result = new Geom_RectangularTrimmedSurface(GS, u1, u2, Utrim, USense);
471 if (!result.IsNull())
472 DrawTrSurf::Set(a[1], result);
474 DrawTrSurf::Set(a[1],result2d);
479 //=======================================================================
480 //function : converting
482 //=======================================================================
484 static Standard_Integer converting(Draw_Interpretor& , Standard_Integer n, const char ** a)
486 if ( n < 3) return 1;
488 Convert_ParameterisationType
489 Parameterisation = Convert_TgtThetaOver2 ;
490 if (strcmp(a[n-1], "qa") == 0) {
491 Parameterisation = Convert_QuasiAngular ;
493 else if (strcmp(a[n-1], "c1") == 0) {
494 Parameterisation = Convert_RationalC1 ;
496 else if (strcmp (a[n-1], "s1") == 0) {
497 Parameterisation = Convert_TgtThetaOver2_1 ;
499 else if (strcmp (a[n-1], "s2") == 0) {
500 Parameterisation = Convert_TgtThetaOver2_2;
502 else if (strcmp (a[n-1], "s3") == 0) {
503 Parameterisation = Convert_TgtThetaOver2_3 ;
505 else if (strcmp (a[n-1], "s4") == 0) {
506 Parameterisation = Convert_TgtThetaOver2_4 ;
508 else if (strcmp (a[n-1], "po") == 0) {
509 Parameterisation = Convert_Polynomial;
512 Handle(Geom_Curve) GC = DrawTrSurf::GetCurve(a[2]);
514 Handle(Geom_Surface) GS = DrawTrSurf::GetSurface(a[2]);
516 Handle(Geom2d_Curve) G2d = DrawTrSurf::GetCurve2d(a[2]);
521 G2d = Geom2dConvert::CurveToBSplineCurve(G2d,
523 DrawTrSurf::Set(a[1], G2d);
527 GS = GeomConvert::SurfaceToBSplineSurface( GS);
528 DrawTrSurf::Set(a[1], GS);
532 GC = GeomConvert::CurveToBSplineCurve( GC,
534 DrawTrSurf::Set(a[1], GC);
541 //=======================================================================
542 //function : tobezier
544 //=======================================================================
546 static Standard_Integer tobezier(Draw_Interpretor& di,
547 Standard_Integer n, const char** a)
549 if ( n < 3) return 1;
550 Standard_Integer i,j,NbU,NbV,NbArc;
551 char* name = new char[100];
553 Handle(Geom2d_BSplineCurve) C2d =
554 DrawTrSurf::GetBSplineCurve2d(a[2]);
556 Handle(Geom_BSplineCurve) C3d =
557 DrawTrSurf::GetBSplineCurve(a[2]);
559 Handle(Geom_BSplineSurface) S =
560 DrawTrSurf::GetBSplineSurface(a[2]);
561 if ( S.IsNull()) return 1;
563 Standard_Real U1, U2, V1, V2;
564 U1 = Draw::Atof(a[3]);
565 U2 = Draw::Atof(a[4]);
566 V1 = Draw::Atof(a[5]);
567 V2 = Draw::Atof(a[6]);
568 GeomConvert_BSplineSurfaceToBezierSurface
569 Conv(S, U1, U2, V1, V2, Precision::PConfusion());
570 NbU = Conv.NbUPatches();
571 NbV = Conv.NbVPatches();
572 di << NbU << " X " << NbV << " patches in the result\n";
573 for (i = 1; i <= NbU; i++) {
574 for (j = 1; j <= NbV; j++) {
575 Sprintf(name,"%s_%i_%i",a[1],i,j);
577 DrawTrSurf::Set(temp,Conv.Patch(i,j));
582 GeomConvert_BSplineSurfaceToBezierSurface Conv(S);
583 NbU = Conv.NbUPatches();
584 NbV = Conv.NbVPatches();
585 di << NbU << " X " << NbV << " patches in the result\n";
586 for (i = 1; i <= NbU; i++) {
587 for (j = 1; j <= NbV; j++) {
588 Sprintf(name,"%s_%i_%i",a[1],i,j);
590 DrawTrSurf::Set(temp,Conv.Patch(i,j));
597 Standard_Real U1, U2;
598 U1 = Draw::Atof(a[3]);
599 U2 = Draw::Atof(a[4]);
600 GeomConvert_BSplineCurveToBezierCurve Conv(C3d, U1, U2,
601 Precision::PConfusion());
602 NbArc = Conv.NbArcs();
603 di << NbArc << " arcs in the result\n";
604 for (i = 1; i <= NbArc; i++) {
605 Sprintf(name,"%s_%i",a[1],i);
607 DrawTrSurf::Set(temp,Conv.Arc(i));
611 GeomConvert_BSplineCurveToBezierCurve Conv(C3d);
612 NbArc = Conv.NbArcs();
613 di << NbArc << " arcs in the result\n";
614 for (i = 1; i <= NbArc; i++) {
615 Sprintf(name,"%s_%i",a[1],i);
617 DrawTrSurf::Set(temp,Conv.Arc(i));
624 Standard_Real U1, U2;
625 U1 = Draw::Atof(a[3]);
626 U2 = Draw::Atof(a[4]);
627 Geom2dConvert_BSplineCurveToBezierCurve Conv(C2d, U1, U2,
628 Precision::PConfusion());
629 NbArc = Conv.NbArcs();
630 di << NbArc << " arcs in the result\n";
631 for (i = 1; i <= NbArc; i++) {
632 Sprintf(name,"%s_%i",a[1],i);
634 DrawTrSurf::Set(temp,Conv.Arc(i));
638 Geom2dConvert_BSplineCurveToBezierCurve Conv(C2d);
639 NbArc = Conv.NbArcs();
640 di << NbArc << " arcs in the result\n";
641 for (i = 1; i <= NbArc; i++) {
642 Sprintf(name,"%s_%i",a[1],i);
644 DrawTrSurf::Set(temp,Conv.Arc(i));
652 //=======================================================================
655 //=======================================================================
657 static Standard_Integer convbz(Draw_Interpretor& di,
658 Standard_Integer n, const char** a)
660 if ( n < 4) return 1;
662 Standard_Integer ii, jj, kk=0, NbU, NbV;
663 Standard_Real Tol = Precision::Confusion();
665 NbU = Draw::Atoi(a[2]);
666 Handle(Geom_Curve) aCurve (Handle(Geom_Curve)::DownCast(DrawTrSurf::Get(a[3])));
667 if (aCurve.IsNull()) {
669 NbV = Draw::Atoi(a[3]);
671 di << "The number of bezier surface have to be " << NbU*NbV << "\n";
674 TColGeom_Array2OfBezierSurface BZ(1, NbU, 1, NbV);
676 for (jj=1; jj<=NbV; jj++)
677 for(ii=1;ii<=NbU; ii++) {
679 Handle(Geom_BezierSurface)::DownCast(DrawTrSurf::Get(a[kk]));
680 if (BZ(ii,jj).IsNull()) {
681 di << "the Surface " << kk <<"is not a BezierSurface\n";
686 if (kk<n) Tol = Draw::Atof(a[kk]);
688 GeomConvert_CompBezierSurfacesToBSplineSurface Conv(BZ, Tol);
690 if (! Conv.IsDone()) {
691 di << "Convert Not Done\n";
695 Handle(Geom_BSplineSurface) BSurf =
696 new Geom_BSplineSurface(Conv.Poles()->Array2(),
697 Conv.UKnots()->Array1(),
698 Conv.VKnots()->Array1(),
699 Conv.UMultiplicities()->Array1(),
700 Conv.VMultiplicities()->Array1(),
704 DrawTrSurf::Set(a[1], BSurf);
706 else { // cas de courbes
707 Convert_CompBezierCurvesToBSplineCurve Conv;
708 Handle(Geom_BezierCurve) BZ;
709 for (ii=1, kk=3; ii<=NbU; ii++,kk++) {
710 BZ = Handle(Geom_BezierCurve)::DownCast(DrawTrSurf::Get(a[kk]));
712 di << "the curve " << kk <<"is not a BezierCurve\n";
715 TColgp_Array1OfPnt Poles(1, BZ->NbPoles());
717 Conv.AddCurve(Poles);
722 TColgp_Array1OfPnt Poles(1, Conv.NbPoles());
724 TColStd_Array1OfInteger Mults(1, Conv.NbKnots());
725 TColStd_Array1OfReal Knots(1, Conv.NbKnots());
726 Conv.KnotsAndMults(Knots, Mults);
727 Handle(Geom_BSplineCurve) BS =
728 new (Geom_BSplineCurve) (Poles, Knots, Mults,
730 DrawTrSurf::Set(a[1], BS);
736 //=======================================================================
737 //function : approxsurf
738 //purpose : Approximation d'une Surface par une BSpline non rationnelle
739 //=======================================================================
742 static Standard_Integer approxsurf(Draw_Interpretor& di, Standard_Integer n, const char** a)
744 // " Tolerance (par defaut 0.1mm) "
745 Standard_Real Tol = 1.e-4;
746 // " Ordres de continuites : 0, 1 ou 2 (par defaut 1)"
747 GeomAbs_Shape myUCont = GeomAbs_C1, myVCont = GeomAbs_C1;
748 // " Degre maximum des carreaux de Bezier 14 par defaut "
749 Standard_Integer degU = 14, degV = 14;
750 // " Nombre max de carreaux (par defaut 10)"
751 Standard_Integer nmax = 16;
752 // "Code de precision par defaults"
753 Standard_Integer myPrec = 1;
755 if ( n>10 || n<3) return 1;
757 if (n>3) Tol = Max(Draw::Atof(a[3]),1.e-10);
762 if (Draw::Atoi(a[4]) == 0) myUCont = GeomAbs_C0;
763 if (Draw::Atoi(a[4]) == 2) myUCont = GeomAbs_C2;
764 if (Draw::Atoi(a[5]) == 0) myVCont = GeomAbs_C0;
765 if (Draw::Atoi(a[5]) == 2) myVCont = GeomAbs_C2;
771 ( degU = (Draw::Atoi(a[6])));
772 ( degV = (Draw::Atoi(a[7])));
773 if ((degU<1) || (degU>24)) degU = 14;
774 if ((degV<1) || (degV>24)) degV = 14;
777 if (n>8) nmax = Draw::Atoi(a[8]);
778 if (n>9) myPrec = Draw::Atoi(a[9]);
780 Handle(Geom_Surface) surf = DrawTrSurf::GetSurface(a[2]);
781 if (surf.IsNull()) return 1;
782 GeomConvert_ApproxSurface myApprox(surf,Tol,myUCont,myVCont,degU,degV,nmax,myPrec);
783 if ( myApprox.HasResult()) DrawTrSurf::Set(a[1], myApprox.Surface());
788 //=======================================================================
789 //function : offseting
791 //=======================================================================
793 static Standard_Integer offseting (Draw_Interpretor& ,
794 Standard_Integer n, const char** a)
798 // test the Geom2d curve
799 Handle(Geom2d_Curve) C2d = DrawTrSurf::GetCurve2d(a[2]);
801 Handle(Geom2d_OffsetCurve) OC = new Geom2d_OffsetCurve(C2d,Draw::Atof(a[3]));
802 DrawTrSurf::Set(a[1],OC);
806 Standard_Boolean yasurf = Standard_False;
808 Handle(Geom_Curve) GC = DrawTrSurf::GetCurve(a[2]);
809 Handle(Geom_Surface) GS;
811 GS = DrawTrSurf::GetSurface(a[2]);
814 yasurf = Standard_True;
817 Standard_Real dist = Draw::Atof(a[3]);
819 Handle(Geom_Geometry) result;
822 Handle(Geom_OffsetSurface) GO = new Geom_OffsetSurface(GS,dist);
827 gp_Dir D(Draw::Atof(a[4]),Draw::Atof(a[5]),Draw::Atof(a[6]));
828 Handle(Geom_OffsetCurve) GT = new Geom_OffsetCurve(GC, dist, D);
832 DrawTrSurf::Set(a[1], result);
836 //=======================================================================
837 //function : sreverse
839 //=======================================================================
841 static Standard_Integer sreverse (Draw_Interpretor& , Standard_Integer n, const char** a)
846 for (i = 1; i < n; i++) {
848 Handle(Geom_Surface) GS = DrawTrSurf::GetSurface(a[i]);
861 //=======================================================================
864 //=======================================================================
866 static Standard_Integer iso (Draw_Interpretor& , Standard_Integer n, const char** a)
870 Handle(Geom_Curve) C;
871 Standard_Real par = Draw::Atof(a[3]);
872 Handle(Geom_Surface) GS = DrawTrSurf::GetSurface(a[2]);
878 DrawTrSurf::Set(a[1],C);
885 //=======================================================================
888 //=======================================================================
890 static Standard_Integer value (Draw_Interpretor& ,
891 Standard_Integer n, const char** a)
895 Handle(Geom_Surface) GS = DrawTrSurf::GetSurface(a[1]);
896 if (GS.IsNull()) return 1;
898 Standard_Real U = Draw::Atof(a[2]);
899 Standard_Real V = Draw::Atof(a[3]);
901 Standard_Boolean DrawPoint = ( n%3 == 2);
909 GS->D2(U,V,P,DU,DV,D2U,D2V,D2UV);
910 Draw::Set(a[13],D2U.X());
911 Draw::Set(a[14],D2U.Y());
912 Draw::Set(a[15],D2U.Z());
913 Draw::Set(a[16],D2V.X());
914 Draw::Set(a[17],D2V.Y());
915 Draw::Set(a[18],D2V.Z());
916 Draw::Set(a[19],D2UV.X());
917 Draw::Set(a[20],D2UV.Y());
918 Draw::Set(a[21],D2UV.Z());
923 Draw::Set(a[7],DU.X());
924 Draw::Set(a[8],DU.Y());
925 Draw::Set(a[9],DU.Z());
926 Draw::Set(a[10],DV.X());
927 Draw::Set(a[11],DV.Y());
928 Draw::Set(a[12],DV.Z());
934 Draw::Set(a[4],P.X());
935 Draw::Set(a[5],P.Y());
936 Draw::Set(a[6],P.Z());
939 DrawTrSurf::Set(a[n],P);
945 //=======================================================================
946 //function : movepole
948 //=======================================================================
950 static Standard_Integer movepole (Draw_Interpretor& , Standard_Integer n, const char** a)
953 Standard_Boolean BSpline = Standard_False;
955 Handle(Geom_BezierSurface) GBz = DrawTrSurf::GetBezierSurface(a[1]);
956 Handle(Geom_BSplineSurface) GBs;
958 GBs = DrawTrSurf::GetBSplineSurface(a[1]);
963 BSpline = Standard_True;
966 Standard_Real dx = Draw::Atof(a[n-3]);
967 Standard_Real dy = Draw::Atof(a[n-2]);
968 Standard_Real dz = Draw::Atof(a[n-1]);
970 Standard_Integer nup, nvp;
972 nup = GBz->NbUPoles();
973 nvp = GBz->NbVPoles();
976 nup = GBs->NbUPoles();
977 nvp = GBs->NbVPoles();
980 Standard_Integer FirstRow=0, LastRow=0, FirstCol=0, LastCol=0;
981 // Rem : Row = indice ligne. -> variation en U.
982 // Col = indice colonne.-> variation en V.
984 if (!strcasecmp(a[0],"movep")) {
986 FirstRow = Draw::Atoi(a[2]);
987 FirstCol = Draw::Atoi(a[3]);
988 if ( FirstRow < 1 || FirstRow > nup ||
989 FirstCol < 1 || FirstCol > nvp ) return 1;
993 else if (!strcasecmp(a[0],"moverowp")) {
994 FirstRow = Draw::Atoi(a[2]);
995 if ( FirstRow < 1 || FirstRow > nup ) return 1;
1000 else if (!strcasecmp(a[0],"movecolp")) {
1001 FirstCol = Draw::Atoi(a[2]);
1002 if ( FirstCol < 1 || FirstCol > nvp ) return 1;
1010 for ( Standard_Integer i = FirstRow; i<= LastRow; i++) {
1011 for ( Standard_Integer j = FirstCol; j<= LastCol; j++) {
1014 P.SetCoord(P.X()+dx, P.Y()+dy, P.Z()+dz);
1015 GBz->SetPole(i,j,P);
1019 P.SetCoord(P.X()+dx, P.Y()+dy, P.Z()+dz);
1020 GBs->SetPole(i,j,P);
1031 //=======================================================================
1032 //function : movepoint
1034 //=======================================================================
1036 static Standard_Integer movepoint (Draw_Interpretor& , Standard_Integer n, const char** a)
1038 if (n < 7) return 1;
1040 Handle(Geom_BSplineSurface) GBs = DrawTrSurf::GetBSplineSurface(a[1]);
1045 Standard_Real u = Draw::Atof(a[2]);
1046 Standard_Real v = Draw::Atof(a[3]);
1048 Standard_Real dx = Draw::Atof(a[4]);
1049 Standard_Real dy = Draw::Atof(a[5]);
1050 Standard_Real dz = Draw::Atof(a[6]);
1052 Standard_Integer index1u = 0;
1053 Standard_Integer index2u = 0;
1054 Standard_Integer index1v = 0;
1055 Standard_Integer index2v = 0;
1057 Standard_Integer fmodifu, lmodifu, fmodifv, lmodifv;
1059 index1u = Draw::Atoi(a[7]);
1060 index2u = Draw::Atoi(a[8]);
1061 index1v = Draw::Atoi(a[9]);
1062 index2v = Draw::Atoi(a[10]);
1066 index2u = GBs->NbUPoles()-1;
1068 index2v = GBs->NbVPoles()-1;
1073 p.SetCoord(p.X()+dx, p.Y()+dy, p.Z()+dz);
1074 GBs->MovePoint(u, v, p, index1u, index2u, index1v, index2v, fmodifu, lmodifu, fmodifv, lmodifv);
1080 //=======================================================================
1081 //function : insertknot
1083 //=======================================================================
1085 static Standard_Integer insertknot (Draw_Interpretor& , Standard_Integer n, const char** a)
1087 if (n < 3) return 1;
1089 Handle(Geom_BSplineSurface) GBs = DrawTrSurf::GetBSplineSurface(a[1]);
1091 if (GBs.IsNull()) return 1;
1093 Standard_Real knot=0;
1094 Standard_Integer mult = 0;
1095 Standard_Integer index=0;
1096 if ( !strcasecmp(a[0],"insertuknot") ||
1097 !strcasecmp(a[0],"insertvknot") ) {
1099 knot = Draw::Atof(a[2]);
1100 mult = Draw::Atoi(a[3]);
1102 else if ( !strcasecmp(a[0],"remuknot") ||
1103 !strcasecmp(a[0],"remvknot") ) {
1104 index = Draw::Atoi(a[2]);
1105 if (n>=4) mult = Draw::Atoi(a[3]);
1108 Standard_Real tol = RealLast();
1110 if (!strcasecmp(a[0],"insertuknot")) {
1111 GBs->InsertUKnot(knot,mult,Precision::PConfusion());
1113 else if (!strcasecmp(a[0],"insertvknot")) {
1114 GBs->InsertVKnot(knot,mult,Precision::PConfusion());
1116 else if (!strcasecmp(a[0],"remuknot")) {
1117 if (n>=5) tol = Draw::Atof(a[4]);
1118 if (!GBs->RemoveUKnot(index,mult,tol))
1121 else if (!strcasecmp(a[0],"remvknot")) {
1122 if (n>=5) tol = Draw::Atof(a[4]);
1123 if (!GBs->RemoveVKnot(index,mult,tol))
1131 //=======================================================================
1132 //function : incdegree
1134 //=======================================================================
1136 static Standard_Integer incdegree (Draw_Interpretor& di, Standard_Integer n, const char** a)
1138 if (n < 3) return 1;
1140 Standard_Integer NewDeg = Draw::Atoi(a[2]);
1141 Standard_Boolean BSpline = Standard_False;
1143 Standard_Integer UDeg=0, VDeg=0;
1145 Handle(Geom_BezierSurface) GBz = DrawTrSurf::GetBezierSurface(a[1]);
1146 Handle(Geom_BSplineSurface) GBs;
1149 GBs = DrawTrSurf::GetBSplineSurface(a[1]);
1152 BSpline = Standard_True;
1155 Standard_Integer Degree=0;
1156 if ( !strcasecmp(a[0],"incudeg")) {
1159 Degree = GBs->UDegree();
1160 VDeg = GBs->VDegree();
1163 Degree = GBz->UDegree();
1164 VDeg = GBz->VDegree();
1167 else if ( !strcasecmp(a[0],"incvdeg")) {
1170 Degree = GBs->VDegree();
1171 UDeg = GBs->UDegree();
1174 Degree = GBz->VDegree();
1175 UDeg = GBz->UDegree();
1179 if (Degree > NewDeg) {
1180 di<<"The Degree must be greater than " << Degree <<"\n";
1185 GBs->IncreaseDegree(UDeg, VDeg);
1188 GBz->Increase(UDeg, VDeg);
1195 //=======================================================================
1196 //function : rempole
1198 //=======================================================================
1200 static Standard_Integer rempole (Draw_Interpretor& di, Standard_Integer n, const char** a)
1202 if (n < 3) return 1;
1204 Standard_Integer NewIndex = Draw::Atoi(a[2]);
1205 Standard_Boolean BSpline = Standard_False;
1207 Handle(Geom_BezierSurface) GBz = DrawTrSurf::GetBezierSurface(a[1]);
1208 Handle(Geom_BSplineSurface) GBs;
1211 GBs = DrawTrSurf::GetBSplineSurface(a[1]);
1214 BSpline = Standard_True;
1217 if ( !strcasecmp(a[0],"remrowpole")) {
1219 di << " Error : Cannot remove a polerow on a BSplineSurface \n";
1222 GBz->RemovePoleRow(NewIndex);
1225 else if ( !strcasecmp(a[0],"remcolpole")) {
1227 di << " Error : Cannot remove a polecol on a BSplineSurface \n";
1230 GBz->RemovePoleCol(NewIndex);
1238 //=======================================================================
1241 //=======================================================================
1243 static Standard_Integer sfindp (Draw_Interpretor& , Standard_Integer n, const char** a)
1245 if (n < 7) return 1;
1246 Standard_Boolean BSpline = Standard_False;
1248 Handle(Geom_BezierSurface) GBz = DrawTrSurf::GetBezierSurface(a[1]);
1249 Handle(Geom_BSplineSurface) GBs;
1251 GBs = DrawTrSurf::GetBSplineSurface(a[1]);
1256 BSpline = Standard_True;
1259 Standard_Integer UIndex = 0;
1260 Standard_Integer VIndex = 0;
1261 Standard_Integer view = Draw::Atoi(a[2]);
1262 Standard_Real x = Draw::Atof(a[3]);
1263 Standard_Real y = Draw::Atof(a[4]);
1265 Draw_Display d = dout.MakeDisplay(view);
1268 Handle(DrawTrSurf_BezierSurface) DBz =
1269 new DrawTrSurf_BezierSurface(GBz);
1270 DBz->FindPole( x, y, d, 5, UIndex,VIndex);
1273 Handle(DrawTrSurf_BSplineSurface) DBs =
1274 new DrawTrSurf_BSplineSurface(GBs);
1275 DBs->FindPole( x, y, d, 5, UIndex,VIndex);
1278 Draw::Set(a[5],UIndex);
1279 Draw::Set(a[6],VIndex);
1285 //=======================================================================
1286 //function : ssetperiodic
1288 //=======================================================================
1290 static Standard_Integer ssetperiodic (Draw_Interpretor& , Standard_Integer n, const char** a)
1292 if (n < 2) return 1;
1296 if (!strcasecmp(a[0],"setuperiodic")) {
1297 for (i = 1; i < n; i++) {
1298 Handle(Geom_BSplineSurface)
1299 GBs = DrawTrSurf::GetBSplineSurface(a[i]);
1300 if (!GBs.IsNull()) {
1301 GBs->SetUPeriodic();
1306 else if (!strcasecmp(a[0],"setvperiodic")){
1307 for (i = 1; i < n; i++) {
1308 Handle(Geom_BSplineSurface)
1309 GBs = DrawTrSurf::GetBSplineSurface(a[i]);
1310 if (!GBs.IsNull()) {
1311 GBs->SetVPeriodic();
1316 else if (!strcasecmp(a[0],"setunotperiodic")){
1317 for (i = 1; i < n; i++) {
1318 Handle(Geom_BSplineSurface)
1319 GBs = DrawTrSurf::GetBSplineSurface(a[i]);
1320 if (!GBs.IsNull()) {
1321 GBs->SetUNotPeriodic();
1326 else if (!strcasecmp(a[0],"setvnotperiodic")){
1327 for (i = 1; i < n; i++) {
1328 Handle(Geom_BSplineSurface)
1329 GBs = DrawTrSurf::GetBSplineSurface(a[i]);
1330 if (!GBs.IsNull()) {
1331 GBs->SetVNotPeriodic();
1339 //=======================================================================
1342 //=======================================================================
1344 static Standard_Integer exchuv (Draw_Interpretor& , Standard_Integer n, const char** a)
1346 if (n < 2) return 1;
1349 for (i = 1; i < n; i++) {
1351 Handle(Geom_BSplineSurface) GBs = DrawTrSurf::GetBSplineSurface(a[i]);
1352 if (!GBs.IsNull()) {
1357 Handle(Geom_BezierSurface) GBz = DrawTrSurf::GetBezierSurface(a[i]);
1358 if (!GBz.IsNull()) {
1368 //=======================================================================
1371 //=======================================================================
1373 static Standard_Integer segsur (Draw_Interpretor& , Standard_Integer n, const char** a)
1375 if (n < 6 || n > 8) return 1;
1377 Handle(Geom_BezierSurface) GBz = DrawTrSurf::GetBezierSurface(a[1]);
1378 Handle(Geom_BSplineSurface) GBs;
1380 GBs = DrawTrSurf::GetBSplineSurface(a[1]);
1384 Standard_Real aUTolerance = Precision::PConfusion();
1385 Standard_Real aVTolerance = Precision::PConfusion();
1387 aUTolerance = aVTolerance = Draw::Atof(a[6]);
1389 aVTolerance = Draw::Atof(a[7]);
1391 GBs->Segment(Draw::Atof(a[2]),Draw::Atof(a[3]),Draw::Atof(a[4]),Draw::Atof(a[5]), aUTolerance, aVTolerance);
1394 GBz->Segment(Draw::Atof(a[2]),Draw::Atof(a[3]),Draw::Atof(a[4]),Draw::Atof(a[5]));
1401 static Standard_Integer compBsplSur (Draw_Interpretor& , Standard_Integer n, const char** a)
1405 Message::SendFail() << "Syntax error: Invalid number of parameters";
1409 Handle(Geom_BSplineSurface) GBs1 = DrawTrSurf::GetBSplineSurface(a[1]);
1410 Handle(Geom_BSplineSurface) GBs2 = DrawTrSurf::GetBSplineSurface(a[2]);
1411 if (GBs1.IsNull() || GBs2.IsNull()) {
1412 Message::SendFail() << "Syntax error: Invalid surface";
1416 Standard_Real aU11,aU12,aV11,aV12;
1417 GBs1->Bounds(aU11,aU12,aV11,aV12);
1419 Standard_Real aU21,aU22,aV21,aV22;
1420 GBs2->Bounds(aU21,aU22,aV21,aV22);
1422 Standard_Real aUmin = Max(aU11,aU21);
1423 Standard_Real aUmax = Min(aU12,aU22);
1425 Standard_Real aVmin = Max(aV11,aV21);
1426 Standard_Real aVmax = Min(aV12,aV22);
1428 Standard_Integer nbP = 100;
1429 Standard_Real aStepU = (aUmax - aUmin)/nbP;
1430 Standard_Real aStepV = (aVmax - aVmin)/nbP;
1431 Standard_Integer nbErr =0;
1432 Standard_Integer i =1;
1433 for( ; i <= nbP +1; i++)
1435 Standard_Real aU = aUmin + aStepU*(i-1);
1436 Standard_Integer j =1;
1437 for( ; j <= nbP +1; j++)
1439 Standard_Real aV = aVmin + aStepV*(j-1);
1440 gp_Pnt aP1 = GBs1->Value(aU,aV);
1441 gp_Pnt aP2 = GBs2->Value(aU,aV);
1442 Standard_Real aDist = aP1.SquareDistance(aP2);
1443 if(aDist > Precision::SquareConfusion())
1446 Standard_Real aD = sqrt(aDist);
1447 std::cout<<"Surfaces differ for U,V,Dist: "<<aU<<" "<<aV<<" "<<aD<<std::endl;
1457 //=======================================================================
1458 //function : setuvorigin
1460 //=======================================================================
1462 static Standard_Integer setuvorigin (Draw_Interpretor& , Standard_Integer n, const char** a)
1464 if (n < 3) return 1;
1466 Handle(Geom_BSplineSurface) GBs = DrawTrSurf::GetBSplineSurface(a[1]);
1469 if ( !strcasecmp(a[0],"setuorigin")) {
1470 GBs->SetUOrigin(Draw::Atoi(a[2]));
1472 else if ( !strcasecmp(a[0],"setvorigin")) {
1473 GBs->SetVOrigin(Draw::Atoi(a[2]));
1483 //=======================================================================
1484 //function : parameters
1486 //=======================================================================
1488 static Standard_Integer parameters (Draw_Interpretor& di, Standard_Integer n, const char** a)
1492 // try to find parameters on a Surface
1493 Handle(Geom_Surface) S = DrawTrSurf::GetSurface(a[1]);
1494 if( S.IsNull() ) { di << "Unknown surface\n"; return 1; }
1495 gp_Pnt P(Draw::Atof(a[2]), Draw::Atof(a[3]), Draw::Atof(a[4]));
1496 Standard_Real Tol = Draw::Atof(a[5]), U = 0., V = 0.;
1497 Standard_Boolean res = GeomLib_Tool::Parameters(S,P,Tol,U,V);
1502 if( !res ) { di << "Wrong point\n"; return 1; }
1506 // try to find parameters on a 3d Curve
1507 Handle(Geom_Curve) C = DrawTrSurf::GetCurve(a[1]);
1508 if( C.IsNull() ) { di << "Unknown curve\n"; return 1; }
1509 gp_Pnt P(Draw::Atof(a[2]), Draw::Atof(a[3]), Draw::Atof(a[4]));
1510 Standard_Real Tol = Draw::Atof(a[5]), U = 0.;
1511 Standard_Boolean res = GeomLib_Tool::Parameter(C,P,Tol,U);
1515 if( !res ) { di << "Wrong point\n"; return 1; }
1519 // try to find parameters on a 2d Curve
1520 Handle(Geom2d_Curve) C = DrawTrSurf::GetCurve2d(a[1]);
1521 if( C.IsNull() ) { di << "Unknown curve 2d\n"; return 1; }
1522 gp_Pnt2d P(Draw::Atof(a[2]), Draw::Atof(a[3]));
1523 Standard_Real Tol = Draw::Atof(a[4]), U = 0.;
1524 Standard_Boolean res = GeomLib_Tool::Parameter(C,P,Tol,U);
1528 if( !res ) { di << "Wrong point\n"; return 1; }
1532 di << "Invalid parameters!\n";
1534 di << "parameters Surf X Y Z Tol U V\n";
1535 di << "parameters Curv X Y Z Tol U\n";
1536 di << "parameters Curv2d X Y Tol U\n";
1544 //=======================================================================
1547 //=======================================================================
1549 Standard_Integer bounds(Draw_Interpretor&, Standard_Integer n, const char** a)
1551 Standard_Real U1, U2, V1, V2;
1552 if ( n == 4) { // compute on a curve or a 2d curve
1553 Handle(Geom_Curve) C3d = DrawTrSurf::GetCurve(a[1]);
1554 if ( C3d.IsNull()) { // 2dcurve
1555 Handle(Geom2d_Curve) C2d = DrawTrSurf::GetCurve2d(a[1]);
1556 if ( C2d.IsNull()) return 1;
1557 U1 = C2d->FirstParameter();
1558 U2 = C2d->LastParameter();
1561 U1 = C3d->FirstParameter();
1562 U2 = C3d->LastParameter();
1567 else if ( n == 6) { // compute on a Surface
1568 Handle(Geom_Surface) S = DrawTrSurf::GetSurface(a[1]);
1569 if ( S.IsNull()) return 1;
1570 S->Bounds(U1,U2,V1,V2);
1581 //=======================================================================
1582 //function : SurfaceCommands
1584 //=======================================================================
1587 void GeomliteTest::SurfaceCommands(Draw_Interpretor& theCommands)
1589 static Standard_Boolean loaded = Standard_False;
1591 loaded = Standard_True;
1593 DrawTrSurf::BasicCommands(theCommands);
1596 // analytic surfaces
1597 g = "GEOMETRY surfaces creation";
1599 theCommands.Add("plane",
1600 "plane name [x y z [dx dy dz [ux uy uz]]]",
1604 theCommands.Add("cone",
1605 "cone name [x y z [dx dy dz [ux uy uz]]] semi-angle radius",
1609 theCommands.Add("cylinder",
1610 "cylinder name [x y z [dx dy dz [ux uy uz]]] radius",
1614 theCommands.Add("sphere",
1615 "sphere name [x y z [dx dy dz [ux uy uz]]] radius",
1619 theCommands.Add("torus",
1620 "torus name [x y z [dx dy dz [ux uy uz]]] major minor",
1624 theCommands.Add("beziersurf",
1625 "beziersurf name nbupoles nbvpoles pole, [weight]",
1629 theCommands.Add("bsplinesurf",
1630 "bsplinesurf name udegree nbuknots uknot, umult vdegree nbvknots vknot, vmult pole, weight",
1634 theCommands.Add("upbsplinesurf",
1635 "bsplinesurf name udegree nbuknots uknot, umult vdegree nbvknots vknot, vmult pole, weight",
1639 theCommands.Add("vpbsplinesurf",
1640 "bsplinesurf name udegree nbuknots uknot, umult vdegree nbvknots vknot, vmult pole, weight",
1644 theCommands.Add("uvpbsplinesurf",
1645 "bsplinesurf name udegree nbuknots uknot, umult vdegree nbvknots vknot, vmult pole, weight",
1649 theCommands.Add("extsurf",
1650 "extsurf name curvename dx dy dz",
1654 theCommands.Add("revsurf",
1655 "revsurf name curvename x y z dx dy dz",
1659 theCommands.Add("offset",
1660 "offset name basename distance [dx dy dz]",
1664 theCommands.Add("trim",
1665 "trim newname name [u1 u2 [v1 v2] [usense=1 vsense=1]]"
1666 "\n\t\t: Creates either a new trimmed curve from a curve"
1667 "\n\t\t: or a new trimmed surface in u and v from a surface."
1668 "\n\t\t: Removes trim when called without arguments."
1669 "\n\t\t: - u1 u2 lower and upper parameters of trimming on U direction"
1670 "\n\t\t: - v1 v2 lower and upper parameters of trimming on V direction"
1671 "\n\t\t: - usense vsense senses on U and V directions: 1 - true, 0 - false;"
1672 "\n\t\t Senses are used for the construction only if the surface is periodic"
1673 "\n\t\t in the corresponding parametric direction, and define the available part of the surface",
1677 theCommands.Add("trimu",
1678 "trimu newname name u1 u2 [usense=1]"
1679 "\n\t\t: Creates a u-trimmed surface."
1680 "\n\t\t: - u1 u2 lower and upper parameters of trimming on U direction"
1681 "\n\t\t: - usense sense on U direction: 1 - true, 0 - false;"
1682 "\n\t\t usense is used for the construction only if the surface is u-periodic"
1683 "\n\t\t in the u parametric direction, and define the available part of the surface",
1687 theCommands.Add("trimv",
1688 "trimv newname name v1 v2 [vsense=1]"
1689 "\n\t\t: Creates a v-trimmed surface."
1690 "\n\t\t: - u1 u2 lower and upper parameters of trimming on V direction"
1691 "\n\t\t: - vsense sense on V direction: 1 - true, 0 - false;"
1692 "\n\t\t vsense is used for the construction only if the surface is v-periodic"
1693 "\n\t\t in the v parametric direction, and define the available part of the surface",
1697 theCommands.Add("convert",
1698 "convert result c2d/c3d/surf [qa,c1,s1,s2,s3,s4,po]",
1702 theCommands.Add("tobezier",
1703 "tobezier result c2d/c3d/surf [ufirst, ulast / ufirst, ulast, vfirst, vlast]",
1707 theCommands.Add("convertfrombezier",
1708 "convertfrombezier result nbu [nbv] bz1 [bz2 .... bzn] [tol]",
1712 theCommands.Add("approxsurf",
1713 "approxsurf name surf [Tol [CnU CnV [degU degV [nmax]]]] ",
1717 g = "GEOMETRY Curves and Surfaces modification";
1719 theCommands.Add("ureverse",
1720 "ureverse name ... ",
1724 theCommands.Add("vreverse",
1725 "vreverse name ... ",
1729 theCommands.Add("movep",
1730 "movep name row col dx dy dz",
1734 theCommands.Add("moverowp",
1735 "moverowp name row dx dy dz",
1739 theCommands.Add("movecolp",
1740 "movecolp name col dx dy dz",
1744 theCommands.Add("movepoint",
1745 "movepoint name u v dx dy dz [index1u index2u index2v index2v",
1749 theCommands.Add("insertuknot",
1750 "insertuknot name knot mult",
1754 theCommands.Add("insertvknot",
1755 "insertvknot name knot mult",
1759 theCommands.Add("remuknot",
1760 "remuknot name index [mult] [tol]",
1764 theCommands.Add("remvknot",
1765 "remvknot name index [mult] [tol]",
1769 theCommands.Add("incudeg",
1770 "incudeg name degree",
1774 theCommands.Add("incvdeg",
1775 "incvdeg name degree",
1779 theCommands.Add("remrowpole",
1780 "remrowpole name index",
1784 theCommands.Add("remcolpole",
1785 "remcolpole name index",
1789 theCommands.Add("sfindp",
1790 "sfindp name view x y Uindex Vindex",
1794 theCommands.Add("setuperiodic",
1795 "setuperiodic name ...",
1799 theCommands.Add("setvperiodic",
1800 "setvperiodic name ...",
1804 theCommands.Add("setunotperiodic",
1805 "setunotperiodic name ...",
1809 theCommands.Add("setvnotperiodic",
1810 "setvnotperiodic name ...",
1814 theCommands.Add("exchuv",
1819 theCommands.Add("segsur",
1820 "segsur name Ufirst Ulast Vfirst Vlast [Utol [Vtol]]",
1824 theCommands.Add("setuorigin",
1825 "setuorigin name knotindex",
1829 theCommands.Add("setvorigin",
1830 "setvorigin name knotindex",
1834 g = "GEOMETRY curves creation";
1837 theCommands.Add("uiso",
1838 "uiso curvename surfacename u",
1842 theCommands.Add("viso",
1843 "viso curvename surfacename v",
1848 g = "GEOMETRY curves and surfaces analysis";
1850 theCommands.Add("svalue",
1851 "svalue surfname U V X Y Z [DUX DUY DUZ DVX DVY DVZ [D2UX D2UY D2UZ D2VX D2VY D2VZ D2UVX D2UVY D2UVZ]]",
1855 theCommands.Add("parameters",
1856 "parameters surf/curve X Y [Z] Tol U [V] : {X Y Z} point, {U V} output parameter(s)",
1860 theCommands.Add("bounds",
1861 "bounds S/C/C2d U1 U2 [V1 V2]",
1865 theCommands.Add("surface_radius",
1866 "surface_radius surface Uvalue <Real> Vvalue <Real> returns min max radius of curvature",
1869 theCommands.Add("compBsplSur","BsplSurf1 BSplSurf2",__FILE__,compBsplSur,g);