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