Commit | Line | Data |
---|---|---|
b311480e | 1 | // Created on: 1993-08-12 |
2 | // Created by: Bruno DUMORTIER | |
3 | // Copyright (c) 1993-1999 Matra Datavision | |
973c2be1 | 4 | // Copyright (c) 1999-2014 OPEN CASCADE SAS |
b311480e | 5 | // |
973c2be1 | 6 | // This file is part of Open CASCADE Technology software library. |
b311480e | 7 | // |
973c2be1 | 8 | // This library is free software; you can redistribute it and / or modify it |
9 | // under the terms of the GNU Lesser General Public version 2.1 as published | |
10 | // by the Free Software Foundation, with special exception defined in the file | |
11 | // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT | |
12 | // distribution for complete text of the license and disclaimer of any warranty. | |
b311480e | 13 | // |
973c2be1 | 14 | // Alternatively, this file may be used under the terms of Open CASCADE |
15 | // commercial license or contractual agreement. | |
b311480e | 16 | |
7fd59977 | 17 | // 09/06/97 : JPI : suppression des commandes redondantes suite a la creation de GeomliteTest |
18 | ||
19 | #include <GeometryTest.hxx> | |
20 | #include <Draw_Appli.hxx> | |
21 | #include <DrawTrSurf.hxx> | |
22 | #include <DrawTrSurf_Curve.hxx> | |
23 | #include <DrawTrSurf_Curve2d.hxx> | |
24 | #include <DrawTrSurf_BezierCurve.hxx> | |
25 | #include <DrawTrSurf_BSplineCurve.hxx> | |
26 | #include <DrawTrSurf_BezierCurve2d.hxx> | |
27 | #include <DrawTrSurf_BSplineCurve2d.hxx> | |
28 | #include <Draw_Marker3D.hxx> | |
29 | #include <Draw_Marker2D.hxx> | |
30 | #include <Draw.hxx> | |
31 | #include <Draw_Interpretor.hxx> | |
32 | #include <Draw_Color.hxx> | |
33 | #include <Draw_Display.hxx> | |
34 | ||
35 | #include <GeomAPI.hxx> | |
36 | #include <GeomAPI_IntCS.hxx> | |
37 | #include <GeomAPI_IntSS.hxx> | |
38 | ||
39 | //#include <GeomLProp.hxx> | |
40 | #include <GeomProjLib.hxx> | |
41 | #include <BSplCLib.hxx> | |
42 | ||
43 | #include <gp.hxx> | |
44 | #include <gp_Pln.hxx> | |
45 | #include <gp_Parab2d.hxx> | |
46 | #include <gp_Elips2d.hxx> | |
47 | #include <gp_Hypr2d.hxx> | |
48 | ||
49 | #include <Geom_Line.hxx> | |
50 | #include <Geom_Circle.hxx> | |
51 | #include <Geom_Ellipse.hxx> | |
52 | #include <Geom_Parabola.hxx> | |
53 | #include <Geom_Hyperbola.hxx> | |
54 | #include <Geom2d_Line.hxx> | |
55 | #include <Geom2d_Circle.hxx> | |
56 | #include <Geom2d_Ellipse.hxx> | |
57 | #include <Geom2d_Parabola.hxx> | |
58 | #include <Geom2d_Hyperbola.hxx> | |
59 | #include <Geom2d_BSplineCurve.hxx> | |
60 | #include <Geom2d_Curve.hxx> | |
61 | ||
62 | #include <GccAna_Lin2dBisec.hxx> | |
63 | #include <GccAna_Circ2dBisec.hxx> | |
64 | #include <GccAna_CircLin2dBisec.hxx> | |
65 | #include <GccAna_CircPnt2dBisec.hxx> | |
66 | #include <GccAna_LinPnt2dBisec.hxx> | |
67 | #include <GccAna_Pnt2dBisec.hxx> | |
68 | #include <GccInt_Bisec.hxx> | |
69 | #include <GccInt_IType.hxx> | |
70 | ||
71 | #include <Geom_Plane.hxx> | |
72 | #include <Geom_Curve.hxx> | |
73 | #include <Geom2d_Curve.hxx> | |
74 | #include <Geom2d_TrimmedCurve.hxx> | |
75 | #include <Geom_TrimmedCurve.hxx> | |
76 | ||
77 | #include <Law_BSpline.hxx> | |
78 | ||
79 | #include <TColgp_Array1OfPnt.hxx> | |
80 | #include <TColgp_Array1OfPnt2d.hxx> | |
81 | #include <TColStd_Array1OfReal.hxx> | |
82 | #include <TColStd_Array1OfInteger.hxx> | |
83 | ||
84 | #include <Adaptor3d_HCurve.hxx> | |
85 | #include <Adaptor3d_HSurface.hxx> | |
86 | #include <Adaptor3d_CurveOnSurface.hxx> | |
87 | ||
88 | #include <GeomAdaptor_HCurve.hxx> | |
89 | #include <GeomAdaptor_HSurface.hxx> | |
90 | #include <GeomAdaptor.hxx> | |
91 | #include <Geom2dAdaptor_HCurve.hxx> | |
92 | ||
93 | #include <GeomAbs_SurfaceType.hxx> | |
94 | #include <GeomAbs_CurveType.hxx> | |
95 | ||
96 | #include <ProjLib_CompProjectedCurve.hxx> | |
97 | #include <ProjLib_HCompProjectedCurve.hxx> | |
98 | #include <Approx_CurveOnSurface.hxx> | |
99 | #include <Precision.hxx> | |
100 | #include <Geom2dAdaptor.hxx> | |
101 | ||
102 | ||
103 | #include <Precision.hxx> | |
104 | ||
105 | #include <Geom_Surface.hxx> | |
106 | #include <Adaptor2d_HCurve2d.hxx> | |
107 | #include <stdio.h> | |
108 | #include <BSplCLib.hxx> | |
109 | #include <Geom_BSplineSurface.hxx> | |
110 | #include <Geom_BSplineCurve.hxx> | |
111 | #include <GCPnts_QuasiUniformDeflection.hxx> | |
112 | #include <GCPnts_UniformDeflection.hxx> | |
113 | #include <GCPnts_TangentialDeflection.hxx> | |
114 | #include <GeomAPI_ExtremaCurveCurve.hxx> | |
115 | #include <gce_MakeLin.hxx> | |
116 | #include <TColStd_Array1OfBoolean.hxx> | |
117 | #include <GeomAdaptor_HSurface.hxx> | |
118 | #include <Adaptor3d_TopolTool.hxx> | |
119 | #include <TColgp_Array2OfPnt.hxx> | |
120 | #include <Geom_BSplineSurface.hxx> | |
121 | #include <DrawTrSurf_BSplineSurface.hxx> | |
122 | #include <TColStd_HArray1OfReal.hxx> | |
123 | ||
124 | //epa test | |
125 | #include <BRepBuilderAPI_MakeEdge.hxx> | |
126 | #include <AIS_Shape.hxx> | |
127 | #include <TopoDS_Edge.hxx> | |
128 | #include <GeomLProp_CLProps.hxx> | |
129 | #include <GCPnts_AbscissaPoint.hxx> | |
130 | #include <GCPnts_UniformAbscissa.hxx> | |
131 | #include <DBRep.hxx> | |
132 | ||
133 | #ifdef WNT | |
134 | Standard_IMPORT Draw_Viewer dout; | |
135 | #endif | |
136 | ||
137 | //======================================================================= | |
138 | //function : polecurve2d | |
139 | //purpose : | |
140 | //======================================================================= | |
141 | ||
142 | static Standard_Integer polelaw (Draw_Interpretor& , Standard_Integer n, const char** a) | |
143 | { | |
144 | Standard_Integer k, | |
145 | jj, | |
146 | qq, | |
147 | i; | |
148 | ||
149 | ||
150 | if (n < 3) return 1; | |
151 | Standard_Boolean periodic = Standard_False ; | |
91322f44 | 152 | Standard_Integer deg = Draw::Atoi(a[2]); |
153 | Standard_Integer nbk = Draw::Atoi(a[3]); | |
7fd59977 | 154 | |
155 | TColStd_Array1OfReal knots(1, nbk); | |
156 | TColStd_Array1OfInteger mults(1, nbk); | |
157 | k = 4; | |
158 | Standard_Integer Sigma = 0; | |
159 | for (i = 1; i<=nbk; i++) { | |
91322f44 | 160 | knots( i) = Draw::Atof(a[k]); |
7fd59977 | 161 | k++; |
91322f44 | 162 | mults( i) = Draw::Atoi(a[k]); |
7fd59977 | 163 | Sigma += mults(i); |
164 | k++; | |
165 | } | |
166 | ||
167 | Standard_Integer np; | |
168 | np = Sigma - deg -1; | |
169 | TColStd_Array1OfReal flat_knots(1, Sigma) ; | |
170 | jj = 1 ; | |
171 | for (i = 1 ; i <= nbk ; i++) { | |
172 | for(qq = 1 ; qq <= mults(i) ; qq++) { | |
173 | flat_knots(jj) = knots(i) ; | |
174 | jj ++ ; | |
175 | } | |
176 | } | |
177 | ||
178 | TColgp_Array1OfPnt2d poles (1, np); | |
179 | TColStd_Array1OfReal schoenberg_points(1,np) ; | |
180 | BSplCLib::BuildSchoenbergPoints(deg, | |
181 | flat_knots, | |
182 | schoenberg_points) ; | |
183 | for (i = 1; i <= np; i++) { | |
91322f44 | 184 | poles(i).SetCoord(schoenberg_points(i),Draw::Atof(a[k])); |
7fd59977 | 185 | k++; |
186 | } | |
187 | ||
188 | Handle(Geom2d_BSplineCurve) result = | |
189 | new Geom2d_BSplineCurve(poles, knots, mults, deg, periodic); | |
190 | DrawTrSurf::Set(a[1],result); | |
191 | ||
192 | ||
193 | return 0; | |
194 | } | |
195 | //======================================================================= | |
196 | //function : to2d | |
197 | //purpose : | |
198 | //======================================================================= | |
199 | ||
200 | static Standard_Integer to2d (Draw_Interpretor& , Standard_Integer n, const char** a) | |
201 | { | |
202 | if (n < 3) return 1; | |
203 | ||
204 | // get the curve | |
205 | Handle(Geom_Curve) C = DrawTrSurf::GetCurve(a[2]); | |
206 | if (C.IsNull()) | |
207 | return 1; | |
208 | ||
209 | Handle(Geom_Surface) S; | |
210 | if (n >= 4) { | |
211 | S = DrawTrSurf::GetSurface(a[3]); | |
212 | if (S.IsNull()) return 1; | |
213 | } | |
214 | else | |
215 | S = new Geom_Plane(gp::XOY()); | |
216 | ||
217 | Handle(Geom_Plane) P = Handle(Geom_Plane)::DownCast(S); | |
218 | if (P.IsNull()) return 1; | |
219 | Handle(Geom2d_Curve) r = GeomAPI::To2d(C,P->Pln()); | |
220 | DrawTrSurf::Set(a[1],r); | |
221 | return 0; | |
222 | } | |
223 | ||
224 | //======================================================================= | |
225 | //function : to3d | |
226 | //purpose : | |
227 | //======================================================================= | |
228 | ||
229 | static Standard_Integer to3d (Draw_Interpretor& , Standard_Integer n, const char** a) | |
230 | { | |
231 | if (n < 3) return 1; | |
232 | ||
233 | Handle(Geom2d_Curve) C = DrawTrSurf::GetCurve2d(a[2]); | |
234 | if (C.IsNull()) return 1; | |
235 | ||
236 | Handle(Geom_Surface) S; | |
237 | if (n >= 4) { | |
238 | S = DrawTrSurf::GetSurface(a[3]); | |
239 | if (S.IsNull()) return 1; | |
240 | } | |
241 | else | |
242 | S = new Geom_Plane(gp::XOY()); | |
243 | ||
244 | Handle(Geom_Plane) P = Handle(Geom_Plane)::DownCast(S); | |
245 | if (P.IsNull()) return 1; | |
246 | Handle(Geom_Curve) r = GeomAPI::To3d(C,P->Pln()); | |
247 | ||
248 | DrawTrSurf::Set(a[1],r); | |
249 | return 0; | |
250 | } | |
251 | ||
252 | //======================================================================= | |
253 | //function : gproject | |
254 | //purpose : | |
255 | //======================================================================= | |
256 | ||
257 | ||
258 | static Standard_Integer gproject(Draw_Interpretor& di, Standard_Integer n, const char** a) | |
259 | { | |
260 | ||
261 | char newname[1024]; | |
262 | char* temp = newname; | |
263 | char newname1[10]; | |
264 | char* temp1 = newname1; | |
265 | char name[100]; | |
266 | Standard_Integer ONE = 1; | |
267 | ||
268 | if (n == 3) | |
91322f44 | 269 | Sprintf(name,"p"); |
7fd59977 | 270 | else if (n == 4) { |
91322f44 | 271 | Sprintf(name,"%s",a[1]); |
7fd59977 | 272 | ONE = 2; |
273 | } | |
274 | else { | |
275 | di << "gproject wait 2 or 3 arguments" << "\n"; | |
276 | return 1; | |
277 | } | |
278 | ||
279 | Handle(Geom_Curve) Cur = DrawTrSurf::GetCurve(a[ONE]); | |
280 | Handle(Geom_Surface) Sur = DrawTrSurf::GetSurface(a[ONE+1]); | |
281 | if (Cur.IsNull() || Sur.IsNull()) return 1; | |
282 | ||
283 | Handle(GeomAdaptor_HCurve) hcur = new GeomAdaptor_HCurve(Cur); | |
284 | Handle(GeomAdaptor_HSurface) hsur = new GeomAdaptor_HSurface(Sur); | |
285 | ||
286 | ||
287 | Standard_Real myTol3d = 1.e-6; | |
288 | GeomAbs_Shape myContinuity = GeomAbs_C2; | |
289 | Standard_Integer myMaxDegree = 14, myMaxSeg = 16; | |
290 | ||
291 | ||
292 | ProjLib_CompProjectedCurve Projector(hsur, hcur, myTol3d/10, myTol3d/10); | |
293 | Handle(ProjLib_HCompProjectedCurve) HProjector = new ProjLib_HCompProjectedCurve(); | |
294 | HProjector->Set(Projector); | |
295 | ||
296 | Standard_Integer k; | |
297 | Standard_Real Udeb, Ufin, UIso, VIso; | |
298 | Standard_Integer Only2d, Only3d; | |
299 | gp_Pnt2d P2d, Pdeb, Pfin; | |
300 | gp_Pnt P; | |
301 | Handle(Adaptor2d_HCurve2d) HPCur; | |
302 | Handle(Geom2d_Curve) PCur2d; // Only for isoparametric projection | |
303 | ||
304 | for(k = 1; k <= Projector.NbCurves(); k++){ | |
91322f44 | 305 | Sprintf(newname,"%s_%d",name,k); |
306 | Sprintf(newname1,"%s2d_%d",name,k); | |
7fd59977 | 307 | if(Projector.IsSinglePnt(k, P2d)){ |
308 | // cout<<"Part "<<k<<" of the projection is punctual"<<endl; | |
309 | Projector.GetSurface()->D0(P2d.X(), P2d.Y(), P); | |
310 | DrawTrSurf::Set(temp, P); | |
311 | DrawTrSurf::Set(temp1, P2d); | |
312 | di<<temp<<" is 3d projected curve"<<"\n"; | |
313 | di<<temp1<<" is pcurve"<<"\n"; | |
314 | } | |
315 | else { | |
316 | Only2d = Only3d = Standard_False; | |
317 | Projector.Bounds(k, Udeb, Ufin); | |
318 | gp_Dir2d Dir; // Only for isoparametric projection | |
319 | ||
320 | if (Projector.IsUIso(k, UIso)) { | |
321 | // cout<<"Part "<<k<<" of the projection is U-isoparametric curve"<<endl; | |
322 | Projector.D0(Udeb, Pdeb); | |
323 | Projector.D0(Ufin, Pfin); | |
324 | Udeb = Pdeb.Y(); | |
325 | Ufin = Pfin.Y(); | |
326 | if (Udeb > Ufin) { | |
327 | Dir = gp_Dir2d(0, -1); | |
328 | Udeb = - Udeb; | |
329 | Ufin = - Ufin; | |
330 | } | |
331 | else Dir = gp_Dir2d(0, 1); | |
332 | PCur2d = new Geom2d_TrimmedCurve(new Geom2d_Line(gp_Pnt2d(UIso, 0), Dir), Udeb, Ufin); | |
333 | HPCur = new Geom2dAdaptor_HCurve(PCur2d); | |
334 | Only3d = Standard_True; | |
335 | } | |
336 | else if(Projector.IsVIso(k, VIso)) { | |
337 | // cout<<"Part "<<k<<" of the projection is V-isoparametric curve"<<endl; | |
338 | Projector.D0(Udeb, Pdeb); | |
339 | Projector.D0(Ufin, Pfin); | |
340 | Udeb = Pdeb.X(); | |
341 | Ufin = Pfin.X(); | |
342 | if (Udeb > Ufin) { | |
343 | Dir = gp_Dir2d(-1, 0); | |
344 | Udeb = - Udeb; | |
345 | Ufin = - Ufin; | |
346 | } | |
347 | else Dir = gp_Dir2d(1, 0); | |
348 | PCur2d = new Geom2d_TrimmedCurve(new Geom2d_Line(gp_Pnt2d(0, VIso), Dir), Udeb, Ufin); | |
349 | HPCur = new Geom2dAdaptor_HCurve(PCur2d); | |
350 | Only3d = Standard_True; | |
351 | } | |
352 | else HPCur = HProjector; | |
353 | ||
354 | if(Projector.MaxDistance(k) <= myTol3d) | |
355 | Only2d = Standard_True; | |
356 | ||
357 | if(Only2d && Only3d) { | |
358 | Handle(Geom_Curve) OutCur = new Geom_TrimmedCurve(GeomAdaptor::MakeCurve(hcur->Curve()), Ufin, Udeb); | |
359 | DrawTrSurf::Set(temp, OutCur); | |
360 | DrawTrSurf::Set(temp1, PCur2d); | |
361 | di<<temp<<" is 3d projected curve"<<"\n"; | |
362 | di<<temp1<<" is pcurve"<<"\n"; | |
363 | return 0; | |
364 | } | |
365 | else { | |
366 | Approx_CurveOnSurface appr(HPCur, hsur, Udeb, Ufin, myTol3d, | |
367 | myContinuity, myMaxDegree, myMaxSeg, | |
368 | Only3d, Only2d); | |
369 | if(!Only3d) { | |
370 | PCur2d = appr.Curve2d(); | |
371 | di << " Error in 2d is " << appr.MaxError2dU() | |
372 | << "; " << appr.MaxError2dV() << "\n"; | |
373 | } | |
374 | if(Only2d) { | |
375 | Handle(Geom_Curve) OutCur = | |
376 | new Geom_TrimmedCurve(GeomAdaptor::MakeCurve(hcur->Curve()), | |
377 | Ufin, Udeb); | |
378 | DrawTrSurf::Set(temp, OutCur); | |
379 | } | |
380 | else { | |
381 | di << " Error in 3d is " << appr.MaxError3d() << "\n"; | |
382 | DrawTrSurf::Set(temp, appr.Curve3d()); | |
383 | } | |
384 | DrawTrSurf::Set(temp1, PCur2d); | |
385 | di<<temp<<" is 3d projected curve"<<"\n"; | |
386 | di<<temp1<<" is pcurve"<<"\n"; | |
387 | } | |
388 | } | |
389 | } | |
390 | return 0; | |
391 | } | |
392 | //======================================================================= | |
393 | //function : project | |
394 | //purpose : | |
395 | //======================================================================= | |
396 | ||
397 | static Standard_Integer project (Draw_Interpretor& di, | |
398 | Standard_Integer n, const char** a) | |
399 | { | |
400 | if ( n == 1) { | |
401 | ||
402 | di << "project result2d c3d surf [-e p] [-v n] [-t tol]" << "\n"; | |
403 | di << " -e p : extent the surface of <p>%" << "\n"; | |
404 | di << " -v n : verify the projection at <n> points." << "\n"; | |
405 | di << " -t tol : set the tolerance for approximation" << "\n"; | |
406 | return 0; | |
407 | } | |
408 | ||
409 | if (n < 4) return 1; | |
410 | Handle(Geom_Surface) GS = DrawTrSurf::GetSurface(a[3]); | |
411 | if (GS.IsNull()) return 1; | |
412 | ||
413 | Handle(Geom_Curve) GC = DrawTrSurf::GetCurve(a[2]); | |
414 | if (GC.IsNull()) return 1; | |
415 | ||
416 | Standard_Real tolerance = Precision::Confusion() ; | |
417 | ||
418 | Standard_Real U1,U2,V1,V2; | |
419 | GS->Bounds(U1,U2,V1,V2); | |
420 | ||
421 | Standard_Boolean Verif = Standard_False, Extent = Standard_False; | |
422 | Standard_Integer NbPoints=0; | |
423 | ||
424 | Standard_Integer index = 4; | |
425 | while ( index+1 < n) { | |
426 | if ( a[index][0] != '-') return 1; | |
427 | ||
428 | if ( a[index][1] == 'e') { | |
91322f44 | 429 | Standard_Real p = Draw::Atof(a[index+1]); |
7fd59977 | 430 | Standard_Real dU = p * (U2 - U1) / 100.; |
431 | Standard_Real dV = p * (V2 - V1) / 100.; | |
432 | U1 -= dU; U2 += dU; V1 -= dV; V2 += dV; | |
433 | Extent = Standard_True; | |
434 | } | |
435 | else if ( a[index][1] == 'v') { | |
436 | Verif = Standard_True; | |
91322f44 | 437 | NbPoints = Draw::Atoi(a[index+1]); |
7fd59977 | 438 | } |
439 | else if ( a[index][1] == 't') { | |
91322f44 | 440 | tolerance = Draw::Atof(a[index+1]); |
7fd59977 | 441 | } |
442 | index += 2; | |
443 | } | |
444 | ||
445 | Handle(Geom2d_Curve) G2d = | |
446 | GeomProjLib::Curve2d(GC, GS, U1, U2, V1, V2, tolerance); | |
447 | ||
448 | if ( G2d.IsNull() ) { | |
449 | di << "\n" << "Projection Failed" << "\n"; | |
450 | return 1; | |
451 | } | |
452 | else { | |
453 | DrawTrSurf::Set(a[1],G2d); | |
454 | } | |
455 | if ( Verif) { // verify the projection on n points | |
456 | if ( NbPoints <= 0) { | |
457 | di << " n must be positive" << "\n"; | |
458 | return 0; | |
459 | } | |
460 | gp_Pnt P1,P2; | |
461 | gp_Pnt2d P2d; | |
462 | ||
463 | Standard_Real U, dU; | |
464 | Standard_Real Dist,DistMax = -1.; | |
465 | U1 = GC->FirstParameter(); | |
466 | U2 = GC->LastParameter(); | |
467 | dU = ( U2 - U1) / (NbPoints + 1); | |
468 | for ( Standard_Integer i = 0 ; i <= NbPoints +1; i++) { | |
469 | U = U1 + i *dU; | |
470 | P1 = GC->Value(U); | |
471 | P2d = G2d->Value(U); | |
472 | P2 = GS->Value(P2d.X(), P2d.Y()); | |
473 | Dist = P1.Distance(P2); | |
474 | di << " Parameter = " << U << "\tDistance = " << Dist << "\n"; | |
475 | if ( Dist > DistMax) DistMax = Dist; | |
476 | } | |
477 | di << " **** Distance Maximale : " << DistMax << "\n"; | |
478 | } | |
479 | ||
480 | return 0; | |
481 | } | |
482 | ||
483 | //======================================================================= | |
484 | //function : projonplane | |
485 | //purpose : | |
486 | //======================================================================= | |
487 | ||
488 | Standard_Integer projonplane(Draw_Interpretor& di, | |
489 | Standard_Integer n, const char** a) | |
490 | { | |
491 | if ( n < 4 ) return 1; | |
492 | ||
493 | Handle(Geom_Surface) S = DrawTrSurf::GetSurface(a[3]); | |
494 | if ( S.IsNull()) return 1; | |
495 | ||
496 | Handle(Geom_Plane) Pl = Handle(Geom_Plane)::DownCast(S); | |
497 | if ( Pl.IsNull()) { | |
498 | di << " The surface must be a plane" << "\n"; | |
499 | return 1; | |
500 | } | |
501 | ||
502 | Handle(Geom_Curve) C = DrawTrSurf::GetCurve(a[2]); | |
503 | if ( C.IsNull()) return 1; | |
504 | ||
505 | Standard_Boolean Param = Standard_True; | |
91322f44 | 506 | if ((n == 5 && Draw::Atoi(a[4]) == 0) || |
507 | (n == 8 && Draw::Atoi(a[7]) == 0)) Param = Standard_False; | |
7fd59977 | 508 | |
509 | gp_Dir D; | |
510 | ||
511 | if ( n == 8) { | |
91322f44 | 512 | D = gp_Dir(Draw::Atof(a[4]),Draw::Atof(a[5]),Draw::Atof(a[6])); |
7fd59977 | 513 | } |
514 | else { | |
515 | D = Pl->Pln().Position().Direction(); | |
516 | } | |
517 | ||
518 | Handle(Geom_Curve) Res = | |
519 | GeomProjLib::ProjectOnPlane(C,Pl,D,Param); | |
520 | ||
521 | DrawTrSurf::Set(a[1],Res); | |
522 | return 0; | |
523 | ||
524 | } | |
525 | ||
526 | ||
527 | //======================================================================= | |
528 | //function : bisec | |
529 | //purpose : | |
530 | //======================================================================= | |
531 | ||
532 | static void solution(const Handle(GccInt_Bisec)& Bis, | |
533 | const char* name, | |
534 | const Standard_Integer i) | |
535 | { | |
536 | char solname[200]; | |
537 | if ( i == 0) | |
91322f44 | 538 | Sprintf(solname,"%s",name); |
7fd59977 | 539 | else |
91322f44 | 540 | Sprintf(solname,"%s_%d",name,i); |
7fd59977 | 541 | const char* temp = solname; // pour portage WNT |
542 | ||
543 | switch ( Bis->ArcType()) { | |
544 | case GccInt_Lin: | |
545 | DrawTrSurf::Set(temp, new Geom2d_Line(Bis->Line())); | |
546 | break; | |
547 | case GccInt_Cir: | |
548 | DrawTrSurf::Set(temp, new Geom2d_Circle(Bis->Circle())); | |
549 | break; | |
550 | case GccInt_Ell: | |
551 | DrawTrSurf::Set(temp, new Geom2d_Ellipse(Bis->Ellipse())); | |
552 | break; | |
553 | case GccInt_Par: | |
554 | DrawTrSurf::Set(temp, new Geom2d_Parabola(Bis->Parabola())); | |
555 | break; | |
556 | case GccInt_Hpr: | |
557 | DrawTrSurf::Set(temp, new Geom2d_Hyperbola(Bis->Hyperbola())); | |
558 | break; | |
559 | case GccInt_Pnt: | |
560 | DrawTrSurf::Set(temp, Bis->Point()); | |
561 | break; | |
562 | } | |
563 | } | |
564 | ||
565 | static Standard_Integer bisec (Draw_Interpretor& di, | |
566 | Standard_Integer n, const char** a) | |
567 | { | |
568 | if (n < 4) return 1; | |
569 | ||
570 | Handle(Geom2d_Curve) C1 = DrawTrSurf::GetCurve2d(a[2]); | |
571 | Handle(Geom2d_Curve) C2 = DrawTrSurf::GetCurve2d(a[3]); | |
572 | gp_Pnt2d P1,P2; | |
573 | Standard_Boolean ip1 = DrawTrSurf::GetPoint2d(a[2],P1); | |
574 | Standard_Boolean ip2 = DrawTrSurf::GetPoint2d(a[3],P2); | |
575 | Standard_Integer i, Compt = 0; | |
576 | Standard_Integer NbSol = 0; | |
577 | ||
578 | if ( !C1.IsNull()) { | |
579 | Handle(Standard_Type) Type1 = C1->DynamicType(); | |
580 | if ( !C2.IsNull()) { | |
581 | Handle(Standard_Type) Type2 = C2->DynamicType(); | |
582 | if ( Type1 == STANDARD_TYPE(Geom2d_Line) && | |
583 | Type2 == STANDARD_TYPE(Geom2d_Line) ) { | |
584 | GccAna_Lin2dBisec Bis(Handle(Geom2d_Line)::DownCast(C1)->Lin2d(), | |
585 | Handle(Geom2d_Line)::DownCast(C2)->Lin2d()); | |
586 | if ( Bis.IsDone()) { | |
587 | char solname[200]; | |
588 | NbSol = Bis.NbSolutions(); | |
589 | for ( i = 1; i <= NbSol; i++) { | |
91322f44 | 590 | Sprintf(solname,"%s_%d",a[1],i); |
7fd59977 | 591 | const char* temp = solname; // pour portage WNT |
592 | DrawTrSurf::Set(temp,new Geom2d_Line(Bis.ThisSolution(i))); | |
593 | } | |
594 | } | |
595 | else { | |
596 | di << " Bisec has failed !!" << "\n"; | |
597 | return 1; | |
598 | } | |
599 | } | |
600 | else if ( Type1 == STANDARD_TYPE(Geom2d_Line) && | |
601 | Type2 == STANDARD_TYPE(Geom2d_Circle) ) { | |
602 | GccAna_CircLin2dBisec | |
603 | Bis(Handle(Geom2d_Circle)::DownCast(C2)->Circ2d(), | |
604 | Handle(Geom2d_Line)::DownCast(C1)->Lin2d()); | |
605 | if ( Bis.IsDone()) { | |
606 | NbSol= Bis.NbSolutions(); | |
607 | if ( NbSol >= 2) Compt = 1; | |
608 | for ( i = 1; i <= NbSol; i++) { | |
609 | solution(Bis.ThisSolution(i),a[1],Compt); | |
610 | Compt++; | |
611 | } | |
612 | } | |
613 | else { | |
614 | di << " Bisec has failed !!" << "\n"; | |
615 | return 1; | |
616 | } | |
617 | } | |
618 | else if ( Type2 == STANDARD_TYPE(Geom2d_Line) && | |
619 | Type1 == STANDARD_TYPE(Geom2d_Circle) ) { | |
620 | GccAna_CircLin2dBisec | |
621 | Bis(Handle(Geom2d_Circle)::DownCast(C1)->Circ2d(), | |
622 | Handle(Geom2d_Line)::DownCast(C2)->Lin2d()); | |
623 | if ( Bis.IsDone()) { | |
624 | // char solname[200]; | |
625 | NbSol = Bis.NbSolutions(); | |
626 | if ( NbSol >= 2) Compt = 1; | |
627 | for ( i = 1; i <= NbSol; i++) { | |
628 | solution(Bis.ThisSolution(i),a[1],Compt); | |
629 | Compt++; | |
630 | } | |
631 | } | |
632 | else { | |
633 | di << " Bisec has failed !!" << "\n"; | |
634 | return 1; | |
635 | } | |
636 | } | |
637 | else if ( Type2 == STANDARD_TYPE(Geom2d_Circle) && | |
638 | Type1 == STANDARD_TYPE(Geom2d_Circle) ) { | |
639 | GccAna_Circ2dBisec | |
640 | Bis(Handle(Geom2d_Circle)::DownCast(C1)->Circ2d(), | |
641 | Handle(Geom2d_Circle)::DownCast(C2)->Circ2d()); | |
642 | if ( Bis.IsDone()) { | |
643 | // char solname[200]; | |
644 | NbSol = Bis.NbSolutions(); | |
645 | if ( NbSol >= 2) Compt = 1; | |
646 | for ( i = 1; i <= NbSol; i++) { | |
647 | solution(Bis.ThisSolution(i),a[1],Compt); | |
648 | Compt++; | |
649 | } | |
650 | } | |
651 | else { | |
652 | di << " Bisec has failed !!" << "\n"; | |
653 | return 1; | |
654 | } | |
655 | } | |
656 | else { | |
657 | di << " args must be line/circle/point line/circle/point" << "\n"; | |
658 | return 1; | |
659 | } | |
660 | } | |
661 | else if (ip2) { | |
662 | if ( Type1 == STANDARD_TYPE(Geom2d_Circle)) { | |
663 | GccAna_CircPnt2dBisec Bis | |
664 | (Handle(Geom2d_Circle)::DownCast(C1)->Circ2d(),P2); | |
665 | if ( Bis.IsDone()) { | |
666 | NbSol = Bis.NbSolutions(); | |
667 | if ( NbSol >= 2) Compt = 1; | |
668 | for ( i = 1; i <= NbSol; i++) { | |
669 | solution(Bis.ThisSolution(i),a[1],Compt); | |
670 | Compt++; | |
671 | } | |
672 | } | |
673 | else { | |
674 | di << " Bisec has failed !!" << "\n"; | |
675 | return 1; | |
676 | } | |
677 | } | |
678 | else if ( Type1 == STANDARD_TYPE(Geom2d_Line)) { | |
679 | GccAna_LinPnt2dBisec Bis | |
680 | (Handle(Geom2d_Line)::DownCast(C1)->Lin2d(),P2); | |
681 | if ( Bis.IsDone()) { | |
682 | NbSol = 1; | |
683 | solution(Bis.ThisSolution(),a[1],0); | |
684 | } | |
685 | else { | |
686 | di << " Bisec has failed !!" << "\n"; | |
687 | return 1; | |
688 | } | |
689 | } | |
690 | } | |
691 | else { | |
692 | di << " the second arg must be line/circle/point " << "\n"; | |
693 | } | |
694 | } | |
695 | else if ( ip1) { | |
696 | if ( !C2.IsNull()) { | |
697 | Handle(Standard_Type) Type2 = C2->DynamicType(); | |
698 | if ( Type2 == STANDARD_TYPE(Geom2d_Circle)) { | |
699 | GccAna_CircPnt2dBisec Bis | |
700 | (Handle(Geom2d_Circle)::DownCast(C2)->Circ2d(),P1); | |
701 | if ( Bis.IsDone()) { | |
702 | NbSol = Bis.NbSolutions(); | |
703 | if ( NbSol >= 2) Compt = 1; | |
704 | for ( i = 1; i <= Bis.NbSolutions(); i++) { | |
705 | solution(Bis.ThisSolution(i),a[1],Compt); | |
706 | Compt++; | |
707 | } | |
708 | } | |
709 | else { | |
710 | di << " Bisec has failed !!" << "\n"; | |
711 | return 1; | |
712 | } | |
713 | } | |
714 | else if ( Type2 == STANDARD_TYPE(Geom2d_Line)) { | |
715 | GccAna_LinPnt2dBisec Bis | |
716 | (Handle(Geom2d_Line)::DownCast(C2)->Lin2d(),P1); | |
717 | if ( Bis.IsDone()) { | |
718 | NbSol = 1; | |
719 | solution(Bis.ThisSolution(),a[1],0); | |
720 | } | |
721 | else { | |
722 | di << " Bisec has failed !!" << "\n"; | |
723 | return 1; | |
724 | } | |
725 | } | |
726 | } | |
727 | else if (ip2) { | |
728 | GccAna_Pnt2dBisec Bis(P1,P2); | |
729 | if ( Bis.HasSolution()) { | |
730 | NbSol = 1; | |
731 | DrawTrSurf::Set(a[1],new Geom2d_Line(Bis.ThisSolution())); | |
732 | } | |
733 | else { | |
734 | di << " Bisec has failed !!" << "\n"; | |
735 | return 1; | |
736 | } | |
737 | } | |
738 | else { | |
739 | di << " the second arg must be line/circle/point " << "\n"; | |
740 | return 1; | |
741 | } | |
742 | } | |
743 | else { | |
744 | di << " args must be line/circle/point line/circle/point" << "\n"; | |
745 | return 1; | |
746 | } | |
747 | ||
748 | if ( NbSol >= 2) { | |
749 | di << "There are " << NbSol << " Solutions." << "\n"; | |
750 | } | |
751 | else { | |
752 | di << "There is " << NbSol << " Solution." << "\n"; | |
753 | } | |
754 | ||
755 | return 0; | |
756 | } | |
757 | ||
758 | //======================================================================= | |
759 | //function : cmovetangent | |
760 | //purpose : | |
761 | //======================================================================= | |
762 | ||
763 | static Standard_Integer movelaw (Draw_Interpretor& di, Standard_Integer n, const char** a) | |
764 | { | |
765 | Standard_Integer dimension, | |
766 | ii, | |
767 | condition=0, | |
768 | error_status ; | |
769 | Standard_Real u, | |
770 | x, | |
771 | tolerance, | |
772 | tx ; | |
773 | ||
91322f44 | 774 | u = Draw::Atof(a[2]); |
775 | x = Draw::Atof(a[3]); | |
7fd59977 | 776 | tolerance = 1.0e-5 ; |
777 | dimension = 2 ; | |
778 | if (n < 5) { | |
779 | return 1 ; | |
780 | } | |
781 | Handle(Geom2d_BSplineCurve) G2 = DrawTrSurf::GetBSplineCurve2d(a[1]); | |
782 | if (!G2.IsNull()) { | |
91322f44 | 783 | tx = Draw::Atof(a[4]) ; |
7fd59977 | 784 | if (n == 6) { |
91322f44 | 785 | condition = Max(Draw::Atoi(a[5]), -1) ; |
7fd59977 | 786 | condition = Min(condition, G2->Degree()-1) ; |
787 | } | |
788 | TColgp_Array1OfPnt2d curve_poles(1,G2->NbPoles()) ; | |
789 | TColStd_Array1OfReal law_poles(1,G2->NbPoles()) ; | |
790 | TColStd_Array1OfReal law_knots(1,G2->NbKnots()) ; | |
791 | TColStd_Array1OfInteger law_mults(1,G2->NbKnots()) ; | |
792 | ||
793 | G2->Knots(law_knots) ; | |
794 | G2->Multiplicities(law_mults) ; | |
795 | G2->Poles(curve_poles) ; | |
796 | for (ii = 1 ; ii <= G2->NbPoles() ; ii++) { | |
797 | law_poles(ii) = curve_poles(ii).Coord(2) ; | |
798 | } | |
799 | ||
800 | Law_BSpline a_law(law_poles, | |
801 | law_knots, | |
802 | law_mults, | |
803 | G2->Degree(), | |
804 | Standard_False) ; | |
805 | ||
806 | a_law.MovePointAndTangent(u, | |
807 | x, | |
808 | tx, | |
809 | tolerance, | |
810 | condition, | |
811 | condition, | |
812 | error_status) ; | |
813 | ||
814 | for (ii = 1 ; ii <= G2->NbPoles() ; ii++) { | |
815 | curve_poles(ii).SetCoord(2,a_law.Pole(ii)) ; | |
816 | G2->SetPole(ii,curve_poles(ii)) ; | |
817 | } | |
818 | ||
819 | ||
820 | if (! error_status) { | |
821 | Draw::Repaint(); | |
822 | } | |
823 | else { | |
824 | di << "Not enought degree of freedom increase degree please" << "\n"; | |
825 | } | |
826 | ||
827 | ||
828 | } | |
829 | return 0; | |
830 | } | |
831 | ||
832 | ||
3492f422 PA |
833 | //Static method computing deviation of curve and polyline |
834 | ||
835 | static void ComputeDeviation(const Handle(Geom_Curve)& theCurve, | |
836 | const Handle(Geom_BSplineCurve)& thePnts, | |
837 | Standard_Real& theDmax, | |
838 | Standard_Real& theUfMax, | |
839 | Standard_Real& theUlMax, | |
840 | Standard_Integer& theImax) | |
841 | { | |
842 | theDmax = 0.; | |
843 | theUfMax = 0.; | |
844 | theUlMax = 0.; | |
845 | theImax = 0; | |
3492f422 PA |
846 | |
847 | //take knots | |
848 | Standard_Integer nbp = thePnts->NbKnots(); | |
849 | TColStd_Array1OfReal aKnots(1, nbp); | |
850 | thePnts->Knots(aKnots); | |
851 | ||
852 | Standard_Integer i; | |
853 | for(i = 1; i < nbp; ++i) { | |
854 | Standard_Real uf = aKnots(i); | |
855 | Standard_Real ul = aKnots(i+1); | |
856 | ||
857 | GeomAPI_ExtremaCurveCurve ECC(theCurve, thePnts, uf, ul, uf, ul); | |
858 | ||
859 | Standard_Integer nbe = ECC.NbExtrema(); | |
860 | if(nbe > 0) { | |
861 | Standard_Integer k; | |
862 | Standard_Real d = 0.; | |
863 | for(k = 1; k <= nbe; k++) { | |
864 | if(ECC.Distance(k) > d) d = ECC.Distance(k); | |
865 | } | |
866 | ||
867 | if(d > theDmax) { | |
868 | theDmax = d; | |
869 | theUfMax = uf; | |
870 | theUlMax = ul; | |
871 | theImax = i; | |
872 | } | |
873 | } | |
874 | } | |
875 | } | |
876 | ||
877 | ||
7fd59977 | 878 | //======================================================================= |
879 | //function : crvpoints | |
880 | //purpose : | |
881 | //======================================================================= | |
882 | ||
883 | static Standard_Integer crvpoints (Draw_Interpretor& di, Standard_Integer /*n*/, const char** a) | |
884 | { | |
885 | Standard_Integer i, nbp; | |
886 | Standard_Real defl; | |
887 | ||
888 | Handle(Geom_Curve) C = DrawTrSurf::GetCurve(a[2]); | |
91322f44 | 889 | defl = Draw::Atof(a[3]); |
7fd59977 | 890 | |
891 | GeomAdaptor_Curve GAC(C); | |
7fd59977 | 892 | GCPnts_QuasiUniformDeflection PntGen(GAC, defl); |
3492f422 | 893 | |
7fd59977 | 894 | if(!PntGen.IsDone()) { |
895 | di << "Points generation failed" << "\n"; | |
896 | return 1; | |
897 | } | |
898 | ||
899 | nbp = PntGen.NbPoints(); | |
900 | di << "Nb points : " << nbp << "\n"; | |
901 | ||
902 | TColgp_Array1OfPnt aPoles(1, nbp); | |
903 | TColStd_Array1OfReal aKnots(1, nbp); | |
904 | TColStd_Array1OfInteger aMults(1, nbp); | |
905 | ||
906 | for(i = 1; i <= nbp; ++i) { | |
907 | aPoles(i) = PntGen.Value(i); | |
908 | aKnots(i) = PntGen.Parameter(i); | |
909 | aMults(i) = 1; | |
910 | } | |
911 | ||
912 | aMults(1) = 2; | |
913 | aMults(nbp) = 2; | |
914 | ||
915 | Handle(Geom_BSplineCurve) aPnts = new Geom_BSplineCurve(aPoles, aKnots, aMults, 1); | |
916 | Handle(DrawTrSurf_BSplineCurve) aDrCrv = new DrawTrSurf_BSplineCurve(aPnts); | |
917 | ||
918 | aDrCrv->ClearPoles(); | |
919 | Draw_Color aKnColor(Draw_or); | |
920 | aDrCrv->SetKnotsColor(aKnColor); | |
921 | aDrCrv->SetKnotsShape(Draw_Plus); | |
922 | ||
923 | Draw::Set(a[1], aDrCrv); | |
924 | ||
925 | Standard_Real dmax = 0., ufmax = 0., ulmax = 0.; | |
926 | Standard_Integer imax = 0; | |
927 | ||
3492f422 PA |
928 | //check deviation |
929 | ComputeDeviation(C,aPnts,dmax,ufmax,ulmax,imax); | |
930 | di << "Max defl: " << dmax << " " << ufmax << " " << ulmax << " " << i << "\n"; | |
7fd59977 | 931 | |
3492f422 PA |
932 | return 0; |
933 | } | |
7fd59977 | 934 | |
3492f422 PA |
935 | //======================================================================= |
936 | //function : crvtpoints | |
937 | //purpose : | |
938 | //======================================================================= | |
7fd59977 | 939 | |
3492f422 PA |
940 | static Standard_Integer crvtpoints (Draw_Interpretor& di, Standard_Integer n, const char** a) |
941 | { | |
942 | Standard_Integer i, nbp; | |
943 | Standard_Real defl, angle = Precision::Angular(); | |
944 | ||
945 | Handle(Geom_Curve) C = DrawTrSurf::GetCurve(a[2]); | |
91322f44 | 946 | defl = Draw::Atof(a[3]); |
3492f422 PA |
947 | |
948 | if(n > 3) | |
91322f44 | 949 | angle = Draw::Atof(a[4]); |
3492f422 PA |
950 | |
951 | GeomAdaptor_Curve GAC(C); | |
952 | GCPnts_TangentialDeflection PntGen(GAC, angle, defl, 2); | |
953 | ||
954 | nbp = PntGen.NbPoints(); | |
955 | di << "Nb points : " << nbp << "\n"; | |
956 | ||
957 | TColgp_Array1OfPnt aPoles(1, nbp); | |
958 | TColStd_Array1OfReal aKnots(1, nbp); | |
959 | TColStd_Array1OfInteger aMults(1, nbp); | |
960 | ||
961 | for(i = 1; i <= nbp; ++i) { | |
962 | aPoles(i) = PntGen.Value(i); | |
963 | aKnots(i) = PntGen.Parameter(i); | |
964 | aMults(i) = 1; | |
7fd59977 | 965 | } |
3492f422 PA |
966 | |
967 | aMults(1) = 2; | |
968 | aMults(nbp) = 2; | |
7fd59977 | 969 | |
3492f422 PA |
970 | Handle(Geom_BSplineCurve) aPnts = new Geom_BSplineCurve(aPoles, aKnots, aMults, 1); |
971 | Handle(DrawTrSurf_BSplineCurve) aDrCrv = new DrawTrSurf_BSplineCurve(aPnts); | |
972 | ||
973 | aDrCrv->ClearPoles(); | |
974 | Draw_Color aKnColor(Draw_or); | |
975 | aDrCrv->SetKnotsColor(aKnColor); | |
976 | aDrCrv->SetKnotsShape(Draw_Plus); | |
977 | ||
978 | Draw::Set(a[1], aDrCrv); | |
979 | ||
980 | Standard_Real dmax = 0., ufmax = 0., ulmax = 0.; | |
981 | Standard_Integer imax = 0; | |
982 | ||
983 | //check deviation | |
984 | ComputeDeviation(C,aPnts,dmax,ufmax,ulmax,imax); | |
7fd59977 | 985 | di << "Max defl: " << dmax << " " << ufmax << " " << ulmax << " " << i << "\n"; |
986 | ||
987 | return 0; | |
988 | } | |
7fd59977 | 989 | //======================================================================= |
990 | //function : uniformAbscissa | |
991 | //purpose : epa test (TATA-06-002 (Problem with GCPnts_UniformAbscissa class) | |
992 | //======================================================================= | |
993 | static Standard_Integer uniformAbscissa (Draw_Interpretor& di, Standard_Integer n, const char** a) | |
994 | { | |
995 | if( n != 3 ) | |
996 | return 1; | |
997 | ||
998 | /*Handle(Geom_BSplineCurve) ellip; | |
999 | ellip = DrawTrSurf::GetBSplineCurve(a[1]); | |
1000 | if (ellip.IsNull()) | |
1001 | { | |
1002 | di << " BSpline is NULL "<<"\n"; | |
1003 | return 1; | |
1004 | }*/ | |
1005 | ||
1006 | Handle(Geom_Curve) ellip; | |
1007 | ellip = DrawTrSurf::GetCurve(a[1]); | |
1008 | if (ellip.IsNull()) | |
1009 | { | |
1010 | di << " Curve is NULL "<<"\n"; | |
1011 | return 1; | |
1012 | } | |
1013 | ||
1014 | Standard_Integer nocp; | |
91322f44 | 1015 | nocp = Draw::Atoi(a[2]); |
7fd59977 | 1016 | if(nocp < 2) |
1017 | return 1; | |
1018 | ||
1019 | ||
1020 | //test nbPoints for Geom_Ellipse | |
1021 | ||
1022 | try | |
1023 | { | |
1024 | GeomLProp_CLProps Prop(ellip,2,Precision::Intersection()); | |
1025 | Prop.SetCurve(ellip); | |
1026 | ||
1027 | GeomAdaptor_Curve GAC(ellip); | |
1028 | di<<"Type Of curve: "<<GAC.GetType()<<"\n"; | |
1029 | Standard_Real Tol = Precision::Confusion(); | |
1030 | Standard_Real L; | |
1031 | ||
1032 | L = GCPnts_AbscissaPoint::Length(GAC, GAC.FirstParameter(), GAC.LastParameter(), Tol); | |
1033 | di<<"Ellipse length = "<<L<<"\n"; | |
1034 | Standard_Real Abscissa = L/(nocp-1); | |
1035 | di << " CUR : Abscissa " << Abscissa << "\n"; | |
1036 | ||
1037 | GCPnts_UniformAbscissa myAlgo(GAC, Abscissa, ellip->FirstParameter(), ellip->LastParameter()); | |
1038 | if ( myAlgo.IsDone() ) | |
1039 | { | |
1040 | di << " CasCurve - nbpoints " << myAlgo.NbPoints() << "\n"; | |
1041 | for(Standard_Integer i = 1; i<= myAlgo.NbPoints(); i++ ) | |
1042 | di << i <<" points = " << myAlgo.Parameter( i ) << "\n"; | |
1043 | } | |
1044 | } | |
1045 | ||
1046 | catch (Standard_Failure ) | |
1047 | { | |
1048 | di << " Standard Failure " <<"\n"; | |
1049 | } | |
1050 | return 0; | |
1051 | } | |
1052 | ||
1053 | //======================================================================= | |
1054 | //function : EllipsUniformAbscissa | |
1055 | //purpose : epa test (TATA-06-002 (Problem with GCPnts_UniformAbscissa class) | |
1056 | //======================================================================= | |
1057 | static Standard_Integer EllipsUniformAbscissa (Draw_Interpretor& di, Standard_Integer n, const char** a) | |
1058 | { | |
1059 | if( n != 4 ) | |
1060 | return 1; | |
1061 | ||
1062 | Standard_Real R1; | |
91322f44 | 1063 | R1 = Draw::Atof(a[1]); |
7fd59977 | 1064 | Standard_Real R2; |
91322f44 | 1065 | R2 = Draw::Atof(a[2]); |
7fd59977 | 1066 | |
1067 | Standard_Integer nocp; | |
91322f44 | 1068 | nocp = Draw::Atoi(a[3]); |
7fd59977 | 1069 | if(nocp < 2) |
1070 | return 1; | |
1071 | ||
1072 | //test nbPoints for Geom_Ellipse | |
1073 | Handle_Geom_Ellipse ellip; | |
1074 | ||
1075 | ||
1076 | try | |
1077 | { | |
1078 | gp_Pnt location; | |
1079 | location = gp_Pnt( 0.0, 0.0, 0.0); | |
1080 | gp_Dir main_direction(0.0, 0.0, 1.0); | |
1081 | ||
1082 | gp_Dir x_direction(1.0, 0.0, 0.0); | |
1083 | gp_Ax2 mainaxis( location, main_direction); | |
1084 | ||
1085 | mainaxis.SetXDirection(x_direction); | |
1086 | ellip = new Geom_Ellipse(mainaxis,R1, R2); | |
1087 | ||
1088 | BRepBuilderAPI_MakeEdge curve_edge(ellip); | |
1089 | TopoDS_Edge edge_curve = curve_edge.Edge(); | |
1090 | ||
1091 | DBRep::Set("Ellipse",edge_curve); | |
1092 | } | |
1093 | ||
1094 | catch(Standard_Failure) | |
1095 | { | |
1096 | di << " Standard Failure "<<"\n"; | |
1097 | } | |
1098 | ||
1099 | try | |
1100 | { | |
1101 | GeomLProp_CLProps Prop(ellip,2,Precision::Intersection()); | |
1102 | Prop.SetCurve(ellip); | |
1103 | ||
1104 | GeomAdaptor_Curve GAC(ellip); | |
1105 | di<<"Type Of curve: "<<GAC.GetType()<<"\n"; | |
1106 | Standard_Real Tol = Precision::Confusion(); | |
1107 | Standard_Real L; | |
1108 | ||
1109 | L = GCPnts_AbscissaPoint::Length(GAC, GAC.FirstParameter(), GAC.LastParameter(), Tol); | |
1110 | di<<"Ellipse length = "<<L<<"\n"; | |
1111 | Standard_Real Abscissa = L/(nocp-1); | |
1112 | di << " CUR : Abscissa " << Abscissa << "\n"; | |
1113 | ||
1114 | GCPnts_UniformAbscissa myAlgo(GAC, Abscissa, ellip->FirstParameter(), ellip->LastParameter()); | |
1115 | if ( myAlgo.IsDone() ) | |
1116 | { | |
1117 | di << " CasCurve - nbpoints " << myAlgo.NbPoints() << "\n"; | |
1118 | for(Standard_Integer i = 1; i<= myAlgo.NbPoints(); i++ ) | |
1119 | di << i <<" points = " << myAlgo.Parameter( i ) << "\n"; | |
1120 | } | |
1121 | } | |
1122 | ||
1123 | catch (Standard_Failure ) | |
1124 | { | |
1125 | di << " Standard Failure " <<"\n"; | |
1126 | } | |
1127 | return 0; | |
1128 | } | |
1129 | ||
1130 | //======================================================================= | |
1131 | //function : mypoints | |
1132 | //purpose : | |
1133 | //======================================================================= | |
1134 | ||
1135 | static Standard_Integer mypoints (Draw_Interpretor& di, Standard_Integer /*n*/, const char** a) | |
1136 | { | |
1137 | Standard_Integer i, nbp; | |
1138 | Standard_Real defl; | |
1139 | ||
1140 | Handle(Geom_Curve) C = DrawTrSurf::GetCurve(a[2]); | |
91322f44 | 1141 | defl = Draw::Atof(a[3]); |
7fd59977 | 1142 | const Handle(Geom_BSplineCurve)& aBS = Handle(Geom_BSplineCurve)::DownCast(C); |
1143 | ||
1144 | if(aBS.IsNull()) return 1; | |
1145 | ||
1146 | Standard_Integer ui1 = aBS->FirstUKnotIndex(); | |
1147 | Standard_Integer ui2 = aBS->LastUKnotIndex(); | |
1148 | ||
1149 | Standard_Integer nbsu = ui2-ui1+1; nbsu += (nbsu - 1) * (aBS->Degree()-1); | |
1150 | ||
1151 | TColStd_Array1OfReal anUPars(1, nbsu); | |
1152 | TColStd_Array1OfBoolean anUFlg(1, nbsu); | |
1153 | ||
1154 | Standard_Integer j, k, nbi; | |
1155 | Standard_Real t1, t2, dt; | |
1156 | ||
1157 | //Filling of sample parameters | |
1158 | nbi = aBS->Degree(); | |
1159 | k = 0; | |
1160 | t1 = aBS->Knot(ui1); | |
1161 | for(i = ui1+1; i <= ui2; ++i) { | |
1162 | t2 = aBS->Knot(i); | |
1163 | dt = (t2 - t1)/nbi; | |
1164 | j = 1; | |
1165 | do { | |
1166 | ++k; | |
1167 | anUPars(k) = t1; | |
1168 | anUFlg(k) = Standard_False; | |
1169 | t1 += dt; | |
1170 | } | |
1171 | while (++j <= nbi); | |
1172 | t1 = t2; | |
1173 | } | |
1174 | ++k; | |
1175 | anUPars(k) = t1; | |
1176 | ||
1177 | Standard_Integer l; | |
1178 | defl *= defl; | |
1179 | ||
1180 | j = 1; | |
1181 | anUFlg(1) = Standard_True; | |
1182 | anUFlg(nbsu) = Standard_True; | |
1183 | Standard_Boolean bCont = Standard_True; | |
1184 | while (j < nbsu-1 && bCont) { | |
1185 | t2 = anUPars(j); | |
1186 | gp_Pnt p1 = aBS->Value(t2); | |
1187 | for(k = j+2; k <= nbsu; ++k) { | |
1188 | t2 = anUPars(k); | |
1189 | gp_Pnt p2 = aBS->Value(t2); | |
1190 | gce_MakeLin MkLin(p1, p2); | |
1191 | const gp_Lin& lin = MkLin.Value(); | |
1192 | Standard_Boolean ok = Standard_True; | |
1193 | for(l = j+1; l < k; ++l) { | |
1194 | if(anUFlg(l)) continue; | |
1195 | gp_Pnt pp = aBS->Value(anUPars(l)); | |
1196 | Standard_Real d = lin.SquareDistance(pp); | |
1197 | ||
1198 | if(d <= defl) continue; | |
1199 | ||
1200 | ok = Standard_False; | |
1201 | break; | |
1202 | } | |
1203 | ||
1204 | ||
1205 | if(!ok) { | |
1206 | j = k - 1; | |
1207 | anUFlg(j) = Standard_True; | |
1208 | break; | |
1209 | } | |
1210 | ||
1211 | } | |
1212 | ||
1213 | if(k >= nbsu) bCont = Standard_False; | |
1214 | } | |
1215 | ||
1216 | nbp = 0; | |
1217 | for(i = 1; i <= nbsu; ++i) { | |
1218 | if(anUFlg(i)) nbp++; | |
1219 | } | |
1220 | ||
1221 | TColgp_Array1OfPnt aPoles(1, nbp); | |
1222 | TColStd_Array1OfReal aKnots(1, nbp); | |
1223 | TColStd_Array1OfInteger aMults(1, nbp); | |
1224 | j = 0; | |
1225 | for(i = 1; i <= nbsu; ++i) { | |
1226 | if(anUFlg(i)) { | |
1227 | ++j; | |
1228 | aKnots(j) = anUPars(i); | |
1229 | aMults(j) = 1; | |
1230 | aPoles(j) = aBS->Value(aKnots(j)); | |
1231 | } | |
1232 | } | |
1233 | ||
1234 | aMults(1) = 2; | |
1235 | aMults(nbp) = 2; | |
1236 | ||
1237 | Handle(Geom_BSplineCurve) aPnts = new Geom_BSplineCurve(aPoles, aKnots, aMults, 1); | |
1238 | Handle(DrawTrSurf_BSplineCurve) aDrCrv = new DrawTrSurf_BSplineCurve(aPnts); | |
1239 | ||
1240 | aDrCrv->ClearPoles(); | |
1241 | Draw_Color aKnColor(Draw_or); | |
1242 | aDrCrv->SetKnotsColor(aKnColor); | |
1243 | aDrCrv->SetKnotsShape(Draw_Plus); | |
1244 | ||
1245 | Draw::Set(a[1], aDrCrv); | |
1246 | ||
6e6cd5d9 | 1247 | Standard_Real dmax = 0., ufmax = 0., ulmax = 0.; |
7fd59977 | 1248 | Standard_Integer imax = 0; |
1249 | ||
3492f422 | 1250 | ComputeDeviation(C,aPnts,dmax,ufmax,ulmax,imax); |
7fd59977 | 1251 | di << "Max defl: " << dmax << " " << ufmax << " " << ulmax << " " << imax << "\n"; |
1252 | ||
1253 | return 0; | |
1254 | } | |
1255 | ||
1256 | ||
1257 | ||
1258 | //======================================================================= | |
1259 | //function : surfpoints | |
1260 | //purpose : | |
1261 | //======================================================================= | |
1262 | ||
1263 | static Standard_Integer surfpoints (Draw_Interpretor& /*di*/, Standard_Integer /*n*/, const char** a) | |
1264 | { | |
1265 | Standard_Integer i; | |
1266 | Standard_Real defl; | |
1267 | ||
1268 | Handle(Geom_Surface) S = DrawTrSurf::GetSurface(a[2]); | |
91322f44 | 1269 | defl = Draw::Atof(a[3]); |
7fd59977 | 1270 | |
1271 | Handle(GeomAdaptor_HSurface) AS = new GeomAdaptor_HSurface(S); | |
1272 | ||
1273 | Handle(Adaptor3d_TopolTool) aTopTool = new Adaptor3d_TopolTool(AS); | |
1274 | ||
1275 | aTopTool->SamplePnts(defl, 10, 10); | |
1276 | ||
1277 | Standard_Integer nbpu = aTopTool->NbSamplesU(); | |
1278 | Standard_Integer nbpv = aTopTool->NbSamplesV(); | |
1279 | TColStd_Array1OfReal Upars(1, nbpu), Vpars(1, nbpv); | |
1280 | aTopTool->UParameters(Upars); | |
1281 | aTopTool->VParameters(Vpars); | |
1282 | ||
1283 | TColgp_Array2OfPnt aPoles(1, nbpu, 1, nbpv); | |
1284 | TColStd_Array1OfReal anUKnots(1, nbpu); | |
1285 | TColStd_Array1OfReal aVKnots(1, nbpv); | |
1286 | TColStd_Array1OfInteger anUMults(1, nbpu); | |
1287 | TColStd_Array1OfInteger aVMults(1, nbpv); | |
1288 | ||
1289 | Standard_Integer j; | |
1290 | for(i = 1; i <= nbpu; ++i) { | |
1291 | anUKnots(i) = Upars(i); | |
1292 | anUMults(i) = 1; | |
1293 | for(j = 1; j <= nbpv; ++j) { | |
1294 | aVKnots(j) = Vpars(j); | |
1295 | aVMults(j) = 1; | |
1296 | aPoles(i,j) = S->Value(anUKnots(i),aVKnots(j)); | |
1297 | } | |
1298 | } | |
1299 | ||
1300 | anUMults(1) = 2; | |
1301 | anUMults(nbpu) = 2; | |
1302 | aVMults(1) = 2; | |
1303 | aVMults(nbpv) = 2; | |
1304 | ||
1305 | Handle(Geom_BSplineSurface) aPnts = new Geom_BSplineSurface(aPoles, anUKnots, aVKnots, | |
1306 | anUMults, aVMults, 1, 1); | |
1307 | Handle(DrawTrSurf_BSplineSurface) aDrSurf = new DrawTrSurf_BSplineSurface(aPnts); | |
1308 | ||
1309 | aDrSurf->ClearPoles(); | |
1310 | Draw_Color aKnColor(Draw_or); | |
1311 | aDrSurf->SetKnotsColor(aKnColor); | |
1312 | aDrSurf->SetKnotsShape(Draw_Plus); | |
1313 | ||
1314 | Draw::Set(a[1], aDrSurf); | |
1315 | ||
1316 | ||
1317 | return 0; | |
1318 | } | |
1319 | ||
1320 | ||
1321 | ||
1322 | //======================================================================= | |
1323 | //function : intersect | |
1324 | //purpose : | |
1325 | //======================================================================= | |
7fd59977 | 1326 | static Standard_Integer intersection (Draw_Interpretor& di, Standard_Integer n, const char** a) |
32ca7a51 | 1327 | { |
1328 | if (n < 4) | |
c5c34473 | 1329 | return 1; |
32ca7a51 | 1330 | |
c5c34473 | 1331 | // |
7fd59977 | 1332 | Handle(Geom_Curve) GC1; |
1333 | Handle(Geom_Surface) GS1 = DrawTrSurf::GetSurface(a[2]); | |
32ca7a51 | 1334 | if (GS1.IsNull()) |
1335 | { | |
7fd59977 | 1336 | GC1 = DrawTrSurf::GetCurve(a[2]); |
1337 | if (GC1.IsNull()) | |
1338 | return 1; | |
32ca7a51 | 1339 | } |
1340 | ||
c5c34473 | 1341 | // |
7fd59977 | 1342 | Handle(Geom_Surface) GS2 = DrawTrSurf::GetSurface(a[3]); |
32ca7a51 | 1343 | if (GS2.IsNull()) |
c5c34473 | 1344 | return 1; |
32ca7a51 | 1345 | |
c5c34473 | 1346 | // |
7fd59977 | 1347 | Standard_Real tol = Precision::Confusion(); |
32ca7a51 | 1348 | if (n == 5 || n == 9 || n == 13 || n == 17) |
1349 | tol = Draw::Atof(a[n-1]); | |
1350 | ||
c5c34473 | 1351 | // |
7fd59977 | 1352 | Handle(Geom_Curve) Result; |
1353 | gp_Pnt Point; | |
32ca7a51 | 1354 | |
c5c34473 | 1355 | // |
32ca7a51 | 1356 | if (GC1.IsNull()) |
1357 | { | |
c5c34473 J |
1358 | GeomInt_IntSS Inters; |
1359 | // | |
7fd59977 | 1360 | // Surface Surface |
32ca7a51 | 1361 | if (n <= 5) |
1362 | { | |
7fd59977 | 1363 | // General case |
c5c34473 | 1364 | Inters.Perform(GS1,GS2,tol,Standard_True); |
32ca7a51 | 1365 | } |
1366 | else if (n == 8 || n == 9 || n == 12 || n == 13 || n == 16 || n == 17) | |
1367 | { | |
7fd59977 | 1368 | Standard_Boolean useStart = Standard_True, useBnd = Standard_True; |
1369 | Standard_Integer ista1=0,ista2=0,ibnd1=0,ibnd2=0; | |
1370 | Standard_Real UVsta[4]; | |
1371 | Handle(GeomAdaptor_HSurface) AS1,AS2; | |
32ca7a51 | 1372 | |
c5c34473 | 1373 | // |
32ca7a51 | 1374 | if (n <= 9) // user starting point |
1375 | { | |
7fd59977 | 1376 | useBnd = Standard_False; |
32ca7a51 | 1377 | ista1 = 4; |
1378 | ista2 = 7; | |
1379 | } | |
1380 | else if (n <= 13) // user bounding | |
1381 | { | |
7fd59977 | 1382 | useStart = Standard_False; |
1383 | ibnd1 = 4; ibnd2 = 11; | |
32ca7a51 | 1384 | } |
1385 | else // both user starting point and bounding | |
1386 | { | |
7fd59977 | 1387 | ista1 = 4; ista2 = 7; |
1388 | ibnd1 = 8; ibnd2 = 15; | |
32ca7a51 | 1389 | } |
1390 | ||
7fd59977 | 1391 | if (useStart) |
32ca7a51 | 1392 | { |
7fd59977 | 1393 | for (Standard_Integer i=ista1; i <= ista2; i++) |
32ca7a51 | 1394 | { |
91322f44 | 1395 | UVsta[i-ista1] = Draw::Atof(a[i]); |
32ca7a51 | 1396 | } |
1397 | } | |
1398 | ||
1399 | if (useBnd) | |
1400 | { | |
7fd59977 | 1401 | Standard_Real UVbnd[8]; |
1402 | for (Standard_Integer i=ibnd1; i <= ibnd2; i++) | |
91322f44 | 1403 | UVbnd[i-ibnd1] = Draw::Atof(a[i]); |
32ca7a51 | 1404 | |
7fd59977 | 1405 | AS1 = new GeomAdaptor_HSurface(GS1,UVbnd[0],UVbnd[1],UVbnd[2],UVbnd[3]); |
1406 | AS2 = new GeomAdaptor_HSurface(GS2,UVbnd[4],UVbnd[5],UVbnd[6],UVbnd[7]); | |
32ca7a51 | 1407 | } |
1408 | ||
c5c34473 | 1409 | // |
32ca7a51 | 1410 | if (useStart && !useBnd) |
1411 | { | |
7fd59977 | 1412 | Inters.Perform(GS1,GS2,tol,UVsta[0],UVsta[1],UVsta[2],UVsta[3]); |
32ca7a51 | 1413 | } |
1414 | else if (!useStart && useBnd) | |
1415 | { | |
c5c34473 | 1416 | Inters.Perform(AS1,AS2,tol); |
32ca7a51 | 1417 | } |
1418 | else | |
1419 | { | |
c5c34473 | 1420 | Inters.Perform(AS1,AS2,tol,UVsta[0],UVsta[1],UVsta[2],UVsta[3]); |
32ca7a51 | 1421 | } |
1422 | }//else if (n == 8 || n == 9 || n == 12 || n == 13 || n == 16 || n == 17) | |
1423 | else | |
1424 | { | |
7fd59977 | 1425 | di<<"incorrect number of arguments"<<"\n"; |
1426 | return 1; | |
32ca7a51 | 1427 | } |
1428 | ||
c5c34473 | 1429 | // |
32ca7a51 | 1430 | if (!Inters.IsDone()) |
1431 | { | |
1432 | di<<"No intersections found!"<<"\n"; | |
1433 | ||
c5c34473 | 1434 | return 1; |
32ca7a51 | 1435 | } |
1436 | ||
c5c34473 J |
1437 | // |
1438 | char buf[1024]; | |
1439 | Standard_Integer i, aNbLines, aNbPoints; | |
32ca7a51 | 1440 | |
1441 | // | |
c5c34473 | 1442 | aNbLines = Inters.NbLines(); |
32ca7a51 | 1443 | if (aNbLines >= 2) |
1444 | { | |
1445 | for (i=1; i<=aNbLines; ++i) | |
1446 | { | |
1447 | Sprintf(buf, "%s_%d",a[1],i); | |
1448 | di << buf << " "; | |
1449 | Result = Inters.Line(i); | |
1450 | const char* temp = buf; | |
1451 | DrawTrSurf::Set(temp,Result); | |
1452 | } | |
c5c34473 | 1453 | } |
32ca7a51 | 1454 | else if (aNbLines == 1) |
1455 | { | |
c5c34473 | 1456 | Result = Inters.Line(1); |
32ca7a51 | 1457 | Sprintf(buf,"%s",a[1]); |
1458 | di << buf << " "; | |
c5c34473 J |
1459 | DrawTrSurf::Set(a[1],Result); |
1460 | } | |
32ca7a51 | 1461 | |
c5c34473 J |
1462 | // |
1463 | aNbPoints=Inters.NbPoints(); | |
32ca7a51 | 1464 | for (i=1; i<=aNbPoints; ++i) |
1465 | { | |
c5c34473 | 1466 | Point=Inters.Point(i); |
91322f44 | 1467 | Sprintf(buf,"%s_p_%d",a[1],i); |
32ca7a51 | 1468 | di << buf << " "; |
1469 | const char* temp = buf; | |
c5c34473 | 1470 | DrawTrSurf::Set(temp, Point); |
32ca7a51 | 1471 | } |
1472 | }// if (GC1.IsNull()) | |
1473 | else | |
1474 | { | |
7fd59977 | 1475 | // Curve Surface |
1476 | GeomAPI_IntCS Inters(GC1,GS2); | |
7fd59977 | 1477 | |
32ca7a51 | 1478 | // |
1479 | if (!Inters.IsDone()) | |
1480 | { | |
1481 | di<<"No intersections found!"<<"\n"; | |
1482 | return 1; | |
1483 | } | |
1484 | ||
7fd59977 | 1485 | Standard_Integer nblines = Inters.NbSegments(); |
1486 | Standard_Integer nbpoints = Inters.NbPoints(); | |
32ca7a51 | 1487 | |
1488 | char newname[1024]; | |
1489 | ||
1490 | if ( (nblines+nbpoints) >= 2) | |
1491 | { | |
7fd59977 | 1492 | Standard_Integer i; |
1493 | Standard_Integer Compt = 1; | |
32ca7a51 | 1494 | |
1495 | if(nblines >= 1) | |
1496 | cout << " Lines: " << endl; | |
1497 | ||
1498 | for (i = 1; i <= nblines; i++, Compt++) | |
1499 | { | |
1500 | Sprintf(newname,"%s_%d",a[1],Compt); | |
1501 | di << newname << " "; | |
1502 | Result = Inters.Segment(i); | |
1503 | const char* temp = newname; // pour portage WNT | |
1504 | DrawTrSurf::Set(temp,Result); | |
1505 | } | |
1506 | ||
1507 | if(nbpoints >= 1) | |
1508 | cout << " Points: " << endl; | |
1509 | ||
1510 | const Standard_Integer imax = nblines+nbpoints; | |
1511 | ||
1512 | for (/*i = 1*/; i <= imax; i++, Compt++) | |
1513 | { | |
1514 | Sprintf(newname,"%s_%d",a[1],i); | |
1515 | di << newname << " "; | |
1516 | Point = Inters.Point(i); | |
1517 | const char* temp = newname; // pour portage WNT | |
1518 | DrawTrSurf::Set(temp,Point); | |
1519 | } | |
7fd59977 | 1520 | } |
32ca7a51 | 1521 | else if (nblines == 1) |
1522 | { | |
7fd59977 | 1523 | Result = Inters.Segment(1); |
32ca7a51 | 1524 | Sprintf(newname,"%s",a[1]); |
1525 | di << newname << " "; | |
7fd59977 | 1526 | DrawTrSurf::Set(a[1],Result); |
32ca7a51 | 1527 | } |
1528 | else if (nbpoints == 1) | |
1529 | { | |
7fd59977 | 1530 | Point = Inters.Point(1); |
32ca7a51 | 1531 | Sprintf(newname,"%s",a[1]); |
1532 | di << newname << " "; | |
7fd59977 | 1533 | DrawTrSurf::Set(a[1],Point); |
32ca7a51 | 1534 | } |
7fd59977 | 1535 | } |
7fd59977 | 1536 | |
1537 | dout.Flush(); | |
1538 | return 0; | |
32ca7a51 | 1539 | } |
7fd59977 | 1540 | |
1541 | //======================================================================= | |
1542 | //function : CurveCommands | |
1543 | //purpose : | |
1544 | //======================================================================= | |
7fd59977 | 1545 | void GeometryTest::CurveCommands(Draw_Interpretor& theCommands) |
1546 | { | |
1547 | ||
1548 | static Standard_Boolean loaded = Standard_False; | |
1549 | if (loaded) return; | |
1550 | loaded = Standard_True; | |
1551 | ||
1552 | DrawTrSurf::BasicCommands(theCommands); | |
1553 | ||
1554 | const char* g; | |
1555 | ||
1556 | g = "GEOMETRY curves creation"; | |
1557 | ||
1558 | theCommands.Add("law", | |
1559 | "law name degree nbknots knot, umult value", | |
1560 | __FILE__, | |
1561 | polelaw,g); | |
1562 | ||
1563 | theCommands.Add("to2d","to2d c2dname c3d [plane (XOY)]", | |
1564 | __FILE__, | |
1565 | to2d,g); | |
1566 | ||
1567 | theCommands.Add("to3d","to3d c3dname c2d [plane (XOY)]", | |
1568 | __FILE__, | |
1569 | to3d,g); | |
1570 | ||
1571 | theCommands.Add("gproject", | |
1572 | "gproject : [projectname] curve surface", | |
1573 | __FILE__, | |
1574 | gproject,g); | |
1575 | ||
1576 | theCommands.Add("project", | |
1577 | "project : no args to have help", | |
1578 | __FILE__, | |
1579 | project,g); | |
1580 | ||
1581 | theCommands.Add("projonplane", | |
1582 | "projonplane r C3d Plane [dx dy dz] [0/1]", | |
1583 | projonplane); | |
1584 | ||
1585 | theCommands.Add("bisec", | |
1586 | "bisec result line/circle/point line/circle/point", | |
1587 | __FILE__, | |
1588 | bisec, g); | |
1589 | ||
1590 | g = "GEOMETRY Curves and Surfaces modification"; | |
1591 | ||
1592 | ||
1593 | theCommands.Add("movelaw", | |
1594 | "movelaw name u x tx [ constraint = 0]", | |
1595 | __FILE__, | |
1596 | movelaw,g) ; | |
1597 | ||
1598 | ||
1599 | ||
1600 | g = "GEOMETRY intersections"; | |
1601 | ||
1602 | theCommands.Add("intersect", | |
1603 | "intersect result surf1/curv1 surf2 [tolerance]\n\t\t " | |
1604 | "intersect result surf1 surf2 [u1 v1 u2 v2] [U1F U1L V1F V1L U2F U2L V2F V2L] [tolerance]", | |
1605 | __FILE__, | |
1606 | intersection,g); | |
1607 | ||
1608 | theCommands.Add("crvpoints", | |
1609 | "crvpoints result curv deflection", | |
1610 | __FILE__, | |
1611 | crvpoints,g); | |
3492f422 PA |
1612 | |
1613 | theCommands.Add("crvtpoints", | |
1614 | "crvtpoints result curv deflection angular deflection - tangential deflection points", | |
1615 | __FILE__, | |
1616 | crvtpoints,g); | |
7fd59977 | 1617 | |
1618 | theCommands.Add("uniformAbscissa", | |
1619 | "uniformAbscissa Curve nbPnt", | |
1620 | __FILE__, | |
1621 | uniformAbscissa,g); | |
1622 | ||
1623 | theCommands.Add("uniformAbscissaEl", | |
1624 | "uniformAbscissaEl maxR minR nbPnt", | |
1625 | __FILE__, EllipsUniformAbscissa,g); | |
1626 | ||
1627 | theCommands.Add("mypoints", | |
1628 | "mypoints result curv deflection", | |
1629 | __FILE__, | |
1630 | mypoints,g); | |
1631 | theCommands.Add("surfpoints", | |
1632 | "surfoints result surf deflection", | |
1633 | __FILE__, | |
1634 | surfpoints,g); | |
1635 | ||
1636 | } | |
1637 |