7fd59977 |
1 | // File: DrawTrSurf_2.cxx |
2 | // Created: Thu Aug 12 19:33:52 1993 |
3 | // Author: Bruno DUMORTIER |
4 | // <dub@topsn3> |
5 | |
6 | #ifdef HAVE_CONFIG_H |
7 | # include <config.h> |
8 | #endif |
9 | #include <GeomliteTest.hxx> |
10 | #include <DrawTrSurf.hxx> |
11 | #include <Draw.hxx> |
12 | #include <Draw_Interpretor.hxx> |
13 | #include <Draw_Appli.hxx> |
14 | #include <Draw_Display.hxx> |
15 | |
16 | #include <GeomAbs_SurfaceType.hxx> |
17 | #include <GeomAbs_IsoType.hxx> |
18 | #include <GeomAbs_Shape.hxx> |
19 | |
20 | #include <Geom_Plane.hxx> |
21 | #include <Geom_CylindricalSurface.hxx> |
22 | #include <Geom_ConicalSurface.hxx> |
23 | #include <Geom_SphericalSurface.hxx> |
24 | #include <Geom_ToroidalSurface.hxx> |
25 | #include <Geom_BezierSurface.hxx> |
26 | #include <Geom_BSplineSurface.hxx> |
27 | #include <Geom_SurfaceOfLinearExtrusion.hxx> |
28 | #include <Geom_SurfaceOfRevolution.hxx> |
29 | #include <Geom_RectangularTrimmedSurface.hxx> |
30 | #include <Geom_OffsetSurface.hxx> |
31 | #include <Geom_Surface.hxx> |
32 | |
33 | #include <Geom_TrimmedCurve.hxx> |
34 | #include <Geom_OffsetCurve.hxx> |
35 | #include <Geom_BezierCurve.hxx> |
36 | #include <Geom_BSplineCurve.hxx> |
37 | |
38 | #include <Geom2d_TrimmedCurve.hxx> |
39 | #include <Geom2d_OffsetCurve.hxx> |
40 | |
41 | #include <GeomAdaptor_Surface.hxx> |
42 | #include <GeomAdaptor_HSurface.hxx> |
43 | #include <GeomAdaptor_Curve.hxx> |
44 | #include <Geom2dAdaptor_Curve.hxx> |
45 | |
46 | #include <TColGeom_Array2OfBezierSurface.hxx> |
47 | #include <TColgp_Array1OfPnt.hxx> |
48 | #include <TColgp_Array2OfPnt.hxx> |
49 | #include <TColStd_Array1OfReal.hxx> |
50 | #include <TColStd_Array2OfReal.hxx> |
51 | #include <TColStd_Array1OfInteger.hxx> |
52 | #include <TColStd_HArray1OfInteger.hxx> |
53 | #include <TColStd_HArray1OfReal.hxx> |
54 | #include <TColStd_HArray2OfReal.hxx> |
55 | |
56 | #include <ElSLib.hxx> |
57 | #include <ElCLib.hxx> |
58 | #include <Precision.hxx> |
59 | #include <Convert_CompBezierCurvesToBSplineCurve.hxx> |
60 | #include <GeomConvert.hxx> |
61 | #include <GeomConvert_BSplineCurveToBezierCurve.hxx> |
62 | #include <GeomConvert_BSplineSurfaceToBezierSurface.hxx> |
63 | #include <GeomConvert_CompBezierSurfacesToBSplineSurface.hxx> |
64 | #include <Geom2dConvert.hxx> |
65 | #include <Geom2dConvert_BSplineCurveToBezierCurve.hxx> |
66 | #include <GeomLProp_SLProps.hxx> |
67 | |
68 | |
69 | #include <DrawTrSurf_BezierSurface.hxx> |
70 | #include <DrawTrSurf_BSplineSurface.hxx> |
71 | #include <GeomConvert_ApproxSurface.hxx> |
72 | #include <GeomLib_Tool.hxx> |
73 | #include <TopoDS_Shape.hxx> |
74 | #include <DBRep.hxx> |
75 | |
76 | //#ifdef WNT |
77 | #include <stdio.h> |
78 | #ifdef WNT |
79 | //#define strcasecmp strcmp Already defined |
80 | Standard_IMPORT Draw_Viewer dout; |
81 | #endif |
82 | #ifdef HAVE_STRINGS_H |
83 | # include <strings.h> |
84 | #endif |
85 | |
86 | |
87 | |
88 | |
89 | //======================================================================= |
90 | //function : compute min max radius of curvature on a surface |
91 | //purpose : |
92 | //======================================================================= |
93 | static Standard_Integer surface_radius (Draw_Interpretor& di, |
94 | Standard_Integer n, |
95 | const char** a) |
96 | { |
97 | Standard_Integer report_curvature = 0 ; |
98 | Standard_Real UParameter,VParameter,radius,tolerance = 1.0e-7 ; |
99 | |
100 | if (n < 4) return 1; |
101 | if (n >= 6) report_curvature = 1 ; |
102 | |
103 | UParameter = atof(a[2]); |
104 | VParameter = atof(a[3]); |
105 | Handle(Geom_Surface) SurfacePtr = DrawTrSurf::GetSurface(a[1]); |
106 | if (!SurfacePtr.IsNull()) { |
107 | GeomLProp_SLProps myProperties(SurfacePtr, |
108 | UParameter, |
109 | VParameter, |
110 | 2, |
111 | tolerance); |
112 | if (myProperties.IsCurvatureDefined()) { |
113 | radius = myProperties.MinCurvature(); |
114 | |
115 | if (report_curvature) Draw::Set(a[4],radius); |
116 | |
117 | if (Abs(radius) > tolerance) { |
118 | radius = 1.0e0/ radius ; |
119 | di << "Min Radius of Curvature : " << radius << "\n"; |
120 | } |
121 | else { |
122 | di << "Min Radius of Curvature : infinite" << "\n"; |
123 | } |
124 | |
125 | radius = myProperties.MaxCurvature(); |
126 | if (report_curvature) Draw::Set(a[5],radius); |
127 | if (Abs(radius) > tolerance) { |
128 | radius = 1.0e0/ radius; |
129 | di << "Max Radius of Curvature : " << radius << "\n"; |
130 | } |
131 | else |
132 | di << "Min Radius of Curvature : infinite" << "\n"; |
133 | } |
134 | else { |
135 | di << "Curvature not defined." << "\n"; |
136 | } |
137 | } |
138 | else { |
139 | return 1; |
140 | } |
141 | return 0; |
142 | } |
143 | |
144 | |
145 | //======================================================================= |
146 | //function : anasurface |
147 | //purpose : |
148 | //======================================================================= |
149 | |
150 | static Standard_Integer anasurface (Draw_Interpretor& , |
151 | Standard_Integer n, |
152 | const char** a) |
153 | { |
154 | if (n < 2) return 1; |
155 | gp_Ax3 loc; |
156 | |
157 | Standard_Integer i; |
158 | |
159 | if (n < 5) { |
160 | loc = gp_Ax3(gp_Pnt(0,0,0),gp_Dir(0,0,1),gp_Dir(1,0,0)); |
161 | i = 2; |
162 | } |
163 | else if (n < 8) { |
164 | loc = gp_Ax3(gp_Pnt(atof(a[2]),atof(a[3]),atof(a[4])), |
165 | gp_Dir(0,0,1),gp_Dir(1,0,0)); |
166 | i = 5; |
167 | } |
168 | else if (n < 11) { |
169 | loc = gp_Ax3(gp_Pnt(atof(a[2]),atof(a[3]),atof(a[4])), |
170 | gp_Dir(atof(a[5]),atof(a[6]),atof(a[7]))); |
171 | i = 8; |
172 | } |
173 | else if (n < 14) { |
174 | loc = gp_Ax3(gp_Pnt(atof(a[2]),atof(a[3]),atof(a[4])), |
175 | gp_Dir(atof(a[5]),atof(a[6]),atof(a[7])), |
176 | gp_Dir(atof(a[8]),atof(a[9]),atof(a[10]))); |
177 | i = 11; |
178 | } |
179 | else |
180 | return 1; |
181 | |
182 | Handle(Geom_Geometry) result; |
183 | |
184 | if (!strcasecmp(a[0],"plane")) { |
185 | Handle(Geom_Plane) C = new Geom_Plane(loc); |
186 | result = C; |
187 | } |
188 | else { |
189 | if (i >= n) return 1; |
190 | Standard_Real par1 = atof(a[i]); |
191 | |
192 | if (!strcasecmp(a[0],"cylinder")) { |
193 | Handle(Geom_CylindricalSurface) C = |
194 | new Geom_CylindricalSurface(loc,par1); |
195 | result = C; |
196 | } |
197 | |
198 | else if (!strcasecmp(a[0],"sphere")) { |
199 | Handle(Geom_SphericalSurface) C = |
200 | new Geom_SphericalSurface(loc,par1); |
201 | result = C; |
202 | } |
203 | |
204 | else { |
205 | if (i+1 >= n) return 1; |
206 | Standard_Real par2 = atof(a[i+1]); |
207 | |
208 | if (!strcasecmp(a[0],"cone")) { |
c6541a0c |
209 | par1 *= (M_PI / 180.0); |
7fd59977 |
210 | Handle(Geom_ConicalSurface) C = |
211 | new Geom_ConicalSurface(loc,par1,par2); |
212 | result = C; |
213 | } |
214 | |
215 | else if (!strcasecmp(a[0],"torus")) { |
216 | Handle(Geom_ToroidalSurface) C = |
217 | new Geom_ToroidalSurface(loc,par1,par2); |
218 | result = C; |
219 | } |
220 | } |
221 | } |
222 | |
223 | DrawTrSurf::Set(a[1],result); |
224 | return 0; |
225 | } |
226 | |
227 | |
228 | //======================================================================= |
229 | //function : polesurface |
230 | //purpose : |
231 | //======================================================================= |
232 | |
233 | static Standard_Integer polesurface (Draw_Interpretor& , Standard_Integer n, const char** a) |
234 | { |
235 | Standard_Integer k,j,i; |
236 | |
237 | |
238 | if (n < 4) return 1; |
239 | |
240 | if (!strcasecmp(a[0],"beziersurf")) { |
241 | |
242 | Standard_Integer nup = atoi(a[2]); |
243 | Standard_Integer nvp = atoi(a[3]); |
244 | if (nup * nvp == 0) return 1; |
245 | |
246 | i = (n - 4) / (nup * nvp); |
247 | if (i < 3 || i > 4) return 1; |
248 | Standard_Boolean hasw = i == 4; |
249 | |
250 | TColgp_Array2OfPnt poles(1,nup,1,nvp); |
251 | TColStd_Array2OfReal weights(1,nup,1,nvp); |
252 | |
253 | k = 4; |
254 | for (j = 1; j <= nvp; j++) { |
255 | for (i = 1; i <= nup; i++) { |
256 | poles(i, j).SetCoord(atof(a[k]),atof(a[k+1]),atof(a[k+2])); |
257 | k += 3; |
258 | if (hasw) { |
259 | weights(i, j) = atof(a[k]); |
260 | k++; |
261 | } |
262 | } |
263 | } |
264 | |
265 | Handle(Geom_BezierSurface) result; |
266 | if (hasw) |
267 | result = new Geom_BezierSurface(poles,weights); |
268 | else |
269 | result = new Geom_BezierSurface(poles); |
270 | |
271 | DrawTrSurf::Set(a[1],result); |
272 | } |
273 | |
274 | else { |
275 | Standard_Integer udeg = atoi(a[2]); |
276 | Standard_Integer nbuk = atoi(a[3]); |
277 | |
278 | Standard_Boolean uper = (*a[0] == 'u') || (*(a[0]+1) == 'u'); |
279 | Standard_Boolean vper = (*a[0] == 'v') || (*(a[0]+1) == 'v'); |
280 | |
281 | TColStd_Array1OfReal uk (1, nbuk); |
282 | TColStd_Array1OfInteger umult(1, nbuk); |
283 | k = 4; |
284 | Standard_Integer SigmaU = 0; |
285 | for (i = 1; i<=nbuk; i++) { |
286 | uk( i) = atof(a[k]); |
287 | k++; |
288 | umult( i) = atoi(a[k]); |
289 | SigmaU += umult(i); |
290 | k++; |
291 | } |
292 | |
293 | Standard_Integer vdeg = atoi(a[k]); |
294 | k++; |
295 | Standard_Integer nbvk = atoi(a[k]); |
296 | k++; |
297 | |
298 | TColStd_Array1OfReal vk (1, nbvk); |
299 | TColStd_Array1OfInteger vmult(1, nbvk); |
300 | Standard_Integer SigmaV = 0; |
301 | for (i = 1; i<=nbvk; i++) { |
302 | vk( i) = atof(a[k]); |
303 | k++; |
304 | vmult( i) = atoi(a[k]); |
305 | SigmaV += vmult(i); |
306 | k++; |
307 | } |
308 | |
309 | Standard_Integer nup,nvp; |
310 | if (uper) |
311 | nup = SigmaU - umult(nbuk); |
312 | else |
313 | nup = SigmaU - udeg -1; |
314 | if (vper) |
315 | nvp = SigmaV - vmult(nbvk); |
316 | else |
317 | nvp = SigmaV - vdeg -1; |
318 | TColgp_Array2OfPnt poles (1, nup, 1, nvp); |
319 | TColStd_Array2OfReal weights(1, nup, 1, nvp); |
320 | |
321 | for (j = 1; j <= nvp; j++) { |
322 | for (i = 1; i <= nup; i++) { |
323 | poles(i, j).SetCoord(atof(a[k]),atof(a[k+1]),atof(a[k+2])); |
324 | k += 3; |
325 | weights(i, j) = atof(a[k]); |
326 | k++; |
327 | } |
328 | } |
329 | |
330 | Handle(Geom_BSplineSurface) result = |
331 | new Geom_BSplineSurface(poles, weights, |
332 | uk , vk , |
333 | umult, vmult , |
334 | udeg , vdeg , |
335 | uper , vper ); |
336 | |
337 | DrawTrSurf::Set(a[1],result); |
338 | } |
339 | |
340 | return 0; |
341 | } |
342 | |
343 | //======================================================================= |
344 | //function : algosurface |
345 | //purpose : |
346 | //======================================================================= |
347 | |
348 | static Standard_Integer algosurface (Draw_Interpretor& , Standard_Integer n, const char** a) |
349 | { |
350 | if (n < 5) return 1; |
351 | |
352 | Handle(Geom_Curve) GC = DrawTrSurf::GetCurve(a[2]); |
353 | if (GC.IsNull()) return 1; |
354 | |
355 | gp_Dir D; |
356 | gp_Pnt P; |
357 | |
358 | if (!strcasecmp(a[0],"extsurf")) { |
359 | D.SetCoord(atof(a[3]),atof(a[4]),atof(a[5])); |
360 | Handle(Geom_SurfaceOfLinearExtrusion) result = |
361 | new Geom_SurfaceOfLinearExtrusion(GC,D); |
362 | |
363 | DrawTrSurf::Set(a[1],result); |
364 | |
365 | } |
366 | else if (!strcasecmp(a[0],"revsurf")) { |
367 | if (n<8) return 1; |
368 | P.SetCoord(atof(a[3]),atof(a[4]),atof(a[5])); |
369 | D.SetCoord(atof(a[6]),atof(a[7]),atof(a[8])); |
370 | |
371 | Handle(Geom_SurfaceOfRevolution) result = |
372 | new Geom_SurfaceOfRevolution(GC,gp_Ax1(P,D)); |
373 | |
374 | DrawTrSurf::Set(a[1],result); |
375 | |
376 | } |
377 | |
378 | return 0; |
379 | |
380 | } |
381 | |
382 | |
383 | |
384 | //======================================================================= |
385 | //function : trimming |
386 | //purpose : |
387 | //======================================================================= |
388 | |
389 | static Standard_Integer trimming (Draw_Interpretor& , |
390 | Standard_Integer n, const char** a) |
391 | { |
392 | if (n < 3) return 1; |
393 | |
394 | Handle(Geom_Curve) GC = DrawTrSurf::GetCurve(a[2]); |
395 | Handle(Geom2d_Curve) GC2d = DrawTrSurf::GetCurve2d(a[2]); |
396 | Handle(Geom_Surface) GS = DrawTrSurf::GetSurface(a[2]); |
397 | |
398 | if (n == 3) { |
399 | if (!GC.IsNull()) { |
400 | Handle(Geom_TrimmedCurve) T = Handle(Geom_TrimmedCurve)::DownCast(GC); |
401 | if (!T.IsNull()) GC = T->BasisCurve(); |
402 | DrawTrSurf::Set(a[1],GC); |
403 | } |
404 | else if (!GC2d.IsNull()) { |
405 | Handle(Geom2d_TrimmedCurve) T = Handle(Geom2d_TrimmedCurve)::DownCast(GC2d); |
406 | if (!T.IsNull()) GC2d = T->BasisCurve(); |
407 | DrawTrSurf::Set(a[1],GC2d); |
408 | } |
409 | else if (!GS.IsNull()) { |
410 | Handle(Geom_RectangularTrimmedSurface) T = Handle(Geom_RectangularTrimmedSurface)::DownCast(GS); |
411 | if (!T.IsNull()) GS = T->BasisSurface(); |
412 | DrawTrSurf::Set(a[1],GS); |
413 | } |
414 | return 0; |
415 | } |
416 | |
417 | if (n < 5) return 1; |
418 | |
419 | Standard_Real u1 = atof(a[3]); |
420 | Standard_Real u2 = atof(a[4]); |
421 | |
422 | Handle(Geom_Geometry) result; |
423 | Handle(Geom2d_Curve) result2d; |
424 | |
425 | if (!strcasecmp(a[0],"trim")) { |
426 | if (!GS.IsNull()) { |
427 | if (n<7) return 1; |
428 | result = |
429 | new Geom_RectangularTrimmedSurface(GS,u1,u2,atof(a[5]),atof(a[6])); |
430 | } |
431 | else if (!GC.IsNull()) { |
432 | result = new Geom_TrimmedCurve(GC, u1, u2); |
433 | } |
434 | else if (!GC2d.IsNull()) { |
435 | result2d = new Geom2d_TrimmedCurve(GC2d, u1, u2); |
436 | } |
437 | else |
438 | return 1; |
439 | } |
440 | else { |
441 | if (GS.IsNull()) return 1; |
442 | result = new Geom_RectangularTrimmedSurface(GS,u1,u2, |
443 | !strcasecmp(a[0],"trimu")); |
444 | } |
445 | |
446 | if (!result.IsNull()) |
447 | DrawTrSurf::Set(a[1], result); |
448 | else |
449 | DrawTrSurf::Set(a[1],result2d); |
450 | |
451 | return 0; |
452 | } |
453 | |
454 | //======================================================================= |
455 | //function : converting |
456 | //purpose : |
457 | //======================================================================= |
458 | |
459 | static Standard_Integer converting(Draw_Interpretor& , Standard_Integer n, const char ** a) |
460 | { |
461 | if ( n < 3) return 1; |
462 | |
463 | Convert_ParameterisationType |
464 | Parameterisation = Convert_TgtThetaOver2 ; |
465 | if (strcmp(a[n-1], "qa") == 0) { |
466 | Parameterisation = Convert_QuasiAngular ; |
467 | } |
468 | else if (strcmp(a[n-1], "c1") == 0) { |
469 | Parameterisation = Convert_RationalC1 ; |
470 | } |
471 | else if (strcmp (a[n-1], "s1") == 0) { |
472 | Parameterisation = Convert_TgtThetaOver2_1 ; |
473 | } |
474 | else if (strcmp (a[n-1], "s2") == 0) { |
475 | Parameterisation = Convert_TgtThetaOver2_2; |
476 | } |
477 | else if (strcmp (a[n-1], "s3") == 0) { |
478 | Parameterisation = Convert_TgtThetaOver2_3 ; |
479 | } |
480 | else if (strcmp (a[n-1], "s4") == 0) { |
481 | Parameterisation = Convert_TgtThetaOver2_4 ; |
482 | } |
483 | else if (strcmp (a[n-1], "po") == 0) { |
484 | Parameterisation = Convert_Polynomial; |
485 | } |
486 | |
487 | Handle(Geom_Curve) GC = DrawTrSurf::GetCurve(a[2]); |
488 | if ( GC.IsNull()) { |
489 | Handle(Geom_Surface) GS = DrawTrSurf::GetSurface(a[2]); |
490 | if ( GS.IsNull()) { |
491 | Handle(Geom2d_Curve) G2d = DrawTrSurf::GetCurve2d(a[2]); |
492 | if ( G2d.IsNull()) { |
493 | return 1; |
494 | } |
495 | else { |
496 | G2d = Geom2dConvert::CurveToBSplineCurve(G2d, |
497 | Parameterisation); |
498 | DrawTrSurf::Set(a[1], G2d); |
499 | } |
500 | } |
501 | else { |
502 | GS = GeomConvert::SurfaceToBSplineSurface( GS); |
503 | DrawTrSurf::Set(a[1], GS); |
504 | } |
505 | } |
506 | else { |
507 | GC = GeomConvert::CurveToBSplineCurve( GC, |
508 | Parameterisation); |
509 | DrawTrSurf::Set(a[1], GC); |
510 | } |
511 | |
512 | return 0; |
513 | } |
514 | |
515 | |
516 | //======================================================================= |
517 | //function : tobezier |
518 | //purpose : |
519 | //======================================================================= |
520 | |
521 | static Standard_Integer tobezier(Draw_Interpretor& di, |
522 | Standard_Integer n, const char** a) |
523 | { |
524 | if ( n < 3) return 1; |
525 | Standard_Integer i,j,NbU,NbV,NbArc; |
526 | char* name = new char[100]; |
527 | |
528 | Handle(Geom2d_BSplineCurve) C2d = |
529 | DrawTrSurf::GetBSplineCurve2d(a[2]); |
530 | if ( C2d.IsNull()) { |
531 | Handle(Geom_BSplineCurve) C3d = |
532 | DrawTrSurf::GetBSplineCurve(a[2]); |
533 | if ( C3d.IsNull()) { |
534 | Handle(Geom_BSplineSurface) S = |
535 | DrawTrSurf::GetBSplineSurface(a[2]); |
536 | if ( S.IsNull()) return 1; |
537 | if (n == 7) { |
538 | Standard_Real U1, U2, V1, V2; |
539 | U1 = atof(a[3]); |
540 | U2 = atof(a[4]); |
541 | V1 = atof(a[5]); |
542 | V2 = atof(a[6]); |
543 | GeomConvert_BSplineSurfaceToBezierSurface |
544 | Conv(S, U1, U2, V1, V2, Precision::PConfusion()); |
545 | NbU = Conv.NbUPatches(); |
546 | NbV = Conv.NbVPatches(); |
547 | di << NbU << " X " << NbV << " patches in the result" << "\n"; |
548 | for (i = 1; i <= NbU; i++) { |
549 | for (j = 1; j <= NbV; j++) { |
550 | sprintf(name,"%s_%i_%i",a[1],i,j); |
551 | char *temp = name ; |
552 | DrawTrSurf::Set(temp,Conv.Patch(i,j)); |
553 | } |
554 | } |
555 | } |
556 | else { |
557 | GeomConvert_BSplineSurfaceToBezierSurface Conv(S); |
558 | NbU = Conv.NbUPatches(); |
559 | NbV = Conv.NbVPatches(); |
560 | di << NbU << " X " << NbV << " patches in the result" << "\n"; |
561 | for (i = 1; i <= NbU; i++) { |
562 | for (j = 1; j <= NbV; j++) { |
563 | sprintf(name,"%s_%i_%i",a[1],i,j); |
564 | char *temp = name ; |
565 | DrawTrSurf::Set(temp,Conv.Patch(i,j)); |
566 | } |
567 | } |
568 | } |
569 | } |
570 | else { |
571 | if (n==5) { |
572 | Standard_Real U1, U2; |
573 | U1 = atof(a[3]); |
574 | U2 = atof(a[4]); |
575 | GeomConvert_BSplineCurveToBezierCurve Conv(C3d, U1, U2, |
576 | Precision::PConfusion()); |
577 | NbArc = Conv.NbArcs(); |
578 | di << NbArc << " arcs in the result" << "\n"; |
579 | for (i = 1; i <= NbArc; i++) { |
580 | sprintf(name,"%s_%i",a[1],i); |
581 | char *temp = name ; |
582 | DrawTrSurf::Set(temp,Conv.Arc(i)); |
583 | } |
584 | } |
585 | else { |
586 | GeomConvert_BSplineCurveToBezierCurve Conv(C3d); |
587 | NbArc = Conv.NbArcs(); |
588 | di << NbArc << " arcs in the result" << "\n"; |
589 | for (i = 1; i <= NbArc; i++) { |
590 | sprintf(name,"%s_%i",a[1],i); |
591 | char *temp = name ; |
592 | DrawTrSurf::Set(temp,Conv.Arc(i)); |
593 | } |
594 | } |
595 | } |
596 | } |
597 | else { |
598 | if (n==5) { |
599 | Standard_Real U1, U2; |
600 | U1 = atof(a[3]); |
601 | U2 = atof(a[4]); |
602 | Geom2dConvert_BSplineCurveToBezierCurve Conv(C2d, U1, U2, |
603 | Precision::PConfusion()); |
604 | NbArc = Conv.NbArcs(); |
605 | di << NbArc << " arcs in the result" << "\n"; |
606 | for (i = 1; i <= NbArc; i++) { |
607 | sprintf(name,"%s_%i",a[1],i); |
608 | char *temp = name ; |
609 | DrawTrSurf::Set(temp,Conv.Arc(i)); |
610 | } |
611 | } |
612 | else { |
613 | Geom2dConvert_BSplineCurveToBezierCurve Conv(C2d); |
614 | NbArc = Conv.NbArcs(); |
615 | di << NbArc << " arcs in the result" << "\n"; |
616 | for (i = 1; i <= NbArc; i++) { |
617 | sprintf(name,"%s_%i",a[1],i); |
618 | char *temp = name ; |
619 | DrawTrSurf::Set(temp,Conv.Arc(i)); |
620 | } |
621 | } |
622 | } |
623 | |
624 | return 0; |
625 | } |
626 | |
627 | //======================================================================= |
628 | //function : convbz |
629 | //purpose : |
630 | //======================================================================= |
631 | |
632 | static Standard_Integer convbz(Draw_Interpretor& di, |
633 | Standard_Integer n, const char** a) |
634 | { |
635 | if ( n < 4) return 1; |
636 | |
637 | Standard_Integer ii, jj, kk=0, NbU, NbV; |
638 | Standard_Real Tol = Precision::Confusion(); |
639 | |
640 | NbU = atoi(a[2]); |
641 | if ( (Handle(Geom_Curve):: |
642 | DownCast(DrawTrSurf::Get(a[3]))).IsNull()) { |
643 | // Cas Surfacique |
644 | NbV = atoi(a[3]); |
645 | if (n<4+NbU*NbV) { |
646 | di << "The number of bezier surface have to be " << NbU*NbV << "\n"; |
647 | return 1; |
648 | } |
649 | TColGeom_Array2OfBezierSurface BZ(1, NbU, 1, NbV); |
650 | kk = 4; |
651 | for (jj=1; jj<=NbV; jj++) |
652 | for(ii=1;ii<=NbU; ii++) { |
653 | BZ(ii,jj) = |
654 | Handle(Geom_BezierSurface)::DownCast(DrawTrSurf::Get(a[kk])); |
655 | if (BZ(ii,jj).IsNull()) { |
656 | di << "the Surface " << kk <<"is not a BezierSurface" << "\n"; |
657 | return 1; |
658 | } |
659 | kk++; |
660 | } |
661 | if (kk<n) Tol = atof(a[kk]); |
662 | |
663 | GeomConvert_CompBezierSurfacesToBSplineSurface Conv(BZ, Tol); |
664 | |
665 | if (! Conv.IsDone()) { |
666 | di << "Convert Not Done" << "\n"; |
667 | return 1; |
668 | } |
669 | |
670 | Handle(Geom_BSplineSurface) BSurf = |
671 | new Geom_BSplineSurface(Conv.Poles()->Array2(), |
672 | Conv.UKnots()->Array1(), |
673 | Conv.VKnots()->Array1(), |
674 | Conv.UMultiplicities()->Array1(), |
675 | Conv.VMultiplicities()->Array1(), |
676 | Conv.UDegree(), |
677 | Conv.VDegree()); |
678 | |
679 | DrawTrSurf::Set(a[1], BSurf); |
680 | } |
681 | else { // cas de courbes |
682 | Convert_CompBezierCurvesToBSplineCurve Conv; |
683 | Handle(Geom_BezierCurve) BZ; |
684 | for (ii=1, kk=3; ii<=NbU; ii++,kk++) { |
685 | BZ = Handle(Geom_BezierCurve)::DownCast(DrawTrSurf::Get(a[kk])); |
686 | if (BZ.IsNull()) { |
687 | di << "the curve " << kk <<"is not a BezierCurve" << "\n"; |
688 | return 1; |
689 | } |
690 | TColgp_Array1OfPnt Poles(1, BZ->NbPoles()); |
691 | BZ->Poles(Poles); |
692 | Conv.AddCurve(Poles); |
693 | } |
694 | |
695 | Conv.Perform(); |
696 | |
697 | TColgp_Array1OfPnt Poles(1, Conv.NbPoles()); |
698 | Conv.Poles(Poles); |
699 | TColStd_Array1OfInteger Mults(1, Conv.NbKnots()); |
700 | TColStd_Array1OfReal Knots(1, Conv.NbKnots()); |
701 | Conv.KnotsAndMults(Knots, Mults); |
702 | Handle(Geom_BSplineCurve) BS = |
703 | new (Geom_BSplineCurve) (Poles, Knots, Mults, |
704 | Conv.Degree()); |
705 | DrawTrSurf::Set(a[1], BS); |
706 | } |
707 | |
708 | return 0; |
709 | } |
710 | |
711 | //======================================================================= |
712 | //function : approxsurf |
713 | //purpose : Approximation d'une Surface par une BSpline non rationnelle |
714 | //======================================================================= |
715 | |
716 | |
717 | static Standard_Integer approxsurf(Draw_Interpretor& di, Standard_Integer n, const char** a) |
718 | { |
719 | // " Tolerance (par defaut 0.1mm) " |
720 | Standard_Real Tol = 1.e-4; |
721 | // " Ordres de continuites : 0, 1 ou 2 (par defaut 1)" |
722 | GeomAbs_Shape myUCont = GeomAbs_C1, myVCont = GeomAbs_C1; |
723 | // " Degre maximum des carreaux de Bezier 14 par defaut " |
724 | Standard_Integer degU = 14, degV = 14; |
725 | // " Nombre max de carreaux (par defaut 10)" |
726 | Standard_Integer nmax = 16; |
727 | // "Code de precision par defaults" |
728 | Standard_Integer myPrec = 1; |
729 | |
730 | if ( n>10 || n<3) return 1; |
731 | |
732 | if (n>3) Tol = Max(atof(a[3]),1.e-10); |
733 | |
734 | if (n==5) return 1; |
735 | |
736 | if (n>5) { |
737 | if (atoi(a[4]) == 0) myUCont = GeomAbs_C0; |
738 | if (atoi(a[4]) == 2) myUCont = GeomAbs_C2; |
739 | if (atoi(a[5]) == 0) myVCont = GeomAbs_C0; |
740 | if (atoi(a[5]) == 2) myVCont = GeomAbs_C2; |
741 | } |
742 | |
743 | if (n==7) return 1; |
744 | |
745 | if (n>7) { |
746 | ( degU = (atoi(a[6]))); |
747 | ( degV = (atoi(a[7]))); |
748 | if ((degU<1) || (degU>24)) degU = 14; |
749 | if ((degV<1) || (degV>24)) degV = 14; |
750 | } |
751 | |
752 | if (n>8) nmax = atoi(a[8]); |
753 | if (n>9) myPrec = atoi(a[9]); |
754 | |
755 | Handle(Geom_Surface) surf = DrawTrSurf::GetSurface(a[2]); |
756 | if (surf.IsNull()) return 1; |
757 | GeomConvert_ApproxSurface myApprox(surf,Tol,myUCont,myVCont,degU,degV,nmax,myPrec); |
758 | if ( myApprox.HasResult()) DrawTrSurf::Set(a[1], myApprox.Surface()); |
759 | di<<a[1]<<"\n"; |
760 | return 0; |
761 | } |
762 | |
763 | //======================================================================= |
764 | //function : offseting |
765 | //purpose : |
766 | //======================================================================= |
767 | |
768 | static Standard_Integer offseting (Draw_Interpretor& , |
769 | Standard_Integer n, const char** a) |
770 | { |
771 | if (n < 4) return 1; |
772 | |
773 | // test the Geom2d curve |
774 | Handle(Geom2d_Curve) C2d = DrawTrSurf::GetCurve2d(a[2]); |
775 | if (!C2d.IsNull()) { |
776 | Handle(Geom2d_OffsetCurve) OC = new Geom2d_OffsetCurve(C2d,atof(a[3])); |
777 | DrawTrSurf::Set(a[1],OC); |
778 | return 0; |
779 | } |
780 | |
781 | Standard_Boolean yasurf = Standard_False; |
782 | |
783 | Handle(Geom_Curve) GC = DrawTrSurf::GetCurve(a[2]); |
784 | Handle(Geom_Surface) GS; |
785 | if (GC.IsNull()) { |
786 | GS = DrawTrSurf::GetSurface(a[2]); |
787 | if (GS.IsNull()) |
788 | return 1; |
789 | yasurf = Standard_True; |
790 | } |
791 | |
792 | Standard_Real dist = atof(a[3]); |
793 | |
794 | Handle(Geom_Geometry) result; |
795 | |
796 | if (yasurf) { |
797 | Handle(Geom_OffsetSurface) GO = new Geom_OffsetSurface(GS,dist); |
798 | result = GO; |
799 | } |
800 | else { |
801 | if (n < 7) return 1; |
802 | gp_Dir D(atof(a[4]),atof(a[5]),atof(a[6])); |
803 | Handle(Geom_OffsetCurve) GT = new Geom_OffsetCurve(GC, dist, D); |
804 | result = GT; |
805 | } |
806 | |
807 | DrawTrSurf::Set(a[1], result); |
808 | return 0; |
809 | } |
810 | |
811 | //======================================================================= |
812 | //function : sreverse |
813 | //purpose : |
814 | //======================================================================= |
815 | |
816 | static Standard_Integer sreverse (Draw_Interpretor& , Standard_Integer n, const char** a) |
817 | { |
818 | if (n < 2) return 1; |
819 | |
820 | Standard_Integer i; |
821 | for (i = 1; i < n; i++) { |
822 | |
823 | Handle(Geom_Surface) GS = DrawTrSurf::GetSurface(a[i]); |
824 | if (!GS.IsNull()) { |
825 | if (*a[0] == 'u') |
826 | GS->UReverse(); |
827 | else |
828 | GS->VReverse(); |
829 | Draw::Repaint(); |
830 | } |
831 | } |
832 | |
833 | return 0; |
834 | } |
835 | |
836 | //======================================================================= |
837 | //function : iso |
838 | //purpose : |
839 | //======================================================================= |
840 | |
841 | static Standard_Integer iso (Draw_Interpretor& , Standard_Integer n, const char** a) |
842 | { |
843 | if (n < 4) return 1; |
844 | |
845 | Handle(Geom_Curve) C; |
846 | Standard_Real par = atof(a[3]); |
847 | Handle(Geom_Surface) GS = DrawTrSurf::GetSurface(a[2]); |
848 | if (!GS.IsNull()) { |
849 | if (*a[0] == 'u') |
850 | C = GS->UIso(par); |
851 | else |
852 | C = GS->VIso(par); |
853 | DrawTrSurf::Set(a[1],C); |
854 | } |
855 | |
856 | return 0; |
857 | } |
858 | |
859 | |
860 | //======================================================================= |
861 | //function : value |
862 | //purpose : |
863 | //======================================================================= |
864 | |
865 | static Standard_Integer value (Draw_Interpretor& , |
866 | Standard_Integer n, const char** a) |
867 | { |
868 | if (n < 5) return 1; |
869 | |
870 | Handle(Geom_Surface) GS = DrawTrSurf::GetSurface(a[1]); |
871 | if (GS.IsNull()) return 1; |
872 | |
873 | Standard_Real U = atof(a[2]); |
874 | Standard_Real V = atof(a[3]); |
875 | |
876 | Standard_Boolean DrawPoint = ( n%3 == 2); |
877 | if ( DrawPoint) n--; |
878 | |
879 | gp_Pnt P; |
880 | if (n >= 13) { |
881 | gp_Vec DU,DV; |
882 | if (n >= 22) { |
883 | gp_Vec D2U,D2V,D2UV; |
884 | GS->D2(U,V,P,DU,DV,D2U,D2V,D2UV); |
885 | Draw::Set(a[13],D2U.X()); |
886 | Draw::Set(a[14],D2U.Y()); |
887 | Draw::Set(a[15],D2U.Z()); |
888 | Draw::Set(a[16],D2V.X()); |
889 | Draw::Set(a[17],D2V.Y()); |
890 | Draw::Set(a[18],D2V.Z()); |
891 | Draw::Set(a[19],D2UV.X()); |
892 | Draw::Set(a[20],D2UV.Y()); |
893 | Draw::Set(a[21],D2UV.Z()); |
894 | } |
895 | else |
896 | GS->D1(U,V,P,DU,DV); |
897 | |
898 | Draw::Set(a[7],DU.X()); |
899 | Draw::Set(a[8],DU.Y()); |
900 | Draw::Set(a[9],DU.Z()); |
901 | Draw::Set(a[10],DV.X()); |
902 | Draw::Set(a[11],DV.Y()); |
903 | Draw::Set(a[12],DV.Z()); |
904 | } |
905 | else |
906 | GS->D0(U,V,P); |
907 | |
908 | if ( n > 6) { |
909 | Draw::Set(a[4],P.X()); |
910 | Draw::Set(a[5],P.Y()); |
911 | Draw::Set(a[6],P.Z()); |
912 | } |
913 | if ( DrawPoint) { |
914 | DrawTrSurf::Set(a[n],P); |
915 | } |
916 | |
917 | return 0; |
918 | } |
919 | |
920 | //======================================================================= |
921 | //function : movepole |
922 | //purpose : |
923 | //======================================================================= |
924 | |
925 | static Standard_Integer movepole (Draw_Interpretor& , Standard_Integer n, const char** a) |
926 | { |
927 | if (n < 6) return 1; |
928 | Standard_Boolean BSpline = Standard_False; |
929 | |
930 | Handle(Geom_BezierSurface) GBz = DrawTrSurf::GetBezierSurface(a[1]); |
931 | Handle(Geom_BSplineSurface) GBs; |
932 | if (GBz.IsNull()) { |
933 | GBs = DrawTrSurf::GetBSplineSurface(a[1]); |
934 | if (GBs.IsNull()) |
935 | return 1; |
936 | BSpline = Standard_True; |
937 | } |
938 | |
939 | Standard_Real dx = atof(a[n-3]); |
940 | Standard_Real dy = atof(a[n-2]); |
941 | Standard_Real dz = atof(a[n-1]); |
942 | |
943 | Standard_Integer nup, nvp; |
944 | if( !BSpline) { |
945 | nup = GBz->NbUPoles(); |
946 | nvp = GBz->NbVPoles(); |
947 | } |
948 | else { |
949 | nup = GBs->NbUPoles(); |
950 | nvp = GBs->NbVPoles(); |
951 | } |
952 | |
953 | Standard_Integer FirstRow=0, LastRow=0, FirstCol=0, LastCol=0; |
954 | // Rem : Row = indice ligne. -> variation en U. |
955 | // Col = indice colonne.-> variation en V. |
956 | |
957 | if (!strcasecmp(a[0],"movep")) { |
958 | if (n<7) return 1; |
959 | FirstRow = atoi(a[2]); |
960 | FirstCol = atoi(a[3]); |
961 | if ( FirstRow < 1 || FirstRow > nup || |
962 | FirstCol < 1 || FirstCol > nvp ) return 1; |
963 | LastRow = FirstRow; |
964 | LastCol = FirstCol; |
965 | } |
966 | else if (!strcasecmp(a[0],"moverowp")) { |
967 | FirstRow = atoi(a[2]); |
968 | if ( FirstRow < 1 || FirstRow > nup ) return 1; |
969 | LastRow = FirstRow; |
970 | FirstCol = 1; |
971 | LastCol = nvp; |
972 | } |
973 | else if (!strcasecmp(a[0],"movecolp")) { |
974 | FirstCol = atoi(a[2]); |
975 | if ( FirstCol < 1 || FirstCol > nvp ) return 1; |
976 | LastCol = FirstCol; |
977 | FirstRow = 1; |
978 | LastRow = nup; |
979 | } |
980 | |
981 | gp_Pnt P; |
982 | |
983 | for ( Standard_Integer i = FirstRow; i<= LastRow; i++) { |
984 | for ( Standard_Integer j = FirstCol; j<= LastCol; j++) { |
985 | if( !BSpline) { |
986 | P = GBz->Pole(i,j); |
987 | P.SetCoord(P.X()+dx, P.Y()+dy, P.Z()+dz); |
988 | GBz->SetPole(i,j,P); |
989 | } |
990 | else { |
991 | P = GBs->Pole(i,j); |
992 | P.SetCoord(P.X()+dx, P.Y()+dy, P.Z()+dz); |
993 | GBs->SetPole(i,j,P); |
994 | } |
995 | } |
996 | } |
997 | |
998 | Draw::Repaint(); |
999 | |
1000 | return 0; |
1001 | } |
1002 | |
1003 | |
1004 | //======================================================================= |
1005 | //function : movepoint |
1006 | //purpose : |
1007 | //======================================================================= |
1008 | |
1009 | static Standard_Integer movepoint (Draw_Interpretor& , Standard_Integer n, const char** a) |
1010 | { |
1011 | if (n < 7) return 1; |
1012 | |
1013 | Handle(Geom_BSplineSurface) GBs = DrawTrSurf::GetBSplineSurface(a[1]); |
1014 | if (GBs.IsNull()) { |
1015 | return 1; |
1016 | } |
1017 | |
1018 | Standard_Real u = atof(a[2]); |
1019 | Standard_Real v = atof(a[3]); |
1020 | |
1021 | Standard_Real dx = atof(a[4]); |
1022 | Standard_Real dy = atof(a[5]); |
1023 | Standard_Real dz = atof(a[6]); |
1024 | |
1025 | Standard_Integer index1u = 0; |
1026 | Standard_Integer index2u = 0; |
1027 | Standard_Integer index1v = 0; |
1028 | Standard_Integer index2v = 0; |
1029 | |
1030 | Standard_Integer fmodifu, lmodifu, fmodifv, lmodifv; |
1031 | if (n == 11) { |
1032 | index1u = atoi(a[7]); |
1033 | index2u = atoi(a[8]); |
1034 | index1v = atoi(a[9]); |
1035 | index2v = atoi(a[10]); |
1036 | } |
1037 | else { |
1038 | index1u = 2; |
1039 | index2u = GBs->NbUPoles()-1; |
1040 | index1v = 2; |
1041 | index2v = GBs->NbVPoles()-1; |
1042 | } |
1043 | |
1044 | gp_Pnt p; |
1045 | GBs->D0(u, v, p); |
1046 | p.SetCoord(p.X()+dx, p.Y()+dy, p.Z()+dz); |
1047 | GBs->MovePoint(u, v, p, index1u, index2u, index1v, index2v, fmodifu, lmodifu, fmodifv, lmodifv); |
1048 | Draw::Repaint(); |
1049 | return 0; |
1050 | } |
1051 | |
1052 | |
1053 | //======================================================================= |
1054 | //function : insertknot |
1055 | //purpose : |
1056 | //======================================================================= |
1057 | |
1058 | static Standard_Integer insertknot (Draw_Interpretor& , Standard_Integer n, const char** a) |
1059 | { |
1060 | if (n < 3) return 1; |
1061 | |
1062 | Handle(Geom_BSplineSurface) GBs = DrawTrSurf::GetBSplineSurface(a[1]); |
1063 | |
1064 | if (GBs.IsNull()) return 1; |
1065 | |
1066 | Standard_Real knot=0; |
1067 | Standard_Integer mult = 0; |
1068 | Standard_Integer index=0; |
1069 | if ( !strcasecmp(a[0],"insertuknot") || |
1070 | !strcasecmp(a[0],"insertvknot") ) { |
1071 | if (n<4) return 1; |
1072 | knot = atof(a[2]); |
1073 | mult = atoi(a[3]); |
1074 | } |
1075 | else if ( !strcasecmp(a[0],"remuknot") || |
1076 | !strcasecmp(a[0],"remvknot") ) { |
1077 | index = atoi(a[2]); |
1078 | if (n>=4) mult = atoi(a[3]); |
1079 | } |
1080 | |
1081 | Standard_Real tol = RealLast(); |
1082 | |
1083 | if (!strcasecmp(a[0],"insertuknot")) { |
1084 | GBs->InsertUKnot(knot,mult,Precision::PConfusion()); |
1085 | } |
1086 | else if (!strcasecmp(a[0],"insertvknot")) { |
1087 | GBs->InsertVKnot(knot,mult,Precision::PConfusion()); |
1088 | } |
1089 | else if (!strcasecmp(a[0],"remuknot")) { |
1090 | if (n>=5) tol = atof(a[4]); |
1091 | if (!GBs->RemoveUKnot(index,mult,tol)) |
1092 | return 1; |
1093 | } |
1094 | else if (!strcasecmp(a[0],"remvknot")) { |
1095 | if (n>=5) tol = atof(a[4]); |
1096 | if (!GBs->RemoveVKnot(index,mult,tol)) |
1097 | return 1; |
1098 | } |
1099 | |
1100 | Draw::Repaint(); |
1101 | return 0; |
1102 | } |
1103 | |
1104 | //======================================================================= |
1105 | //function : incdegree |
1106 | //purpose : |
1107 | //======================================================================= |
1108 | |
1109 | static Standard_Integer incdegree (Draw_Interpretor& di, Standard_Integer n, const char** a) |
1110 | { |
1111 | if (n < 3) return 1; |
1112 | |
1113 | Standard_Integer NewDeg = atoi(a[2]); |
1114 | Standard_Boolean BSpline = Standard_False; |
1115 | |
1116 | Standard_Integer UDeg=0, VDeg=0; |
1117 | |
1118 | Handle(Geom_BezierSurface) GBz = DrawTrSurf::GetBezierSurface(a[1]); |
1119 | Handle(Geom_BSplineSurface) GBs; |
1120 | |
1121 | if (GBz.IsNull()) { |
1122 | GBs = DrawTrSurf::GetBSplineSurface(a[1]); |
1123 | if (GBs.IsNull()) |
1124 | return 1; |
1125 | BSpline = Standard_True; |
1126 | } |
1127 | |
1128 | Standard_Integer Degree=0; |
1129 | if ( !strcasecmp(a[0],"incudeg")) { |
1130 | UDeg = NewDeg; |
1131 | if (BSpline) { |
1132 | Degree = GBs->UDegree(); |
1133 | VDeg = GBs->VDegree(); |
1134 | } |
1135 | else { |
1136 | Degree = GBz->UDegree(); |
1137 | VDeg = GBz->VDegree(); |
1138 | } |
1139 | } |
1140 | else if ( !strcasecmp(a[0],"incvdeg")) { |
1141 | VDeg = NewDeg; |
1142 | if (BSpline) { |
1143 | Degree = GBs->VDegree(); |
1144 | UDeg = GBs->UDegree(); |
1145 | } |
1146 | else { |
1147 | Degree = GBz->VDegree(); |
1148 | UDeg = GBz->UDegree(); |
1149 | } |
1150 | } |
1151 | |
1152 | if (Degree > NewDeg) { |
1153 | di<<"The Degree must be greater than " << Degree <<"\n"; |
1154 | return 1; |
1155 | } |
1156 | |
1157 | if ( BSpline) { |
1158 | GBs->IncreaseDegree(UDeg, VDeg); |
1159 | } |
1160 | else { |
1161 | GBz->Increase(UDeg, VDeg); |
1162 | } |
1163 | |
1164 | Draw::Repaint(); |
1165 | return 0; |
1166 | } |
1167 | |
1168 | //======================================================================= |
1169 | //function : rempole |
1170 | //purpose : |
1171 | //======================================================================= |
1172 | |
1173 | static Standard_Integer rempole (Draw_Interpretor& di, Standard_Integer n, const char** a) |
1174 | { |
1175 | if (n < 3) return 1; |
1176 | |
1177 | Standard_Integer NewIndex = atoi(a[2]); |
1178 | Standard_Boolean BSpline = Standard_False; |
1179 | |
1180 | Handle(Geom_BezierSurface) GBz = DrawTrSurf::GetBezierSurface(a[1]); |
1181 | Handle(Geom_BSplineSurface) GBs; |
1182 | |
1183 | if (GBz.IsNull()) { |
1184 | GBs = DrawTrSurf::GetBSplineSurface(a[1]); |
1185 | if (GBs.IsNull()) |
1186 | return 1; |
1187 | BSpline = Standard_True; |
1188 | } |
1189 | |
1190 | Standard_Integer Index; |
1191 | if ( !strcasecmp(a[0],"remrowpole")) { |
1192 | if (BSpline) |
1193 | Index = GBs->UDegree(); |
1194 | else |
1195 | Index = GBz->UDegree(); |
1196 | } |
1197 | else if ( !strcasecmp(a[0],"remcolpole")) { |
1198 | if (BSpline) |
1199 | Index = GBs->VDegree(); |
1200 | else |
1201 | Index = GBz->VDegree(); |
1202 | } |
1203 | |
1204 | if ( !strcasecmp(a[0],"remrowpole")) { |
1205 | if ( BSpline) { |
1206 | di << " Error : Cannot remove a polerow on a BSplineSurface " << "\n"; |
1207 | } |
1208 | else { |
1209 | GBz->RemovePoleRow(NewIndex); |
1210 | } |
1211 | } |
1212 | else if ( !strcasecmp(a[0],"remcolpole")) { |
1213 | if ( BSpline) { |
1214 | di << " Error : Cannot remove a polecol on a BSplineSurface " << "\n"; |
1215 | } |
1216 | else { |
1217 | GBz->RemovePoleCol(NewIndex); |
1218 | } |
1219 | } |
1220 | |
1221 | Draw::Repaint(); |
1222 | return 0; |
1223 | } |
1224 | |
1225 | //======================================================================= |
1226 | //function : sfindp |
1227 | //purpose : |
1228 | //======================================================================= |
1229 | |
1230 | static Standard_Integer sfindp (Draw_Interpretor& , Standard_Integer n, const char** a) |
1231 | { |
1232 | if (n < 7) return 1; |
1233 | Standard_Boolean BSpline = Standard_False; |
1234 | |
1235 | Handle(Geom_BezierSurface) GBz = DrawTrSurf::GetBezierSurface(a[1]); |
1236 | Handle(Geom_BSplineSurface) GBs; |
1237 | if (GBz.IsNull()) { |
1238 | GBs = DrawTrSurf::GetBSplineSurface(a[1]); |
1239 | if (GBs.IsNull()) |
1240 | return 1; |
1241 | BSpline = Standard_True; |
1242 | } |
1243 | |
1244 | Standard_Integer UIndex = 0; |
1245 | Standard_Integer VIndex = 0; |
1246 | Standard_Integer view = atoi(a[2]); |
1247 | Standard_Real x = atof(a[3]); |
1248 | Standard_Real y = atof(a[4]); |
1249 | |
1250 | Draw_Display d = dout.MakeDisplay(view); |
1251 | |
1252 | if( !BSpline) { |
1253 | Handle(DrawTrSurf_BezierSurface) DBz = |
1254 | new DrawTrSurf_BezierSurface(GBz); |
1255 | DBz->FindPole( x, y, d, 5, UIndex,VIndex); |
1256 | } |
1257 | else { |
1258 | Handle(DrawTrSurf_BSplineSurface) DBs = |
1259 | new DrawTrSurf_BSplineSurface(GBs); |
1260 | DBs->FindPole( x, y, d, 5, UIndex,VIndex); |
1261 | } |
1262 | |
1263 | Draw::Set(a[5],UIndex); |
1264 | Draw::Set(a[6],VIndex); |
1265 | |
1266 | return 0; |
1267 | } |
1268 | |
1269 | |
1270 | //======================================================================= |
1271 | //function : ssetperiodic |
1272 | //purpose : |
1273 | //======================================================================= |
1274 | |
1275 | static Standard_Integer ssetperiodic (Draw_Interpretor& , Standard_Integer n, const char** a) |
1276 | { |
1277 | if (n < 2) return 1; |
1278 | |
1279 | Standard_Integer i; |
1280 | |
1281 | if (!strcasecmp(a[0],"setuperiodic")) { |
1282 | for (i = 1; i < n; i++) { |
1283 | Handle(Geom_BSplineSurface) |
1284 | GBs = DrawTrSurf::GetBSplineSurface(a[i]); |
1285 | if (!GBs.IsNull()) { |
1286 | GBs->SetUPeriodic(); |
1287 | Draw::Repaint(); |
1288 | } |
1289 | } |
1290 | } |
1291 | else if (!strcasecmp(a[0],"setvperiodic")){ |
1292 | for (i = 1; i < n; i++) { |
1293 | Handle(Geom_BSplineSurface) |
1294 | GBs = DrawTrSurf::GetBSplineSurface(a[i]); |
1295 | if (!GBs.IsNull()) { |
1296 | GBs->SetVPeriodic(); |
1297 | Draw::Repaint(); |
1298 | } |
1299 | } |
1300 | } |
1301 | else if (!strcasecmp(a[0],"setunotperiodic")){ |
1302 | for (i = 1; i < n; i++) { |
1303 | Handle(Geom_BSplineSurface) |
1304 | GBs = DrawTrSurf::GetBSplineSurface(a[i]); |
1305 | if (!GBs.IsNull()) { |
1306 | GBs->SetUNotPeriodic(); |
1307 | Draw::Repaint(); |
1308 | } |
1309 | } |
1310 | } |
1311 | else if (!strcasecmp(a[0],"setvnotperiodic")){ |
1312 | for (i = 1; i < n; i++) { |
1313 | Handle(Geom_BSplineSurface) |
1314 | GBs = DrawTrSurf::GetBSplineSurface(a[i]); |
1315 | if (!GBs.IsNull()) { |
1316 | GBs->SetVNotPeriodic(); |
1317 | Draw::Repaint(); |
1318 | } |
1319 | } |
1320 | } |
1321 | return 0; |
1322 | } |
1323 | |
1324 | //======================================================================= |
1325 | //function : exchuv |
1326 | //purpose : |
1327 | //======================================================================= |
1328 | |
1329 | static Standard_Integer exchuv (Draw_Interpretor& , Standard_Integer n, const char** a) |
1330 | { |
1331 | if (n < 2) return 1; |
1332 | |
1333 | Standard_Integer i; |
1334 | for (i = 1; i < n; i++) { |
1335 | |
1336 | Handle(Geom_BSplineSurface) GBs = DrawTrSurf::GetBSplineSurface(a[i]); |
1337 | if (!GBs.IsNull()) { |
1338 | GBs->ExchangeUV(); |
1339 | Draw::Repaint(); |
1340 | } |
1341 | else { |
1342 | Handle(Geom_BezierSurface) GBz = DrawTrSurf::GetBezierSurface(a[i]); |
1343 | if (!GBz.IsNull()) { |
1344 | GBz->ExchangeUV(); |
1345 | Draw::Repaint(); |
1346 | } |
1347 | } |
1348 | } |
1349 | |
1350 | return 0; |
1351 | } |
1352 | |
1353 | //======================================================================= |
1354 | //function : segsur |
1355 | //purpose : |
1356 | //======================================================================= |
1357 | |
1358 | static Standard_Integer segsur (Draw_Interpretor& , Standard_Integer n, const char** a) |
1359 | { |
1360 | if (n < 6) return 1; |
1361 | |
1362 | Handle(Geom_BezierSurface) GBz = DrawTrSurf::GetBezierSurface(a[1]); |
1363 | Handle(Geom_BSplineSurface) GBs; |
1364 | if (GBz.IsNull()) { |
1365 | GBs = DrawTrSurf::GetBSplineSurface(a[1]); |
1366 | if (GBs.IsNull()) |
1367 | return 1; |
1368 | GBs->Segment(atof(a[2]),atof(a[3]),atof(a[4]),atof(a[5])); |
1369 | } |
1370 | else { |
1371 | GBz->Segment(atof(a[2]),atof(a[3]),atof(a[4]),atof(a[5])); |
1372 | } |
1373 | |
1374 | Draw::Repaint(); |
1375 | return 0; |
1376 | } |
1377 | |
1378 | static Standard_Integer compBsplSur (Draw_Interpretor& , Standard_Integer n, const char** a) |
1379 | { |
1380 | if (n < 2) |
1381 | { |
1382 | cout<<"Invalid number of parameters"<<endl; |
1383 | return 1; |
1384 | } |
1385 | |
1386 | Handle(Geom_BSplineSurface) GBs1 = DrawTrSurf::GetBSplineSurface(a[1]); |
1387 | Handle(Geom_BSplineSurface) GBs2 = DrawTrSurf::GetBSplineSurface(a[2]); |
1388 | if (GBs1.IsNull() || GBs2.IsNull()) { |
1389 | cout<<"Invalid surface"<<endl; |
1390 | return 1; |
1391 | } |
1392 | |
1393 | Standard_Real aU11,aU12,aV11,aV12; |
1394 | GBs1->Bounds(aU11,aU12,aV11,aV12); |
1395 | |
1396 | Standard_Real aU21,aU22,aV21,aV22; |
1397 | GBs2->Bounds(aU21,aU22,aV21,aV22); |
1398 | |
1399 | Standard_Real aUmin = Max(aU11,aU21); |
1400 | Standard_Real aUmax = Min(aU12,aU22); |
1401 | |
1402 | Standard_Real aVmin = Max(aV11,aV21); |
1403 | Standard_Real aVmax = Min(aV12,aV22); |
1404 | |
1405 | Standard_Integer nbP = 100; |
1406 | Standard_Real aStepU = (aUmax - aUmin)/nbP; |
1407 | Standard_Real aStepV = (aVmax - aVmin)/nbP; |
1408 | Standard_Integer nbErr =0; |
1409 | Standard_Integer i =1; |
1410 | for( ; i <= nbP +1; i++) |
1411 | { |
1412 | Standard_Real aU = aUmin + aStepU*(i-1); |
1413 | Standard_Integer j =1; |
1414 | for( ; j <= nbP +1; j++) |
1415 | { |
1416 | Standard_Real aV = aVmin + aStepV*(j-1); |
1417 | gp_Pnt aP1 = GBs1->Value(aU,aV); |
1418 | gp_Pnt aP2 = GBs2->Value(aU,aV); |
1419 | Standard_Real aDist = aP1.SquareDistance(aP2); |
1420 | if(aDist > Precision::Confusion() * Precision::Confusion()) |
1421 | { |
1422 | nbErr++; |
1423 | Standard_Real aD = sqrt(aDist); |
1424 | cout<<"Surfaces differ for U,V,Dist: "<<aU<<" "<<aV<<" "<<aD<<endl; |
1425 | } |
1426 | } |
1427 | } |
1428 | |
1429 | |
1430 | Draw::Repaint(); |
1431 | return 0; |
1432 | } |
1433 | |
1434 | //======================================================================= |
1435 | //function : setuvorigin |
1436 | //purpose : |
1437 | //======================================================================= |
1438 | |
1439 | static Standard_Integer setuvorigin (Draw_Interpretor& , Standard_Integer n, const char** a) |
1440 | { |
1441 | if (n < 3) return 1; |
1442 | |
1443 | Handle(Geom_BSplineSurface) GBs = DrawTrSurf::GetBSplineSurface(a[1]); |
1444 | if (GBs.IsNull()) |
1445 | return 1; |
1446 | if ( !strcasecmp(a[0],"setuorigin")) { |
1447 | GBs->SetUOrigin(atoi(a[2])); |
1448 | } |
1449 | else if ( !strcasecmp(a[0],"setvorigin")) { |
1450 | GBs->SetVOrigin(atoi(a[2])); |
1451 | } |
1452 | else |
1453 | return 1; |
1454 | |
1455 | Draw::Repaint(); |
1456 | return 0; |
1457 | } |
1458 | |
1459 | |
1460 | //======================================================================= |
1461 | //function : parameters |
1462 | //purpose : |
1463 | //======================================================================= |
1464 | |
1465 | static Standard_Integer parameters (Draw_Interpretor& di, Standard_Integer n, const char** a) |
1466 | { |
1467 | if(n == 8) |
1468 | { |
1469 | // try to find parameters on a Surface |
1470 | Handle(Geom_Surface) S = DrawTrSurf::GetSurface(a[1]); |
1471 | if( S.IsNull() ) { di << "Unknown surface" << "\n"; return 1; } |
1472 | gp_Pnt P(atof(a[2]), atof(a[3]), atof(a[4])); |
1473 | Standard_Real Tol = atof(a[5]), U = 0., V = 0.; |
1474 | Standard_Boolean res = GeomLib_Tool::Parameters(S,P,Tol,U,V); |
1475 | |
1476 | Draw::Set(a[6],U); |
1477 | Draw::Set(a[7],V); |
1478 | |
1479 | if( !res ) { di << "Wrong point" << "\n"; return 1; } |
1480 | } |
1481 | else if(n == 7) |
1482 | { |
1483 | // try to find parameters on a 3d Curve |
1484 | Handle(Geom_Curve) C = DrawTrSurf::GetCurve(a[1]); |
1485 | if( C.IsNull() ) { di << "Unknown curve" << "\n"; return 1; } |
1486 | gp_Pnt P(atof(a[2]), atof(a[3]), atof(a[4])); |
1487 | Standard_Real Tol = atof(a[5]), U = 0.; |
1488 | Standard_Boolean res = GeomLib_Tool::Parameter(C,P,Tol,U); |
1489 | |
1490 | Draw::Set(a[6],U); |
1491 | |
1492 | if( !res ) { di << "Wrong point" << "\n"; return 1; } |
1493 | } |
1494 | else if(n == 6) |
1495 | { |
1496 | // try to find parameters on a 2d Curve |
1497 | Handle(Geom2d_Curve) C = DrawTrSurf::GetCurve2d(a[1]); |
1498 | if( C.IsNull() ) { di << "Unknown curve 2d" << "\n"; return 1; } |
1499 | gp_Pnt2d P(atof(a[2]), atof(a[3])); |
1500 | Standard_Real Tol = atof(a[4]), U = 0.; |
1501 | Standard_Boolean res = GeomLib_Tool::Parameter(C,P,Tol,U); |
1502 | |
1503 | Draw::Set(a[5],U); |
1504 | |
1505 | if( !res ) { di << "Wrong point" << "\n"; return 1; } |
1506 | } |
1507 | else |
1508 | { |
1509 | di << "Invalid parameters!" << "\n"; |
1510 | di << "Usage:" << "\n"; |
1511 | di << "parameters Surf X Y Z Tol U V" << "\n"; |
1512 | di << "parameters Curv X Y Z Tol U" << "\n"; |
1513 | di << "parameters Curv2d X Y Tol U" << "\n"; |
1514 | return 1; |
1515 | } |
1516 | |
1517 | return 0; |
1518 | } |
1519 | |
1520 | |
1521 | //======================================================================= |
1522 | //function : bounds |
1523 | //purpose : |
1524 | //======================================================================= |
1525 | |
1526 | Standard_Integer bounds(Draw_Interpretor&, Standard_Integer n, const char** a) |
1527 | { |
1528 | Standard_Real U1, U2, V1, V2; |
1529 | if ( n == 4) { // compute on a curve or a 2d curve |
1530 | Handle(Geom_Curve) C3d = DrawTrSurf::GetCurve(a[1]); |
1531 | if ( C3d.IsNull()) { // 2dcurve |
1532 | Handle(Geom2d_Curve) C2d = DrawTrSurf::GetCurve2d(a[1]); |
1533 | if ( C2d.IsNull()) return 1; |
1534 | U1 = C2d->FirstParameter(); |
1535 | U2 = C2d->LastParameter(); |
1536 | } |
1537 | else { // 3dcurve |
1538 | U1 = C3d->FirstParameter(); |
1539 | U2 = C3d->LastParameter(); |
1540 | } |
1541 | Draw::Set(a[2],U1); |
1542 | Draw::Set(a[3],U2); |
1543 | } |
1544 | else if ( n == 6) { // compute on a Surface |
1545 | Handle(Geom_Surface) S = DrawTrSurf::GetSurface(a[1]); |
1546 | if ( S.IsNull()) return 1; |
1547 | S->Bounds(U1,U2,V1,V2); |
1548 | |
1549 | Draw::Set(a[2],U1); |
1550 | Draw::Set(a[3],U2); |
1551 | Draw::Set(a[4],V1); |
1552 | Draw::Set(a[5],V2); |
1553 | } |
1554 | |
1555 | return 0; |
1556 | } |
1557 | |
1558 | //======================================================================= |
1559 | //function : SurfaceCommands |
1560 | //purpose : |
1561 | //======================================================================= |
1562 | |
1563 | |
1564 | void GeomliteTest::SurfaceCommands(Draw_Interpretor& theCommands) |
1565 | { |
1566 | static Standard_Boolean loaded = Standard_False; |
1567 | if (loaded) return; |
1568 | loaded = Standard_True; |
1569 | |
1570 | DrawTrSurf::BasicCommands(theCommands); |
1571 | |
1572 | const char* g; |
1573 | // analytic surfaces |
1574 | g = "GEOMETRY surfaces creation"; |
1575 | |
1576 | theCommands.Add("plane", |
1577 | "plane name [x y z [dx dy dz [ux uy uz]]]", |
1578 | __FILE__, |
1579 | anasurface,g); |
1580 | |
1581 | theCommands.Add("cone", |
1582 | "cone name [x y z [dx dy dz [ux uy uz]]] semi-angle radius", |
1583 | __FILE__, |
1584 | anasurface,g); |
1585 | |
1586 | theCommands.Add("cylinder", |
1587 | "cylinder name [x y z [dx dy dz [ux uy uz]]] radius", |
1588 | __FILE__, |
1589 | anasurface,g); |
1590 | |
1591 | theCommands.Add("sphere", |
1592 | "sphere name [x y z [dx dy dz [ux uy uz]]] radius", |
1593 | __FILE__, |
1594 | anasurface,g); |
1595 | |
1596 | theCommands.Add("torus", |
1597 | "torus name [x y z [dx dy dz [ux uy uz]]] major minor", |
1598 | __FILE__, |
1599 | anasurface,g); |
1600 | |
1601 | theCommands.Add("beziersurf", |
1602 | "beziersurf name nbupoles nbvpoles pole, [weight]", |
1603 | __FILE__, |
1604 | polesurface,g); |
1605 | |
1606 | theCommands.Add("bsplinesurf", |
1607 | "bsplinesurf name udegree nbuknots uknot, umult vdegree nbvknots vknot, vmult pole, weight", |
1608 | __FILE__, |
1609 | polesurface,g); |
1610 | |
1611 | theCommands.Add("upbsplinesurf", |
1612 | "bsplinesurf name udegree nbuknots uknot, umult vdegree nbvknots vknot, vmult pole, weight", |
1613 | __FILE__, |
1614 | polesurface,g); |
1615 | |
1616 | theCommands.Add("vpbsplinesurf", |
1617 | "bsplinesurf name udegree nbuknots uknot, umult vdegree nbvknots vknot, vmult pole, weight", |
1618 | __FILE__, |
1619 | polesurface,g); |
1620 | |
1621 | theCommands.Add("uvpbsplinesurf", |
1622 | "bsplinesurf name udegree nbuknots uknot, umult vdegree nbvknots vknot, vmult pole, weight", |
1623 | __FILE__, |
1624 | polesurface,g); |
1625 | |
1626 | theCommands.Add("extsurf", |
1627 | "extsurf name curvename dx dy dz", |
1628 | __FILE__, |
1629 | algosurface,g); |
1630 | |
1631 | theCommands.Add("revsurf", |
1632 | "revsurf name curvename x y z dx dy dz", |
1633 | __FILE__, |
1634 | algosurface,g); |
1635 | |
1636 | theCommands.Add("offset", |
1637 | "offset name basename distance [dx dy dz]", |
1638 | __FILE__, |
1639 | offseting,g); |
1640 | |
1641 | theCommands.Add("trim", |
1642 | "trim newname name [u1 u2 [v1 v2]], no args remove trim", |
1643 | __FILE__, |
1644 | trimming,g); |
1645 | |
1646 | theCommands.Add("trimu", |
1647 | "trim newname name u1 u2", |
1648 | __FILE__, |
1649 | trimming,g); |
1650 | |
1651 | theCommands.Add("trimv", |
1652 | "trim newname name v1 v2", |
1653 | __FILE__, |
1654 | trimming,g); |
1655 | |
1656 | theCommands.Add("convert", |
1657 | "convert result c2d/c3d/surf [qa,c1,s1,s2,s3,s4,po]", |
1658 | __FILE__, |
1659 | converting,g); |
1660 | |
1661 | theCommands.Add("tobezier", |
1662 | "tobezier result c2d/c3d/surf [ufirst, ulast / ufirst, ulast, vfirst, vlast]", |
1663 | __FILE__, |
1664 | tobezier,g); |
1665 | |
1666 | theCommands.Add("convertfrombezier", |
1667 | "convertfrombezier result nbu [nbv] bz1 [bz2 .... bzn] [tol]", |
1668 | __FILE__, |
1669 | convbz,g); |
1670 | |
1671 | theCommands.Add("approxsurf", |
1672 | "approxsurf name surf [Tol [CnU CnV [degU degV [nmax]]]] ", |
1673 | __FILE__, |
1674 | approxsurf,g); |
1675 | |
1676 | g = "GEOMETRY Curves and Surfaces modification"; |
1677 | |
1678 | theCommands.Add("ureverse", |
1679 | "ureverse name ... ", |
1680 | __FILE__, |
1681 | sreverse,g); |
1682 | |
1683 | theCommands.Add("vreverse", |
1684 | "vreverse name ... ", |
1685 | __FILE__, |
1686 | sreverse,g); |
1687 | |
1688 | theCommands.Add("movep", |
1689 | "movep name row col dx dy dz", |
1690 | __FILE__, |
1691 | movepole,g); |
1692 | |
1693 | theCommands.Add("moverowp", |
1694 | "moverowp name row dx dy dz", |
1695 | __FILE__, |
1696 | movepole,g); |
1697 | |
1698 | theCommands.Add("movecolp", |
1699 | "movecolp name col dx dy dz", |
1700 | __FILE__, |
1701 | movepole,g); |
1702 | |
1703 | theCommands.Add("movepoint", |
1704 | "movepoint name u v dx dy dz [index1u index2u index2v index2v", |
1705 | __FILE__, |
1706 | movepoint,g); |
1707 | |
1708 | theCommands.Add("insertuknot", |
1709 | "insertuknot name knot mult", |
1710 | __FILE__, |
1711 | insertknot,g); |
1712 | |
1713 | theCommands.Add("insertvknot", |
1714 | "insertvknot name knot mult", |
1715 | __FILE__, |
1716 | insertknot,g); |
1717 | |
1718 | theCommands.Add("remuknot", |
1719 | "remuknot name index [mult] [tol]", |
1720 | __FILE__, |
1721 | insertknot,g); |
1722 | |
1723 | theCommands.Add("remvknot", |
1724 | "remvknot name index [mult] [tol]", |
1725 | __FILE__, |
1726 | insertknot,g); |
1727 | |
1728 | theCommands.Add("incudeg", |
1729 | "incudeg name degree", |
1730 | __FILE__, |
1731 | incdegree,g); |
1732 | |
1733 | theCommands.Add("incvdeg", |
1734 | "incvdeg name degree", |
1735 | __FILE__, |
1736 | incdegree,g); |
1737 | |
1738 | theCommands.Add("remrowpole", |
1739 | "remrowpole name index", |
1740 | __FILE__, |
1741 | rempole,g); |
1742 | |
1743 | theCommands.Add("remcolpole", |
1744 | "remcolpole name index", |
1745 | __FILE__, |
1746 | rempole,g); |
1747 | |
1748 | theCommands.Add("sfindp", |
1749 | "sfindp name view x y Uindex Vindex", |
1750 | __FILE__, |
1751 | sfindp,g); |
1752 | |
1753 | theCommands.Add("setuperiodic", |
1754 | "setuperiodic name ...", |
1755 | __FILE__, |
1756 | ssetperiodic,g); |
1757 | |
1758 | theCommands.Add("setvperiodic", |
1759 | "setvperiodic name ...", |
1760 | __FILE__, |
1761 | ssetperiodic,g); |
1762 | |
1763 | theCommands.Add("setunotperiodic", |
1764 | "setunotperiodic name ...", |
1765 | __FILE__, |
1766 | ssetperiodic,g); |
1767 | |
1768 | theCommands.Add("setvnotperiodic", |
1769 | "setvnotperiodic name ...", |
1770 | __FILE__, |
1771 | ssetperiodic,g); |
1772 | |
1773 | theCommands.Add("exchuv", |
1774 | "exchuv name ...", |
1775 | __FILE__, |
1776 | exchuv,g); |
1777 | |
1778 | theCommands.Add("segsur", |
1779 | "segsur name Ufirst Ulast Vfirst Vlast", |
1780 | __FILE__, |
1781 | segsur , g); |
1782 | |
1783 | theCommands.Add("setuorigin", |
1784 | "setuorigin name knotindex", |
1785 | __FILE__, |
1786 | setuvorigin , g); |
1787 | |
1788 | theCommands.Add("setvorigin", |
1789 | "setvorigin name knotindex", |
1790 | __FILE__, |
1791 | setuvorigin , g); |
1792 | |
1793 | g = "GEOMETRY curves creation"; |
1794 | |
1795 | |
1796 | theCommands.Add("uiso", |
1797 | "uiso curvename surfacename u", |
1798 | __FILE__, |
1799 | iso,g); |
1800 | |
1801 | theCommands.Add("viso", |
1802 | "viso curvename surfacename v", |
1803 | __FILE__, |
1804 | iso,g); |
1805 | |
1806 | |
1807 | g = "GEOMETRY curves and surfaces analysis"; |
1808 | |
1809 | theCommands.Add("svalue", |
1810 | "svalue surfname U V X Y Z [DUX DUY DUZ DVX DVY DVZ [D2UX D2UY D2UZ D2VX D2VY D2VZ D2UVX D2UVY D2UVZ]]", |
1811 | __FILE__, |
1812 | value,g); |
1813 | |
1814 | theCommands.Add("parameters", |
1815 | "parameters surf/curve X Y [Z] Tol U [V] : {X Y Z} point, {U V} output parameter(s)", |
1816 | __FILE__, |
1817 | parameters,g); |
1818 | |
1819 | theCommands.Add("bounds", |
1820 | "bounds S/C/C2d U1 U2 [V1 V2]", |
1821 | __FILE__, |
1822 | bounds,g); |
1823 | |
1824 | theCommands.Add("surface_radius", |
1825 | "surface_radius surface Uvalue <Real> Vvalue <Real> returns min max radius of curvature", |
1826 | __FILE__, |
1827 | surface_radius,g); |
1828 | theCommands.Add("compBsplSur","BsplSurf1 BSplSurf2",__FILE__,compBsplSur,g); |
1829 | |
1830 | } |