7fd59977 |
1 | // DCA_Presentation.cpp: implementation of the DCA_Presentation class. |
2 | // Geometry Direct Construction Algorithms |
3 | ////////////////////////////////////////////////////////////////////// |
4 | |
5 | #include "stdafx.h" |
6 | #include "DCA_Presentation.h" |
7 | |
8 | #include <gce_MakeCirc.hxx> |
9 | #include <gce_MakeElips.hxx> |
10 | #include <gce_MakeParab.hxx> |
11 | #include <gce_MakePln.hxx> |
12 | #include <gce_MakeHypr.hxx> |
13 | #include <gce_MakeLin.hxx> |
14 | #include <gce_MakeCylinder.hxx> |
15 | #include <gce_MakeCone.hxx> |
16 | |
17 | #include <gp_Vec.hxx> |
18 | #include <gp_Dir.hxx> |
19 | #include <gp_Lin.hxx> |
20 | #include <gp_Pln.hxx> |
21 | #include <gp_Ax2.hxx> |
22 | #include <gp_Ax1.hxx> |
23 | #include <gp_Circ.hxx> |
24 | #include <gp_Ax3.hxx> |
25 | #include <gp_Cylinder.hxx> |
26 | #include <gp_Torus.hxx> |
27 | #include <gp_Sphere.hxx> |
28 | |
29 | #include <GC_MakeTrimmedCylinder.hxx> |
30 | #include <GC_MakeCylindricalSurface.hxx> |
31 | #include <GC_MakeTrimmedCone.hxx> |
32 | #include <OCCDemo_Presentation.h> |
33 | #include <AIS_Point.hxx> |
34 | #include <AIS_Shape.hxx> |
35 | #include <Precision.hxx> |
36 | |
37 | #include <Geom_Line.hxx> |
38 | #include <Geom_Vector.hxx> |
39 | #include <Geom_CartesianPoint.hxx> |
40 | #include <Geom_Circle.hxx> |
41 | #include <Geom_Ellipse.hxx> |
42 | #include <Geom_Parabola.hxx> |
43 | #include <Geom_Hyperbola.hxx> |
44 | #include <Geom_Plane.hxx> |
45 | #include <Geom_ToroidalSurface.hxx> |
46 | #include <Geom_ConicalSurface.hxx> |
47 | #include <Geom_SphericalSurface.hxx> |
48 | #include <Geom_CylindricalSurface.hxx> |
49 | #include <Geom_TrimmedCurve.hxx> |
50 | #include <Geom_RectangularTrimmedSurface.hxx> |
51 | #include <TCollection_AsciiString.hxx> |
52 | |
53 | #ifdef WNT |
54 | #define EOL "\r\n" |
55 | #else |
56 | #define EOL "\n" |
57 | #endif |
58 | |
59 | // Initialization of global variable with an instance of this class |
60 | OCCDemo_Presentation* OCCDemo_Presentation::Current = new DCA_Presentation; |
61 | |
62 | // Initialization of array of samples |
63 | const DCA_Presentation::PSampleFuncType DCA_Presentation::SampleFuncs[] = |
64 | { |
65 | &DCA_Presentation::sampleLine, |
66 | &DCA_Presentation::sampleParabola, |
67 | &DCA_Presentation::sampleHyperbola, |
68 | &DCA_Presentation::sampleCircle, |
69 | &DCA_Presentation::sampleEllipse, |
70 | &DCA_Presentation::samplePlane, |
71 | &DCA_Presentation::sampleCylindricalSurface, |
72 | &DCA_Presentation::sampleSphericalSurface, |
73 | &DCA_Presentation::sampleToroidalSurface, |
74 | &DCA_Presentation::sampleConicalSurface, |
75 | }; |
76 | |
77 | ////////////////////////////////////////////////////////////////////// |
78 | // Construction/Destruction |
79 | ////////////////////////////////////////////////////////////////////// |
80 | |
81 | DCA_Presentation::DCA_Presentation() |
82 | { |
83 | myIndex = 0; |
84 | myNbSamples = sizeof(SampleFuncs)/sizeof(PSampleFuncType); |
85 | setName ("Direct Construction Algorithms"); |
86 | FitMode=false; |
87 | } |
88 | |
89 | ////////////////////////////////////////////////////////////////////// |
90 | // Sample execution |
91 | ////////////////////////////////////////////////////////////////////// |
92 | |
93 | void DCA_Presentation::DoSample() |
94 | { |
95 | getAISContext()->EraseAll(); |
96 | if (myIndex >=0 && myIndex < myNbSamples) |
97 | (this->*SampleFuncs[myIndex])(); |
98 | } |
99 | |
100 | ////////////////////////////////////////////////////////////////////// |
101 | // Sample functions |
102 | ////////////////////////////////////////////////////////////////////// |
103 | |
104 | // global data used by various samples |
105 | static gp_Pnt aCenterPoint(120, 0, 0); |
106 | |
107 | //================================================================ |
108 | // Function : DCA_Presentation::sampleLine |
109 | // Purpose : |
110 | //================================================================ |
111 | void DCA_Presentation::sampleLine() |
112 | { |
113 | Standard_CString aTitle = "Construction of lines"; |
114 | |
115 | TCollection_AsciiString aText( |
116 | " // Define two points" EOL |
117 | " gp_Pnt aPoint(-350, 0, 0);" EOL |
118 | " gp_Pnt aPoint1(600, 0, 0);" EOL EOL |
119 | |
120 | " // Create a line between two points" EOL |
121 | " gp_Lin aLin = gce_MakeLin(aPoint, aPoint1);" EOL |
122 | ); |
123 | Comment(aTitle,aText); |
124 | |
125 | // Define two points |
126 | gp_Pnt aPoint(-350, 0, 0); |
127 | gp_Pnt aPoint1(600, 0, 0); |
128 | |
129 | // Create a line between two points |
130 | gp_Lin aLin = gce_MakeLin(aPoint,aPoint1); |
131 | |
132 | drawPoint(aPoint1); |
133 | drawPoint(aPoint); |
134 | |
135 | if(WAIT_A_LITTLE) return; |
136 | |
137 | Handle(Geom_Line) aLine = new Geom_Line(aLin); |
138 | Handle(Geom_TrimmedCurve) aCurve = |
139 | new Geom_TrimmedCurve(aLine, -50, aPoint.Distance(aPoint1)+50); |
140 | drawCurve(aCurve); |
141 | } |
142 | |
143 | //================================================================ |
144 | // Function : DCA_Presentation::sampleParabola |
145 | // Purpose : |
146 | //================================================================ |
147 | void DCA_Presentation::sampleParabola() |
148 | { |
149 | Standard_CString aTitle = " Construction of parabols"; |
150 | getAISContext()->EraseAll(); |
151 | TCollection_AsciiString aText( |
152 | " //define direction vectors" EOL |
153 | " gp_Dir aDir(1,0,0);" EOL |
154 | " gp_Dir aDir1(0,1,0);" EOL |
155 | "" EOL |
156 | " //define two points" EOL |
157 | " gp_Pnt aPointParab(80 ,0 ,-200);" EOL |
158 | " gp_Pnt aFocalPointParab(80 ,0 ,-100);" EOL |
159 | "" EOL |
160 | " //define coordinate system and an axis" EOL |
161 | " gp_Ax2 anAx2(aPointParab, aDir);" EOL |
162 | " gp_Ax1 anAx1(aPointParab, aDir1); " EOL |
163 | "" EOL |
164 | " //METHOD1.(coordinate system, focal_length)" EOL |
165 | " Standard_Real aFocalLength = 50;" EOL |
166 | " gp_Parab aParab = gce_MakeParab(anAx2,aFocalLength);" EOL |
167 | " " EOL |
168 | " //METHOD2.(axis,point)" EOL |
169 | " gp_Parab aParab1 = gce_MakeParab(anAx1,aFocalPointParab);" EOL |
170 | ); |
171 | |
172 | Comment(aTitle,aText); |
173 | |
174 | //define direction vectors |
175 | gp_Dir aDir(1,0,0); |
176 | gp_Dir aDir1(0,1,0); |
177 | |
178 | //define two points |
179 | gp_Pnt aPointParab(80 ,0 ,-200); |
180 | gp_Pnt aFocalPointParab(80 ,0 ,-100); |
181 | |
182 | //define coordinate system and an axis |
183 | gp_Ax2 anAx2(aPointParab, aDir); |
184 | gp_Ax1 anAx1(aPointParab, aDir1); |
185 | |
186 | //METHOD1.(coordinate system, focal_length) |
187 | Standard_Real aFocalLength = 50; |
188 | gp_Parab aParab = gce_MakeParab(anAx2,aFocalLength); |
189 | |
190 | //METHOD2.(axis,point) |
191 | gp_Parab aParab1 = gce_MakeParab(anAx1,aFocalPointParab); |
192 | |
193 | //output first parabola |
194 | drawPoint(aPointParab); |
195 | drawVector(aPointParab,gp_Vec(aDir)*150,Quantity_Color(Quantity_NOC_WHITE)); |
196 | |
197 | if(WAIT_A_LITTLE) return; |
198 | |
92efcf78 |
199 | Handle(Geom_Line) aFocalLenLin = new Geom_Line(gce_MakeLin(aPointParab, gp_Dir(0,0,1))); |
200 | Handle(Geom_TrimmedCurve) aTrim = new Geom_TrimmedCurve(aFocalLenLin, -aFocalLength/2, aFocalLength/2); |
7fd59977 |
201 | drawCurve(aTrim); |
202 | |
203 | if(WAIT_A_LITTLE) return; |
204 | |
92efcf78 |
205 | Handle(Geom_Parabola) aParabola = new Geom_Parabola(aParab); |
206 | Handle(Geom_TrimmedCurve) aParabTrimmed = |
7fd59977 |
207 | new Geom_TrimmedCurve(aParabola,-300,300,Standard_True); |
208 | drawCurve(aParabTrimmed); |
209 | |
210 | if(WAIT_A_LITTLE) return; |
211 | |
212 | getAISContext()->EraseAll(); |
213 | |
214 | //output second parabola |
215 | drawPoint(aPointParab); |
216 | drawVector(aPointParab,gp_Vec(aDir1)*150,Quantity_Color(Quantity_NOC_WHITE)); |
217 | drawPoint(aFocalPointParab); |
218 | |
219 | if(WAIT_A_LITTLE) return; |
220 | |
92efcf78 |
221 | Handle(Geom_Parabola) aParabola1 = new Geom_Parabola(aParab1); |
222 | Handle(Geom_TrimmedCurve) aParabTrimmed1 = new Geom_TrimmedCurve(aParabola1,-300,300,Standard_True); |
7fd59977 |
223 | drawCurve(aParabTrimmed1); |
224 | } |
225 | //================================================================ |
226 | // Function : DCA_Presentation::sampleHyperbola |
227 | // Purpose : |
228 | //================================================================ |
229 | void DCA_Presentation::sampleHyperbola() |
230 | { |
231 | Standard_CString aTitle = " Construction of hyperbols "; |
232 | TCollection_AsciiString aText( |
233 | " //define direction vectors" EOL |
234 | " gp_Dir aDir(1,0,0);" EOL |
235 | "" EOL |
236 | " //define four points" EOL |
237 | " gp_Pnt aPointHypr(100 ,0 ,-200);" EOL |
238 | " gp_Pnt aPointHypr1(100 ,0 ,-300);" EOL |
239 | " gp_Pnt aPointHypr2(100 ,0 ,-100);" EOL |
240 | " gp_Pnt aPointHypr3(100 ,100 ,-300);" EOL |
241 | "" EOL |
242 | " //define axis" EOL |
243 | " gp_Ax2 anAxHypr(aPointHypr, aDir);" EOL |
244 | "" EOL |
245 | " //define radii" EOL |
246 | " Standard_Real MajorRadius=100;" EOL |
247 | " Standard_Real MinorRadius=80;" EOL |
248 | " " EOL |
249 | " //METHOD1.(axis,major and minor radiuses)" EOL |
250 | " gp_Hypr aHypr1 = gce_MakeHypr(anAxHypr, MajorRadius, MinorRadius);" EOL |
251 | "" EOL |
252 | " //METHOD2.(three points)" EOL |
253 | " gp_Hypr aHypr2 = gce_MakeHypr(aPointHypr2, aPointHypr3, aPointHypr1);" EOL |
254 | ); |
255 | Comment(aTitle,aText); |
256 | |
257 | //define direction vectors |
258 | gp_Dir aDir(1,0,0); |
259 | |
260 | //define four points |
261 | gp_Pnt aPointHypr(100 ,0 ,-200); |
262 | gp_Pnt aPointHypr1(100 ,0 ,-300); |
263 | gp_Pnt aPointHypr2(100 ,0 ,-100); |
264 | gp_Pnt aPointHypr3(100 ,100 ,-300); |
265 | |
266 | //define axis |
267 | gp_Ax2 anAxHypr(aPointHypr, aDir); |
268 | |
269 | //define radii |
270 | Standard_Real MajorRadius=100; |
271 | Standard_Real MinorRadius=80; |
272 | |
273 | //METHOD1.(axis,major and minor radiuses) |
274 | gp_Hypr aHypr1 = gce_MakeHypr(anAxHypr, MajorRadius, MinorRadius); |
275 | |
276 | //METHOD2.(three points) |
277 | gp_Hypr aHypr2 = gce_MakeHypr(aPointHypr2, aPointHypr3, aPointHypr1); |
278 | |
279 | |
280 | //output first hyperbola |
281 | drawPoint(aPointHypr); |
282 | drawVector(aPointHypr,gp_Vec(aDir)*200,Quantity_Color(Quantity_NOC_WHITE)); |
283 | |
284 | if(WAIT_A_LITTLE) return; |
285 | |
92efcf78 |
286 | Handle(Geom_Hyperbola) aHyperbola1 = new Geom_Hyperbola(aHypr1); |
287 | Handle(Geom_TrimmedCurve) aHyprTrimmed = |
7fd59977 |
288 | new Geom_TrimmedCurve(aHyperbola1,-3,4,Standard_True); |
289 | drawCurve(aHyprTrimmed); |
290 | |
291 | if(WAIT_A_LITTLE) return; |
292 | |
293 | getAISContext()->EraseAll(); |
294 | |
295 | //output seconf hyperbola |
296 | //output points and vector |
297 | drawPoint(aPointHypr1); |
298 | drawPoint(aPointHypr2); |
299 | drawPoint(aPointHypr3); |
300 | |
301 | if(WAIT_A_LITTLE) return; |
302 | |
303 | drawVector(aPointHypr1,gp_Vec(aPointHypr1,aPointHypr2)*3,Quantity_Color(Quantity_NOC_WHITE)); |
304 | |
305 | if(WAIT_A_LITTLE) return; |
306 | |
307 | //output of display MajorRadius (yellow color) |
92efcf78 |
308 | Handle(Geom_Line) aLine = new Geom_Line(gce_MakeLin(aPointHypr1,aPointHypr2)); |
309 | Handle(Geom_TrimmedCurve) aTrimmed1 = |
7fd59977 |
310 | new Geom_TrimmedCurve(aLine, 0, aPointHypr1.Distance(aPointHypr2)); |
311 | drawCurve(aTrimmed1,Quantity_Color(Quantity_NOC_YELLOW)); |
312 | |
313 | if(WAIT_A_LITTLE) return; |
314 | |
315 | //output of display MinorRadius (yellow color) |
92efcf78 |
316 | Handle(Geom_Line) aLine1 = new Geom_Line(gce_MakeLin(aPointHypr3, gp_Dir(0,-1,0))); |
317 | Handle(Geom_TrimmedCurve) aTrimmed2 = new Geom_TrimmedCurve(aLine1, 0,100); |
7fd59977 |
318 | drawCurve(aTrimmed2,Quantity_Color(Quantity_NOC_YELLOW)); |
319 | |
320 | if(WAIT_A_LITTLE) return; |
321 | |
322 | //output hyperbola |
92efcf78 |
323 | Handle(Geom_Hyperbola) aHyperbola2 = new Geom_Hyperbola(aHypr2); |
324 | Handle(Geom_TrimmedCurve) aHyprTrimmed1 = |
7fd59977 |
325 | new Geom_TrimmedCurve(aHyperbola2,-2,2,Standard_True); |
326 | drawCurve(aHyprTrimmed1); |
327 | } |
328 | //================================================================ |
329 | // Function : DCA_Presentation::sampleCircle |
330 | // Purpose : |
331 | //================================================================ |
332 | void DCA_Presentation::sampleCircle() |
333 | { |
334 | Standard_CString aTitle = " Construction of Circle"; |
335 | TCollection_AsciiString aText( |
336 | " //define direction vectors" EOL |
337 | " gp_Dir aDir(1,0,0);" EOL |
338 | "" EOL |
339 | " //define axis" EOL |
340 | " gp_Ax2 anAx2(aCenterPoint, aDir);" EOL |
341 | "" EOL |
342 | " //define points" EOL |
343 | " gp_Pnt aCirclePoint1(0,420,0);" EOL |
344 | " gp_Pnt aCirclePoint2(0,120,300);" EOL |
345 | " gp_Pnt aCirclePoint3(0,-200,0);" EOL |
346 | " gp_Pnt aCirclePoint4(120,0,100);" EOL |
347 | "" EOL |
348 | " //define base circle" EOL |
349 | " //define radius" EOL |
350 | " Standard_Real radius = 300;" EOL |
351 | " gp_Circ aCircle(anAx2, radius);" EOL |
352 | " " EOL |
353 | " // METHOD 1.(point,vector,radius)" EOL |
354 | " gp_Circ aCirc = gce_MakeCirc (aCenterPoint, aDir, radius);" EOL |
355 | "" EOL |
356 | " // METHOD 2.(three points)" EOL |
357 | " gp_Circ aCirc1 = gce_MakeCirc(aCirclePoint1, aCirclePoint2, aCirclePoint3);" EOL |
358 | "" EOL |
359 | " // METHOD 3.(circle,point)" EOL |
360 | " gp_Circ aCirc2 = gce_MakeCirc(aCircle, aCirclePoint4);" EOL |
361 | ); |
362 | Comment(aTitle,aText); |
363 | |
364 | //define direction vectors |
365 | gp_Dir aDir(1,0,0); |
366 | |
367 | //define axis |
368 | gp_Ax2 anAx2(aCenterPoint, aDir); |
369 | |
370 | //define points |
371 | gp_Pnt aCirclePoint1(0,420,0); |
372 | gp_Pnt aCirclePoint2(0,120,300); |
373 | gp_Pnt aCirclePoint3(0,-200,0); |
374 | gp_Pnt aCirclePoint4(120,0,100); |
375 | |
376 | //define base circle |
377 | //define radius |
378 | Standard_Real radius = 300; |
379 | gp_Circ aCircle(anAx2, radius); |
380 | |
381 | // METHOD 1.(point,vector,radius) |
382 | gp_Circ aCirc = gce_MakeCirc (aCenterPoint, aDir, radius); |
383 | |
384 | // METHOD 2.(three points) |
385 | gp_Circ aCirc1 = gce_MakeCirc(aCirclePoint1, aCirclePoint2, aCirclePoint3); |
386 | |
387 | // METHOD 3.(circle,point) |
388 | gp_Circ aCirc2 = gce_MakeCirc(aCircle, aCirclePoint4); |
389 | |
390 | |
391 | // METHOD 1.(output of display) |
392 | |
393 | //output point and vector |
394 | drawPoint(aCenterPoint); |
395 | drawVector(aCenterPoint,gp_Vec(aDir)*400,Quantity_Color(Quantity_NOC_WHITE)); |
396 | if(WAIT_A_LITTLE) return; |
397 | |
398 | //output radius |
92efcf78 |
399 | Handle(Geom_Line) aLine = new Geom_Line(gce_MakeLin (aCenterPoint,gp_Dir(0,0,1))); |
400 | Handle(Geom_TrimmedCurve) aTrimmed = new Geom_TrimmedCurve(aLine,0,300); |
7fd59977 |
401 | drawCurve(aTrimmed,Quantity_Color(Quantity_NOC_WHITE)); |
402 | |
403 | if(WAIT_A_LITTLE) return; |
404 | |
405 | //output circle |
406 | drawCurve(new Geom_Circle(aCirc)); |
407 | |
408 | if(WAIT_A_LITTLE) return; |
409 | |
410 | getAISContext()->EraseAll(); |
411 | |
412 | // METHOD 2.(output of display) |
413 | |
414 | //output points |
415 | drawPoint(aCirclePoint1); |
416 | drawPoint(aCirclePoint2); |
417 | drawPoint(aCirclePoint3); |
418 | |
419 | if(WAIT_A_LITTLE) return; |
420 | |
421 | //output circle |
422 | drawCurve(new Geom_Circle(aCirc1),Quantity_Color(Quantity_NOC_RED)); |
423 | |
424 | if(WAIT_A_LITTLE) return; |
425 | |
426 | getAISContext()->EraseAll(); |
427 | |
428 | // METHOD 3.(output of display) |
429 | |
430 | //output point and base circle |
431 | drawPoint(aCirclePoint4); |
432 | drawCurve(new Geom_Circle(aCircle),Quantity_Color(Quantity_NOC_WHITE)); |
433 | |
434 | if(WAIT_A_LITTLE) return; |
435 | |
436 | //output circle |
437 | drawCurve(new Geom_Circle(aCirc2),Quantity_Color(Quantity_NOC_RED)); |
438 | } |
439 | //================================================================ |
440 | // Function : DCA_Presentation::sampleEllipse |
441 | // Purpose : |
442 | //================================================================ |
443 | void DCA_Presentation::sampleEllipse() |
444 | { |
445 | Standard_CString aTitle = " Construction of Ellipse"; |
446 | TCollection_AsciiString aText( |
447 | " //define direction vectors" EOL |
448 | " gp_Dir aDir(1,0,0);" EOL |
449 | "" EOL |
450 | " //define axis" EOL |
451 | " gp_Ax2 anAx2(aCenterPoint, aDir);" EOL |
452 | "" EOL |
453 | " //define points" EOL |
454 | " gp_Pnt aEllipsPoint1(120,0,300);" EOL |
455 | " gp_Pnt aEllipsPoint2(120,120,0);" EOL |
456 | "" EOL |
457 | " //define radiuses" EOL |
458 | " Standard_Real MajorRadius = 300;" EOL |
459 | " Standard_Real MinorRadius = 120;" EOL |
460 | "" EOL |
461 | " //METHOD 1.(axis,two radiuses)" EOL |
462 | " gp_Elips aElips = gce_MakeElips(anAx2, MajorRadius, MinorRadius);" EOL |
463 | "" EOL |
464 | " //METHOD 2 (three points) " EOL |
465 | " gp_Elips aElips1 = gce_MakeElips(aEllipsPoint1, aEllipsPoint2, aCenterPoint);" EOL |
466 | ); |
467 | Comment(aTitle,aText); |
468 | |
469 | //define direction vectors |
470 | gp_Dir aDir(1,0,0); |
471 | |
472 | //define axis |
473 | gp_Ax2 anAx2(aCenterPoint, aDir); |
474 | |
475 | //define points |
476 | gp_Pnt aEllipsPoint1(120,0,300); |
477 | gp_Pnt aEllipsPoint2(120,120,0); |
478 | |
479 | //define radiuses |
480 | Standard_Real MajorRadius = 300; |
481 | Standard_Real MinorRadius = 120; |
482 | |
483 | //METHOD 1.(axis,two radiuses) |
484 | gp_Elips aElips = gce_MakeElips(anAx2, MajorRadius, MinorRadius); |
485 | |
486 | //METHOD 2 (three points) |
487 | gp_Elips aElips1 = gce_MakeElips(aEllipsPoint1, aEllipsPoint2, aCenterPoint); |
488 | |
489 | |
490 | //METHOD 1 .(output of display) |
491 | //output point and vector |
492 | drawPoint(aCenterPoint); |
493 | drawVector(aCenterPoint,gp_Vec(aDir)*400,Quantity_Color(Quantity_NOC_WHITE)); |
494 | |
495 | if(WAIT_A_LITTLE) return; |
496 | |
497 | //output first ellipse |
498 | drawCurve(new Geom_Ellipse(aElips)); |
499 | |
500 | if(WAIT_A_LITTLE) return; |
501 | |
502 | getAISContext()->EraseAll(); |
503 | |
504 | //METHOD 2 .(output of display) |
505 | drawPoint(aCenterPoint); |
506 | drawPoint(aEllipsPoint1); |
507 | drawPoint(aEllipsPoint2); |
508 | |
509 | if(WAIT_A_LITTLE) return; |
510 | |
511 | //define MajorRadius |
512 | gp_Dir aDir1(0,1,0); |
513 | gp_Dir aDir2(0,0,1); |
514 | gce_MakeLin aMakeLin(aCenterPoint,aDir1); |
515 | gp_Lin aLine = aMakeLin.Value(); |
516 | |
517 | //define MinorRadius |
518 | gce_MakeLin aMakeLin1(aCenterPoint,aDir2); |
519 | gp_Lin aLine1 = aMakeLin1.Value(); |
520 | |
521 | //output MajorRadius |
92efcf78 |
522 | Handle(Geom_Line) aLineMajorRadius = new Geom_Line(aLine); |
523 | Handle(Geom_TrimmedCurve) aTrimmed = |
7fd59977 |
524 | new Geom_TrimmedCurve(aLineMajorRadius,0,120); |
525 | drawCurve(aTrimmed,Quantity_Color(Quantity_NOC_WHITE)); |
526 | |
527 | if(WAIT_A_LITTLE) return; |
528 | |
529 | //output MinorRadius |
92efcf78 |
530 | Handle(Geom_Line) aLineMinorrRadius = new Geom_Line(aLine1); |
531 | Handle(Geom_TrimmedCurve) aTrimmed1 = |
7fd59977 |
532 | new Geom_TrimmedCurve(aLineMinorrRadius,0,300); |
533 | drawCurve(aTrimmed1,Quantity_Color(Quantity_NOC_WHITE)); |
534 | |
535 | if(WAIT_A_LITTLE) return; |
536 | |
537 | //output second ellipse |
538 | drawCurve(new Geom_Ellipse(aElips1),Quantity_Color(Quantity_NOC_RED)); |
539 | } |
540 | //================================================================ |
541 | // Function : DCA_Presentation::samplePlane |
542 | // Purpose : |
543 | //================================================================ |
544 | void DCA_Presentation::samplePlane() |
545 | { |
546 | Standard_CString aTitle = "Construction of Plane "; |
547 | TCollection_AsciiString aText( |
548 | " //define direction vector" EOL |
549 | " gp_Dir aDir(1,0,0);" EOL |
550 | "" EOL |
551 | " //define axis" EOL |
552 | " gp_Ax2 anAx2(aCenterPoint,aDir);" EOL |
553 | "" EOL |
554 | " //define three points" EOL |
555 | " gp_Pnt aPointPlane1(0,0,0);" EOL |
556 | " gp_Pnt aPointPlane2(0,-120,0);" EOL |
557 | " gp_Pnt aPointPlane3(0,50 , -100);" EOL |
558 | "" EOL |
559 | " //METHOD 1.(axis)" EOL |
560 | " gp_Pln aPlane = gce_MakePln(anAx2);" EOL |
561 | " " EOL |
562 | " //METHOD 2 (three points) " EOL |
563 | " gp_Pln aPlane1 = gce_MakePln(aPointPlane1,aPointPlane2,aPointPlane3);" EOL |
564 | ); |
565 | Comment(aTitle,aText); |
566 | |
567 | //define direction vector |
568 | gp_Dir aDir(1,0,0); |
569 | |
570 | //define axis |
571 | gp_Ax2 anAx2(aCenterPoint,aDir); |
572 | |
573 | //define three points |
574 | gp_Pnt aPointPlane1(0,0,0); |
575 | gp_Pnt aPointPlane2(0,-120,0); |
576 | gp_Pnt aPointPlane3(0,50 , -100); |
577 | |
578 | //METHOD 1.(axis) |
579 | gp_Pln aPlane = gce_MakePln(anAx2); |
580 | |
581 | //METHOD 2 (three points) |
582 | gp_Pln aPlane1 = gce_MakePln(aPointPlane1,aPointPlane2,aPointPlane3); |
583 | |
584 | |
585 | //METHOD 1. (output of display) |
586 | drawPoint(aCenterPoint); |
587 | drawVector(aCenterPoint,gp_Vec(aDir)*400,Quantity_Color(Quantity_NOC_WHITE)); |
588 | |
589 | if(WAIT_A_LITTLE) return; |
590 | |
92efcf78 |
591 | Handle(Geom_Plane) aPln = new Geom_Plane(aPlane); |
592 | Handle(Geom_RectangularTrimmedSurface) aPlnTrimmed = |
7fd59977 |
593 | new Geom_RectangularTrimmedSurface(aPln,-300,300,-300,300,Standard_True,Standard_True); |
594 | drawSurface(aPlnTrimmed); |
595 | |
596 | if(WAIT_A_LITTLE) return; |
597 | |
598 | getAISContext()->EraseAll(); |
599 | |
600 | //METHOD 2.(output of display) |
601 | drawPoint(aPointPlane1); |
602 | drawPoint(aPointPlane2); |
603 | drawPoint(aPointPlane3); |
604 | |
605 | if(WAIT_A_LITTLE) return; |
606 | |
92efcf78 |
607 | Handle(Geom_Plane) aPln1 = new Geom_Plane(aPlane1); |
608 | Handle(Geom_RectangularTrimmedSurface) aPlnTrimmed1 = |
7fd59977 |
609 | new Geom_RectangularTrimmedSurface(aPln1,-200,300,-200,300,Standard_True,Standard_True); |
610 | drawSurface(aPlnTrimmed1); |
611 | |
612 | } |
613 | //================================================================ |
614 | // Function : OCCDemo_Presentation::sampleCylindricalSurface |
615 | // Purpose : |
616 | //================================================================ |
617 | void DCA_Presentation::sampleCylindricalSurface() |
618 | { |
619 | Standard_CString aTitle = " Construction of CylindricalSurface "; |
620 | TCollection_AsciiString aText( |
621 | " //define direction vectors" EOL |
622 | " gp_Dir aDir(1,0,0);" EOL |
623 | " " EOL |
624 | " //define points " EOL |
625 | " gp_Pnt aCylinderPoint1(0,20,-20);" EOL |
626 | " gp_Pnt aCylinderPoint2(0,20,-100);" EOL |
627 | " gp_Pnt aCylinderPoint3(120,20,-100);" EOL |
628 | " gp_Pnt aCylinderPoint4(120,20,100);" EOL |
629 | "" EOL |
630 | " //define axises" EOL |
631 | " gp_Ax3 anAx3(aCenterPoint,aDir);" EOL |
632 | "" EOL |
633 | " //define base cylinder" EOL |
634 | " Standard_Real rad = 10;" EOL |
635 | " gp_Cylinder aCylinder(anAx3,rad);" EOL |
636 | "" EOL |
637 | " //define base circle" EOL |
638 | " Standard_Real Radius = 100;" EOL |
639 | " gp_Circ aCirc(anAx3.Ax2(),Radius);" EOL |
640 | "" EOL |
641 | " //METHOD 1.(axis,radius) " EOL |
642 | " gp_Cylinder aCyl = gce_MakeCylinder (anAx3.Ax2(),Radius);" EOL |
643 | "" EOL |
644 | " //METHOD 2.(three points) " EOL |
645 | " gp_Cylinder aCyl1 = gce_MakeCylinder(aCylinderPoint2,aCylinderPoint3,aCylinderPoint1);" EOL |
646 | " " EOL |
647 | " //METHOD 3.(point,base cylinder)" EOL |
648 | " gp_Cylinder aCyl2 = gce_MakeCylinder(aCylinder,aCylinderPoint4);" EOL |
649 | "" EOL |
650 | " //METHOD 4.(base circle)" EOL |
651 | " gp_Cylinder aCyl3 = gce_MakeCylinder(aCirc);" EOL |
652 | ); |
653 | Comment(aTitle,aText); |
654 | |
655 | //define direction vectors |
656 | gp_Dir aDir(1,0,0); |
657 | |
658 | //define points |
659 | gp_Pnt aCylinderPoint1(0,20,-20); |
660 | gp_Pnt aCylinderPoint2(0,20,-100); |
661 | gp_Pnt aCylinderPoint3(120,20,-100); |
662 | gp_Pnt aCylinderPoint4(120,20,100); |
663 | |
664 | //define axises |
665 | gp_Ax3 anAx3(aCenterPoint,aDir); |
666 | |
667 | //define base cylinder |
668 | Standard_Real rad = 10; |
669 | gp_Cylinder aCylinder(anAx3,rad); |
670 | |
671 | //define base circle |
672 | Standard_Real Radius = 100; |
673 | gp_Circ aCirc(anAx3.Ax2(),Radius); |
674 | |
675 | //METHOD 1.(axis,radius) |
676 | gp_Cylinder aCyl = gce_MakeCylinder (anAx3.Ax2(),Radius); |
677 | |
678 | //METHOD 2.(three points) |
679 | gp_Cylinder aCyl1 = gce_MakeCylinder(aCylinderPoint2,aCylinderPoint3,aCylinderPoint1); |
680 | |
681 | //METHOD 3.(point,base cylinder) |
682 | gp_Cylinder aCyl2 = gce_MakeCylinder(aCylinder,aCylinderPoint4); |
683 | |
684 | //METHOD 4.(base circle) |
685 | gp_Cylinder aCyl3 = gce_MakeCylinder(aCirc); |
686 | |
687 | |
688 | //METHOD 1.(output of dispay) |
689 | drawPoint(aCenterPoint); |
690 | drawVector(aCenterPoint,gp_Vec(aDir)*400,Quantity_Color(Quantity_NOC_WHITE)); |
691 | if(WAIT_A_LITTLE) return; |
692 | //output radius |
693 | gp_Dir aDir1(0,0,1); |
694 | gce_MakeLin aMakeLin(aCenterPoint,aDir1); |
695 | gp_Lin aLin = aMakeLin.Value(); |
92efcf78 |
696 | Handle(Geom_Line) aLine = new Geom_Line(aLin); |
697 | Handle(Geom_TrimmedCurve) aTrimmed = new Geom_TrimmedCurve(aLine,-100,0); |
7fd59977 |
698 | drawCurve(aTrimmed,Quantity_Color(Quantity_NOC_WHITE)); |
699 | if(WAIT_A_LITTLE) return; |
700 | // output cylinder |
92efcf78 |
701 | Handle(Geom_CylindricalSurface) aCylSurface = |
7fd59977 |
702 | new Geom_CylindricalSurface(aCyl); |
92efcf78 |
703 | Handle(Geom_RectangularTrimmedSurface) aCylTrimmed = |
7fd59977 |
704 | new Geom_RectangularTrimmedSurface(aCylSurface,0,2*PI,-200,300,Standard_True,Standard_True); |
705 | drawSurface(aCylTrimmed); |
706 | if(WAIT_A_LITTLE) return; |
707 | getAISContext()->EraseAll(); |
708 | |
709 | //METHOD 2.(output of dispay) |
710 | //output points |
711 | drawPoint(aCylinderPoint1); |
712 | drawPoint(aCylinderPoint2); |
713 | drawPoint(aCylinderPoint3); |
714 | if(WAIT_A_LITTLE) return; |
715 | //output vector |
716 | drawVector(aCylinderPoint2,gp_Vec(aCylinderPoint2,aCylinderPoint3)*3,Quantity_Color(Quantity_NOC_WHITE)); |
717 | if(WAIT_A_LITTLE) return; |
718 | //output radius |
92efcf78 |
719 | Handle(Geom_Line) aLine1 = new Geom_Line(gce_MakeLin(aCylinderPoint1,aDir1)); |
720 | Handle(Geom_TrimmedCurve) aTrimmed1 = new Geom_TrimmedCurve(aLine1,-80,0); |
7fd59977 |
721 | drawCurve(aTrimmed1,Quantity_Color(Quantity_NOC_WHITE)); |
722 | if(WAIT_A_LITTLE) return; |
723 | //output cylinder |
92efcf78 |
724 | Handle(Geom_CylindricalSurface) aCylSurface1 = |
7fd59977 |
725 | new Geom_CylindricalSurface(aCyl1); |
92efcf78 |
726 | Handle(Geom_RectangularTrimmedSurface) aCylTrimmed1 = |
7fd59977 |
727 | new Geom_RectangularTrimmedSurface(aCylSurface1,0,2*PI,-300,100,Standard_True,Standard_True); |
728 | drawSurface(aCylTrimmed1); |
729 | if(WAIT_A_LITTLE) return; |
730 | getAISContext()->EraseAll(); |
731 | |
732 | //METHOD 3.(output of dispay) |
733 | //output base cylinder |
92efcf78 |
734 | Handle(Geom_CylindricalSurface) aCylSurf = new Geom_CylindricalSurface(aCylinder); |
735 | Handle(Geom_RectangularTrimmedSurface) aCylTrimmed2 = |
7fd59977 |
736 | new Geom_RectangularTrimmedSurface(aCylSurf,0,2*PI,-200,200,Standard_True,Standard_True); |
737 | drawSurface(aCylTrimmed2 ,Quantity_Color(Quantity_NOC_WHITE)); |
738 | //output point |
739 | drawPoint(aCylinderPoint4); |
740 | if(WAIT_A_LITTLE) return; |
741 | //output cylinder |
92efcf78 |
742 | Handle(Geom_CylindricalSurface) aCylSurface2 = |
7fd59977 |
743 | new Geom_CylindricalSurface(aCyl2); |
92efcf78 |
744 | Handle(Geom_RectangularTrimmedSurface) aCylTrimmed3 = |
7fd59977 |
745 | new Geom_RectangularTrimmedSurface(aCylSurface2,0,2*PI,-200,200,Standard_True,Standard_True); |
746 | drawSurface(aCylTrimmed3); |
747 | if(WAIT_A_LITTLE) return; |
748 | getAISContext()->EraseAll(); |
749 | //METHOD 4.(output of dispay) |
750 | drawPoint(aCenterPoint); |
751 | drawVector(aCenterPoint,gp_Vec(aDir)*400,Quantity_Color(Quantity_NOC_WHITE)); |
752 | //output base circle |
753 | drawCurve(new Geom_Circle(aCirc),Quantity_Color(Quantity_NOC_WHITE)); |
754 | if(WAIT_A_LITTLE) return; |
755 | //output cylinder |
92efcf78 |
756 | Handle(Geom_CylindricalSurface) aCylSurface3 = |
7fd59977 |
757 | new Geom_CylindricalSurface(aCyl3); |
92efcf78 |
758 | Handle(Geom_RectangularTrimmedSurface) aCylTrimmed4 = |
7fd59977 |
759 | new Geom_RectangularTrimmedSurface(aCylSurface3,0,2*PI,-200,200,Standard_True,Standard_True); |
760 | drawSurface(aCylTrimmed4); |
761 | } |
762 | //================================================================ |
763 | // Function : DCA_Presentation::sampleToroidalSurface |
764 | // Purpose : |
765 | //================================================================ |
766 | void DCA_Presentation::sampleToroidalSurface() |
767 | { |
768 | Standard_CString aTitle = " Construction of ToroidalSurface "; |
769 | TCollection_AsciiString aText( |
770 | " //define direction vectors" EOL |
771 | " gp_Dir aDir(1,0,0);" EOL |
772 | " //define toroidal surface's axis" EOL |
773 | " gp_Ax3 anAx3(aCenterPoint, aDir);" EOL |
774 | "" EOL |
775 | " //define two radiuses" EOL |
776 | " Standard_Real MajorRadius = 200;" EOL |
777 | " Standard_Real MinorRadius = 100;" EOL |
778 | " " EOL |
779 | " //make torus" EOL |
780 | " gp_Torus aTorus(anAx3, MajorRadius, MinorRadius);" EOL |
781 | ); |
782 | Comment(aTitle,aText); |
783 | |
784 | //define direction vectors |
785 | gp_Dir aDir(1,0,0); |
786 | //define toroidal surface's axis |
787 | gp_Ax3 anAx3(aCenterPoint, aDir); |
788 | |
789 | //define two radiuses |
790 | Standard_Real MajorRadius = 200; |
791 | Standard_Real MinorRadius = 100; |
792 | |
793 | //make torus |
794 | gp_Torus aTorus(anAx3, MajorRadius, MinorRadius); |
795 | |
796 | //display shapes in the viewer |
797 | drawPoint(aCenterPoint); |
798 | drawVector(aCenterPoint,gp_Vec(aDir)*400,Quantity_Color(Quantity_NOC_WHITE)); |
799 | |
800 | if(WAIT_A_LITTLE) return; |
801 | |
802 | //output MajorRadius |
92efcf78 |
803 | Handle(Geom_Line) R1 = new Geom_Line(gce_MakeLin(aCenterPoint, gp_Dir(0,1,0))); |
804 | Handle(Geom_TrimmedCurve) aTrimmedR1 = new Geom_TrimmedCurve(R1,0,MajorRadius); |
7fd59977 |
805 | drawCurve(aTrimmedR1, Quantity_Color(Quantity_NOC_WHITE)); |
806 | drawCurve(new Geom_Circle(anAx3.Ax2(), MajorRadius)); |
807 | |
808 | if(WAIT_A_LITTLE) return; |
809 | |
810 | // output MinorRadius as a circle |
811 | gp_Ax2 aMinorRadAx(aTrimmedR1->EndPoint(), gp_Dir(0,0,1)); |
92efcf78 |
812 | Handle(Geom_Circle) aMinorRadCirc = new Geom_Circle(aMinorRadAx, MinorRadius); |
7fd59977 |
813 | drawCurve(aMinorRadCirc); |
814 | |
815 | if(WAIT_A_LITTLE) return; |
816 | |
817 | //output torus |
818 | drawSurface(new Geom_ToroidalSurface(aTorus)); |
819 | |
820 | } |
821 | //================================================================ |
822 | // Function : DCA_Presentation::sampleConicalSurface |
823 | // Purpose : |
824 | //================================================================ |
825 | void DCA_Presentation::sampleConicalSurface() |
826 | { |
827 | Standard_CString aTitle = " Construction of ConicalSurface"; |
828 | TCollection_AsciiString aText( |
829 | " //define direction vectors" EOL |
830 | " gp_Dir aDir(1,0,0);" EOL |
831 | " " EOL |
832 | " //define points" EOL |
833 | " gp_Pnt aPoint_1(0,0,0);" EOL |
834 | " gp_Pnt aPoint_2(240,0,0);" EOL |
835 | " gp_Pnt aPoint_3(0,-50,0);" EOL |
836 | " gp_Pnt aPoint_4(100,-60,0);" EOL |
837 | " gp_Pnt aConePnt(120,-100,0);" EOL |
838 | " gp_Pnt aConePnt1(0,-50,0);" EOL |
839 | " gp_Pnt aConePnt2(0,-100,0);" EOL |
840 | "" EOL |
841 | " //define axises" EOL |
842 | " gp_Ax2 anAx2(aCenterPoint,aDir);" EOL |
843 | " gp_Ax1 anAx1(aCenterPoint,aDir);" EOL |
844 | "" EOL |
845 | " //define radiuses" EOL |
846 | " Standard_Real Radius1 = 100;" EOL |
847 | " Standard_Real Radius2 = 50;" EOL |
848 | " Standard_Real Radius3 = 70;" EOL |
849 | "" EOL |
850 | " //define angle" EOL |
851 | " Standard_Real Angle = PI/6;" EOL |
852 | "" EOL |
853 | " //METHOD 1.(axis,two points)" EOL |
854 | " gp_Cone aCone1 = gce_MakeCone(anAx1, aConePnt1, aConePnt);" EOL |
855 | "" EOL |
856 | " //METHOD 2.(two points,two radiuses)" EOL |
857 | " gp_Cone aCone2 = gce_MakeCone(aConePnt2,aConePnt,Radius2,Radius1);" EOL |
858 | "" EOL |
859 | " //METHOD 3.(axis,angle,radius)" EOL |
860 | " gp_Cone aCone3 = gce_MakeCone(anAx2,Angle,Radius3);" EOL |
861 | "" EOL |
862 | " //METHOD 4.(four points)" EOL |
863 | " gp_Cone aCone4 = gce_MakeCone (aPoint_1,aPoint_2,aPoint_3,aPoint_4);" EOL |
864 | ); |
865 | |
866 | Comment(aTitle,aText); |
867 | |
868 | //define direction vectors |
869 | gp_Dir aDir(1,0,0); |
870 | |
871 | //define points |
872 | gp_Pnt aPoint_1(0,0,0); |
873 | gp_Pnt aPoint_2(240,0,0); |
874 | gp_Pnt aPoint_3(0,-50,0); |
875 | gp_Pnt aPoint_4(100,-60,0); |
876 | gp_Pnt aConePnt(120,-100,0); |
877 | gp_Pnt aConePnt1(0,-50,0); |
878 | gp_Pnt aConePnt2(0,-100,0); |
879 | |
880 | //define axises |
881 | gp_Ax2 anAx2(aCenterPoint,aDir); |
882 | gp_Ax1 anAx1(aCenterPoint,aDir); |
883 | |
884 | //define radiuses |
885 | Standard_Real Radius1 = 100; |
886 | Standard_Real Radius2 = 50; |
887 | Standard_Real Radius3 = 70; |
888 | |
889 | //define angle |
890 | Standard_Real Angle = PI/6; |
891 | |
892 | //METHOD 1.(axis,two points) |
893 | gp_Cone aCone1 = gce_MakeCone(anAx1, aConePnt1, aConePnt); |
894 | |
895 | //METHOD 2.(two points,two radiuses) |
896 | gp_Cone aCone2 = gce_MakeCone(aConePnt2,aConePnt,Radius2,Radius1); |
897 | |
898 | //METHOD 3.(axis,angle,radius) |
899 | gp_Cone aCone3 = gce_MakeCone(anAx2,Angle,Radius3); |
900 | |
901 | //METHOD 4.(four points) |
902 | gp_Cone aCone4 = gce_MakeCone (aPoint_1,aPoint_2,aPoint_3,aPoint_4); |
903 | |
904 | |
905 | //METHOD1.(output of display) |
906 | //output axis |
907 | drawPoint(aCenterPoint); |
908 | drawVector(aCenterPoint,gp_Vec(aDir)*400,Quantity_Color(Quantity_NOC_WHITE)); |
909 | |
910 | if(WAIT_A_LITTLE) return; |
911 | |
912 | //output points |
913 | drawPoint(aConePnt); |
914 | drawPoint(aConePnt1); |
915 | |
916 | gp_Dir aDir1(0,1,0); |
917 | //output first radius |
92efcf78 |
918 | Handle(Geom_Line) aLine = new Geom_Line(gce_MakeLin(aConePnt,aDir1)); |
919 | Handle(Geom_TrimmedCurve) aTrimmed = new Geom_TrimmedCurve(aLine,0,100); |
7fd59977 |
920 | drawCurve(aTrimmed,Quantity_Color(Quantity_NOC_WHITE)); |
921 | |
922 | //output second radius |
92efcf78 |
923 | Handle(Geom_Line) aLine1 = new Geom_Line(gce_MakeLin(aConePnt1,aDir1)); |
924 | Handle(Geom_TrimmedCurve) aTrimmed1 = new Geom_TrimmedCurve(aLine1,0,50); |
7fd59977 |
925 | drawCurve(aTrimmed1,Quantity_Color(Quantity_NOC_WHITE)); |
926 | |
927 | if(WAIT_A_LITTLE) return; |
928 | |
929 | //output ruling of cone |
92efcf78 |
930 | Handle(Geom_Line) aLine2 = new Geom_Line(gce_MakeLin(aConePnt,aConePnt1)); |
931 | Handle(Geom_TrimmedCurve) aTrimmed2 = |
7fd59977 |
932 | new Geom_TrimmedCurve(aLine2,0,aConePnt.Distance(aConePnt1)); |
933 | drawCurve(aTrimmed2,Quantity_Color(Quantity_NOC_RED)); |
934 | |
935 | if(WAIT_A_LITTLE) return; |
936 | |
937 | //output cone |
92efcf78 |
938 | Handle(Geom_ConicalSurface) aConSurface1 = new Geom_ConicalSurface(aCone1); |
939 | Handle(Geom_RectangularTrimmedSurface) aConTrimmed1 = |
7fd59977 |
940 | new Geom_RectangularTrimmedSurface(aConSurface1,0,2*PI,-50,450,Standard_True,Standard_True); |
941 | drawSurface(aConTrimmed1); |
942 | |
943 | if(WAIT_A_LITTLE) return; |
944 | |
945 | getAISContext()->EraseAll(); |
946 | |
947 | //METHOD2.(output of display) |
948 | drawPoint(aConePnt2); |
949 | drawPoint(aConePnt); |
950 | |
951 | if(WAIT_A_LITTLE) return; |
952 | |
953 | drawVector(aConePnt2,gp_Vec(aConePnt2,aConePnt)*2,Quantity_Color(Quantity_NOC_WHITE)); |
954 | |
955 | if(WAIT_A_LITTLE) return; |
956 | |
957 | //output of first radius |
92efcf78 |
958 | Handle(Geom_Line) aLineR1 = new Geom_Line(gce_MakeLin (aConePnt,aDir1)); |
959 | Handle(Geom_TrimmedCurve) aTrimmedR1 = new Geom_TrimmedCurve(aLineR1,0,Radius1); |
7fd59977 |
960 | drawCurve(aTrimmedR1,Quantity_Color(Quantity_NOC_WHITE)); |
961 | |
962 | //output of second radius |
92efcf78 |
963 | Handle(Geom_Line) aLineR2 = new Geom_Line(gce_MakeLin (aConePnt2,aDir1)); |
964 | Handle(Geom_TrimmedCurve) aTrimmedR2 = new Geom_TrimmedCurve(aLineR2,0,Radius2); |
7fd59977 |
965 | drawCurve(aTrimmedR2,Quantity_Color(Quantity_NOC_WHITE)); |
966 | |
967 | //output cone |
92efcf78 |
968 | Handle(Geom_ConicalSurface) aConSurface2 = new Geom_ConicalSurface(aCone2); |
969 | Handle(Geom_RectangularTrimmedSurface) aConTrimmed2 = |
7fd59977 |
970 | new Geom_RectangularTrimmedSurface(aConSurface2,0,2*PI,-120,400,Standard_True,Standard_True); |
971 | drawSurface(aConTrimmed2); |
972 | |
973 | if(WAIT_A_LITTLE) return; |
974 | |
975 | getAISContext()->EraseAll(); |
976 | |
977 | //METHOD3.(output of display) |
978 | drawPoint(aCenterPoint); |
979 | drawVector(aCenterPoint,gp_Vec(aDir)*400,Quantity_Color(Quantity_NOC_WHITE)); |
980 | |
981 | if(WAIT_A_LITTLE) return; |
982 | |
983 | //output radius |
92efcf78 |
984 | Handle(Geom_Line) aLine3 = new Geom_Line(gce_MakeLin (aCenterPoint,aDir1)); |
985 | Handle(Geom_TrimmedCurve) aTrimmed3 = new Geom_TrimmedCurve(aLine3,0,70); |
7fd59977 |
986 | drawCurve(aTrimmed3 ,Quantity_Color(Quantity_NOC_WHITE)); |
987 | |
988 | //output cone |
92efcf78 |
989 | Handle(Geom_ConicalSurface) aConSurface3 = new Geom_ConicalSurface(aCone3); |
990 | Handle(Geom_RectangularTrimmedSurface) aConTrimmed = |
7fd59977 |
991 | new Geom_RectangularTrimmedSurface(aConSurface3,0,2*PI,-300,300,Standard_True,Standard_True); |
992 | drawSurface(aConTrimmed); |
993 | |
994 | if(WAIT_A_LITTLE) return; |
995 | |
996 | getAISContext()->EraseAll(); |
997 | |
998 | //METHOD4.(output of display) |
999 | |
1000 | //output points |
1001 | drawPoint(aPoint_1); |
1002 | drawPoint(aPoint_2); |
1003 | drawPoint(aPoint_3); |
1004 | drawPoint(aPoint_4); |
1005 | |
1006 | if(WAIT_A_LITTLE) return; |
1007 | |
1008 | //output vector |
1009 | drawVector(aPoint_1,gp_Vec(aPoint_1,aPoint_2)*2,Quantity_Color(Quantity_NOC_WHITE)); |
1010 | |
1011 | if(WAIT_A_LITTLE) return; |
1012 | |
1013 | //output ruling of cone |
92efcf78 |
1014 | Handle(Geom_Line) aLine4 = new Geom_Line(gce_MakeLin (aPoint_3,aPoint_4)); |
1015 | Handle(Geom_TrimmedCurve) aTrimmed4 = |
7fd59977 |
1016 | new Geom_TrimmedCurve(aLine4,0,aPoint_3.Distance(aPoint_4)); |
1017 | drawCurve(aTrimmed4 ,Quantity_Color(Quantity_NOC_RED)); |
1018 | |
1019 | if(WAIT_A_LITTLE) return; |
1020 | |
1021 | //output first radius |
92efcf78 |
1022 | Handle(Geom_Line) aLine5 = new Geom_Line(gce_MakeLin (aPoint_3,aDir1)); |
1023 | Handle(Geom_TrimmedCurve) aTrimmed5 = new Geom_TrimmedCurve(aLine5,0,50); |
7fd59977 |
1024 | drawCurve(aTrimmed5 ,Quantity_Color(Quantity_NOC_WHITE)); |
1025 | |
1026 | if(WAIT_A_LITTLE) return; |
1027 | |
1028 | //output second radius |
92efcf78 |
1029 | Handle(Geom_Line) aLine6 = new Geom_Line(gce_MakeLin (aPoint_4,aDir1)); |
1030 | Handle(Geom_TrimmedCurve) aTrimmed6 = new Geom_TrimmedCurve(aLine6,0,60); |
7fd59977 |
1031 | drawCurve(aTrimmed6 ,Quantity_Color(Quantity_NOC_WHITE)); |
1032 | |
1033 | if(WAIT_A_LITTLE) return; |
1034 | |
1035 | //output cone |
92efcf78 |
1036 | Handle(Geom_ConicalSurface) aConSurface4 = new Geom_ConicalSurface(aCone4); |
1037 | Handle(Geom_RectangularTrimmedSurface) aConTrimmed4 = |
7fd59977 |
1038 | new Geom_RectangularTrimmedSurface(aConSurface4,0,2*PI,-300,300,Standard_True,Standard_True); |
1039 | drawSurface(aConTrimmed4); |
1040 | |
1041 | } |
1042 | //================================================================ |
1043 | // Function : DCA_Presentation::sampleSphericalSurface |
1044 | // Purpose : |
1045 | //================================================================ |
1046 | void DCA_Presentation::sampleSphericalSurface() |
1047 | { |
1048 | Standard_CString aTitle = " Construction of SphericalSurface"; |
1049 | TCollection_AsciiString aText( |
1050 | " //define direction vector" EOL |
1051 | " gp_Dir aDir(1,0,0);" EOL |
1052 | "" EOL |
1053 | " //define axises" EOL |
1054 | " gp_Ax3 anAx3(aCenterPoint,aDir);" EOL |
1055 | "" EOL |
1056 | " //define radius" EOL |
1057 | " Standard_Real Radius = 300;" EOL |
1058 | "" EOL |
1059 | " //make sphere" EOL |
1060 | " gp_Sphere aSphere(anAx3,Radius);" EOL |
1061 | ); |
1062 | Comment(aTitle,aText); |
1063 | |
1064 | //define direction vector |
1065 | gp_Dir aDir(1,0,0); |
1066 | |
1067 | //define axises |
1068 | gp_Ax3 anAx3(aCenterPoint,aDir); |
1069 | |
1070 | //define radius |
1071 | Standard_Real Radius = 300; |
1072 | |
1073 | //make sphere |
1074 | gp_Sphere aSphere(anAx3,Radius); |
1075 | |
1076 | //output of display |
1077 | drawPoint(aCenterPoint); |
1078 | drawVector(aCenterPoint,gp_Vec(aDir)*400,Quantity_Color(Quantity_NOC_WHITE)); |
1079 | |
1080 | if(WAIT_A_LITTLE) return; |
1081 | |
1082 | drawSurface(new Geom_SphericalSurface(aSphere)); |
1083 | } |
1084 | |
1085 | |
1086 | |
1087 | //================================================================ |
1088 | // Function : DCA_Presentation::Comment |
1089 | // Purpose : |
1090 | //================================================================ |
1091 | void DCA_Presentation::Comment(const Standard_CString theTitle, |
1092 | TCollection_AsciiString &theText) |
1093 | { |
1094 | setResultTitle(theTitle); |
1095 | setResultText(theText.ToCString()); |
1096 | } |