7fd59977 |
1 | // GeomSources.cpp: implementation of the GeomSources class. |
2 | // |
3 | ////////////////////////////////////////////////////////////////////// |
4 | |
5 | #include "stdafx.h" |
6 | #include "GeomSources.h" |
7 | #include "GeometryApp.h" |
8 | #include "MainFrm.h" |
9e3ca93a |
9 | #include <Geom_Curve.hxx> |
10 | #include <Geom2d_Curve.hxx> |
7fd59977 |
11 | GeomSources::GeomSources() |
12 | { |
13 | } |
14 | |
15 | GeomSources::~GeomSources() |
16 | { |
17 | } |
7fd59977 |
18 | void GeomSources::PreProcess(CGeometryDoc* aDoc,DisplayType aDisplayType) |
19 | { |
5c1f974e |
20 | if (aDisplayType == No2D3D ) |
21 | { |
eb4320f2 |
22 | aDoc->GetAISContext()->EraseAll(); |
5c1f974e |
23 | aDoc->Put3DOnTop(); |
24 | } |
25 | |
26 | if (aDisplayType == a2DNo3D) |
27 | { |
28 | aDoc->GetISessionContext()->EraseAll(); |
29 | aDoc->Put2DOnTop(); |
30 | } |
31 | |
32 | if (aDisplayType != No2D3D && aDisplayType != a2D3D) |
33 | { |
34 | aDoc->Minimize3D(); |
35 | } |
36 | |
37 | if (aDisplayType != a2DNo3D && aDisplayType != a2D3D) |
38 | { |
39 | aDoc->Minimize2D(); |
40 | } |
41 | |
42 | if (aDisplayType == a2D3D) |
43 | { |
eb4320f2 |
44 | aDoc->GetAISContext()->EraseAll(); |
5c1f974e |
45 | aDoc->GetISessionContext()->EraseAll(); |
46 | aDoc->Put3DOnTop(false); |
47 | aDoc->Put2DOnTop(false); |
48 | |
49 | // both on top |
50 | // send the message Title Horizontaly to the child of doc main frame |
51 | CGeometryApp* TheAppli = (CGeometryApp*)AfxGetApp(); |
52 | CMainFrame* TheMainFrame= (CMainFrame*)TheAppli->m_pMainWnd; |
53 | ::SendMessage(TheMainFrame->m_hWndMDIClient, WM_MDITILE, 0, 0); |
54 | } |
7fd59977 |
55 | } |
56 | |
576f8b11 |
57 | void GeomSources::PostProcess (CGeometryDoc* aDoc, UINT anID, DisplayType aDisplayType, |
2f697f2f |
58 | const TCollection_AsciiString& theString, Standard_Boolean UpdateViewer, Quantity_Coefficient Coef) |
7fd59977 |
59 | { |
576f8b11 |
60 | Standard_CString aString = theString.ToCString(); |
2f697f2f |
61 | if (UpdateViewer) |
62 | { |
63 | if (aDisplayType == No2D3D || aDisplayType == a2D3D) |
64 | { |
65 | aDoc->Fit3DViews(Coef); |
66 | } |
67 | |
68 | if (aDisplayType == a2DNo3D || aDisplayType == a2D3D) |
69 | { |
70 | aDoc->Fit2DViews(); |
71 | } |
5c1f974e |
72 | } |
7fd59977 |
73 | |
5c1f974e |
74 | TCollection_AsciiString Message("Results are "); |
7fd59977 |
75 | |
76 | switch (aDisplayType) |
77 | { |
5c1f974e |
78 | case No2DNo3D: Message = "All results are in this box \n"; |
7fd59977 |
79 | break; |
5c1f974e |
80 | case No2D3D: Message += "only in 3D \n"; |
7fd59977 |
81 | break; |
5c1f974e |
82 | case a2DNo3D: Message += "only in 2d \n"; |
7fd59977 |
83 | break; |
5c1f974e |
84 | case a2D3D: Message += "in both 2D and 3D \n"; |
7fd59977 |
85 | break; |
5c1f974e |
86 | } |
87 | Message += "====================================\n"; |
88 | Message += aString; |
7fd59977 |
89 | |
5c1f974e |
90 | CString text(Message.ToCString()); |
91 | aDoc->myCResultDialog.SetText(text); |
7fd59977 |
92 | |
5c1f974e |
93 | CString s; |
94 | if (! s.LoadString( anID )) |
576f8b11 |
95 | AfxMessageBox (L"Error Loading String: "); |
7fd59977 |
96 | |
5c1f974e |
97 | CString Title = s.Left( s.Find( '\n' )); |
7fd59977 |
98 | |
5c1f974e |
99 | aDoc->myCResultDialog.SetTitle(Title); |
100 | aDoc->SetTitle(Title); |
7fd59977 |
101 | } |
102 | |
5c573e69 |
103 | void GeomSources::AddSeparator(CGeometryDoc* /*aDoc*/,TCollection_AsciiString& aMessage) |
7fd59977 |
104 | { |
5c1f974e |
105 | aMessage+= "------------------------------------------------------------------------\n"; |
7fd59977 |
106 | } |
107 | void GeomSources::DisplayPoint(CGeometryDoc* aDoc, |
5c573e69 |
108 | const gp_Pnt2d& aPoint, |
7fd59977 |
109 | const char* aText, |
110 | Standard_Boolean UpdateViewer, |
111 | Standard_Real anXoffset, |
112 | Standard_Real anYoffset, |
113 | Standard_Real TextScale) |
114 | { |
5c1f974e |
115 | Handle(ISession_Point) aGraphicPoint = new ISession_Point(aPoint); |
116 | aDoc->GetISessionContext()->Display(aGraphicPoint,UpdateViewer); |
117 | Handle(ISession_Text) aGraphicText = new ISession_Text(aText,aPoint.X()+anXoffset,aPoint.Y()+anYoffset); |
118 | aGraphicText->SetScale (TextScale); |
119 | aDoc->GetISessionContext()->Display(aGraphicText,UpdateViewer); |
7fd59977 |
120 | } |
121 | |
122 | void GeomSources::DisplayPoint(CGeometryDoc* aDoc, |
5c573e69 |
123 | const gp_Pnt& aPoint, |
7fd59977 |
124 | const char* aText, |
125 | Standard_Boolean UpdateViewer, |
126 | Standard_Real anXoffset, |
127 | Standard_Real anYoffset, |
128 | Standard_Real aZoffset, |
129 | Standard_Real TextScale) |
130 | { |
5c1f974e |
131 | Handle(ISession_Point) aGraphicPoint = new ISession_Point(aPoint); |
132 | aDoc->GetAISContext()->Display(aGraphicPoint,UpdateViewer); |
133 | Handle(ISession_Text) aGraphicText = new ISession_Text(aText,aPoint.X()+anXoffset,aPoint.Y()+anYoffset,aPoint.Z()+aZoffset); |
134 | aGraphicText->SetScale (TextScale); |
135 | aDoc->GetAISContext()->Display(aGraphicText,UpdateViewer); |
7fd59977 |
136 | } |
137 | |
138 | void GeomSources::DisplayCurve(CGeometryDoc* aDoc, |
139 | Handle(Geom2d_Curve) aCurve, |
140 | Standard_Integer aColorIndex, |
141 | Standard_Boolean UpdateViewer) |
142 | { |
5c1f974e |
143 | Handle(ISession2D_Curve) aGraphicCurve = new ISession2D_Curve(aCurve); |
144 | aGraphicCurve->SetColorIndex(aColorIndex) ; |
145 | aDoc->GetISessionContext()->Display(aGraphicCurve,UpdateViewer); |
7fd59977 |
146 | } |
147 | |
148 | void GeomSources::DisplayCurveAndCurvature(CGeometryDoc* aDoc, |
149 | Handle(Geom2d_Curve) aCurve, |
150 | Standard_Integer aColorIndex, |
151 | Standard_Boolean UpdateViewer) |
152 | { |
5c1f974e |
153 | Handle(ISession2D_Curve) aGraphicCurve = new ISession2D_Curve(aCurve); |
154 | aGraphicCurve->SetDisplayCurbure(Standard_True) ; |
155 | aGraphicCurve->SetDiscretisation(20); |
156 | aGraphicCurve->SetColorIndex(aColorIndex) ; |
157 | aDoc->GetISessionContext()->Display(aGraphicCurve,UpdateViewer); |
7fd59977 |
158 | } |
159 | |
160 | void GeomSources::DisplayCurve(CGeometryDoc* aDoc, |
161 | Handle(Geom_Curve) aCurve, |
162 | Quantity_NameOfColor aNameOfColor, |
163 | Standard_Boolean UpdateViewer) |
164 | { |
5c1f974e |
165 | Handle(ISession_Curve) aGraphicCurve = new ISession_Curve(aCurve); |
166 | aDoc->GetAISContext()->SetColor(aGraphicCurve,aNameOfColor, Standard_False); |
167 | aGraphicCurve->Attributes()->LineAspect()->SetColor(aNameOfColor); |
168 | aDoc->GetAISContext()->Display(aGraphicCurve,UpdateViewer); |
7fd59977 |
169 | } |
170 | |
171 | void GeomSources::DisplayCurve(CGeometryDoc* aDoc, |
172 | Handle(Geom_Curve) aCurve, |
173 | Standard_Boolean UpdateViewer) |
174 | { |
175 | Handle(ISession_Curve) aGraphicCurve = new ISession_Curve(aCurve); |
176 | aDoc->GetAISContext()->Display(aGraphicCurve,UpdateViewer); |
177 | } |
178 | |
179 | |
180 | |
181 | |
182 | void GeomSources::DisplaySurface(CGeometryDoc* aDoc, |
183 | Handle(Geom_Surface) aSurface, |
184 | Quantity_NameOfColor aNameOfColor, |
185 | Standard_Boolean UpdateViewer) |
186 | { |
5c1f974e |
187 | Handle(ISession_Surface) aGraphicalSurface = new ISession_Surface(aSurface); |
188 | aDoc->GetAISContext()->SetColor(aGraphicalSurface,aNameOfColor, Standard_False); |
189 | aGraphicalSurface->Attributes()->FreeBoundaryAspect()->SetColor(aNameOfColor); |
190 | aGraphicalSurface->Attributes()->UIsoAspect()->SetColor(aNameOfColor); |
191 | aGraphicalSurface->Attributes()->VIsoAspect()->SetColor(aNameOfColor); |
192 | aDoc->GetAISContext()->Display(aGraphicalSurface,UpdateViewer); |
7fd59977 |
193 | } |
194 | |
195 | void GeomSources::DisplaySurface(CGeometryDoc* aDoc, |
196 | Handle(Geom_Surface) aSurface, |
197 | Standard_Boolean UpdateViewer) |
198 | { |
5c1f974e |
199 | Handle(ISession_Surface) aGraphicalSurface = new ISession_Surface(aSurface); |
200 | aDoc->GetAISContext()->Display(aGraphicalSurface,UpdateViewer); |
7fd59977 |
201 | } |
202 | |
2f697f2f |
203 | void GeomSources::ResetView(CGeometryDoc* aDoc) |
204 | { |
205 | aDoc->GetAISContext()->CurrentViewer()->InitActiveViews(); |
206 | Handle(V3d_View) aView = aDoc->GetAISContext()->CurrentViewer()->ActiveView(); |
207 | aView->Reset(); |
208 | } |
209 | |
7fd59977 |
210 | // Function name : GeomSources::gpTest1 |
211 | // Description : |
212 | // Return type : void |
213 | // Argument : CGeometryDoc* aDoc |
214 | void GeomSources::gpTest1(CGeometryDoc* aDoc) |
215 | { |
216 | DisplayType TheDisplayType = No2D3D; |
217 | PreProcess(aDoc,TheDisplayType); |
5c1f974e |
218 | //============================================================== |
219 | |
220 | gp_XYZ A(1,2,3); |
221 | gp_XYZ B(2,2,2); |
222 | gp_XYZ C(3,2,3); |
223 | Standard_Real result = A.DotCross(B,C); |
7fd59977 |
224 | |
225 | //============================================================== |
5c1f974e |
226 | TCollection_AsciiString Message ("\ |
7fd59977 |
227 | \n\ |
228 | gp_XYZ A(1,2,3); \n\ |
229 | gp_XYZ B(2,2,2); \n\ |
230 | gp_XYZ C(3,2,3); \n\ |
231 | Standard_Real result = A.DotCross(B,C); \n\ |
232 | \n"); |
5c1f974e |
233 | AddSeparator(aDoc,Message); |
7fd59977 |
234 | //-------------------------------------------------------------- |
5c573e69 |
235 | |
7fd59977 |
236 | DisplayPoint(aDoc,gp_Pnt(A),"A (1,2,3)",false,0.1); |
237 | DisplayPoint(aDoc,gp_Pnt(B),"B (2,2,2)",false,0.1); |
5c573e69 |
238 | DisplayPoint(aDoc,gp_Pnt(C),"C (3,2,3)",false,0.1); |
7fd59977 |
239 | |
240 | // to add a numeric value in a TCollectionAsciiString |
5c1f974e |
241 | TCollection_AsciiString Message2 (result); |
7fd59977 |
242 | |
5c1f974e |
243 | Message+= " result = "; |
244 | Message+= Message2; |
576f8b11 |
245 | PostProcess(aDoc,ID_BUTTON_Test_1,TheDisplayType,Message); |
7fd59977 |
246 | } |
247 | |
248 | // Function name : GeomSources::gpTest2 |
249 | // Description : |
250 | // Return type : void |
251 | // Argument : CGeometryDoc* aDoc |
252 | void GeomSources::gpTest2(CGeometryDoc* aDoc) |
253 | { |
254 | DisplayType TheDisplayType = No2D3D; |
255 | PreProcess(aDoc,TheDisplayType); |
256 | //============================================================== |
257 | |
5c1f974e |
258 | gp_Pnt P1(1,2,3); |
7fd59977 |
259 | |
260 | //============================================================== |
5c1f974e |
261 | TCollection_AsciiString Message ("\ |
7fd59977 |
262 | \n\ |
263 | gp_Pnt P1(1,2,3); \n\ |
264 | \n"); |
5c1f974e |
265 | AddSeparator(aDoc,Message); |
7fd59977 |
266 | //-------------------------------------------------------------- |
2f697f2f |
267 | DisplayPoint(aDoc,P1,"P1 (1,2,3)",false,30); |
268 | PostProcess(aDoc,ID_BUTTON_Test_2,TheDisplayType,Message,Standard_False); |
269 | ResetView(aDoc); |
7fd59977 |
270 | } |
271 | |
272 | |
273 | // Function name : GeomSources::gpTest3 |
274 | // Description : |
275 | // Return type : void |
276 | // Argument : CGeometryDoc* aDoc |
277 | void GeomSources::gpTest3(CGeometryDoc* aDoc) |
278 | { |
5c1f974e |
279 | DisplayType TheDisplayType = No2D3D; |
280 | PreProcess(aDoc,TheDisplayType); |
7fd59977 |
281 | //============================================================== |
282 | |
5c1f974e |
283 | gp_XYZ A(1,2,3); |
284 | gp_Pnt P2(A); |
7fd59977 |
285 | |
286 | //============================================================== |
5c1f974e |
287 | TCollection_AsciiString Message ("\ |
7fd59977 |
288 | \n\ |
289 | gp_XYZ A(1,2,3); \n\ |
290 | gp_Pnt P2(A); \n\ |
291 | \n"); |
5c1f974e |
292 | AddSeparator(aDoc,Message); |
7fd59977 |
293 | //-------------------------------------------------------------- |
2f697f2f |
294 | DisplayPoint(aDoc,P2,"P2 (1,2,3)",false,30); |
295 | PostProcess(aDoc,ID_BUTTON_Test_3,TheDisplayType,Message,Standard_False); |
296 | ResetView(aDoc); |
7fd59977 |
297 | } |
298 | |
299 | |
300 | // Function name : GeomSources::gpTest4 |
301 | // Description : |
302 | // Return type : void |
303 | // Argument : CGeometryDoc* aDoc |
304 | void GeomSources::gpTest4(CGeometryDoc* aDoc) |
305 | { |
5c1f974e |
306 | DisplayType TheDisplayType = No2D3D; |
307 | PreProcess(aDoc,TheDisplayType); |
7fd59977 |
308 | //============================================================== |
309 | |
5c1f974e |
310 | gp_Pnt P3 = gp::Origin(); |
311 | Standard_Real TheX = P3.X(); |
312 | Standard_Real TheY = P3.Y(); |
313 | Standard_Real TheZ = P3.Z(); |
7fd59977 |
314 | |
315 | |
316 | //============================================================== |
317 | TCollection_AsciiString Message ("\ |
318 | \n\ |
319 | gp_Pnt P3 = gp::Origin(); \n\ |
320 | Standard_Real TheX = P3.X(); \n\ |
321 | Standard_Real TheY = P3.Y(); \n\ |
322 | Standard_Real TheZ = P3.Z(); \n\ |
323 | \n"); |
5c1f974e |
324 | AddSeparator(aDoc,Message); |
7fd59977 |
325 | //-------------------------------------------------------------- |
2f697f2f |
326 | DisplayPoint(aDoc,P3,"P3 = gp::Origin()",false,30); |
5c1f974e |
327 | |
328 | TCollection_AsciiString Message2 (TheX); |
329 | TCollection_AsciiString Message3 (TheY); |
330 | TCollection_AsciiString Message4 (TheZ); |
331 | |
332 | Message += " TheX = "; |
333 | Message += Message2; |
334 | Message += " TheY = "; |
335 | Message += Message3; |
336 | Message += " TheZ = "; |
337 | Message4 = TheZ; |
338 | Message += Message4; |
339 | |
2f697f2f |
340 | PostProcess(aDoc,ID_BUTTON_Test_4,TheDisplayType,Message,Standard_False); |
341 | ResetView(aDoc); |
7fd59977 |
342 | } |
343 | |
344 | |
345 | // Function name : GeomSources::gpTest5 |
346 | // Description : |
347 | // Return type : void |
348 | // Argument : CGeometryDoc* aDoc |
349 | void GeomSources::gpTest5(CGeometryDoc* aDoc) |
350 | { |
5c1f974e |
351 | DisplayType TheDisplayType = No2D3D; |
352 | PreProcess(aDoc,TheDisplayType); |
7fd59977 |
353 | //============================================================== |
354 | |
5c1f974e |
355 | gp_Pnt P1(1,2,3); |
356 | gp_Pnt P2(3,4,5); |
357 | gp_Pnt PB = P1; |
358 | Standard_Real alpha = 3; |
359 | Standard_Real beta = 7; |
360 | PB.BaryCenter(alpha,P2,beta); |
7fd59977 |
361 | |
362 | //============================================================== |
5c1f974e |
363 | TCollection_AsciiString Message ("\ |
7fd59977 |
364 | \n\ |
365 | gp_Pnt P1(1,2,3); \n\ |
366 | gp_Pnt P2(3,4,5); \n\ |
367 | gp_Pnt PB = P1; \n\ |
368 | Standard_Real alpha = 3; \n\ |
369 | Standard_Real beta = 7; \n\ |
370 | PB.BaryCenter(alpha,P2,beta); \n\ |
371 | \n"); |
372 | |
5c1f974e |
373 | AddSeparator(aDoc,Message); |
7fd59977 |
374 | //-------------------------------------------------------------- |
375 | |
5c1f974e |
376 | DisplayPoint(aDoc,P1,"P1",false,0.2); |
377 | DisplayPoint(aDoc,P2,"P2",false,0.2); |
378 | DisplayPoint(aDoc,PB,"PB = barycenter ( 3 * P1 , 7 * P2) ",false,0.2); |
379 | |
380 | TCollection_AsciiString Message2 (PB.X()); |
381 | TCollection_AsciiString Message3 (PB.Y()); |
382 | TCollection_AsciiString Message4 (PB.Z()); |
383 | |
384 | Message += " PB ( "; |
385 | Message += Message2; |
386 | Message += " , "; |
387 | Message += Message3; |
388 | Message += " , "; |
389 | Message += Message4; |
390 | Message += " ); "; |
576f8b11 |
391 | PostProcess(aDoc,ID_BUTTON_Test_5,TheDisplayType,Message); |
7fd59977 |
392 | } |
393 | |
394 | |
395 | // Function name : GeomSources::gpTest6 |
396 | // Description : |
397 | // Return type : void |
398 | // Argument : CGeometryDoc* aDoc |
399 | void GeomSources::gpTest6(CGeometryDoc* aDoc) |
400 | { |
5c1f974e |
401 | DisplayType TheDisplayType = No2D3D; |
402 | PreProcess(aDoc,TheDisplayType); |
7fd59977 |
403 | //============================================================== |
404 | |
405 | // Compute a 3d point P as BaryCenter of an array of point |
5c1f974e |
406 | gp_Pnt P1(0,0,5); |
407 | gp_Pnt P2(1,2,3); |
408 | gp_Pnt P3(2,3,-2); |
409 | gp_Pnt P4(4,3,5); |
410 | gp_Pnt P5(5,5,4); |
411 | TColgp_Array1OfPnt array (1,5); // sizing array |
412 | array.SetValue(1,P1); |
413 | array.SetValue(2,P2); |
414 | array.SetValue(3,P3); |
415 | array.SetValue(4,P4); |
416 | array.SetValue(5,P5); |
417 | |
418 | Standard_Real Tolerance = 8; // ajout de la tolerance |
419 | GProp_PEquation PE (array,Tolerance); |
420 | |
421 | gp_Pnt P; // P declaration |
422 | Standard_Boolean IsPoint; |
423 | |
424 | if (PE.IsPoint()) |
425 | { |
426 | IsPoint = true; |
7fd59977 |
427 | P = PE .Point(); |
5c1f974e |
428 | } |
429 | else |
430 | { |
431 | IsPoint = false; |
432 | } |
433 | |
434 | if (PE.IsLinear()){ /*... */ } |
435 | if (PE.IsPlanar()){ /*... */ } |
436 | if (PE.IsSpace()) { /*... */ } |
7fd59977 |
437 | |
438 | //============================================================== |
5c1f974e |
439 | TCollection_AsciiString Message ("\ |
7fd59977 |
440 | \n\ |
441 | \n\ |
442 | // Compute a 3d point P as BaryCenter of an array of point \n\ |
443 | gp_Pnt P1(0,0,5); \n\ |
444 | gp_Pnt P2(1,2,3); \n\ |
445 | gp_Pnt P3(2,3,-2); \n\ |
446 | gp_Pnt P4(4,3,5); \n\ |
447 | gp_Pnt P5(5,5,4); \n\ |
448 | TColgp_Array1OfPnt array (1,5); // sizing array \n\ |
449 | array.SetValue(1,P1); \n\ |
450 | array.SetValue(2,P2); \n\ |
451 | array.SetValue(3,P3); \n\ |
452 | array.SetValue(4,P4); \n\ |
453 | array.SetValue(5,P5); \n\ |
454 | \n\ |
455 | Standard_Real Tolerance = 8; // ajout de la tolerance \n\ |
456 | GProp_PEquation PE (array,Tolerance); \n\ |
457 | \n\ |
458 | gp_Pnt P; // P declaration \n\ |
459 | Standard_Boolean IsPoint; \n\ |
460 | if (PE.IsPoint()){IsPoint = true; \n\ |
461 | P = PE .Point();} \n\ |
462 | else { IsPoint = false; } \n\ |
463 | if (PE.IsLinear()){ /*... */ } \n\ |
464 | if (PE.IsPlanar()){ /*... */ } \n\ |
465 | if (PE.IsSpace()) { /*... */ } \n\ |
466 | \n"); |
5c1f974e |
467 | AddSeparator(aDoc,Message); |
7fd59977 |
468 | //-------------------------------------------------------------- |
469 | |
5c1f974e |
470 | TCollection_AsciiString PointName("P"); |
7fd59977 |
471 | |
472 | |
473 | for(Standard_Integer i= array.Lower();i <= array.Upper(); i++) |
5c1f974e |
474 | { |
475 | TCollection_AsciiString TheString (i); |
476 | TheString = PointName+ TheString; |
477 | DisplayPoint(aDoc,array(i),TheString.ToCString(),false,0.5); |
478 | } |
479 | |
480 | DisplayPoint(aDoc,P,"P",false,0.5); |
481 | TCollection_AsciiString Message2 (P.X()); |
482 | TCollection_AsciiString Message3 (P.Y()); |
483 | TCollection_AsciiString Message4 (P.Z()); |
484 | |
485 | Message += " IsPoint = "; |
486 | if (IsPoint) |
487 | { |
488 | Message += "True --> "; |
489 | Message += " P ( "; |
7fd59977 |
490 | |
5c1f974e |
491 | Message += Message2; Message += " , "; |
492 | Message += Message3; Message += " , "; |
493 | Message += Message4; Message += " ); \n"; |
494 | } |
495 | else |
496 | Message += "False\n"; |
497 | |
498 | Message += " IsLinear = "; |
499 | if (PE.IsLinear()) |
500 | Message += "True \n"; |
501 | else |
502 | Message += "False\n"; |
503 | |
504 | Message += " IsPlanar = "; |
505 | if (PE.IsPlanar()) |
506 | Message += "True \n"; |
507 | else |
508 | Message += "False\n"; |
509 | |
510 | Message += " IsSpace = "; |
511 | if |
512 | (PE.IsSpace()) |
513 | Message += "True \n"; |
514 | else |
515 | Message += "False\n"; |
7fd59977 |
516 | |
576f8b11 |
517 | PostProcess(aDoc,ID_BUTTON_Test_6,TheDisplayType,Message); |
7fd59977 |
518 | } |
519 | |
520 | // Function name : GeomSources::gpTest7 |
521 | // Description : |
522 | // Return type : void |
523 | // Argument : CGeometryDoc* aDoc |
524 | void GeomSources::gpTest7(CGeometryDoc* aDoc) |
525 | { |
5c1f974e |
526 | DisplayType TheDisplayType = a2DNo3D; |
527 | PreProcess(aDoc,TheDisplayType); |
7fd59977 |
528 | //============================================================== |
529 | |
5c1f974e |
530 | gp_Pnt2d P1(0,5); |
531 | gp_Pnt2d P2(5.5,1); |
532 | gp_Pnt2d P3(-2,2); |
533 | |
534 | Handle(Geom2d_TrimmedCurve) C = |
7fd59977 |
535 | GCE2d_MakeArcOfCircle (P1,P2,P3).Value(); |
536 | |
5c1f974e |
537 | Standard_Real FirstParameter = C->FirstParameter(); |
538 | Standard_Real LastParameter = C->LastParameter(); |
539 | Standard_Real MiddleParameter = (FirstParameter+LastParameter)/2; |
540 | Standard_Real param = MiddleParameter; //in radians |
7fd59977 |
541 | |
5c1f974e |
542 | gp_Pnt2d P; |
543 | gp_Vec2d V; |
544 | C->D1(param,P,V); |
7fd59977 |
545 | // we recover point P and the vector V |
546 | |
547 | //============================================================== |
5c1f974e |
548 | TCollection_AsciiString Message ("\ |
7fd59977 |
549 | \n\ |
550 | \n\ |
551 | gp_Pnt2d P1(0,5); \n\ |
552 | gp_Pnt2d P2(5.5,1); \n\ |
553 | gp_Pnt2d P3(-2,2); \n\ |
554 | \n\ |
555 | Handle(Geom2d_TrimmedCurve) C = \n\ |
556 | GCE2d_MakeArcOfCircle (P1,P2,P3).Value(); \n\ |
557 | \n\ |
558 | Standard_Real FirstParameter = C->FirstParameter(); \n\ |
559 | Standard_Real LastParameter = C->LastParameter(); \n\ |
560 | Standard_Real MiddleParameter = \n\ |
561 | (FirstParameter+LastParameter)/2; \n\ |
562 | Standard_Real param = MiddleParameter; //in radians \n\ |
563 | \n\ |
564 | gp_Pnt2d P; \n\ |
565 | gp_Vec2d V; \n\ |
566 | C->D1(param,P,V); \n\ |
567 | // we recover point P and the vector V \n\ |
568 | \n"); |
5c1f974e |
569 | AddSeparator(aDoc,Message); |
570 | //-------------------------------------------------------------- |
7fd59977 |
571 | |
9e3ca93a |
572 | DisplayCurve(aDoc,Handle(Geom2d_Curve)::DownCast(C)); |
5c1f974e |
573 | Handle(ISession_Direction) aDirection = new ISession_Direction(P,V); |
574 | aDoc->GetISessionContext()->Display(aDirection, Standard_False); |
7fd59977 |
575 | |
5c1f974e |
576 | DisplayPoint(aDoc,P,"P",false,0.5); |
7fd59977 |
577 | |
576f8b11 |
578 | PostProcess(aDoc,ID_BUTTON_Test_7,TheDisplayType,Message); |
7fd59977 |
579 | } |
580 | |
581 | // Function name : GeomSources::gpTest8 |
582 | // Description : |
583 | // Return type : void |
584 | // Argument : CGeometryDoc* aDoc |
585 | void GeomSources::gpTest8(CGeometryDoc* aDoc) |
586 | { |
5c1f974e |
587 | DisplayType TheDisplayType = a2DNo3D; |
588 | PreProcess(aDoc,TheDisplayType); |
7fd59977 |
589 | //============================================================== |
590 | |
5c1f974e |
591 | Standard_Real radius = 5; |
592 | Handle(Geom2d_Circle) C = |
7fd59977 |
593 | new Geom2d_Circle(gp::OX2d(),radius); |
5c1f974e |
594 | Standard_Real param = 1.2*M_PI; |
595 | Geom2dLProp_CLProps2d CLP |
7fd59977 |
596 | (C,param,2,Precision::PConfusion()); |
5c1f974e |
597 | gp_Dir2d D; |
598 | CLP.Tangent(D); |
7fd59977 |
599 | // D is the Tangent direction at parameter 1.2*PI |
600 | |
601 | //============================================================== |
5c1f974e |
602 | TCollection_AsciiString Message (" \ |
7fd59977 |
603 | \n\ |
604 | Standard_Real radius = 5; \n\ |
605 | Handle(Geom2d_Circle) C = \n\ |
606 | new Geom2d_Circle(gp::OX2d(),radius); \n\ |
607 | Standard_Real param = 1.2*PI; \n\ |
608 | Geom2dLProp_CLProps2d CLP \n\ |
609 | (C,param,2,Precision::PConfusion()); \n\ |
610 | gp_Dir2d D; \n\ |
611 | CLP.Tangent(D); \n\ |
612 | // D is the Tangent direction at parameter 1.2*PI \n\ |
613 | \n"); |
5c1f974e |
614 | AddSeparator(aDoc,Message); |
615 | //-------------------------------------------------------------- |
616 | Handle(ISession2D_Curve) aCurve = new ISession2D_Curve(C); |
617 | aDoc->GetISessionContext()->Display(aCurve,Standard_False); |
618 | Handle(ISession_Direction) aDirection = new ISession_Direction(gp_Pnt2d(0,0),D,2); |
619 | aDoc->GetISessionContext()->Display(aDirection,Standard_False); |
7fd59977 |
620 | |
5c1f974e |
621 | TCollection_AsciiString Message2 (D.X()); |
622 | TCollection_AsciiString Message3 (D.Y()); |
7fd59977 |
623 | |
5c1f974e |
624 | Message += " D ( "; |
625 | Message += Message2; Message += " , "; |
626 | Message += Message3; Message += " ); \n"; |
7fd59977 |
627 | |
576f8b11 |
628 | PostProcess(aDoc,ID_BUTTON_Test_8,TheDisplayType,Message); |
5c1f974e |
629 | } |
7fd59977 |
630 | |
631 | // Function name : GeomSources::gpTest9 |
632 | // Description : |
633 | // Return type : void |
634 | // Argument : CGeometryDoc* aDoc |
635 | void GeomSources::gpTest9(CGeometryDoc* aDoc) |
636 | { |
5c1f974e |
637 | DisplayType TheDisplayType = a2DNo3D; |
638 | PreProcess(aDoc,TheDisplayType); |
639 | |
640 | //============================================================== |
7fd59977 |
641 | |
5c1f974e |
642 | Standard_Real radius = 5; |
643 | Handle(Geom2d_Circle) C = |
7fd59977 |
644 | new Geom2d_Circle(gp::OX2d(),radius); |
5c1f974e |
645 | Geom2dAdaptor_Curve GAC (C); |
646 | Standard_Real startparam = 10*M_PI/180; |
647 | Standard_Real abscissa = 45*M_PI/180; |
648 | gp_Pnt2d P1; |
649 | C->D0(startparam,P1); |
650 | // abscissa is the distance along the curve from startparam |
651 | GCPnts_AbscissaPoint AP (GAC, abscissa, startparam); |
652 | gp_Pnt2d P2; |
653 | if (AP.IsDone()){C->D0(AP.Parameter(),P2);} |
654 | // P is now correctly set |
655 | |
656 | //============================================================== |
657 | TCollection_AsciiString Message (" \n\ |
7fd59977 |
658 | \n\ |
659 | \n\ |
660 | Standard_Real radius = 5; \n\ |
661 | Handle(Geom2d_Circle) C = \n\ |
662 | new Geom2d_Circle(gp::OX2d(),radius); \n\ |
663 | Geom2dAdaptor_Curve GAC (C); \n\ |
664 | Standard_Real startparam = 10*PI180; \n\ |
665 | Standard_Real abscissa = 45*PI180; \n\ |
666 | gp_Pnt2d P1; \n\ |
667 | C->D0(startparam,P1); \n\ |
668 | // abscissa is the distance along the curve from startparam \n\ |
669 | GCPnts_AbscissaPoint AP (GAC, abscissa, startparam); \n\ |
670 | gp_Pnt2d P2; \n\ |
671 | if (AP.IsDone()){C->D0(AP.Parameter(),P2);} \n\ |
672 | // P is now correctly set \n\ |
673 | \n\ |
674 | \n"); |
5c1f974e |
675 | AddSeparator(aDoc,Message); |
676 | //-------------------------------------------------------------- |
677 | Handle(ISession2D_Curve) aCurve = new ISession2D_Curve(C); |
678 | aDoc->GetISessionContext()->Display(aCurve,Standard_False); |
7fd59977 |
679 | |
5c1f974e |
680 | DisplayPoint(aDoc,P1,"P1"); |
681 | if (AP.IsDone()) DisplayPoint(aDoc,P2,"P2"); |
7fd59977 |
682 | |
5c1f974e |
683 | TCollection_AsciiString Message2 (P1.X()); |
684 | TCollection_AsciiString Message3 (P1.Y()); |
7fd59977 |
685 | |
5c1f974e |
686 | TCollection_AsciiString Message4 (P2.X()); |
687 | TCollection_AsciiString Message5 (P2.Y()); |
688 | |
689 | Message += " P1 ( "; |
690 | Message += Message2; Message += " , "; |
691 | Message += Message3; Message += " ); \n"; |
7fd59977 |
692 | |
5c1f974e |
693 | Message += " P2 ( "; |
694 | Message += Message4; Message += " , "; |
695 | Message += Message5; Message += " ); \n"; |
576f8b11 |
696 | PostProcess(aDoc,ID_BUTTON_Test_9,TheDisplayType,Message); |
5c1f974e |
697 | } |
7fd59977 |
698 | |
699 | // Function name : GeomSources::gpTest10 |
700 | // Description : |
701 | // Return type : void |
702 | // Argument : CGeometryDoc* aDoc |
703 | void GeomSources::gpTest10(CGeometryDoc* aDoc) |
704 | { |
5c1f974e |
705 | DisplayType TheDisplayType = a2DNo3D; |
706 | PreProcess(aDoc,TheDisplayType); |
707 | //============================================================== |
7fd59977 |
708 | |
5c1f974e |
709 | gp_Pnt2d P; |
710 | Standard_Real radius = 5; |
711 | Handle(Geom2d_Circle) C = |
712 | new Geom2d_Circle(gp::OX2d(),radius); |
713 | Geom2dAdaptor_Curve GAC (C); |
714 | Standard_Real abscissa = 3; |
715 | GCPnts_UniformAbscissa UA (GAC,abscissa); |
716 | TColgp_SequenceOfPnt2d aSequence; |
717 | if (UA.IsDone()) |
7fd59977 |
718 | { |
5c1f974e |
719 | Standard_Real N = UA.NbPoints(); |
720 | Standard_Integer count = 1; |
721 | for(;count<=N;count++) |
722 | { |
723 | C->D0(UA.Parameter(count),P); |
5c573e69 |
724 | //Standard_Real Parameter = UA.Parameter(count); |
5c1f974e |
725 | // append P in a Sequence |
726 | aSequence.Append(P); |
7fd59977 |
727 | } |
5c1f974e |
728 | } |
729 | Standard_Real Abscissa = UA.Abscissa(); |
7fd59977 |
730 | |
5c1f974e |
731 | //============================================================== |
732 | TCollection_AsciiString Message (" \ |
7fd59977 |
733 | \n\ |
734 | gp_Pnt2d P; \n\ |
735 | Standard_Real radius = 5; \n\ |
736 | Handle(Geom2d_Circle) C = \n\ |
737 | new Geom2d_Circle(gp::OX2d(),radius); \n\ |
738 | Geom2dAdaptor_Curve GAC (C); \n\ |
739 | Standard_Real abscissa = 3; \n\ |
740 | GCPnts_UniformAbscissa UA (GAC,abscissa); \n\ |
741 | TColgp_SequenceOfPnt2d aSequence; \n\ |
742 | if (UA.IsDone()) \n\ |
743 | { \n\ |
744 | Standard_Real N = UA.NbPoints(); \n\ |
745 | Standard_Integer count = 1; \n\ |
746 | for(;count<=N;count++) \n\ |
747 | { \n\ |
748 | C->D0(UA.Parameter(count),P); \n\ |
749 | Standard_Real Parameter = UA.Parameter(count); \n\ |
750 | // append P in a Sequence \n\ |
751 | aSequence.Append(P); \n\ |
752 | } \n\ |
753 | } \n\ |
754 | Standard_Real Abscissa = UA.Abscissa(); \n\ |
755 | \n"); |
5c1f974e |
756 | AddSeparator(aDoc,Message); |
757 | //-------------------------------------------------------------- |
758 | Handle(ISession2D_Curve) aCurve = new ISession2D_Curve(C); |
759 | aDoc->GetISessionContext()->Display(aCurve,Standard_False); |
7fd59977 |
760 | |
5c1f974e |
761 | TCollection_AsciiString aString; |
762 | for (Standard_Integer i=1;i<= aSequence.Length();i++) |
763 | { |
7fd59977 |
764 | |
5c1f974e |
765 | TCollection_AsciiString Message2 (i); |
766 | TCollection_AsciiString Message3 (UA.Parameter(i)); |
767 | |
768 | aString = "P"; |
769 | aString += Message2; |
770 | aString +=": Parameter : "; |
771 | aString += Message3; |
772 | |
773 | // First and Last texts are displayed with an Y offset, point 4 is upper |
774 | Standard_Real YOffset = -0.3; |
775 | YOffset += 0.2 * ( i == 1 ); |
776 | YOffset += 0.4 * ( i == 4 ); |
777 | YOffset += -0.2 * ( i == aSequence.Length() ); |
778 | |
779 | DisplayPoint(aDoc,aSequence(i),aString.ToCString(),false,0.5,YOffset,0.04); |
780 | } |
781 | |
782 | TCollection_AsciiString Message3 (Abscissa); |
7fd59977 |
783 | |
5c1f974e |
784 | Message += "Abscissa = "; |
785 | Message += Message3; |
786 | Message += " \n"; |
787 | |
576f8b11 |
788 | PostProcess(aDoc,ID_BUTTON_Test_10,TheDisplayType,Message); |
5c1f974e |
789 | } |
7fd59977 |
790 | |
791 | // Function name : GeomSources::gpTest11 |
792 | // Description : |
793 | // Return type : void |
794 | // Argument : CGeometryDoc* aDoc |
795 | void GeomSources::gpTest11(CGeometryDoc* aDoc) |
796 | { |
5c1f974e |
797 | DisplayType TheDisplayType = No2D3D; |
798 | PreProcess(aDoc,TheDisplayType); |
799 | //============================================================== |
800 | |
801 | Standard_Real radius = 5; |
802 | Handle(Geom_SphericalSurface) SP = |
803 | new Geom_SphericalSurface(gp_Ax3(gp::XOY()),radius); |
804 | Standard_Real u = 2; |
805 | Standard_Real v = 3; |
806 | gp_Pnt P = SP->Value(u,v); |
807 | |
7fd59977 |
808 | //============================================================== |
809 | TCollection_AsciiString Message (" \ |
810 | \n\ |
811 | Standard_Real radius = 5; \n\ |
812 | Handle(Geom_SphericalSurface) SP = \n\ |
813 | new Geom_SphericalSurface(gp_Ax3(gp::XOY()),radius); \n\ |
814 | Standard_Real u = 2; \n\ |
815 | Standard_Real v = 3; \n\ |
816 | gp_Pnt P = SP->Value(u,v); \n\ |
817 | \n"); |
5c1f974e |
818 | AddSeparator(aDoc,Message); |
819 | //-------------------------------------------------------------- |
7fd59977 |
820 | |
5c1f974e |
821 | DisplaySurface(aDoc,SP); |
822 | DisplayPoint(aDoc,P,"P",false,0.5); |
823 | TCollection_AsciiString Message2 (P.X()); |
824 | TCollection_AsciiString Message3 (P.Y()); |
7fd59977 |
825 | |
5c1f974e |
826 | Message += " P ( "; |
827 | Message += Message2; |
828 | Message += " , "; |
829 | Message += Message3; |
830 | Message += " ); \n"; |
7fd59977 |
831 | |
576f8b11 |
832 | PostProcess(aDoc,ID_BUTTON_Test_11,TheDisplayType,Message); |
7fd59977 |
833 | } |
834 | |
7fd59977 |
835 | // Function name : GeomSources::gpTest12 |
836 | // Description : |
837 | // Return type : void |
838 | // Argument : CGeometryDoc* aDoc |
839 | void GeomSources::gpTest12(CGeometryDoc* aDoc) |
840 | { |
5c1f974e |
841 | DisplayType TheDisplayType = No2D3D; |
842 | PreProcess(aDoc,TheDisplayType); |
843 | //============================================================== |
844 | |
845 | gp_Pnt N,Q,P(1,2,3); |
846 | Standard_Real distance, radius = 5; |
847 | Handle(Geom_Circle) C = new Geom_Circle(gp::XOY(),radius); |
848 | GeomAPI_ProjectPointOnCurve PPC (P,C); |
849 | N = PPC.NearestPoint(); |
850 | Standard_Integer NbResults = PPC.NbPoints(); |
851 | |
852 | if(NbResults>0) |
853 | { |
854 | for(Standard_Integer i = 1;i<=NbResults;i++) |
855 | { |
856 | Q = PPC.Point(i); |
857 | distance = PPC.Distance(i); |
858 | // do something with Q or distance here |
859 | } |
860 | } |
861 | |
862 | //============================================================== |
863 | TCollection_AsciiString Message (" \ |
7fd59977 |
864 | \n\ |
865 | gp_Pnt N,Q,P(1,2,3); \n\ |
866 | Standard_Real distance, radius = 5; \n\ |
867 | Handle(Geom_Circle) C = new Geom_Circle(gp::XOY(),radius); \n\ |
868 | GeomAPI_ProjectPointOnCurve PPC (P,C); \n\ |
869 | N = PPC.NearestPoint(); \n\ |
870 | Standard_Integer NbResults = PPC.NbPoints(); \n\ |
871 | \n\ |
872 | if(NbResults>0){ \n\ |
873 | for(Standard_Integer i = 1;i<=NbResults;i++){ \n\ |
874 | Q = PPC.Point(i); \n\ |
875 | distance = PPC.Distance(i); \n\ |
876 | // do something with Q or distance here \n\ |
877 | } \n\ |
878 | } \n\ |
879 | \n"); |
880 | AddSeparator(aDoc,Message); |
881 | //-------------------------------------------------------------- |
882 | |
5c1f974e |
883 | TCollection_AsciiString aString; |
7fd59977 |
884 | |
5c1f974e |
885 | DisplayPoint(aDoc,P,"P",false,0.5); |
7fd59977 |
886 | |
5c1f974e |
887 | TCollection_AsciiString Message2 (PPC.LowerDistance()); |
888 | |
889 | aString = "N : at Distance : "; |
890 | aString += Message2; |
891 | |
892 | DisplayPoint(aDoc,N,aString.ToCString(),false,0.5,0,-0.5); |
9e3ca93a |
893 | DisplayCurve(aDoc,Handle(Geom_Curve)::DownCast(C),Quantity_NOC_YELLOW,false); |
5c1f974e |
894 | |
895 | if(NbResults>0) |
896 | { |
897 | for(Standard_Integer i = 1;i<=NbResults;i++) |
898 | { |
899 | Q = PPC.Point(i); |
900 | distance = PPC.Distance(i); |
901 | TCollection_AsciiString Message3 (i); |
902 | TCollection_AsciiString Message4 (distance); |
903 | |
904 | aString = "Q"; |
905 | aString += Message3; |
906 | aString +=": at Distance : "; |
907 | aString += Message4; |
908 | DisplayPoint(aDoc,Q,aString.ToCString(),false,0.5); |
909 | } |
910 | } |
911 | |
576f8b11 |
912 | PostProcess(aDoc,ID_BUTTON_Test_12,TheDisplayType,Message); |
7fd59977 |
913 | } |
914 | |
915 | // Function name : GeomSources::gpTest13 |
916 | // Description : |
917 | // Return type : void |
918 | // Argument : CGeometryDoc* aDoc |
919 | void GeomSources::gpTest13(CGeometryDoc* aDoc) |
920 | { |
5c1f974e |
921 | DisplayType TheDisplayType = No2D3D; |
922 | PreProcess(aDoc,TheDisplayType); |
923 | |
924 | //============================================================== |
925 | |
926 | gp_Pnt N,Q,P(7,8,9); |
927 | Standard_Real distance, radius = 5; |
928 | Handle(Geom_SphericalSurface) SP = |
929 | new Geom_SphericalSurface(gp_Ax3(gp::XOY()),radius); |
930 | GeomAPI_ProjectPointOnSurf PPS(P,SP); |
931 | N = PPS.NearestPoint(); |
932 | Standard_Integer NbResults = PPS.NbPoints(); |
933 | if(NbResults>0) |
934 | { |
935 | for(Standard_Integer i = 1;i<=NbResults;i++) |
936 | { |
937 | Q = PPS.Point(i); |
938 | distance = PPS.Distance(i); |
939 | // do something with Q or distance here |
940 | } |
941 | } |
7fd59977 |
942 | |
5c1f974e |
943 | //============================================================== |
7fd59977 |
944 | TCollection_AsciiString Message (" \ |
945 | \n\ |
946 | gp_Pnt N,Q,P(7,8,9); \n\ |
947 | Standard_Real distance, radius = 5; \n\ |
948 | Handle(Geom_SphericalSurface) SP = \n\ |
949 | new Geom_SphericalSurface(gp_Ax3(gp::XOY()),radius); \n\ |
950 | GeomAPI_ProjectPointOnSurf PPS(P,SP); \n\ |
951 | N = PPS.NearestPoint(); \n\ |
952 | Standard_Integer NbResults = PPS.NbPoints(); \n\ |
953 | if(NbResults>0){ \n\ |
954 | for(Standard_Integer i = 1;i<=NbResults;i++){ \n\ |
955 | Q = PPS.Point(i); \n\ |
956 | distance = PPS.Distance(i); \n\ |
957 | // do something with Q or distance here \n\ |
958 | } \n\ |
959 | } \n\ |
960 | \n"); |
5c1f974e |
961 | AddSeparator(aDoc,Message); |
962 | //-------------------------------------------------------------- |
963 | TCollection_AsciiString aString; |
964 | |
965 | DisplayPoint(aDoc,P,"P",false,0.5); |
966 | TCollection_AsciiString Message2 (PPS.LowerDistance()); |
967 | |
968 | aString = "N : at Distance : "; aString += Message2; |
969 | DisplayPoint(aDoc,N,aString.ToCString(),false,0.5,0,-0.6); |
970 | |
971 | Handle(ISession_Surface) aSurface = new ISession_Surface(SP); |
6262338c |
972 | Handle(Prs3d_Drawer) CurDrawer = aSurface->Attributes(); |
5c1f974e |
973 | CurDrawer->UIsoAspect()->SetNumber(10); |
974 | CurDrawer->VIsoAspect()->SetNumber(10); |
975 | aDoc->GetAISContext()->SetLocalAttributes(aSurface, CurDrawer); |
976 | aDoc->GetAISContext()->Display(aSurface, Standard_False); |
977 | |
978 | if(NbResults>0) |
979 | { |
980 | for(Standard_Integer i = 1;i<=NbResults;i++) |
981 | { |
982 | |
983 | Q = PPS.Point(i); |
984 | distance = PPS.Distance(i); |
985 | TCollection_AsciiString Message3 (i); |
986 | TCollection_AsciiString Message4 (distance); |
987 | |
988 | aString = "Q"; |
989 | aString += Message3; |
990 | aString +=": at Distance : "; |
991 | aString += Message4; |
992 | |
993 | DisplayPoint(aDoc,Q,aString.ToCString(),false,0.5); |
994 | } |
995 | } |
576f8b11 |
996 | PostProcess(aDoc,ID_BUTTON_Test_13,TheDisplayType,Message); |
7fd59977 |
997 | } |
998 | |
999 | // Function name : GeomSources::gpTest14 |
1000 | // Description : |
1001 | // Return type : void |
1002 | // Argument : CGeometryDoc* aDoc |
1003 | void GeomSources::gpTest14(CGeometryDoc* aDoc) |
1004 | { |
5c1f974e |
1005 | DisplayType TheDisplayType = No2D3D; |
1006 | PreProcess(aDoc,TheDisplayType); |
1007 | //============================================================== |
7fd59977 |
1008 | |
5c1f974e |
1009 | gp_Pnt P; |
1010 | gp_Ax3 theAxe(gp::XOY()); |
1011 | gp_Pln PL(theAxe); |
1012 | Standard_Real MinorRadius = 5; |
1013 | Standard_Real MajorRadius = 8; |
1014 | gp_Elips EL (gp::YOZ(),MajorRadius,MinorRadius); |
1015 | IntAna_IntConicQuad ICQ |
7fd59977 |
1016 | (EL,PL,Precision::Angular(),Precision::Confusion()); |
5c1f974e |
1017 | if (ICQ.IsDone()){ |
7fd59977 |
1018 | Standard_Integer NbResults = ICQ.NbPoints(); |
1019 | if (NbResults>0){ |
5c1f974e |
1020 | for(Standard_Integer i = 1;i<=NbResults;i++){ |
7fd59977 |
1021 | P = ICQ.Point(i); |
1022 | // do something with P here |
5c1f974e |
1023 | } |
1024 | } |
1025 | } |
7fd59977 |
1026 | |
5c1f974e |
1027 | //============================================================== |
1028 | TCollection_AsciiString Message (" \ |
7fd59977 |
1029 | \n\ |
1030 | gp_Pnt P; \n\ |
1031 | gp_Pln PL (gp_Ax3(gp::XOY())); \n\ |
1032 | Standard_Real MinorRadius = 5; \n\ |
1033 | Standard_Real MajorRadius = 8; \n\ |
1034 | gp_Elips EL (gp::YOZ(),MajorRadius,MinorRadius); \n\ |
1035 | IntAna_IntConicQuad ICQ \n\ |
1036 | (EL,PL,Precision::Angular(),Precision::Confusion()); \n\ |
1037 | if (ICQ.IsDone()){ \n\ |
1038 | Standard_Integer NbResults = ICQ.NbPoints(); \n\ |
1039 | if (NbResults>0){ \n\ |
1040 | for(Standard_Integer i = 1;i<=NbResults;i++){ \n\ |
1041 | P = ICQ.Point(i); \n\ |
1042 | // do something with P here \n\ |
1043 | } \n\ |
1044 | } \n\ |
1045 | } \n\ |
1046 | \n"); |
5c1f974e |
1047 | AddSeparator(aDoc,Message); |
1048 | //-------------------------------------------------------------- |
7fd59977 |
1049 | |
5c1f974e |
1050 | Handle(Geom_Plane) aPlane = GC_MakePlane(PL).Value(); |
1051 | Handle(Geom_RectangularTrimmedSurface) aSurface= new Geom_RectangularTrimmedSurface(aPlane,-8.,8.,-12.,12.); |
7fd59977 |
1052 | |
5c1f974e |
1053 | DisplaySurface(aDoc,aSurface); |
7fd59977 |
1054 | |
5c1f974e |
1055 | Handle(Geom_Ellipse) anEllips = GC_MakeEllipse(EL).Value(); |
9e3ca93a |
1056 | DisplayCurve(aDoc,Handle(Geom_Curve)::DownCast(anEllips),Quantity_NOC_YELLOW,false); |
7fd59977 |
1057 | |
5c1f974e |
1058 | TCollection_AsciiString aString; |
7fd59977 |
1059 | |
5c1f974e |
1060 | if (ICQ.IsDone()) |
1061 | { |
1062 | Standard_Integer NbResults = ICQ.NbPoints(); |
1063 | if (NbResults>0) |
1064 | { |
1065 | for(Standard_Integer i = 1;i<=NbResults;i++) |
1066 | { |
7fd59977 |
1067 | |
5c1f974e |
1068 | TCollection_AsciiString Message2(i); |
1069 | |
1070 | P = ICQ.Point(i); |
1071 | aString = "P";aString += Message2; |
1072 | DisplayPoint(aDoc,P,aString.ToCString(),false,0.5); |
1073 | } |
1074 | } |
1075 | } |
1076 | |
576f8b11 |
1077 | PostProcess(aDoc,ID_BUTTON_Test_14,TheDisplayType,Message); |
7fd59977 |
1078 | } |
1079 | |
1080 | // Function name : GeomSources::gpTest15 |
1081 | // Description : |
1082 | // Return type : void |
1083 | // Argument : CGeometryDoc* aDoc |
1084 | void GeomSources::gpTest15(CGeometryDoc* aDoc) |
1085 | { |
5c1f974e |
1086 | DisplayType TheDisplayType = No2D3D; |
1087 | PreProcess(aDoc,TheDisplayType); |
1088 | //============================================================== |
1089 | |
1090 | gp_Pnt P1(1,2,3); |
1091 | gp_Pnt P1Copy = P1; |
1092 | gp_Pnt P2(5,4,6); |
1093 | gp_Trsf TRSF; |
1094 | TRSF.SetMirror(P2); |
1095 | P1Copy.Transform(TRSF); |
1096 | |
1097 | //============================================================== |
7fd59977 |
1098 | TCollection_AsciiString Message (" \ |
1099 | \n\ |
1100 | gp_Pnt P1(1,2,3); \n\ |
1101 | gp_Pnt P1Copy = P1; \n\ |
1102 | gp_Pnt P2(5,4,6); \n\ |
1103 | gp_Trsf TRSF; \n\ |
1104 | TRSF.SetMirror(P2); \n\ |
1105 | P1Copy.Transform(TRSF); \n\ |
1106 | \n"); |
5c1f974e |
1107 | AddSeparator(aDoc,Message); |
1108 | //-------------------------------------------------------------- |
7fd59977 |
1109 | |
5c1f974e |
1110 | DisplayPoint(aDoc,P1Copy,"P1Copy",false,0.5); |
1111 | DisplayPoint(aDoc,P1,"P1",false,0.5); |
1112 | DisplayPoint(aDoc,P2,"P2",false,0.5); |
7fd59977 |
1113 | |
576f8b11 |
1114 | PostProcess(aDoc,ID_BUTTON_Test_15,TheDisplayType,Message); |
7fd59977 |
1115 | } |
1116 | |
7fd59977 |
1117 | // Function name : GeomSources::gpTest16 |
1118 | // Description : |
1119 | // Return type : void |
1120 | // Argument : CGeometryDoc* aDoc |
1121 | void GeomSources::gpTest16(CGeometryDoc* aDoc) |
1122 | { |
5c1f974e |
1123 | DisplayType TheDisplayType = No2D3D; |
1124 | PreProcess(aDoc,TheDisplayType); |
7fd59977 |
1125 | //============================================================== |
1126 | |
5c1f974e |
1127 | gp_Pnt P1(1,2,3); |
1128 | gp_Pnt P2(5,4,6); |
1129 | gp_Vec V1 (P1,P2); |
1130 | |
1131 | gp_Pnt P3(10,4,7); |
1132 | gp_Pnt P4(2,0,1); |
1133 | gp_Vec V2 (P3,P4); |
1134 | |
1135 | Standard_Boolean result = |
1136 | V1.IsOpposite(V2,Precision::Angular()); |
1137 | // result should be true |
7fd59977 |
1138 | |
1139 | //============================================================== |
5c1f974e |
1140 | TCollection_AsciiString Message (" \ |
7fd59977 |
1141 | \n\ |
1142 | gp_Pnt P1(1,2,3); \n\ |
1143 | gp_Pnt P2(5,4,6); \n\ |
1144 | gp_Vec V1 (P1,P2); \n\ |
1145 | \n\ |
1146 | gp_Pnt P3(10,4,7); \n\ |
1147 | gp_Pnt P4(2,0,1); \n\ |
1148 | gp_Vec V2 (P3,P4); \n\ |
1149 | \n\ |
1150 | Standard_Boolean result = \n\ |
1151 | V1.IsOpposite(V2,Precision::Angular()); \n\ |
1152 | // result should be true \n\ |
1153 | \n"); |
5c1f974e |
1154 | AddSeparator(aDoc,Message); |
1155 | //-------------------------------------------------------------- |
7fd59977 |
1156 | |
5c1f974e |
1157 | DisplayPoint(aDoc,P1,"P1",false,0.5); |
1158 | DisplayPoint(aDoc,P2,"P2",false,0.5); |
1159 | DisplayPoint(aDoc,P3,"P3",false,0.5); |
1160 | DisplayPoint(aDoc,P4,"P4",false,0.5); |
7fd59977 |
1161 | |
5c1f974e |
1162 | Handle(ISession_Direction) aDirection1 = new ISession_Direction(P1,V1); |
1163 | aDoc->GetAISContext()->Display(aDirection1, Standard_False); |
7fd59977 |
1164 | |
5c1f974e |
1165 | Handle(ISession_Direction) aDirection2 = new ISession_Direction(P3,V2); |
1166 | aDoc->GetAISContext()->Display(aDirection2, Standard_False); |
7fd59977 |
1167 | |
5c1f974e |
1168 | Message += "result = "; |
1169 | if (result) Message += "True \n"; else Message += "False \n"; |
7fd59977 |
1170 | |
576f8b11 |
1171 | PostProcess(aDoc,ID_BUTTON_Test_16,TheDisplayType,Message); |
7fd59977 |
1172 | } |
1173 | |
1174 | // Function name : GeomSources::gpTest17 |
1175 | // Description : |
1176 | // Return type : void |
1177 | // Argument : CGeometryDoc* aDoc |
1178 | void GeomSources::gpTest17(CGeometryDoc* aDoc) |
1179 | { |
5c1f974e |
1180 | DisplayType TheDisplayType = No2D3D; |
1181 | PreProcess(aDoc,TheDisplayType); |
1182 | //============================================================== |
1183 | |
1184 | gp_Dir D1(1,2,3); |
1185 | gp_Dir D2(3,4,5); |
1186 | Standard_Real ang = D1.Angle(D2); |
1187 | // the result is in radians in the range [0,PI] |
7fd59977 |
1188 | |
5c1f974e |
1189 | //============================================================== |
1190 | TCollection_AsciiString Message (" \ |
7fd59977 |
1191 | \n\ |
1192 | gp_Dir D1(1,2,3); \n\ |
1193 | gp_Dir D2(3,4,5); \n\ |
1194 | Standard_Real ang = D1.Angle(D2); \n\ |
1195 | // the result is in radians in the range [0,PI] \n\ |
1196 | \n"); |
5c1f974e |
1197 | AddSeparator(aDoc,Message); |
1198 | //-------------------------------------------------------------- |
7fd59977 |
1199 | |
5c1f974e |
1200 | Handle(ISession_Direction) aDirection1 = new ISession_Direction(gp_Pnt(0,0,0),D1,3); |
1201 | aDoc->GetAISContext()->Display(aDirection1, Standard_False); |
7fd59977 |
1202 | |
5c1f974e |
1203 | Handle(ISession_Direction) aDirection2 = new ISession_Direction(gp_Pnt(0,0,0),D2,3); |
1204 | aDoc->GetAISContext()->Display(aDirection2, Standard_False); |
7fd59977 |
1205 | |
5c1f974e |
1206 | cout<<" D1.Angle(D2) : "<<ang<<endl; |
1207 | |
1208 | TCollection_AsciiString Message2 (ang); |
1209 | TCollection_AsciiString Message3 (ang/M_PI/180); |
1210 | |
1211 | Message += " ang = "; |
1212 | Message += Message2; |
1213 | Message += " radian \n"; |
1214 | Message += " ang/PI180 = "; |
1215 | Message += Message3; |
1216 | Message += " degree \n"; |
1217 | |
576f8b11 |
1218 | PostProcess(aDoc,ID_BUTTON_Test_17,TheDisplayType,Message); |
7fd59977 |
1219 | } |
1220 | |
1221 | // Function name : GeomSources::gpTest18 |
1222 | // Description : |
1223 | // Return type : void |
1224 | // Argument : CGeometryDoc* aDoc |
1225 | void GeomSources::gpTest18(CGeometryDoc* aDoc) |
1226 | { |
5c1f974e |
1227 | DisplayType TheDisplayType = a2DNo3D; |
1228 | PreProcess(aDoc,TheDisplayType); |
1229 | //============================================================== |
1230 | |
1231 | gp_Pnt2d P(2,3); |
1232 | gp_Dir2d D(4,5); |
1233 | gp_Ax22d A(P,D); |
1234 | gp_Parab2d Para(A,6); |
1235 | // P is the vertex point |
1236 | // P and D give the axis of symmetry |
1237 | // 6 is the focal length of the parabola |
1238 | |
1239 | //============================================================== |
1240 | TCollection_AsciiString Message (" \ |
7fd59977 |
1241 | \n\ |
1242 | gp_Pnt2d P(2,3); \n\ |
1243 | gp_Dir2d D(4,5); \n\ |
1244 | gp_Ax22d A(P,D); \n\ |
1245 | gp_Parab2d Para(A,6); \n\ |
1246 | // P is the vertex point \n\ |
1247 | // P and D give the axis of symmetry \n\ |
1248 | // 6 is the focal length of the parabola \n\ |
1249 | \n"); |
5c1f974e |
1250 | AddSeparator(aDoc,Message); |
1251 | //-------------------------------------------------------------- |
1252 | |
1253 | DisplayPoint(aDoc,P,"P",false,0.5,0,3); |
1254 | |
1255 | Handle(ISession_Direction) aDirection = new ISession_Direction(P,D,200); |
1256 | aDoc->GetISessionContext()->Display(aDirection,Standard_False); |
1257 | Handle(Geom2d_Parabola) aParabola = GCE2d_MakeParabola(Para); |
1258 | Handle(Geom2d_TrimmedCurve) aTrimmedCurve = new Geom2d_TrimmedCurve(aParabola,-100,100); |
1259 | Handle(ISession2D_Curve) aCurve = new ISession2D_Curve(aTrimmedCurve); |
1260 | //aCurve->SetColorIndex(3); |
1261 | aDoc->GetISessionContext()->Display(aCurve, Standard_False); |
1262 | |
1263 | Message += " The entity A of type gp_Ax22d is not displayable \n "; |
1264 | Message += " The entity D of type gp_Dir2d is displayed as a vector \n ( mean with a length != 1 ) \n "; |
576f8b11 |
1265 | PostProcess(aDoc,ID_BUTTON_Test_18,TheDisplayType,Message); |
7fd59977 |
1266 | } |
1267 | |
1268 | // Function name : GeomSources::gpTest19 |
1269 | // Description : |
1270 | // Return type : void |
1271 | // Argument : CGeometryDoc* aDoc |
1272 | void GeomSources::gpTest19(CGeometryDoc* aDoc) |
1273 | { |
5c1f974e |
1274 | DisplayType TheDisplayType = No2D3D; |
1275 | PreProcess(aDoc,TheDisplayType); |
1276 | //============================================================== |
1277 | |
1278 | gp_Pnt P1(2,3,4); |
1279 | gp_Dir D(4,5,6); |
1280 | gp_Ax3 A(P1,D); |
1281 | Standard_Boolean IsDirectA = A.Direct(); |
1282 | |
1283 | gp_Dir AXDirection = A.XDirection() ; |
1284 | gp_Dir AYDirection = A.YDirection() ; |
1285 | |
1286 | gp_Pnt P2(5,3,4); |
1287 | gp_Ax3 A2(P2,D); |
1288 | A2.YReverse(); |
1289 | // axis3 is now left handed |
1290 | Standard_Boolean IsDirectA2 = A2.Direct(); |
1291 | |
1292 | gp_Dir A2XDirection = A2.XDirection() ; |
1293 | gp_Dir A2YDirection = A2.YDirection() ; |
1294 | |
1295 | //============================================================== |
1296 | TCollection_AsciiString Message (" \ |
7fd59977 |
1297 | \n\ |
1298 | gp_Pnt P1(2,3,4); \n\ |
1299 | gp_Dir D(4,5,6); \n\ |
1300 | gp_Ax3 A(P,D); \n\ |
1301 | Standard_Boolean IsDirectA = A.Direct(); \n\ |
1302 | \n\ |
1303 | gp_Dir AXDirection = A.XDirection() ; \n\ |
1304 | gp_Dir AYDirection = A.YDirection() ; \n\ |
1305 | \n\ |
1306 | gp_Pnt P2(5,3,4); \n\ |
1307 | gp_Ax3 A2(P2,D); \n\ |
1308 | A2.YReverse(); \n\ |
1309 | // axis3 is now left handed \n\ |
1310 | Standard_Boolean IsDirectA2 = A2.Direct(); \n\ |
1311 | \n\ |
1312 | gp_Dir A2XDirection = A2.XDirection() ; \n\ |
1313 | gp_Dir A2YDirection = A2.YDirection() ; \n\ |
1314 | \n"); |
5c1f974e |
1315 | AddSeparator(aDoc,Message); |
1316 | //-------------------------------------------------------------- |
1317 | |
e5b32824 |
1318 | // Set style for vector lines |
1319 | Handle(Prs3d_LineAspect) anAxesAspect = new Prs3d_LineAspect (Quantity_NOC_GREEN, Aspect_TOL_SOLID, 1.0); |
1320 | |
5c1f974e |
1321 | DisplayPoint(aDoc,P1,"P1",false,0.1); |
1322 | Handle(ISession_Direction) aDirection = new ISession_Direction(P1,D,2); |
1323 | aDoc->GetAISContext()->Display(aDirection, Standard_False); |
1324 | |
1325 | Handle(ISession_Direction) aDirection2 = new ISession_Direction(P1,AXDirection,2); |
5c573e69 |
1326 | aDirection2->SetText("A.XDirection"); |
e5b32824 |
1327 | aDirection2->SetLineAspect (anAxesAspect); |
5c1f974e |
1328 | aDoc->GetAISContext()->Display(aDirection2, Standard_False); |
1329 | Handle(ISession_Direction) aDirection3 = new ISession_Direction(P1,AYDirection,2); |
5c573e69 |
1330 | aDirection3->SetText("A.YDirection"); |
e5b32824 |
1331 | aDirection3->SetLineAspect (anAxesAspect); |
5c1f974e |
1332 | aDoc->GetAISContext()->Display(aDirection3, Standard_False); |
1333 | |
1334 | DisplayPoint(aDoc,P2,"P2",false,0.1); |
1335 | Handle(ISession_Direction) aDirection4 = new ISession_Direction(P2,D,2); |
1336 | aDoc->GetAISContext()->Display(aDirection4, Standard_False); |
1337 | |
1338 | Handle(ISession_Direction) aDirection5 = new ISession_Direction(P2,A2XDirection,2); |
5c573e69 |
1339 | aDirection5->SetText("A2 XDirection"); |
e5b32824 |
1340 | aDirection5->SetLineAspect (anAxesAspect); |
5c1f974e |
1341 | aDoc->GetAISContext()->Display(aDirection5, Standard_False); |
1342 | Handle(ISession_Direction) aDirection6 = new ISession_Direction(P2,A2YDirection,2); |
5c573e69 |
1343 | aDirection6->SetText("A2 YDirection"); |
e5b32824 |
1344 | aDirection6->SetLineAspect (anAxesAspect); |
5c1f974e |
1345 | aDoc->GetAISContext()->Display(aDirection6, Standard_False); |
1346 | |
1347 | Message += "IsDirectA = "; |
1348 | if(IsDirectA) |
1349 | Message += "True = Right Handed \n"; |
1350 | else |
1351 | Message += "False = Left Handed \n"; |
1352 | |
1353 | Message += "IsDirectA2 = "; |
1354 | if(IsDirectA2) |
1355 | Message += "True = Right Handed \n"; |
1356 | else |
1357 | Message += "False = Left Handed \n"; |
1358 | |
576f8b11 |
1359 | PostProcess(aDoc,ID_BUTTON_Test_19,TheDisplayType,Message); |
7fd59977 |
1360 | } |
1361 | |
1362 | // Function name : GeomSources::gpTest20 |
1363 | // Description : |
1364 | // Return type : void |
1365 | // Argument : CGeometryDoc* aDoc |
1366 | void GeomSources::gpTest20(CGeometryDoc* aDoc) |
1367 | { |
5c1f974e |
1368 | DisplayType TheDisplayType = a2DNo3D; |
1369 | PreProcess(aDoc,TheDisplayType); |
1370 | //============================================================== |
1371 | |
1372 | TColgp_Array1OfPnt2d array (1,5); // sizing array |
1373 | array.SetValue(1,gp_Pnt2d (0,0)); |
1374 | array.SetValue(2,gp_Pnt2d (1,2)); |
1375 | array.SetValue(3,gp_Pnt2d (2,3)); |
1376 | array.SetValue(4,gp_Pnt2d (4,3)); |
1377 | array.SetValue(5,gp_Pnt2d (5,5)); |
1378 | Handle(Geom2d_BSplineCurve) SPL1 = |
1379 | Geom2dAPI_PointsToBSpline(array); |
7fd59977 |
1380 | |
5c1f974e |
1381 | Handle(TColgp_HArray1OfPnt2d) harray = |
1382 | new TColgp_HArray1OfPnt2d (1,5); // sizing harray |
1383 | harray->SetValue(1,gp_Pnt2d (7+ 0,0)); |
1384 | harray->SetValue(2,gp_Pnt2d (7+ 1,2)); |
1385 | harray->SetValue(3,gp_Pnt2d (7+ 2,3)); |
1386 | harray->SetValue(4,gp_Pnt2d (7+ 4,3)); |
1387 | harray->SetValue(5,gp_Pnt2d (7+ 5,5)); |
1388 | Geom2dAPI_Interpolate anInterpolation(harray,Standard_False,0.01); |
1389 | anInterpolation.Perform(); |
1390 | Handle(Geom2d_BSplineCurve) SPL2 = anInterpolation.Curve(); |
1391 | |
1392 | Handle(TColgp_HArray1OfPnt2d) harray2 = |
1393 | new TColgp_HArray1OfPnt2d (1,5); // sizing harray |
1394 | harray2->SetValue(1,gp_Pnt2d (11+ 0,0)); |
1395 | harray2->SetValue(2,gp_Pnt2d (11+ 1,2)); |
1396 | harray2->SetValue(3,gp_Pnt2d (11+ 2,3)); |
1397 | harray2->SetValue(4,gp_Pnt2d (11+ 4,3)); |
1398 | harray2->SetValue(5,gp_Pnt2d (11+ 5,5)); |
1399 | Geom2dAPI_Interpolate anInterpolation2(harray2,Standard_True,0.01); |
1400 | anInterpolation2.Perform(); |
1401 | Handle(Geom2d_BSplineCurve) SPL3 = anInterpolation2.Curve(); |
1402 | // redefined C++ operator allows these assignments |
1403 | |
1404 | //============================================================== |
1405 | TCollection_AsciiString Message (" \ |
7fd59977 |
1406 | \n\ |
1407 | TColgp_Array1OfPnt2d array (1,5); // sizing array \n\ |
1408 | array.SetValue(1,gp_Pnt2d (0,0)); \n\ |
1409 | array.SetValue(2,gp_Pnt2d (1,2)); \n\ |
1410 | array.SetValue(3,gp_Pnt2d (2,3)); \n\ |
1411 | array.SetValue(4,gp_Pnt2d (4,3)); \n\ |
1412 | array.SetValue(5,gp_Pnt2d (5,5)); \n\ |
1413 | Handle(Geom2d_BSplineCurve) SPL1 = \n\ |
1414 | Geom2dAPI_PointsToBSpline(array); \n\ |
1415 | \n\ |
1416 | Handle(TColgp_HArray1OfPnt2d) harray = \n\ |
1417 | new TColgp_HArray1OfPnt2d (1,5); // sizing harray \n\ |
1418 | harray->SetValue(1,gp_Pnt2d (7+ 0,0)); \n\ |
1419 | harray->SetValue(2,gp_Pnt2d (7+ 1,2)); \n\ |
1420 | harray->SetValue(3,gp_Pnt2d (7+ 2,3)); \n\ |
1421 | harray->SetValue(4,gp_Pnt2d (7+ 4,3)); \n\ |
1422 | harray->SetValue(5,gp_Pnt2d (7+ 5,5)); \n\ |
1423 | Geom2dAPI_Interpolate anInterpolation(harray,Standard_False,0.01); \n\ |
1424 | anInterpolation.Perform(); \n\ |
1425 | Handle(Geom2d_BSplineCurve) SPL2 = anInterpolation.Curve(); \n\ |
1426 | \n\ |
1427 | Handle(TColgp_HArray1OfPnt2d) harray2 = \n\ |
1428 | new TColgp_HArray1OfPnt2d (1,5); // sizing harray \n"); |
5c1f974e |
1429 | Message += "\ |
7fd59977 |
1430 | harray2->SetValue(1,gp_Pnt2d (11+ 0,0)); \n\ |
1431 | harray2->SetValue(2,gp_Pnt2d (11+ 1,2)); \n\ |
1432 | harray2->SetValue(3,gp_Pnt2d (11+ 2,3)); \n\ |
1433 | harray2->SetValue(4,gp_Pnt2d (11+ 4,3)); \n\ |
1434 | harray2->SetValue(5,gp_Pnt2d (11+ 5,5)); \n\ |
1435 | Geom2dAPI_Interpolate anInterpolation2(harray2,Standard_True,0.01); \n\ |
1436 | anInterpolation2.Perform(); \n\ |
1437 | Handle(Geom2d_BSplineCurve) SPL3 = anInterpolation2.Curve(); \n\ |
1438 | // redefined C++ operator allows these assignments \n\ |
1439 | \n"; |
5c1f974e |
1440 | AddSeparator(aDoc,Message); |
1441 | //-------------------------------------------------------------- |
1442 | TCollection_AsciiString aString; |
7fd59977 |
1443 | Standard_Integer i; |
5c1f974e |
1444 | for(i = array.Lower();i<=array.Upper();i++) |
1445 | { |
1446 | gp_Pnt2d P = array(i); |
1447 | TCollection_AsciiString Message2 (i); |
1448 | aString = "array ";aString += Message2; |
1449 | DisplayPoint(aDoc,P,aString.ToCString(),false,0.5); |
1450 | } |
1451 | for( int i = harray->Lower();i<=harray->Upper();i++) |
1452 | { |
1453 | gp_Pnt2d P = harray->Value(i); |
1454 | TCollection_AsciiString Message2 (i); |
1455 | aString = "harray ";aString += Message2; |
1456 | DisplayPoint(aDoc,P,aString.ToCString(),false,0.5); |
1457 | } |
1458 | for( i = harray2->Lower();i<=harray2->Upper();i++) |
1459 | { |
1460 | gp_Pnt2d P = harray2->Value(i); |
1461 | TCollection_AsciiString Message2 (i); |
1462 | aString = "harray2 ";aString += Message2; |
1463 | DisplayPoint(aDoc,P,aString.ToCString(),false,0.5); |
1464 | } |
1465 | |
1466 | if (!SPL1.IsNull()) |
1467 | { |
1468 | Handle(ISession2D_Curve) aCurve = new ISession2D_Curve(SPL1); |
1469 | aCurve->SetColorIndex(3); |
1470 | aDoc->GetISessionContext()->Display(aCurve, Standard_False); |
1471 | } |
1472 | else |
576f8b11 |
1473 | MessageBoxW (AfxGetApp()->m_pMainWnd->m_hWnd, L"SPL1.IsNull()", L"CasCade Error", MB_ICONERROR); |
7fd59977 |
1474 | |
5c1f974e |
1475 | if (!SPL2.IsNull()) |
1476 | { |
1477 | Handle(ISession2D_Curve) aCurve2 = new ISession2D_Curve(SPL2); |
1478 | aCurve2->SetColorIndex(5); |
1479 | aDoc->GetISessionContext()->Display(aCurve2, Standard_False); |
1480 | } |
1481 | else |
576f8b11 |
1482 | MessageBoxW (AfxGetApp()->m_pMainWnd->m_hWnd, L"SPL2.IsNull()", L"CasCade Error", MB_ICONERROR); |
7fd59977 |
1483 | |
5c1f974e |
1484 | if (!SPL3.IsNull()) |
1485 | { |
1486 | Handle(ISession2D_Curve) aCurve2 = new ISession2D_Curve(SPL3); |
1487 | aCurve2->SetColorIndex(6); |
1488 | aDoc->GetISessionContext()->Display(aCurve2, Standard_False); |
1489 | } |
1490 | else |
576f8b11 |
1491 | MessageBoxW (AfxGetApp()->m_pMainWnd->m_hWnd, L"SPL3.IsNull()", L"CasCade Error", MB_ICONERROR); |
5c1f974e |
1492 | |
1493 | Message += " SPL1 is Red \n"; |
1494 | Message += " SPL2 is Blue \n"; |
1495 | Message += " SPL3 is Yellow \n"; |
1496 | |
576f8b11 |
1497 | PostProcess(aDoc,ID_BUTTON_Test_20,TheDisplayType,Message); |
7fd59977 |
1498 | } |
1499 | |
1500 | void GeomSources::gpTest21(CGeometryDoc* aDoc) |
1501 | { |
5c1f974e |
1502 | DisplayType TheDisplayType = a2DNo3D; |
1503 | PreProcess(aDoc,TheDisplayType); |
1504 | |
1505 | //============================================================== |
1506 | |
1507 | gp_Pnt2d P1(-184, 101); |
1508 | gp_Pnt2d P2(20 ,84); |
1509 | Standard_Real aheight = 1; |
1510 | FairCurve_Batten B (P1,P2,aheight); |
1511 | B.SetAngle1(22*M_PI/180); |
1512 | B.SetAngle2(44*M_PI/180); |
1513 | FairCurve_AnalysisCode anAnalysisCode; |
1514 | B.Compute(anAnalysisCode); |
1515 | Handle(Geom2d_BSplineCurve) C = B.Curve(); |
1516 | |
1517 | //============================================================== |
1518 | TCollection_AsciiString Message (" \ |
1519 | \n\ |
1520 | gp_Pnt2d P1(-184, 101); \n\ |
7fd59977 |
1521 | gp_Pnt2d P2(20 ,84); \n\ |
1522 | Standard_Real aheight = 1; \n\ |
1523 | FairCurve_Batten B (P1,P2,aheight); \n\ |
1524 | B.SetAngle1(22*PI180); \n\ |
1525 | B.SetAngle2(44*PI180); \n\ |
1526 | FairCurve_AnalysisCode anAnalysisCode; \n\ |
1527 | B.Compute(anAnalysisCode); \n\ |
1528 | Handle(Geom2d_BSplineCurve) C = B.Curve(); \n\ |
1529 | \n"); |
5c1f974e |
1530 | AddSeparator(aDoc,Message); |
1531 | //-------------------------------------------------------------- |
7fd59977 |
1532 | |
5c1f974e |
1533 | DisplayCurveAndCurvature(aDoc,C,6,Standard_False); |
7fd59977 |
1534 | |
576f8b11 |
1535 | PostProcess(aDoc,ID_BUTTON_Test_21,TheDisplayType,Message); |
7fd59977 |
1536 | } |
1537 | |
1538 | void GeomSources::gpTest22(CGeometryDoc* aDoc) |
1539 | { |
5c1f974e |
1540 | DisplayType TheDisplayType = a2DNo3D; |
1541 | PreProcess(aDoc,TheDisplayType); |
1542 | |
1543 | //============================================================== |
7fd59977 |
1544 | |
5c1f974e |
1545 | gp_Pnt2d P1(-184, 41); |
1546 | gp_Pnt2d P2(20 ,24); |
1547 | Standard_Real aheight = 1; |
1548 | FairCurve_MinimalVariation MV (P1,P2,aheight); |
1549 | MV.SetAngle1(22*M_PI/180); |
1550 | MV.SetAngle2(44*M_PI/180); |
1551 | |
1552 | FairCurve_AnalysisCode anAnalysisCode; |
1553 | MV.Compute(anAnalysisCode); |
1554 | |
1555 | Handle(Geom2d_BSplineCurve) C = MV.Curve(); |
1556 | |
1557 | //============================================================== |
1558 | TCollection_AsciiString Message (" \ |
7fd59977 |
1559 | \n\ |
1560 | gp_Pnt2d P1(-184, 41); \n\ |
1561 | gp_Pnt2d P2(20 ,24); \n\ |
1562 | Standard_Real aheight = 1; \n\ |
1563 | FairCurve_MinimalVariation MV (P1,P2,aheight); \n\ |
1564 | MV.SetAngle1(22*PI180); \n\ |
1565 | MV.SetAngle2(44*PI180); \n\ |
1566 | \n\ |
1567 | FairCurve_AnalysisCode anAnalysisCode; \n\ |
1568 | MV.Compute(anAnalysisCode); \n\ |
1569 | \n\ |
1570 | Handle(Geom2d_BSplineCurve) C = MV.Curve(); \n\ |
1571 | \n"); |
5c1f974e |
1572 | AddSeparator(aDoc,Message); |
1573 | //-------------------------------------------------------------- |
7fd59977 |
1574 | |
5c1f974e |
1575 | DisplayCurveAndCurvature(aDoc,C,7,Standard_False); |
1576 | DisplayPoint(aDoc,P1,"P1",false,0.5); |
1577 | DisplayPoint(aDoc,P2,"P2",false,0.5); |
7fd59977 |
1578 | |
576f8b11 |
1579 | PostProcess(aDoc,ID_BUTTON_Test_22,TheDisplayType,Message); |
7fd59977 |
1580 | } |
1581 | |
7fd59977 |
1582 | // Function name : GeomSources::gpTest23 |
1583 | // Description : |
1584 | // Return type : void |
1585 | // Argument : CGeometryDoc* aDoc |
1586 | void GeomSources::gpTest23(CGeometryDoc* aDoc) |
1587 | { |
5c1f974e |
1588 | DisplayType TheDisplayType = a2DNo3D; |
1589 | PreProcess(aDoc,TheDisplayType); |
1590 | //============================================================== |
1591 | |
1592 | Standard_Real major = 12; |
1593 | Standard_Real minor = 4; |
1594 | gp_Ax2d axis = gp::OX2d(); |
1595 | Handle(Geom2d_Ellipse) E = GCE2d_MakeEllipse (axis,major,minor); |
1596 | Handle(Geom2d_TrimmedCurve) TC = new Geom2d_TrimmedCurve(E,-1,2); |
1597 | |
1598 | // The segment goes in the direction Vfrom P1 |
1599 | // to the point projected on this line by P2 |
1600 | // In the example (0,6). |
1601 | Handle(Geom2d_BSplineCurve) SPL = |
1602 | Geom2dConvert::CurveToBSplineCurve(TC); |
1603 | |
1604 | //============================================================== |
1605 | TCollection_AsciiString Message (" \ |
7fd59977 |
1606 | \n\ |
1607 | Standard_Real major = 12; \n\ |
1608 | Standard_Real minor = 4; \n\ |
1609 | gp_Ax2d axis = gp::OX2d(); \n\ |
1610 | Handle(Geom2d_Ellipse) E = GCE2d_MakeEllipse (axis,major,minor); \n\ |
1611 | \n\ |
1612 | Handle(Geom2d_TrimmedCurve) TC = new Geom2d_TrimmedCurve(E,-1,2); \n\ |
1613 | \n\ |
1614 | // The segment goes in the direction Vfrom P1 \n\ |
1615 | // to the point projected on this line by P2 \n\ |
1616 | // In the example (0,6). \n\ |
1617 | Handle(Geom2d_BSplineCurve) SPL = \n\ |
1618 | Geom2dConvert::CurveToBSplineCurve(TC); \n\ |
1619 | \n"); |
5c1f974e |
1620 | AddSeparator(aDoc,Message); |
1621 | //-------------------------------------------------------------- |
7fd59977 |
1622 | |
5c1f974e |
1623 | Handle(ISession2D_Curve) aCurve = new ISession2D_Curve(E); |
1624 | aCurve->SetColorIndex(3); // Red |
1625 | aCurve->SetTypeOfLine(Aspect_TOL_DOTDASH); |
1626 | aDoc->GetISessionContext()->Display(aCurve, Standard_False); |
7fd59977 |
1627 | |
5c1f974e |
1628 | Handle(ISession2D_Curve) aCurve2 = new ISession2D_Curve(SPL); |
1629 | aDoc->GetISessionContext()->Display(aCurve2, Standard_False); |
7fd59977 |
1630 | |
576f8b11 |
1631 | PostProcess(aDoc,ID_BUTTON_Test_23,TheDisplayType,Message); |
7fd59977 |
1632 | } |
1633 | |
7fd59977 |
1634 | // Function name : GeomSources::gpTest24 |
1635 | // Description : |
1636 | // Return type : void |
1637 | // Argument : CGeometryDoc* aDoc |
1638 | void GeomSources::gpTest24(CGeometryDoc* aDoc) |
1639 | { |
5c1f974e |
1640 | DisplayType TheDisplayType = a2D3D; |
1641 | PreProcess(aDoc,TheDisplayType); |
1642 | //============================================================== |
1643 | |
1644 | Standard_Real radius = 5; |
1645 | gp_Ax2d ax2d(gp_Pnt2d(2,3),gp_Dir2d(1,0)); |
1646 | |
1647 | Handle(Geom2d_Circle) circ2d = |
1648 | new Geom2d_Circle(ax2d,radius); |
1649 | |
1650 | gp_Ax2d circ2dXAxis = circ2d->XAxis(); |
1651 | |
1652 | // create a 3D curve in a given plane |
1653 | Handle(Geom_Curve) C3D = |
1654 | GeomAPI::To3d(circ2d,gp_Pln(gp_Ax3(gp::XOY()))); |
1655 | Handle(Geom_Circle) C3DCircle = |
1656 | Handle(Geom_Circle)::DownCast(C3D); |
1657 | |
1658 | gp_Ax1 C3DCircleXAxis = C3DCircle->XAxis(); |
1659 | |
1660 | // project it to a 2D curve in another plane |
1661 | |
1662 | gp_Pln ProjectionPlane(gp_Pnt(1,1,0),gp_Dir( 1,1,1 )); |
1663 | |
1664 | Handle(Geom2d_Curve) C2D = |
1665 | GeomAPI::To2d(C3D,ProjectionPlane); |
1666 | |
1667 | Handle(Geom2d_Circle) C2DCircle = |
1668 | Handle(Geom2d_Circle)::DownCast(C2D); |
1669 | gp_Ax2d C2DCircleXAxis = C2DCircle->XAxis(); |
1670 | |
1671 | //============================================================== |
1672 | TCollection_AsciiString Message (" \ |
7fd59977 |
1673 | \n\ |
1674 | Standard_Real radius = 5; \n\ |
1675 | gp_Ax2d ax2d(gp_Pnt2d(2,3),gp_Dir2d(1,0)); \n\ |
1676 | \n\ |
1677 | Handle(Geom2d_Circle) circ2d = \n\ |
1678 | new Geom2d_Circle(ax2d,radius); \n\ |
1679 | \n\ |
1680 | gp_Ax2d circ2dXAxis = circ2d->XAxis(); \n\ |
1681 | \n\ |
1682 | // create a 3D curve in a given plane \n\ |
1683 | Handle(Geom_Curve) C3D = \n\ |
1684 | GeomAPI::To3d(circ2d,gp_Pln(gp_Ax3(gp::XOY()))); \n\ |
1685 | Handle(Geom_Circle) C3DCircle = \n\ |
1686 | Handle(Geom_Circle)::DownCast(C3D); \n\ |
1687 | \n\ |
1688 | gp_Ax1 C3DCircleXAxis = C3DCircle->XAxis(); \n\ |
1689 | \n\ |
1690 | // project it to a 2D curve in another plane \n\ |
1691 | \n\ |
1692 | gp_Pln ProjectionPlane(gp_Pnt(1,1,0),gp_Dir( 1,1,1 )); \n\ |
1693 | \n\ |
1694 | Handle(Geom2d_Curve) C2D = \n\ |
1695 | GeomAPI::To2d(C3D,ProjectionPlane); \n\ |
1696 | \n\ |
1697 | Handle(Geom2d_Circle) C2DCircle = \n\ |
1698 | Handle(Geom2d_Circle)::DownCast(C2D); \n\ |
1699 | gp_Ax2d C2DCircleXAxis = C2DCircle->XAxis(); \n\ |
1700 | \n"); |
5c1f974e |
1701 | AddSeparator(aDoc,Message); |
1702 | //-------------------------------------------------------------- |
1703 | Handle(Geom_Plane) aPlane = GC_MakePlane(gp_Pln(gp_Ax3(gp::XOY()))).Value(); |
1704 | Handle(Geom_RectangularTrimmedSurface) aSurface= new Geom_RectangularTrimmedSurface(aPlane,-8.,8.,-12.,12.); |
1705 | DisplaySurface(aDoc,aSurface); |
1706 | |
1707 | Handle(Geom_Plane) aProjectionPlane = GC_MakePlane(ProjectionPlane).Value(); |
1708 | Handle(Geom_RectangularTrimmedSurface) aProjectionPlaneSurface= |
1709 | new Geom_RectangularTrimmedSurface(aProjectionPlane,-8.,8.,-12.,12.); |
1710 | |
1711 | DisplaySurface(aDoc,aProjectionPlaneSurface); |
1712 | |
1713 | Standard_CString aC3DEntityTypeName = C3D->DynamicType()->Name(); |
1714 | Standard_CString aC2DEntityTypeName = C2D->DynamicType()->Name(); |
1715 | |
1716 | Message += " C3D->DynamicType()->Name() = "; |
1717 | Message += aC3DEntityTypeName; Message += " \n"; |
1718 | Message += " C2D->DynamicType()->Name() = "; |
1719 | Message += aC2DEntityTypeName; Message += " \n"; |
1720 | |
1721 | DisplayCurve(aDoc,circ2d,4,false); |
9e3ca93a |
1722 | DisplayCurve(aDoc,Handle(Geom_Curve)::DownCast(C3D),Quantity_NOC_YELLOW,false); |
5c1f974e |
1723 | DisplayCurve(aDoc,C2D,5,false); |
1724 | |
5c573e69 |
1725 | Handle(ISession_Direction) aC3DCircleXAxisDirection = new ISession_Direction(C3DCircleXAxis.Location(),C3DCircleXAxis.Direction(),5.2); |
5c1f974e |
1726 | aDoc->GetAISContext()->Display(aC3DCircleXAxisDirection, Standard_False); |
1727 | |
5c573e69 |
1728 | Handle(ISession_Direction) acirc2dXAxisDirection = new ISession_Direction(circ2dXAxis.Location(),circ2dXAxis.Direction(),5.2); |
5c1f974e |
1729 | aDoc->GetISessionContext()->Display(acirc2dXAxisDirection, Standard_False); |
1730 | |
5c573e69 |
1731 | Handle(ISession_Direction) aC2DCircleXAxisDirection = new ISession_Direction(C2DCircleXAxis.Location(),C2DCircleXAxis.Direction(),5.2); |
5c1f974e |
1732 | aDoc->GetISessionContext()->Display(aC2DCircleXAxisDirection, Standard_False); |
1733 | |
576f8b11 |
1734 | PostProcess(aDoc,ID_BUTTON_Test_24,TheDisplayType,Message); |
7fd59977 |
1735 | } |
1736 | |
7fd59977 |
1737 | // Function name : GeomSources::gpTest25 |
1738 | // Description : |
1739 | // Return type : void |
1740 | // Argument : CGeometryDoc* aDoc |
1741 | void GeomSources::gpTest25(CGeometryDoc* aDoc) |
1742 | { |
5c1f974e |
1743 | DisplayType TheDisplayType = a2DNo3D; |
1744 | PreProcess(aDoc,TheDisplayType); |
1745 | |
1746 | //============================================================== |
1747 | |
1748 | Handle(TColgp_HArray1OfPnt2d) harray = |
1749 | new TColgp_HArray1OfPnt2d (1,5); // sizing harray |
1750 | harray->SetValue(1,gp_Pnt2d (0,0)); |
1751 | harray->SetValue(2,gp_Pnt2d (-3,1)); |
1752 | harray->SetValue(3,gp_Pnt2d (-2,5)); |
1753 | harray->SetValue(4,gp_Pnt2d (2,9)); |
1754 | harray->SetValue(5,gp_Pnt2d (-4,14)); |
1755 | |
1756 | Geom2dAPI_Interpolate anInterpolation(harray,Standard_False,0.01); |
1757 | anInterpolation.Perform(); |
1758 | Handle(Geom2d_BSplineCurve) SPL = anInterpolation.Curve(); |
1759 | |
1760 | gp_Pnt2d P1(-1,-2); |
1761 | gp_Pnt2d P2(0,15); |
1762 | gp_Dir2d V1 = gp::DY2d(); |
1763 | Handle(Geom2d_TrimmedCurve) TC1 = |
1764 | GCE2d_MakeSegment(P1,V1,P2); |
1765 | |
1766 | Standard_Real tolerance = Precision::Confusion(); |
1767 | Geom2dAPI_InterCurveCurve ICC (SPL,TC1,tolerance); |
1768 | Standard_Integer NbPoints =ICC.NbPoints(); |
1769 | gp_Pnt2d PK; |
1770 | |
1771 | for (Standard_Integer k = 1;k<=NbPoints;k++) |
1772 | { |
1773 | PK = ICC.Point(k); |
1774 | // do something with each intersection point |
1775 | } |
1776 | |
1777 | //============================================================== |
1778 | TCollection_AsciiString Message (" \ |
7fd59977 |
1779 | \n\ |
1780 | Handle(TColgp_HArray1OfPnt2d) harray = \n\ |
1781 | new TColgp_HArray1OfPnt2d (1,5); // sizing harray \n\ |
1782 | harray->SetValue(1,gp_Pnt2d (0,0)); \n\ |
1783 | harray->SetValue(2,gp_Pnt2d (-3,1)); \n\ |
1784 | harray->SetValue(3,gp_Pnt2d (-2,5)); \n\ |
1785 | harray->SetValue(4,gp_Pnt2d (2,9)); \n\ |
1786 | harray->SetValue(5,gp_Pnt2d (-4,14)); \n\ |
1787 | \n\ |
1788 | Geom2dAPI_Interpolate anInterpolation(harray,Standard_False,0.01); \n\ |
1789 | anInterpolation.Perform(); \n\ |
1790 | Handle(Geom2d_BSplineCurve) SPL = anInterpolation.Curve(); \n\ |
1791 | \n\ |
1792 | gp_Pnt2d P1(-1,-2); \n\ |
1793 | gp_Pnt2d P2(0,15); \n\ |
1794 | gp_Dir2d V1 = gp::DY2d(); \n\ |
1795 | Handle(Geom2d_TrimmedCurve) TC1= \n\ |
1796 | GCE2d_MakeSegment(P1,V1,P2); \n\ |
1797 | \n\ |
1798 | Standard_Real tolerance = Precision::Confusion(); \n\ |
1799 | Geom2dAPI_InterCurveCurve ICC (SPL,TC1,tolerance); \n\ |
1800 | Standard_Integer NbPoints =ICC.NbPoints(); \n\ |
1801 | gp_Pnt2d PK; \n\ |
1802 | for (Standard_Integer k = 1;k<=NbPoints;k++) \n\ |
1803 | { \n\ |
1804 | PK = ICC.Point(k); \n\ |
1805 | // do something with each intersection point \n\ |
1806 | } \n\ |
1807 | \n"); |
5c1f974e |
1808 | AddSeparator(aDoc,Message); |
1809 | //-------------------------------------------------------------- |
1810 | |
1811 | Handle(ISession2D_Curve) aCurve1 = new ISession2D_Curve(SPL); |
1812 | aCurve1->SetDisplayPole(Standard_False); |
1813 | aDoc->GetISessionContext()->Display(aCurve1, Standard_False); |
1814 | Handle(ISession2D_Curve) aCurve2 = new ISession2D_Curve(TC1); |
1815 | aDoc->GetISessionContext()->Display(aCurve2, Standard_False); |
1816 | |
1817 | TCollection_AsciiString aString; |
1818 | for (Standard_Integer i = 1;i<=NbPoints;i++) |
1819 | { |
1820 | PK = ICC.Point(i); |
1821 | // do something with each intersection point |
1822 | TCollection_AsciiString Message2 (i); |
1823 | TCollection_AsciiString Message3 (PK.X()); |
1824 | TCollection_AsciiString Message4 (PK.Y()); |
1825 | aString = "PK_"; |
1826 | aString += Message2; |
1827 | |
1828 | DisplayPoint(aDoc,PK,aString.ToCString(),false,0.5); |
1829 | |
1830 | Message += "PK_"; |
1831 | Message += Message2; |
1832 | Message += " ( "; |
1833 | Message += Message3; |
1834 | Message += " , "; |
1835 | Message += Message4; |
1836 | Message += " )\n"; |
1837 | } |
1838 | |
576f8b11 |
1839 | PostProcess(aDoc,ID_BUTTON_Test_25,TheDisplayType,Message); |
7fd59977 |
1840 | } |
1841 | |
1842 | // Function name : GeomSources::gpTest26 |
1843 | // Description : |
1844 | // Return type : void |
1845 | // Argument : CGeometryDoc* aDoc |
1846 | void GeomSources::gpTest26(CGeometryDoc* aDoc) |
1847 | { |
5c1f974e |
1848 | DisplayType TheDisplayType = a2DNo3D; |
1849 | PreProcess(aDoc,TheDisplayType); |
1850 | |
1851 | //============================================================== |
1852 | |
1853 | //----------- Build TC1 ----------------------- |
1854 | gp_Pnt2d P1(0,0); gp_Pnt2d P2(2,6); |
1855 | gp_Dir2d V1 = gp::DY2d(); |
1856 | Handle(Geom2d_TrimmedCurve) TC1 = GCE2d_MakeSegment(P1,V1,P2); |
1857 | Standard_Real FP1 = TC1->FirstParameter(); |
1858 | Standard_Real LP1 = TC1->LastParameter(); |
1859 | //----------- Build TC2 ----------------------- |
1860 | gp_Pnt2d P3(-9,6.5); gp_Dir2d V2 = gp::DX2d(); |
1861 | Handle(Geom2d_TrimmedCurve) TC2 = GCE2d_MakeSegment(P3,V2,P2); |
1862 | Standard_Real FP2 = TC1->FirstParameter(); |
1863 | Standard_Real LP2 = TC1->LastParameter(); |
1864 | //----------- Extrema TC1 / TC2 --------------- |
1865 | Geom2dAPI_ExtremaCurveCurve ECC (TC1,TC2, FP1,LP1, FP2,LP2); |
1866 | Standard_Real shortestdistance =-1; |
1867 | if (ECC.NbExtrema() != 0) shortestdistance = ECC.LowerDistance(); |
1868 | //----------- Build SPL1 ---------------------- |
1869 | TColgp_Array1OfPnt2d array (1,5); // sizing array |
1870 | array.SetValue(1,gp_Pnt2d (-4,0)); array.SetValue(2,gp_Pnt2d (-7,2)); |
1871 | array.SetValue(3,gp_Pnt2d (-6,3)); array.SetValue(4,gp_Pnt2d (-4,3)); |
1872 | array.SetValue(5,gp_Pnt2d (-3,5)); |
1873 | Handle(Geom2d_BSplineCurve) SPL1 = Geom2dAPI_PointsToBSpline(array); |
1874 | Standard_Real FPSPL1 = SPL1->FirstParameter(); |
1875 | Standard_Real LPSPL1 = SPL1->LastParameter(); |
1876 | //----------- Extrema TC1 / SPL1 ------------- |
1877 | Geom2dAPI_ExtremaCurveCurve ECC2 (TC1,SPL1, FP1,LP1, FPSPL1,LPSPL1); |
1878 | Standard_Real SPL1shortestdistance =-1; |
1879 | if (ECC2.NbExtrema()!=0) SPL1shortestdistance = ECC2.LowerDistance(); |
1880 | Standard_Integer NbExtrema = ECC2.NbExtrema(); |
1881 | TColgp_Array2OfPnt2d aSolutionArray(1,NbExtrema,1,2); |
1882 | for(int i=1;i <= NbExtrema; i++) |
1883 | { |
1884 | gp_Pnt2d P1,P2; |
1885 | ECC2.Points(i,P1,P2); |
1886 | aSolutionArray(i,1) = P1; |
1887 | aSolutionArray(i,2) = P2; |
1888 | } |
1889 | |
1890 | //============================================================== |
1891 | TCollection_AsciiString Message (" \ |
7fd59977 |
1892 | //----------- Build TC1 ----------------------- \n\ |
1893 | gp_Pnt2d P1(0,0); gp_Pnt2d P2(2,6); \n\ |
1894 | gp_Dir2d V1 = gp::DY2d(); \n\ |
1895 | Handle(Geom2d_TrimmedCurve) TC1 = GCE2d_MakeSegment(P1,V1,P2); \n\ |
1896 | Standard_Real FP1 = TC1->FirstParameter(); \n\ |
1897 | Standard_Real LP1 = TC1->LastParameter(); \n\ |
1898 | //----------- Build TC2 ----------------------- \n\ |
1899 | gp_Pnt2d P3(-9,6.5); gp_Dir2d V2 = gp::DX2d(); \n\ |
1900 | Handle(Geom2d_TrimmedCurve) TC2 = GCE2d_MakeSegment(P3,V2,P2); \n\ |
1901 | Standard_Real FP2 = TC1->FirstParameter(); \n\ |
1902 | Standard_Real LP2 = TC1->LastParameter(); \n\ |
1903 | //----------- Extrema TC1 / TC2 --------------- \n\ |
1904 | Geom2dAPI_ExtremaCurveCurve ECC (TC1,TC2, FP1,LP1, FP2,LP2); \n\ |
1905 | Standard_Real shortestdistance =-1; \n\ |
1906 | if (ECC.NbExtrema() != 0) shortestdistance = ECC.LowerDistance(); \n\ |
1907 | //----------- Build SPL1 ---------------------- \n\ |
1908 | TColgp_Array1OfPnt2d array (1,5); // sizing array \n\ |
1909 | array.SetValue(1,gp_Pnt2d (-4,0)); array.SetValue(2,gp_Pnt2d (-7,2)); \n\ |
1910 | array.SetValue(3,gp_Pnt2d (-6,3)); array.SetValue(4,gp_Pnt2d (-4,3)); \n\ |
1911 | array.SetValue(5,gp_Pnt2d (-3,5)); \n\ |
1912 | Handle(Geom2d_BSplineCurve) SPL1 = Geom2dAPI_PointsToBSpline(array); \n\ |
1913 | Standard_Real FPSPL1 = SPL1->FirstParameter(); \n"); |
1914 | Message += "\ |
1915 | Standard_Real LPSPL1 = SPL1->LastParameter(); \n\ |
1916 | //----------- Extrema TC1 / SPL1 ------------- \n\ |
1917 | Geom2dAPI_ExtremaCurveCurve ECC2 (TC1,SPL1, FP1,LP1, FPSPL1,LPSPL1); \n\ |
1918 | Standard_Real SPL1shortestdistance =-1; \n\ |
1919 | if (ECC2.NbExtrema()!=0) SPL1shortestdistance = ECC2.LowerDistance(); \n\ |
1920 | Standard_Integer NbExtrema = ECC2.NbExtrema(); \n\ |
1921 | TColgp_Array2OfPnt2d aSolutionArray(1,NbExtrema,1,2); \n\ |
1922 | for(int i=1;i <= NbExtrema; i++) { \n\ |
1923 | gp_Pnt2d P1,P2; \n\ |
1924 | ECC2.Points(i,P1,P2); \n\ |
1925 | aSolutionArray(i,1) = P1; aSolutionArray(i,2) = P2; } \n"; |
5c1f974e |
1926 | AddSeparator(aDoc,Message); |
1927 | //-------------------------------------------------------------- |
1928 | |
1929 | TCollection_AsciiString aString; |
1930 | for(int i = array.Lower();i<=array.Upper();i++) |
1931 | { |
1932 | TCollection_AsciiString Message2 (i); |
1933 | gp_Pnt2d P = array(i); |
1934 | aString = "array "; |
1935 | aString += Message2; |
1936 | DisplayPoint(aDoc,P,aString.ToCString(),false,0.5); |
1937 | } |
1938 | |
1939 | if (!SPL1.IsNull()) |
1940 | { |
1941 | Handle(ISession2D_Curve) aCurve = new ISession2D_Curve(SPL1); |
1942 | aCurve->SetDisplayPole(Standard_False); |
1943 | aCurve->SetColorIndex(3); |
1944 | aDoc->GetISessionContext()->Display(aCurve, Standard_False); |
1945 | } |
1946 | else |
576f8b11 |
1947 | MessageBoxW (AfxGetApp()->m_pMainWnd->m_hWnd, L"SPL1.IsNull()", L"CasCade Error", MB_ICONERROR); |
5c1f974e |
1948 | |
1949 | Handle(ISession2D_Curve) aCurve1 = new ISession2D_Curve(TC1); |
1950 | aCurve1->SetColorIndex(6); |
1951 | aDoc->GetISessionContext()->Display(aCurve1, Standard_False); |
1952 | Handle(ISession2D_Curve) aCurve2 = new ISession2D_Curve(TC2); |
1953 | aCurve2->SetColorIndex(5); |
1954 | aDoc->GetISessionContext()->Display(aCurve2, Standard_False); |
1955 | |
1956 | for(int i=1;i <= NbExtrema; i++) |
1957 | { |
1958 | gp_Pnt2d P1 =aSolutionArray(i,1); |
1959 | |
1960 | TCollection_AsciiString Message2 (i); |
1961 | aString = "P1_"; |
1962 | aString += Message2; |
1963 | DisplayPoint(aDoc,P1,aString.ToCString(),false,0.7*i); |
1964 | |
1965 | gp_Pnt2d P2 = aSolutionArray(i,2); |
1966 | |
1967 | Handle(Geom2d_TrimmedCurve) SolutionCurve = |
1968 | GCE2d_MakeSegment(P1,P2); |
1969 | Handle(ISession2D_Curve) aSolutionCurve = new ISession2D_Curve(SolutionCurve); |
1970 | aDoc->GetISessionContext()->Display(aSolutionCurve, Standard_False); |
1971 | } |
1972 | |
1973 | Message += "TC1 is Yellow ,TC2 is Blue ,SPL1 is Red \n"; |
1974 | Message += "ECC.NbExtrema() = "; |
1975 | Message += ECC.NbExtrema(); |
1976 | Message += " shortestdistance = "; |
1977 | Message+= shortestdistance; |
1978 | Message += "\n"; |
1979 | Message += "ECC2.NbExtrema() = "; |
1980 | Message += NbExtrema; |
1981 | Message += " SPL1shortestdistance = "; |
1982 | Message+= SPL1shortestdistance; |
1983 | Message += "\n"; |
1984 | |
576f8b11 |
1985 | PostProcess(aDoc,ID_BUTTON_Test_26,TheDisplayType,Message); |
7fd59977 |
1986 | } |
1987 | |
1988 | // Function name : GeomSources::gpTest27 |
1989 | // Description : |
1990 | // Return type : void |
1991 | // Argument : CGeometryDoc* aDoc |
1992 | void GeomSources::gpTest27(CGeometryDoc* aDoc) |
1993 | { |
5c1f974e |
1994 | DisplayType TheDisplayType = a2DNo3D; |
1995 | PreProcess(aDoc,TheDisplayType); |
1996 | //============================================================== |
1997 | |
1998 | TColgp_Array1OfPnt2d array (1,5); // sizing array |
1999 | array.SetValue(1,gp_Pnt2d (-4,0)); array.SetValue(2,gp_Pnt2d (-7,2)); |
2000 | array.SetValue(3,gp_Pnt2d (-6,3)); array.SetValue(4,gp_Pnt2d (-4,3)); |
2001 | array.SetValue(5,gp_Pnt2d (-3,5)); |
2002 | Handle(Geom2d_BSplineCurve) SPL1 = Geom2dAPI_PointsToBSpline(array); |
2003 | |
2004 | Standard_Real dist = 1; |
2005 | Handle(Geom2d_OffsetCurve) OC = |
2006 | new Geom2d_OffsetCurve(SPL1,dist); |
2007 | Standard_Boolean result = OC->IsCN(2); |
2008 | Standard_Real dist2 = 1.5; |
2009 | Handle(Geom2d_OffsetCurve) OC2 = |
2010 | new Geom2d_OffsetCurve(SPL1,dist2); |
2011 | Standard_Boolean result2 = OC2->IsCN(2); |
2012 | |
2013 | //============================================================== |
2014 | TCollection_AsciiString Message (" \ |
7fd59977 |
2015 | \n\ |
2016 | TColgp_Array1OfPnt2d array (1,5); // sizing array \n\ |
2017 | array.SetValue(1,gp_Pnt2d (-4,0)); array.SetValue(2,gp_Pnt2d (-7,2)); \n\ |
2018 | array.SetValue(3,gp_Pnt2d (-6,3)); array.SetValue(4,gp_Pnt2d (-4,3)); \n\ |
2019 | array.SetValue(5,gp_Pnt2d (-3,5)); \n\ |
2020 | Handle(Geom2d_BSplineCurve) SPL1 = Geom2dAPI_PointsToBSpline(array); \n\ |
2021 | \n\ |
2022 | Standard_Real dist = 1; \n\ |
2023 | Handle(Geom2d_OffsetCurve) OC = \n\ |
2024 | new Geom2d_OffsetCurve(SPL1,dist); \n\ |
2025 | Standard_Boolean result = OC->IsCN(2); \n\ |
2026 | \n\ |
2027 | Standard_Real dist2 = 1.5; \n\ |
2028 | Handle(Geom2d_OffsetCurve) OC2 = \n\ |
2029 | new Geom2d_OffsetCurve(SPL1,dist2); \n\ |
2030 | Standard_Boolean result2 = OC2->IsCN(2); \n\ |
2031 | \n"); |
5c1f974e |
2032 | AddSeparator(aDoc,Message); |
2033 | //-------------------------------------------------------------- |
2034 | Handle(ISession2D_Curve) aCurve1 = new ISession2D_Curve(SPL1); |
2035 | aCurve1->SetColorIndex(6); |
2036 | aDoc->GetISessionContext()->Display(aCurve1, Standard_False); |
2037 | Handle(ISession2D_Curve) aCurve2 = new ISession2D_Curve(OC); |
2038 | aCurve2->SetColorIndex(5); |
2039 | aDoc->GetISessionContext()->Display(aCurve2, Standard_False); |
2040 | Handle(ISession2D_Curve) aCurve3 = new ISession2D_Curve(OC2); |
2041 | aCurve3->SetColorIndex(3); |
2042 | aDoc->GetISessionContext()->Display(aCurve3, Standard_False); |
2043 | |
2044 | |
2045 | Message += "SPL1 is Yellow \n"; |
2046 | Message += "OC is Blue \n"; |
2047 | Message += "OC2 is Red \n\n"; |
2048 | Message += " Warning, Continuity is not guaranteed : \n "; |
2049 | if(result) |
2050 | Message += " result = True \n"; |
2051 | else |
2052 | Message += " result = False \n"; |
2053 | if(result2) |
2054 | Message += " result2 = True \n"; |
2055 | else |
2056 | Message += " result2 = False \n"; |
2057 | |
576f8b11 |
2058 | PostProcess(aDoc,ID_BUTTON_Test_27,TheDisplayType,Message); |
7fd59977 |
2059 | } |
2060 | |
2061 | // Function name : GeomSources::gpTest28 |
2062 | // Description : |
2063 | // Return type : void |
2064 | // Argument : CGeometryDoc* aDoc |
2065 | void GeomSources::gpTest28(CGeometryDoc* aDoc) |
2066 | { |
5c1f974e |
2067 | DisplayType TheDisplayType = a2DNo3D; |
2068 | PreProcess(aDoc,TheDisplayType); |
2069 | //============================================================== |
2070 | |
2071 | gp_Pnt2d P1(1,2); |
2072 | gp_Pnt2d P2(4,5); |
2073 | gp_Lin2d L = gce_MakeLin2d(P1,P2); |
2074 | // assignment by overloaded operator |
2075 | |
2076 | //============================================================== |
2077 | TCollection_AsciiString Message (" \ |
7fd59977 |
2078 | \n\ |
2079 | gp_Pnt2d P1(1,2); \n\ |
2080 | gp_Pnt2d P2(4,5); \n\ |
2081 | gp_Lin2d L = gce_MakeLin2d(P1,P2); \n\ |
2082 | // assignment by overloaded operator \n\ |
2083 | \n"); |
5c1f974e |
2084 | AddSeparator(aDoc,Message); |
2085 | //-------------------------------------------------------------- |
7fd59977 |
2086 | |
5c1f974e |
2087 | DisplayPoint(aDoc,P1,"P1",false,0.5); |
2088 | DisplayPoint(aDoc,P2,"P2",false,0.5); |
7fd59977 |
2089 | |
5c1f974e |
2090 | Handle(Geom2d_TrimmedCurve) aLine = GCE2d_MakeSegment(L,-3,8); |
2091 | Handle(ISession2D_Curve) aCurve = new ISession2D_Curve(aLine); |
2092 | aDoc->GetISessionContext()->Display(aCurve, Standard_False); |
2093 | |
576f8b11 |
2094 | PostProcess(aDoc,ID_BUTTON_Test_28,TheDisplayType,Message); |
7fd59977 |
2095 | } |
2096 | |
2097 | // Function name : GeomSources::gpTest29 |
2098 | // Description : |
2099 | // Return type : void |
2100 | // Argument : CGeometryDoc* aDoc |
2101 | void GeomSources::gpTest29(CGeometryDoc* aDoc) |
2102 | { |
5c1f974e |
2103 | DisplayType TheDisplayType = a2DNo3D; |
2104 | PreProcess(aDoc,TheDisplayType); |
2105 | |
2106 | //============================================================== |
7fd59977 |
2107 | |
5c1f974e |
2108 | gp_Pnt2d P1(1,2); |
2109 | gp_Pnt2d P2(4,5); |
2110 | gp_Lin2d L; |
2111 | GccAna_Pnt2dBisec B(P1,P2); |
2112 | if (B.IsDone()) |
2113 | { |
2114 | L = B.ThisSolution(); |
2115 | } |
2116 | |
2117 | //============================================================== |
2118 | TCollection_AsciiString Message (" \ |
7fd59977 |
2119 | \n\ |
2120 | gp_Pnt2d P1(1,2); \n\ |
2121 | gp_Pnt2d P2(4,5); \n\ |
2122 | gp_Lin2d L; \n\ |
2123 | GccAna_Pnt2dBisec B(P1,P2); \n\ |
2124 | if (B.IsDone()) \n\ |
2125 | { \n\ |
2126 | L = B.ThisSolution(); \n\ |
2127 | } \n\ |
2128 | \n"); |
5c1f974e |
2129 | AddSeparator(aDoc,Message); |
2130 | //-------------------------------------------------------------- |
7fd59977 |
2131 | |
5c1f974e |
2132 | DisplayPoint(aDoc,P1,"P1",false,0.5); |
2133 | DisplayPoint(aDoc,P2,"P2",false,0.5); |
7fd59977 |
2134 | |
5c1f974e |
2135 | if (B.IsDone()) |
2136 | { |
2137 | Handle(Geom2d_TrimmedCurve) aLine = GCE2d_MakeSegment(L,-8,8); |
2138 | Handle(ISession2D_Curve) aCurve = new ISession2D_Curve(aLine); |
2139 | aDoc->GetISessionContext()->Display(aCurve, Standard_False); |
2140 | } |
7fd59977 |
2141 | |
5c1f974e |
2142 | if (B.IsDone()) Message += " \n B Is Done "; |
2143 | else Message += " \n B Is not Done "; |
576f8b11 |
2144 | PostProcess(aDoc,ID_BUTTON_Test_29,TheDisplayType,Message); |
7fd59977 |
2145 | } |
2146 | |
2147 | // Function name : GeomSources::gpTest30 |
2148 | // Description : |
2149 | // Return type : void |
2150 | // Argument : CGeometryDoc* aDoc |
2151 | void GeomSources::gpTest30(CGeometryDoc* aDoc) |
2152 | { |
5c1f974e |
2153 | DisplayType TheDisplayType =a2DNo3D ; |
2154 | PreProcess(aDoc,TheDisplayType); |
2155 | |
2156 | //============================================================== |
2157 | |
2158 | gp_Pnt2d P1 (2,3); |
2159 | gp_Pnt2d P2 (4,4); |
2160 | gp_Pnt2d P3 (6,7); |
2161 | gp_Pnt2d P4 (10,10); |
2162 | gp_Circ2d C = gce_MakeCirc2d (P1,P2,P3); |
2163 | GccEnt_QualifiedCirc QC = GccEnt::Outside(C); |
2164 | GccAna_Lin2d2Tan LT (QC,P4,Precision::Confusion()); |
5c573e69 |
2165 | Standard_Integer NbSol = 0; |
5c1f974e |
2166 | if (LT.IsDone()) |
2167 | { |
2168 | NbSol = LT.NbSolutions(); |
2169 | for(Standard_Integer k=1; k<=NbSol; k++) |
2170 | { |
2171 | gp_Lin2d L = LT.ThisSolution(k); |
2172 | // do something with L |
2173 | } |
2174 | } |
2175 | |
2176 | //============================================================== |
2177 | TCollection_AsciiString Message (" \ |
7fd59977 |
2178 | \n\ |
2179 | gp_Pnt2d P1 (2,3); \n\ |
2180 | gp_Pnt2d P2 (4,4); \n\ |
2181 | gp_Pnt2d P3 (6,7); \n\ |
2182 | gp_Pnt2d P4 (10,10); \n\ |
2183 | gp_Circ2d C = gce_MakeCirc2d (P1,P2,P3); \n\ |
2184 | GccEnt_QualifiedCirc QC = GccEnt::Outside(C); \n\ |
2185 | GccAna_Lin2d2Tan LT (QC,P4,Precision::Confusion()); \n\ |
2186 | Standard_Integer NbSol; \n\ |
2187 | if (LT.IsDone()) \n\ |
2188 | { \n\ |
2189 | NbSol = LT.NbSolutions(); \n\ |
2190 | for(Standard_Integer k=1; k<=NbSol; k++) \n\ |
2191 | { \n\ |
2192 | gp_Lin2d L = LT.ThisSolution(k); \n\ |
2193 | // do something with L \n\ |
2194 | } \n\ |
2195 | } \n\ |
2196 | \n"); |
5c1f974e |
2197 | AddSeparator(aDoc,Message); |
2198 | //-------------------------------------------------------------- |
7fd59977 |
2199 | |
5c1f974e |
2200 | DisplayPoint(aDoc,P1,"P1",false,0.5,-1,0.1); |
2201 | DisplayPoint(aDoc,P2,"P2",false,0.5,-0.7,0.1); |
2202 | DisplayPoint(aDoc,P3,"P3",false,0.5,-0.5,0.1); |
2203 | DisplayPoint(aDoc,P4,"P4",false,0.5,0,0.1); |
7fd59977 |
2204 | |
5c1f974e |
2205 | Handle(Geom2d_Circle) aCircle = new Geom2d_Circle(C); |
2206 | Handle(ISession2D_Curve) aCurve = new ISession2D_Curve(aCircle); |
2207 | aCurve->SetColorIndex(5); |
2208 | aDoc->GetISessionContext()->Display(aCurve, Standard_False); |
7fd59977 |
2209 | |
5c1f974e |
2210 | if (LT.IsDone()) |
2211 | { |
2212 | Standard_Integer NbSol = LT.NbSolutions(); |
2213 | for(Standard_Integer k=1; k<=NbSol; k++) |
2214 | { |
2215 | gp_Lin2d L = LT.ThisSolution(k); |
2216 | Handle(Geom2d_TrimmedCurve) aLine = GCE2d_MakeSegment(L,-10,20); |
2217 | Handle(ISession2D_Curve) aCurve = new ISession2D_Curve(aLine); |
2218 | aDoc->GetISessionContext()->Display(aCurve, Standard_False); |
2219 | } |
2220 | } |
2221 | Message += " C is Blue \n\n"; |
2222 | Message += "LT.IsDone() = "; |
2223 | if (LT.IsDone()) Message += "True \n"; else Message += "False \n"; |
2224 | TCollection_AsciiString Message2 (NbSol); |
2225 | Message += "NbSol = "; Message += Message2 ; Message += "\n"; |
2226 | |
576f8b11 |
2227 | PostProcess(aDoc,ID_BUTTON_Test_30,TheDisplayType,Message); |
5c1f974e |
2228 | } |
7fd59977 |
2229 | |
2230 | // Function name : GeomSources::gpTest31 |
2231 | // Description : |
2232 | // Return type : void |
2233 | // Argument : CGeometryDoc* aDoc |
2234 | void GeomSources::gpTest31(CGeometryDoc* aDoc) |
2235 | { |
5c1f974e |
2236 | DisplayType TheDisplayType = a2DNo3D; |
2237 | PreProcess(aDoc,TheDisplayType); |
2238 | |
2239 | //============================================================== |
2240 | |
2241 | gp_Pnt2d P1 (9,6); |
2242 | gp_Pnt2d P2 (10,4); |
2243 | gp_Pnt2d P3 (6,7); |
2244 | gp_Circ2d C = gce_MakeCirc2d (P1,P2,P3); |
2245 | GccEnt_QualifiedCirc QC = GccEnt::Outside(C); |
2246 | gp_Pnt2d P4 (-2,7); |
2247 | gp_Pnt2d P5 (12,-3); |
2248 | gp_Lin2d L = GccAna_Lin2d2Tan(P4,P5,Precision::Confusion()).ThisSolution(1); |
2249 | GccEnt_QualifiedLin QL = GccEnt::Unqualified(L); |
2250 | Standard_Real radius = 2; |
2251 | GccAna_Circ2d2TanRad TR (QC,QL,radius,Precision::Confusion()); |
2252 | Standard_Real parsol,pararg; |
2253 | gp_Pnt2d tangentpoint1,tangentpoint2; |
2254 | gp_Circ2d circ; |
2255 | if (TR.IsDone()) |
2256 | { |
2257 | Standard_Integer NbSol = TR.NbSolutions(); |
2258 | for (Standard_Integer k=1; k<=NbSol; k++) |
2259 | { |
2260 | circ = TR.ThisSolution(k); |
2261 | // find the solution circle |
2262 | TR.Tangency1(k,parsol,pararg,tangentpoint1); |
2263 | // find the first tangent point |
2264 | TR.Tangency2(k,parsol,pararg,tangentpoint2); |
2265 | // find the second tangent point |
2266 | } |
2267 | } |
2268 | |
2269 | //============================================================== |
2270 | TCollection_AsciiString Message; |
2271 | Message = "\ |
7fd59977 |
2272 | \n\ |
2273 | gp_Pnt2d P1 (9,6); \n\ |
2274 | gp_Pnt2d P2 (10,4); \n\ |
2275 | gp_Pnt2d P3 (6,7); \n\ |
2276 | gp_Circ2d C = gce_MakeCirc2d (P1,P2,P3); \n\ |
2277 | GccEnt_QualifiedCirc QC = GccEnt::Outside(C); \n\ |
2278 | gp_Pnt2d P4 (-2,7); \n\ |
2279 | gp_Pnt2d P5 (12,-3); \n\ |
2280 | gp_Lin2d L = GccAna_Lin2d2Tan(P4,P5,Precision::Confusion()).ThisSolution(1); \n\ |
2281 | GccEnt_QualifiedLin QL = GccEnt::Unqualified(L); \n\ |
2282 | Standard_Real radius = 2; \n\ |
2283 | GccAna_Circ2d2TanRad TR (QC,QL,radius,Precision::Confusion()); \n\ |
2284 | Standard_Real parsol,pararg; \n\ |
2285 | gp_Pnt2d tangentpoint1,tangentpoint2; \n\ |
2286 | gp_Circ2d circ; \n\ |
2287 | if (TR.IsDone()) \n\ |
2288 | { \n\ |
2289 | Standard_Integer NbSol = TR.NbSolutions(); \n\ |
2290 | for (Standard_Integer k=1; k<=NbSol; k++) \n\ |
2291 | { \n"; |
5c1f974e |
2292 | Message += "\ |
7fd59977 |
2293 | circ = TR.ThisSolution(k); \n\ |
2294 | // find the solution circle \n\ |
2295 | TR.Tangency1(k,parsol,pararg,tangentpoint1); \n\ |
2296 | // find the first tangent point \n\ |
2297 | TR.Tangency2(k,parsol,pararg,tangentpoint2); \n\ |
2298 | // find the second tangent point \n\ |
2299 | } \n\ |
2300 | } \n\ |
2301 | \n"; |
5c1f974e |
2302 | AddSeparator(aDoc,Message); |
2303 | |
2304 | //-------------------------------------------------------------- |
2305 | DisplayPoint(aDoc,P1,"P1",false,0.3); |
2306 | DisplayPoint(aDoc,P2,"P2",false,0.3); |
2307 | DisplayPoint(aDoc,P3,"P3",false,0.3); |
2308 | DisplayPoint(aDoc,P4,"P4",false,0.3); |
2309 | DisplayPoint(aDoc,P5,"P5",false,0.3); |
2310 | |
2311 | Handle(Geom2d_Circle) aCircle = new Geom2d_Circle(C); |
2312 | Handle(ISession2D_Curve) aCurve = new ISession2D_Curve(aCircle); |
2313 | aCurve->SetColorIndex(3); |
2314 | |
2315 | aDoc->GetISessionContext()->Display(aCurve, Standard_False); |
2316 | Handle(Geom2d_TrimmedCurve) aLine = GCE2d_MakeSegment(L,-2,20); |
2317 | Handle(ISession2D_Curve) aCurve2 = new ISession2D_Curve(aLine); |
2318 | aCurve2->SetColorIndex(5); |
2319 | aDoc->GetISessionContext()->Display(aCurve2, Standard_False); |
2320 | |
2321 | if (TR.IsDone()) |
2322 | { |
2323 | Standard_Integer NbSol = TR.NbSolutions(); |
2324 | for (Standard_Integer k=1; k<=NbSol; k++) |
2325 | { |
2326 | circ = TR.ThisSolution(k); |
2327 | Handle(Geom2d_Circle) aCircle = new Geom2d_Circle(circ); |
2328 | Handle(ISession2D_Curve) aCurve = new ISession2D_Curve(aCircle); |
2329 | aDoc->GetISessionContext()->Display(aCurve, Standard_False); |
7fd59977 |
2330 | |
5c1f974e |
2331 | // find the solution circle |
2332 | TR.Tangency1(k,parsol,pararg,tangentpoint1); |
2333 | // find the first tangent point |
2334 | TR.Tangency2(k,parsol,pararg,tangentpoint2); |
2335 | // find the second tangent point |
2336 | DisplayPoint(aDoc,tangentpoint1,"tangentpoint1",false,0.3); |
2337 | DisplayPoint(aDoc,tangentpoint2,"tangentpoint2",false,0.3); |
2338 | } |
2339 | } |
2340 | Message += "C is Red \n"; |
2341 | Message += "L is Blue \n"; |
576f8b11 |
2342 | PostProcess(aDoc,ID_BUTTON_Test_31,TheDisplayType,Message); |
7fd59977 |
2343 | } |
2344 | |
2345 | // Function name : GeomSources::gpTest32 |
2346 | // Description : |
2347 | // Return type : void |
2348 | // Argument : CGeometryDoc* aDoc |
2349 | void GeomSources::gpTest32(CGeometryDoc* aDoc) |
2350 | { |
5c1f974e |
2351 | DisplayType TheDisplayType = a2DNo3D; |
2352 | PreProcess(aDoc,TheDisplayType); |
2353 | |
2354 | //============================================================== |
2355 | |
2356 | Standard_Real major = 12; |
2357 | Standard_Real minor = 4; |
2358 | gp_Ax2d axis = gp::OX2d(); |
2359 | gp_Elips2d EE(axis,major,minor); |
2360 | Handle(Geom2d_TrimmedCurve) arc = GCE2d_MakeArcOfEllipse(EE,0.0,M_PI/4); |
2361 | |
2362 | //============================================================== |
2363 | TCollection_AsciiString Message (" \ |
7fd59977 |
2364 | \n\ |
2365 | Standard_Real major = 12; \n\ |
2366 | Standard_Real minor = 4; \n\ |
2367 | gp_Ax2d axis = gp::OX2d(); \n\ |
2368 | gp_Elips2d EE(axis,major,minor); \n\ |
2369 | Handle(Geom2d_TrimmedCurve) arc = GCE2d_MakeArcOfEllipse(EE,0.0,PI/4); \n\ |
2370 | \n"); |
5c1f974e |
2371 | AddSeparator(aDoc,Message); |
2372 | //-------------------------------------------------------------- |
9e3ca93a |
2373 | Handle(Geom2d_Ellipse) E = GCE2d_MakeEllipse(EE); |
5c1f974e |
2374 | Handle(ISession2D_Curve) aCurve = new ISession2D_Curve(E); |
2375 | aCurve->SetColorIndex(3); |
2376 | aCurve->SetTypeOfLine(Aspect_TOL_DOTDASH); |
2377 | //SetWidthOfLine |
2378 | aDoc->GetISessionContext()->Display(aCurve, Standard_False); |
2379 | Handle(ISession2D_Curve) aCurve2 = new ISession2D_Curve(arc); |
2380 | aDoc->GetISessionContext()->Display(aCurve2, Standard_False); |
2381 | TCollection_AsciiString Message2 (M_PI); |
2382 | Message += " PI = ";Message+= Message2; |
2383 | |
576f8b11 |
2384 | PostProcess(aDoc,ID_BUTTON_Test_32,TheDisplayType,Message); |
7fd59977 |
2385 | } |
2386 | |
2387 | // Function name : GeomSources::gpTest33 |
2388 | // Description : |
2389 | // Return type : void |
2390 | // Argument : CGeometryDoc* aDoc |
2391 | void GeomSources::gpTest33(CGeometryDoc* aDoc) |
2392 | { |
5c1f974e |
2393 | DisplayType TheDisplayType = No2D3D; |
2394 | PreProcess(aDoc,TheDisplayType); |
2395 | |
2396 | //============================================================== |
2397 | |
2398 | gp_Pnt P1(0,0,1); |
2399 | gp_Pnt P2(1,2,2); |
2400 | gp_Pnt P3(2,3,3); |
2401 | gp_Pnt P4(4,3,4); |
2402 | gp_Pnt P5(5,5,5); |
2403 | TColgp_Array1OfPnt array (1,5); // sizing array |
2404 | array.SetValue(1,P1); |
2405 | array.SetValue(2,P2); |
2406 | array.SetValue(3,P3); |
2407 | array.SetValue(4,P4); |
2408 | array.SetValue(5,P5); |
2409 | Handle(TColgp_HArray1OfPnt) harray = |
2410 | new TColgp_HArray1OfPnt (1,5); // sizing harray |
2411 | harray->SetValue(1,P1.Translated(gp_Vec(4,0,0))); |
2412 | harray->SetValue(2,P2.Translated(gp_Vec(4,0,0))); |
2413 | harray->SetValue(3,P3.Translated(gp_Vec(4,0,0))); |
2414 | harray->SetValue(4,P4.Translated(gp_Vec(4,0,0))); |
2415 | harray->SetValue(5,P5.Translated(gp_Vec(4,0,0))); |
2416 | Handle(Geom_BSplineCurve) SPL1 = |
2417 | GeomAPI_PointsToBSpline(array).Curve(); |
2418 | |
2419 | GeomAPI_Interpolate anInterpolation(harray,Standard_False,Precision::Approximation()); |
2420 | anInterpolation.Perform(); |
2421 | |
2422 | Handle(Geom_BSplineCurve) SPL2; |
2423 | if (anInterpolation.IsDone()) |
2424 | SPL2 = anInterpolation.Curve(); |
2425 | else |
576f8b11 |
2426 | MessageBoxW (AfxGetApp()->m_pMainWnd->m_hWnd, L"The Interpolation is Not done", L"CasCade Warning", MB_ICONWARNING); |
5c1f974e |
2427 | |
2428 | //============================================================== |
2429 | TCollection_AsciiString Message (" \ |
7fd59977 |
2430 | \n\ |
2431 | gp_Pnt P1(0,0,1); \n\ |
2432 | gp_Pnt P2(1,2,2); \n\ |
2433 | gp_Pnt P3(2,3,3); \n\ |
2434 | gp_Pnt P4(4,3,4); \n\ |
2435 | gp_Pnt P5(5,5,5); \n\ |
2436 | TColgp_Array1OfPnt array (1,5); // sizing array \n\ |
2437 | array.SetValue(1,P1); \n\ |
2438 | array.SetValue(2,P2); \n\ |
2439 | array.SetValue(3,P3); \n\ |
2440 | array.SetValue(4,P4); \n\ |
2441 | array.SetValue(5,P5); \n\ |
2442 | Handle(TColgp_HArray1OfPnt) harray = \n\ |
2443 | new TColgp_HArray1OfPnt (1,5); // sizing harray \n\ |
2444 | harray->SetValue(1,P1.Translated(gp_Vec(4,0,0))); \n\ |
2445 | harray->SetValue(2,P2.Translated(gp_Vec(4,0,0))); \n\ |
2446 | harray->SetValue(3,P3.Translated(gp_Vec(4,0,0))); \n\ |
2447 | harray->SetValue(4,P4.Translated(gp_Vec(4,0,0))); \n\ |
2448 | harray->SetValue(5,P5.Translated(gp_Vec(4,0,0))); \n\ |
2449 | Handle(Geom_BSplineCurve) SPL1 = \n\ |
2450 | GeomAPI_PointsToBSpline(array).Curve(); \n"); |
5c1f974e |
2451 | Message += "\ |
7fd59977 |
2452 | \n\ |
2453 | GeomAPI_Interpolate anInterpolation(harray,Standard_False,Precision::Approximation()); \n\ |
2454 | anInterpolation.Perform(); \n\ |
2455 | \n\ |
2456 | Handle(Geom_BSplineCurve) SPL2; \n\ |
2457 | if (anInterpolation.IsDone()) \n\ |
2458 | SPL2 = anInterpolation.Curve(); \n\ |
2459 | else \n\ |
2460 | MessageBox(0,\"The Interpolation is Not done\",\"CasCade Warning\",MB_ICONWARNING); \n\ |
2461 | \n"; |
5c1f974e |
2462 | AddSeparator(aDoc,Message); |
7fd59977 |
2463 | |
5c1f974e |
2464 | //-------------------------------------------------------------- |
7fd59977 |
2465 | |
5c1f974e |
2466 | TCollection_AsciiString aString; |
2467 | for(Standard_Integer i = array.Lower();i<=array.Upper();i++) |
2468 | { |
2469 | |
2470 | TCollection_AsciiString Message2 (i); |
2471 | gp_Pnt P = array(i); |
2472 | |
2473 | aString = "P"; |
2474 | aString += Message2; |
2475 | if (i == 1) aString += " (array) "; |
2476 | DisplayPoint(aDoc,P,aString.ToCString(),false,0.5);\ |
2477 | |
2478 | aString = "P"; |
2479 | aString += Message2; |
2480 | if (i == 1) aString += " (harray) "; |
2481 | DisplayPoint(aDoc,P.Translated(gp_Vec(4,0,0)),aString.ToCString(),false,0.5);\ |
2482 | |
2483 | } |
2484 | |
2485 | Handle(ISession_Curve) aCurve = new ISession_Curve(SPL1); |
2486 | aDoc->GetAISContext()->SetDisplayMode(aCurve,1); |
2487 | aDoc->GetAISContext()->Display(aCurve, Standard_False); |
2488 | |
2489 | if (anInterpolation.IsDone()) |
2490 | { |
2491 | Handle(ISession_Curve) aCurve2 = new ISession_Curve(SPL2); |
2492 | aDoc->GetAISContext()->SetDisplayMode(aCurve2,1); |
2493 | aDoc->GetAISContext()->Display(aCurve2, Standard_False); |
2494 | } |
2495 | |
576f8b11 |
2496 | PostProcess(aDoc,ID_BUTTON_Test_33,TheDisplayType,Message); |
7fd59977 |
2497 | } |
2498 | |
2499 | // Function name : GeomSources::gpTest34 |
2500 | // Description : |
2501 | // Return type : void |
2502 | // Argument : CGeometryDoc* aDoc |
2503 | void GeomSources::gpTest34(CGeometryDoc* aDoc) |
2504 | { |
5c1f974e |
2505 | DisplayType TheDisplayType = No2D3D; |
2506 | PreProcess(aDoc,TheDisplayType); |
2507 | |
2508 | //============================================================== |
2509 | |
2510 | TColgp_Array1OfPnt array (1,5); // sizing array |
2511 | array.SetValue(1,gp_Pnt(0,0,1)); |
2512 | array.SetValue(2,gp_Pnt(1,2,2)); |
2513 | array.SetValue(3,gp_Pnt(2,3,3)); |
2514 | array.SetValue(4,gp_Pnt(4,4,4)); |
2515 | array.SetValue(5,gp_Pnt(5,5,5)); |
2516 | |
2517 | GProp_PEquation PE (array,1.5 ); |
2518 | |
2519 | if (PE.IsPoint()) |
2520 | {/* ... */} |
2521 | gp_Lin L; |
2522 | if (PE.IsLinear()) |
2523 | { |
2524 | L = PE.Line(); |
2525 | } |
2526 | if (PE.IsPlanar()) |
2527 | {/* ... */} |
2528 | if (PE.IsSpace()) |
2529 | {/* ... */} |
7fd59977 |
2530 | |
5c1f974e |
2531 | //============================================================== |
2532 | TCollection_AsciiString Message (" \ |
7fd59977 |
2533 | \n\ |
2534 | TColgp_Array1OfPnt array (1,5); // sizing array \n\ |
2535 | array.SetValue(1,gp_Pnt(0,0,1)); \n\ |
2536 | array.SetValue(2,gp_Pnt(1,2,2)); \n\ |
2537 | array.SetValue(3,gp_Pnt(2,3,3)); \n\ |
2538 | array.SetValue(4,gp_Pnt(4,4,4)); \n\ |
2539 | array.SetValue(5,gp_Pnt(5,5,5)); \n\ |
2540 | \n\ |
2541 | GProp_PEquation PE (array,1.5 ); \n\ |
2542 | \n\ |
2543 | if (PE.IsPoint()){ /* ... */ } \n\ |
2544 | gp_Lin L; \n\ |
2545 | if (PE.IsLinear()) { L = PE.Line(); } \n\ |
2546 | if (PE.IsPlanar()){ /* ... */ } \n\ |
2547 | if (PE.IsSpace()) { /* ... */ } \n\ |
2548 | \n"); |
5c1f974e |
2549 | AddSeparator(aDoc,Message); |
2550 | //-------------------------------------------------------------- |
2551 | TCollection_AsciiString aString; |
2552 | for(Standard_Integer i = array.Lower();i<=array.Upper();i++) |
2553 | { |
2554 | TCollection_AsciiString Message2 (i); |
2555 | gp_Pnt P = array(i); |
2556 | |
2557 | aString = "P"; |
2558 | aString += Message2; |
2559 | DisplayPoint(aDoc,P,aString.ToCString(),false,0.5); |
2560 | } |
2561 | |
2562 | Message += " PE.IsPoint() = "; |
2563 | if (PE.IsPoint()) |
2564 | Message += "True \n"; |
2565 | else |
2566 | Message += "False\n"; |
2567 | |
2568 | if (PE.IsLinear()) { |
2569 | Message += " PE.IsLinear() = True \n"; |
2570 | L = PE.Line(); |
2571 | Handle(Geom_Line) aLine = new Geom_Line(L); |
2572 | Handle(Geom_TrimmedCurve) aTrimmedCurve = new Geom_TrimmedCurve(aLine,-10,10); |
2573 | Handle(ISession_Curve) aCurve = new ISession_Curve(aTrimmedCurve); |
2574 | aDoc->GetAISContext()->Display(aCurve, Standard_False); |
2575 | } |
2576 | else |
7fd59977 |
2577 | Message += "PE.IsLinear() = False \n"; |
2578 | |
5c1f974e |
2579 | Message += " PE.IsPlanar() = "; |
2580 | if (PE.IsPlanar()) |
2581 | Message += "True \n"; |
2582 | else |
2583 | Message += "False\n"; |
2584 | |
2585 | Message += " PE.IsSpace() = "; |
2586 | if (PE.IsSpace()) |
2587 | Message += "True \n"; |
2588 | else |
2589 | Message += "False\n"; |
7fd59977 |
2590 | |
576f8b11 |
2591 | PostProcess(aDoc,ID_BUTTON_Test_34,TheDisplayType,Message); |
7fd59977 |
2592 | } |
2593 | |
2594 | // Function name : GeomSources::gpTest35 |
2595 | // Description : |
2596 | // Return type : void |
2597 | // Argument : CGeometryDoc* aDoc |
2598 | void GeomSources::gpTest35(CGeometryDoc* aDoc) |
2599 | { |
5c1f974e |
2600 | DisplayType TheDisplayType = No2D3D; |
2601 | PreProcess(aDoc,TheDisplayType); |
2602 | |
2603 | //============================================================== |
2604 | |
2605 | gp_Pnt P1(-5,-5,0); |
2606 | gp_Pnt P2(9,9,9); |
2607 | Handle(Geom_Curve) aCurve = GC_MakeSegment(P1,P2).Value(); |
2608 | gp_Pnt P3(3,0,0); |
2609 | gp_Pnt P4(3,0,10); |
2610 | Standard_Real radius1 = 3; |
2611 | Standard_Real radius2 = 2; |
2612 | Handle(Geom_Surface) aSurface = |
2613 | GC_MakeConicalSurface(P3,P4,radius1,radius2).Value(); |
2614 | GeomAPI_IntCS CS (aCurve,aSurface); |
2615 | Handle(Geom_Curve) segment; |
2616 | |
5c573e69 |
2617 | Standard_Integer NbSeg = 0; |
2618 | Standard_Integer NbPoints = 0; |
5c1f974e |
2619 | if(CS.IsDone()) |
2620 | { |
2621 | NbSeg = CS.NbSegments(); |
2622 | for (Standard_Integer k=1; k<=NbSeg; k++) |
2623 | { |
2624 | segment = CS.Segment(k); |
2625 | // do something with the segment |
2626 | } |
2627 | |
2628 | NbPoints = CS.NbPoints(); |
2629 | for (int k=1; k<=NbPoints; k++) |
2630 | { |
2631 | gp_Pnt aPoint=CS.Point(k); |
2632 | // do something with the point |
2633 | } |
2634 | } |
2635 | |
2636 | //============================================================== |
2637 | TCollection_AsciiString Message (" \ |
7fd59977 |
2638 | \n\ |
2639 | gp_Pnt P1(-5,-5,0); \n\ |
2640 | gp_Pnt P2(9,9,9); \n\ |
2641 | Handle(Geom_Curve) aCurve = GC_MakeSegment(P1,P2).Value(); \n\ |
2642 | gp_Pnt P3(3,0,0); \n\ |
2643 | gp_Pnt P4(3,0,10); \n\ |
2644 | Standard_Real radius1 = 3; \n\ |
2645 | Standard_Real radius2 = 2; \n\ |
2646 | Handle(Geom_Surface) aSurface = \n\ |
2647 | GC_MakeConicalSurface(P3,P4,radius1,radius2).Value(); \n\ |
2648 | GeomAPI_IntCS CS (aCurve,aSurface); \n\ |
2649 | Handle(Geom_Curve) segment; \n\ |
2650 | \n\ |
2651 | Standard_Integer NbSeg; \n\ |
2652 | Standard_Integer NbPoints; \n\ |
2653 | if(CS.IsDone()) \n\ |
2654 | { \n\ |
2655 | NbSeg = CS.NbSegments(); \n\ |
2656 | for (Standard_Integer k=1; k<=NbSeg; k++) \n\ |
2657 | { \n\ |
2658 | segment = CS.Segment(k); \n\ |
2659 | // do something with the segment \n\ |
2660 | } \n\ |
2661 | \n\ |
2662 | NbPoints = CS.NbPoints(); \n\ |
2663 | for (k=1; k<=NbPoints; k++) \n\ |
2664 | { \n\ |
2665 | gp_Pnt aPoint=CS.Point(k); \n\ |
2666 | // do something with the point \n\ |
2667 | } \n\ |
2668 | } \n\ |
2669 | \n"); |
5c1f974e |
2670 | AddSeparator(aDoc,Message); |
2671 | |
2672 | //-------------------------------------------------------------- |
7fd59977 |
2673 | |
5c1f974e |
2674 | Handle(ISession_Curve) aCurve2 = new ISession_Curve(aCurve); |
2675 | aDoc->GetAISContext()->Display(aCurve2, Standard_False); |
7fd59977 |
2676 | |
5c1f974e |
2677 | Handle(Geom_RectangularTrimmedSurface) aTrimmedSurface= new Geom_RectangularTrimmedSurface(aSurface,-50.,50.,false); |
2678 | |
2679 | DisplaySurface(aDoc,aTrimmedSurface); |
2680 | |
2681 | TCollection_AsciiString aString; |
2682 | Standard_Integer k; |
2683 | if(CS.IsDone()) |
2684 | { |
2685 | Standard_Integer NbSeg = CS.NbSegments(); |
2686 | for (k=1; k<=NbSeg; k++) |
2687 | { |
2688 | TCollection_AsciiString Message2 (k); |
2689 | segment = CS.Segment(k); |
2690 | aString = "S_";aString += Message2; |
2691 | Handle(ISession_Curve) aCurve = new ISession_Curve(segment); |
2692 | aDoc->GetAISContext()->Display(aCurve, Standard_False); |
2693 | } |
2694 | |
2695 | for ( k=1; k<=NbPoints; k++) |
2696 | { |
2697 | TCollection_AsciiString Message2 (k); |
2698 | gp_Pnt aPoint=CS.Point(k); |
2699 | aString = "P_";aString += Message2; |
2700 | DisplayPoint(aDoc,aPoint,aString.ToCString(),false,0.5); |
2701 | // do something with the point |
2702 | } |
2703 | } |
2704 | TCollection_AsciiString Message2 (NbSeg); |
2705 | TCollection_AsciiString Message3 (NbPoints); |
2706 | |
2707 | Message += "NbSeg = "; Message += Message2 ; Message += "\n"; |
2708 | Message += "NbPoints = "; Message += Message3 ; Message += "\n"; |
2709 | |
576f8b11 |
2710 | PostProcess(aDoc,ID_BUTTON_Test_35,TheDisplayType,Message); |
7fd59977 |
2711 | } |
2712 | |
2713 | //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
2714 | |
2715 | // Function name : GeomSources::gpTest36 |
2716 | // Description : |
2717 | // Return type : void |
2718 | // Argument : CGeometryDoc* aDoc |
2719 | void GeomSources::gpTest36(CGeometryDoc* aDoc) |
2720 | { |
5c1f974e |
2721 | DisplayType TheDisplayType = No2D3D; |
2722 | PreProcess(aDoc,TheDisplayType); |
7fd59977 |
2723 | //============================================================== |
5c1f974e |
2724 | |
2725 | gp_Pnt centre (5,5,0); gp_Pnt axispoint (9,9,0); |
2726 | Standard_Real radius = 3; |
2727 | Handle(Geom_Circle) circle = |
2728 | GC_MakeCircle(centre,axispoint,radius); |
2729 | |
2730 | Handle(Geom_Geometry) aRotatedEntity = circle->Rotated(gp::OZ(),M_PI/4); |
2731 | Standard_CString aRotatedEntityTypeName = aRotatedEntity->DynamicType()->Name(); |
2732 | |
2733 | Handle(Geom_Geometry) aMirroredEntity = aRotatedEntity->Mirrored(gp::ZOX()); |
2734 | Standard_CString aMirroredEntityTypeName = aMirroredEntity->DynamicType()->Name(); |
2735 | |
2736 | gp_Pnt scalepoint (4,8,0); |
2737 | Standard_Real scalefactor = 0.2; |
2738 | Handle(Geom_Geometry) aScaledEntity = |
2739 | aMirroredEntity->Scaled(scalepoint, scalefactor); |
2740 | Standard_CString aScaledEntityTypeName = aScaledEntity->DynamicType()->Name(); |
2741 | |
2742 | Handle (Geom_Transformation) GT = GC_MakeTranslation (centre, scalepoint); |
2743 | gp_Trsf TR = GT->Trsf(); |
2744 | |
2745 | gp_Vec aTranslationVector(TR.TranslationPart ()); |
2746 | Handle(Geom_Geometry) aTranslatedEntity = |
2747 | aScaledEntity->Translated( aTranslationVector ); |
2748 | Standard_CString aTranslatedEntityTypeName = aTranslatedEntity->DynamicType()->Name(); |
2749 | |
2750 | gp_Mat matrix = TR.HVectorialPart(); |
2751 | Standard_Real value = matrix.Determinant(); |
2752 | |
7fd59977 |
2753 | //============================================================== |
2754 | TCollection_AsciiString Message (" \ |
2755 | \n\ |
2756 | gp_Pnt centre (5,5,0); gp_Pnt axispoint (9,9,0); \n\ |
2757 | Standard_Real radius = 3; \n\ |
2758 | Handle(Geom_Circle) circle = \n\ |
2759 | GC_MakeCircle(centre,axispoint,radius); \n\ |
2760 | \n\ |
2761 | Handle(Geom_Geometry) aRotatedEntity = circle->Rotated(gp::OZ(),PI/4); \n\ |
2762 | Standard_CString aRotatedEntityTypeName = aRotatedEntity->DynamicType()->Name(); \n\ |
2763 | \n\ |
2764 | Handle(Geom_Geometry) aMirroredEntity = aRotatedEntity->Mirrored(gp::ZOX()); \n\ |
2765 | Standard_CString aMirroredEntityTypeName = aMirroredEntity->DynamicType()->Name(); \n\ |
2766 | \n\ |
2767 | gp_Pnt scalepoint (4,8,0); \n\ |
2768 | Standard_Real scalefactor = 0.2; \n\ |
2769 | Handle(Geom_Geometry) aScaledEntity = \n\ |
2770 | aMirroredEntity->Scaled(scalepoint, scalefactor); \n\ |
2771 | Standard_CString aScaledEntityTypeName = aScaledEntity->DynamicType()->Name(); \n\ |
2772 | \n\ |
2773 | Handle (Geom_Transformation) GT = GC_MakeTranslation (centre, scalepoint); \n\ |
2774 | gp_Trsf TR = GT->Trsf(); \n\ |
2775 | \n"); |
2776 | Message +="\ |
2777 | gp_Vec aTranslationVector(TR.TranslationPart ()); \n\ |
2778 | Handle(Geom_Geometry) aTranslatedEntity = \n\ |
2779 | aScaledEntity->Translated( aTranslationVector ); \n\ |
2780 | Standard_CString aTranslatedEntityTypeName = aTranslatedEntity->DynamicType()->Name(); \n\ |
2781 | \n\ |
2782 | gp_Mat matrix = TR.HVectorialPart(); \n\ |
2783 | Standard_Real value = matrix.Determinant(); \n\ |
2784 | \n"; |
5c1f974e |
2785 | AddSeparator(aDoc,Message); |
2786 | //-------------------------------------------------------------- |
2787 | |
2788 | DisplayPoint(aDoc,centre,"centre",false,0.5); |
2789 | DisplayPoint(aDoc,axispoint,"axispoint",false,0.5); |
2790 | DisplayPoint(aDoc,scalepoint,"scalepoint",false,0.5); |
2791 | |
2792 | DisplayCurve(aDoc,circle, Quantity_NOC_RED,false); |
2793 | DisplayCurve(aDoc,Handle(Geom_Curve)::DownCast(aRotatedEntity),Quantity_NOC_PEACHPUFF, false); |
2794 | DisplayCurve(aDoc,Handle(Geom_Curve)::DownCast(aMirroredEntity), Quantity_NOC_YELLOWGREEN,false); |
2795 | DisplayCurve(aDoc,Handle(Geom_Curve)::DownCast(aScaledEntity), Quantity_NOC_GREEN,false); |
2796 | DisplayCurve(aDoc,Handle(Geom_Curve)::DownCast(aTranslatedEntity),Quantity_NOC_WHITE,false); |
2797 | |
2798 | TCollection_AsciiString Message0 (M_PI); |
2799 | Message += " PI = "; |
2800 | Message+= Message0; |
2801 | Message += "\n"; |
2802 | Message += " circle is Red; aRotatedEntity is Peach; aMirroredEntity is Yellow Green\n"; |
2803 | Message += " aScaleEntity is Green; aTranslatedEntity is White\n\n"; |
2804 | |
2805 | TCollection_AsciiString Message2 (aTranslationVector.X()); |
2806 | TCollection_AsciiString Message3 (aTranslationVector.Y()); |
2807 | TCollection_AsciiString Message4 (aTranslationVector.Z()); |
2808 | Message += " aTranslationVector ( "; |
2809 | Message += Message2; Message += " , "; |
2810 | Message += Message3; Message += " , "; |
2811 | Message += Message4; Message += " ); \n"; |
2812 | |
2813 | TCollection_AsciiString Message5 (value); |
2814 | Message += " value = ";Message+= Message5; Message += "\n"; |
2815 | |
2816 | TCollection_AsciiString Message6 (aRotatedEntityTypeName); |
2817 | TCollection_AsciiString Message7 (aMirroredEntityTypeName); |
2818 | TCollection_AsciiString Message8 (aScaledEntityTypeName); |
2819 | TCollection_AsciiString Message9 (aTranslatedEntityTypeName); |
2820 | |
2821 | Message += " aRotatedEntityTypeName = ";Message+= Message6; Message += "\n"; |
2822 | Message += " aMirroredEntityTypeName = ";Message+= Message7; Message += "\n"; |
2823 | Message += " aScaledEntityTypeName = ";Message+= Message8; Message += "\n"; |
2824 | Message += " aTranslatedEntityTypeName = ";Message+= Message9; Message += "\n"; |
2825 | |
576f8b11 |
2826 | PostProcess(aDoc,ID_BUTTON_Test_36,TheDisplayType,Message); |
7fd59977 |
2827 | } |
2828 | |
2829 | // Function name : GeomSources::gpTest37 |
2830 | // Description : |
2831 | // Return type : void |
2832 | // Argument : CGeometryDoc* aDoc |
2833 | void GeomSources::gpTest37(CGeometryDoc* aDoc) |
2834 | { |
5c1f974e |
2835 | DisplayType TheDisplayType = No2D3D; |
2836 | PreProcess(aDoc,TheDisplayType); |
2837 | //============================================================== |
2838 | |
2839 | TColgp_Array1OfPnt anArrayofPnt (1,5); // sizing array |
2840 | anArrayofPnt.SetValue(1,gp_Pnt(0,0,1)); |
2841 | anArrayofPnt.SetValue(2,gp_Pnt(1,2,2)); |
2842 | anArrayofPnt.SetValue(3,gp_Pnt(2,3,3)); |
2843 | anArrayofPnt.SetValue(4,gp_Pnt(4,3,4)); |
2844 | anArrayofPnt.SetValue(5,gp_Pnt(5,5,5)); |
2845 | |
2846 | Standard_Real Tolerance = 1; |
2847 | |
2848 | gp_Pln P; |
2849 | GProp_PEquation PE (anArrayofPnt,Tolerance); |
2850 | if (PE.IsPlanar()) { P = PE.Plane();} |
2851 | |
2852 | if (PE.IsPoint()) { /* ... */ } |
2853 | if (PE.IsLinear()) { /* ... */ } |
2854 | if (PE.IsPlanar()) { P = PE.Plane();} |
2855 | if (PE.IsSpace()) { /* ... */ } |
2856 | |
2857 | //============================================================== |
7fd59977 |
2858 | TCollection_AsciiString Message (" \ |
2859 | \n\ |
2860 | TColgp_Array1OfPnt anArrayofPnt (1,5); // sizing array \n\ |
2861 | anArrayofPnt.SetValue(1,gp_Pnt(0,0,1)); \n\ |
2862 | anArrayofPnt.SetValue(2,gp_Pnt(1,2,2)); \n\ |
2863 | anArrayofPnt.SetValue(3,gp_Pnt(2,3,3)); \n\ |
2864 | anArrayofPnt.SetValue(4,gp_Pnt(4,3,4)); \n\ |
2865 | anArrayofPnt.SetValue(5,gp_Pnt(5,5,5)); \n\ |
2866 | \n\ |
2867 | Standard_Real Tolerance = 1; \n\ |
2868 | \n\ |
2869 | gp_Pln P; \n\ |
2870 | GProp_PEquation PE (anArrayofPnt,Tolerance); \n\ |
2871 | if (PE.IsPlanar()) { P = PE.Plane();} \n\ |
2872 | \n\ |
2873 | if (PE.IsPoint()) { /* ... */ } \n\ |
2874 | if (PE.IsLinear()) { /* ... */ } \n\ |
2875 | if (PE.IsPlanar()) { P = PE.Plane();} \n\ |
2876 | if (PE.IsSpace()) { /* ... */ } \n\ |
2877 | \n"); |
5c1f974e |
2878 | AddSeparator(aDoc,Message); |
2879 | //-------------------------------------------------------------- |
2880 | |
2881 | TCollection_AsciiString aString; |
2882 | for(Standard_Integer i = anArrayofPnt.Lower();i<=anArrayofPnt.Upper();i++){ |
2883 | TCollection_AsciiString Message2(i); |
2884 | gp_Pnt P = anArrayofPnt(i); |
2885 | aString = "P";aString += Message2; |
2886 | DisplayPoint(aDoc,P,aString.ToCString(),false,0.5); |
2887 | } |
2888 | |
2889 | Message += " PE.IsPoint() = "; if (PE.IsPoint()) Message += "True \n"; else Message += "False\n"; |
2890 | Message += " PE.IsLinear() = "; if (PE.IsLinear()) Message += "True \n"; else Message += "False\n"; |
2891 | |
2892 | if (PE.IsPlanar()) { |
2893 | Message += " PE.IsPlanar() = True \n"; |
2894 | P = PE.Plane(); |
2895 | Handle(Geom_Plane) aPlane = new Geom_Plane(P); |
2896 | Handle(Geom_RectangularTrimmedSurface) aSurface= new Geom_RectangularTrimmedSurface(aPlane,-4.,4.,-4.,4.); |
7fd59977 |
2897 | |
5c1f974e |
2898 | DisplaySurface(aDoc,aSurface); |
7fd59977 |
2899 | |
5c1f974e |
2900 | } |
2901 | else |
7fd59977 |
2902 | Message += " PE.IsPlanar() = False \n"; |
2903 | |
5c1f974e |
2904 | Message += " PE.IsSpace() = "; if (PE.IsSpace() ) Message += "True \n"; else Message += "False\n"; |
7fd59977 |
2905 | |
576f8b11 |
2906 | PostProcess(aDoc,ID_BUTTON_Test_37,TheDisplayType,Message); |
7fd59977 |
2907 | } |
2908 | |
2909 | void GeomSources::gpTest38(CGeometryDoc* aDoc) |
2910 | { |
5c1f974e |
2911 | DisplayType TheDisplayType = No2D3D; |
2912 | PreProcess(aDoc,TheDisplayType); |
2913 | //============================================================== |
2914 | |
2915 | TColgp_Array1OfPnt array1 (1,5); // sizing array |
2916 | array1.SetValue(1,gp_Pnt (-4,0,2 )); array1.SetValue(2,gp_Pnt (-7,2,2 )); |
2917 | array1.SetValue(3,gp_Pnt (-6,3,1 )); array1.SetValue(4,gp_Pnt (-4,3,-1)); |
2918 | array1.SetValue(5,gp_Pnt (-3,5,-2)); |
2919 | Handle(Geom_BSplineCurve) SPL1 = GeomAPI_PointsToBSpline(array1).Curve(); |
2920 | |
2921 | TColgp_Array1OfPnt array2 (1,5); // sizing array |
2922 | array2.SetValue(1,gp_Pnt (-4,0, 2)); array2.SetValue(2,gp_Pnt (-2,2,0 )); |
2923 | array2.SetValue(3,gp_Pnt (2 ,3,-1)); array2.SetValue(4,gp_Pnt (3 ,7,-2)); |
2924 | array2.SetValue(5,gp_Pnt (4 ,9,-1)); |
2925 | Handle(Geom_BSplineCurve) SPL2 = GeomAPI_PointsToBSpline(array2).Curve(); |
2926 | |
2927 | GeomFill_FillingStyle Type = GeomFill_StretchStyle; |
2928 | GeomFill_BSplineCurves aGeomFill1(SPL1,SPL2,Type); |
2929 | Handle(Geom_BSplineSurface) aBSplineSurface1 = aGeomFill1.Surface(); |
2930 | |
2931 | Type = GeomFill_CoonsStyle; |
2932 | GeomFill_BSplineCurves aGeomFill2( |
2933 | Handle(Geom_BSplineCurve)::DownCast(SPL1->Translated(gp_Vec(10,0,0))), |
2934 | Handle(Geom_BSplineCurve)::DownCast(SPL2->Translated(gp_Vec(10,0,0))),Type); |
2935 | Handle(Geom_BSplineSurface) aBSplineSurface2 = aGeomFill2.Surface(); |
2936 | Type = GeomFill_CurvedStyle; |
2937 | GeomFill_BSplineCurves aGeomFill3( |
2938 | Handle(Geom_BSplineCurve)::DownCast(SPL1->Translated(gp_Vec(20,0,0))), |
2939 | Handle(Geom_BSplineCurve)::DownCast(SPL2->Translated(gp_Vec(20,0,0))),Type); |
2940 | Handle(Geom_BSplineSurface) aBSplineSurface3 = aGeomFill3.Surface(); |
2941 | |
2942 | //============================================================== |
2943 | TCollection_AsciiString Message (" \ |
7fd59977 |
2944 | \n\ |
2945 | TColgp_Array1OfPnt array1 (1,5); // sizing array \n\ |
2946 | array1.SetValue(1,gp_Pnt (-4,0,2 )); array1.SetValue(2,gp_Pnt (-7,2,2 )); \n\ |
2947 | array1.SetValue(3,gp_Pnt (-6,3,1 )); array1.SetValue(4,gp_Pnt (-4,3,-1)); \n\ |
2948 | array1.SetValue(5,gp_Pnt (-3,5,-2)); \n\ |
2949 | Handle(Geom_BSplineCurve) SPL1 = GeomAPI_PointsToBSpline(array1).Curve(); \n\ |
2950 | \n\ |
2951 | TColgp_Array1OfPnt array2 (1,5); // sizing array \n\ |
2952 | array2.SetValue(1,gp_Pnt (-4,0, 2)); array2.SetValue(2,gp_Pnt (-2,2,0 )); \n\ |
2953 | array2.SetValue(3,gp_Pnt (2 ,3,-1)); array2.SetValue(4,gp_Pnt (3 ,7,-2)); \n\ |
2954 | array2.SetValue(5,gp_Pnt (4 ,9,-1)); \n\ |
2955 | Handle(Geom_BSplineCurve) SPL2 = GeomAPI_PointsToBSpline(array2).Curve(); \n\ |
2956 | \n\ |
2957 | GeomFill_FillingStyle Type = GeomFill_StretchStyle; \n\ |
2958 | GeomFill_BSplineCurves aGeomFill1(SPL1,SPL2,Type); \n\ |
2959 | Handle(Geom_BSplineSurface) aBSplineSurface1 = aGeomFill1.Surface(); \n\ |
2960 | \n\ |
2961 | Type = GeomFill_CoonsStyle; \n\ |
2962 | GeomFill_BSplineCurves aGeomFill2( \n"); |
2963 | Message += "\ |
2964 | Handle(Geom_BSplineCurve)::DownCast(SPL1->Translated(gp_Vec(10,0,0))), \n\ |
2965 | Handle(Geom_BSplineCurve)::DownCast(SPL2->Translated(gp_Vec(10,0,0))),Type); \n\ |
2966 | Handle(Geom_BSplineSurface) aBSplineSurface2 = aGeomFill2.Surface(); \n\ |
2967 | Type = GeomFill_CurvedStyle; \n\ |
2968 | GeomFill_BSplineCurves aGeomFill3( \n\ |
2969 | Handle(Geom_BSplineCurve)::DownCast(SPL1->Translated(gp_Vec(20,0,0))), \n\ |
2970 | Handle(Geom_BSplineCurve)::DownCast(SPL2->Translated(gp_Vec(20,0,0))),Type); \n\ |
2971 | Handle(Geom_BSplineSurface) aBSplineSurface3 = aGeomFill3.Surface(); \n\ |
2972 | \n"; |
5c1f974e |
2973 | AddSeparator(aDoc,Message); |
2974 | //-------------------------------------------------------------- |
7fd59977 |
2975 | |
5c1f974e |
2976 | // Trace des frontieres. -> FreeBoundaryAspect |
2977 | // Trace des isoparametriques. --> UIsoAspect() |
7fd59977 |
2978 | |
5c1f974e |
2979 | DisplaySurface(aDoc,aBSplineSurface1,Quantity_NOC_YELLOW); |
2980 | DisplaySurface(aDoc,aBSplineSurface2,Quantity_NOC_SALMON); |
2981 | DisplaySurface(aDoc,aBSplineSurface3,Quantity_NOC_HOTPINK); |
2982 | |
2983 | for (int i=0;i<=2;i++) |
2984 | { |
2985 | DisplayCurve(aDoc,Handle(Geom_BSplineCurve)::DownCast(SPL1->Translated(gp_Vec(i*10,0,0))), Quantity_NOC_RED,false); |
2986 | DisplayCurve(aDoc,Handle(Geom_BSplineCurve)::DownCast(SPL2->Translated(gp_Vec(i*10,0,0))), Quantity_NOC_GREEN,false); |
2987 | } |
7fd59977 |
2988 | |
5c1f974e |
2989 | Message += "SPL1 is Red; \n"; |
2990 | Message += "SPL2 is Green; \n"; |
2991 | Message += "aBSplineSurface1 is Yellow; ( GeomFill_StretchStyle )\n"; |
2992 | Message += "aBSplineSurface2 is Salmon; ( GeomFill_CoonsStyle ) \n"; |
2993 | Message += "aBSplineSurface3 is Hot pink; ( GeomFill_CurvedStyle ) \n"; |
7fd59977 |
2994 | |
576f8b11 |
2995 | PostProcess(aDoc,ID_BUTTON_Test_38,TheDisplayType,Message); |
7fd59977 |
2996 | } |
2997 | void GeomSources::gpTest39(CGeometryDoc* aDoc) |
2998 | { |
5c1f974e |
2999 | DisplayType TheDisplayType = No2D3D; |
3000 | PreProcess(aDoc,TheDisplayType); |
3001 | //============================================================== |
3002 | |
3003 | TColgp_Array1OfPnt array1 (1,5); // sizing array |
3004 | array1.SetValue(1,gp_Pnt (-4,0,2 )); |
3005 | array1.SetValue(2,gp_Pnt (-5,1,0 )); |
3006 | array1.SetValue(3,gp_Pnt (-6,2,-2 )); |
3007 | array1.SetValue(4,gp_Pnt (-5,4,-7)); |
3008 | array1.SetValue(5,gp_Pnt (-3,5,-12)); |
3009 | |
3010 | TColgp_Array1OfPnt array2 (1,5); // sizing array |
3011 | array2.SetValue(1,gp_Pnt (-4,0, 2)); |
3012 | array2.SetValue(2,gp_Pnt (-3,2,1 )); |
3013 | array2.SetValue(3,gp_Pnt (-1,5,0)); |
3014 | array2.SetValue(4,gp_Pnt (2 ,7,-1)); |
3015 | array2.SetValue(5,gp_Pnt (4 ,9,-1)); |
3016 | |
3017 | TColgp_Array1OfPnt array3 (1,4); // sizing array |
3018 | array3.SetValue(1,gp_Pnt (-3,5, -12)); |
3019 | array3.SetValue(2,gp_Pnt (-2,6,-7 )); |
3020 | array3.SetValue(3,gp_Pnt (0 ,8,-3)); |
3021 | array3.SetValue(4,gp_Pnt (4 ,9,-1)); |
3022 | |
3023 | Handle(Geom_BSplineCurve) SPL1 = GeomAPI_PointsToBSpline(array1).Curve(); |
3024 | Handle(Geom_BSplineCurve) SPL2 = GeomAPI_PointsToBSpline(array2).Curve(); |
3025 | Handle(Geom_BSplineCurve) SPL3 = GeomAPI_PointsToBSpline(array3).Curve(); |
3026 | |
3027 | Handle(GeomAdaptor_HCurve) SPL1Adaptor = new GeomAdaptor_HCurve(SPL1); |
3028 | Handle(GeomFill_SimpleBound) B1 = |
3029 | new GeomFill_SimpleBound(SPL1Adaptor,Precision::Approximation(),Precision::Angular()); |
3030 | Handle(GeomAdaptor_HCurve) SPL2Adaptor = new GeomAdaptor_HCurve(SPL2); |
3031 | Handle(GeomFill_SimpleBound) B2 = |
3032 | new GeomFill_SimpleBound(SPL2Adaptor,Precision::Approximation(),Precision::Angular()); |
3033 | Handle(GeomAdaptor_HCurve) SPL3Adaptor = new GeomAdaptor_HCurve(SPL3); |
3034 | Handle(GeomFill_SimpleBound) B3 = |
3035 | new GeomFill_SimpleBound(SPL3Adaptor,Precision::Approximation(),Precision::Angular()); |
3036 | Standard_Boolean NoCheck= Standard_False; |
3037 | |
3038 | Standard_Integer MaxDeg = 8; |
3039 | Standard_Integer MaxSeg = 2; |
3040 | GeomFill_ConstrainedFilling aConstrainedFilling(MaxDeg, MaxSeg); |
3041 | |
3042 | aConstrainedFilling.Init(B1,B2,B3,NoCheck); |
3043 | |
3044 | Handle(Geom_BSplineSurface) aBSplineSurface = aConstrainedFilling.Surface(); |
3045 | |
7fd59977 |
3046 | //============================================================== |
3047 | TCollection_AsciiString Message (" \ |
3048 | \n\ |
3049 | TColgp_Array1OfPnt array1 (1,5); // sizing array \n\ |
3050 | ... \n\ |
3051 | Handle(Geom_BSplineCurve) SPL1 = GeomAPI_PointsToBSpline(array1).Curve(); \n\ |
3052 | Handle(Geom_BSplineCurve) SPL2 = GeomAPI_PointsToBSpline(array2).Curve(); \n\ |
3053 | Handle(Geom_BSplineCurve) SPL3 = GeomAPI_PointsToBSpline(array3).Curve(); \n\ |
3054 | \n\ |
3055 | Handle(GeomAdaptor_HCurve) SPL1Adaptor = new GeomAdaptor_HCurve(SPL1); \n\ |
3056 | Handle(GeomFill_SimpleBound) B1 = \n\ |
3057 | new GeomFill_SimpleBound(SPL1Adaptor,Precision::Approximation(),Precision::Angular()); \n\ |
3058 | Handle(GeomAdaptor_HCurve) SPL2Adaptor = new GeomAdaptor_HCurve(SPL2); \n\ |
3059 | Handle(GeomFill_SimpleBound) B2 = \n\ |
3060 | new GeomFill_SimpleBound(SPL2Adaptor,Precision::Approximation(),Precision::Angular()); \n\ |
3061 | Handle(GeomAdaptor_HCurve) SPL3Adaptor = new GeomAdaptor_HCurve(SPL3); \n\ |
3062 | Handle(GeomFill_SimpleBound) B3 = \n\ |
3063 | new GeomFill_SimpleBound(SPL3Adaptor,Precision::Approximation(),Precision::Angular()); \n\ |
3064 | Standard_Boolean NoCheck= Standard_False; \n\ |
3065 | \n\ |
3066 | Standard_Integer MaxDeg = 8; \n"); |
3067 | Message += "\ |
3068 | Standard_Integer MaxSeg = 2; \n\ |
3069 | GeomFill_ConstrainedFilling aConstrainedFilling(MaxDeg, MaxSeg); \n\ |
3070 | \n\ |
3071 | aConstrainedFilling.Init(B1,B2,B3,NoCheck); \n\ |
3072 | \n\ |
3073 | Handle(Geom_BSplineSurface) aBSplineSurface = aConstrainedFilling.Surface(); \n\ |
3074 | \n"; |
5c1f974e |
3075 | AddSeparator(aDoc,Message); |
3076 | //-------------------------------------------------------------- |
7fd59977 |
3077 | |
5c1f974e |
3078 | TCollection_AsciiString aString; |
7fd59977 |
3079 | |
5c1f974e |
3080 | DisplaySurface(aDoc,aBSplineSurface,Quantity_NOC_YELLOW); |
3081 | DisplayCurve(aDoc,SPL1,Quantity_NOC_RED ,false); |
3082 | DisplayCurve(aDoc,SPL2,Quantity_NOC_GREEN ,false); |
3083 | DisplayCurve(aDoc,SPL3,Quantity_NOC_BLUE1 ,false); |
7fd59977 |
3084 | |
5c1f974e |
3085 | Message += "SPL1 is Red; \n"; |
3086 | Message += "SPL2 is Green; \n"; |
3087 | Message += "SPL3 is Blue; \n"; |
7fd59977 |
3088 | |
5c1f974e |
3089 | Message += "aBSplineSurface is Yellow; \n"; |
7fd59977 |
3090 | |
576f8b11 |
3091 | PostProcess(aDoc,ID_BUTTON_Test_39,TheDisplayType,Message); |
7fd59977 |
3092 | } |
3093 | |
3094 | void GeomSources::gpTest40(CGeometryDoc* aDoc) |
3095 | { |
5c1f974e |
3096 | DisplayType TheDisplayType = No2D3D; |
3097 | PreProcess(aDoc,TheDisplayType); |
3098 | //============================================================== |
3099 | |
3100 | TColgp_Array1OfPnt array1 (1,5); // sizing array |
3101 | array1.SetValue(1,gp_Pnt (-4,0,2 )); |
3102 | array1.SetValue(2,gp_Pnt (-5,1,0 )); |
3103 | array1.SetValue(3,gp_Pnt (-6,2,-2 )); |
3104 | array1.SetValue(4,gp_Pnt (-5,4,-7)); |
3105 | array1.SetValue(5,gp_Pnt (-3,5,-12)); |
3106 | |
3107 | Handle(Geom_BSplineCurve) SPL1 = |
3108 | GeomAPI_PointsToBSpline(array1).Curve(); |
3109 | |
3110 | GeomFill_Pipe aPipe(SPL1,1); |
3111 | aPipe.Perform(); |
3112 | Handle(Geom_Surface) aSurface= aPipe.Surface(); |
3113 | Standard_CString aSurfaceEntityTypeName="Not Computed"; |
3114 | if (!aSurface.IsNull()) |
3115 | aSurfaceEntityTypeName = aSurface->DynamicType()->Name(); |
3116 | |
3117 | Handle(Geom_Ellipse) E = GC_MakeEllipse( gp::XOY() ,3,1).Value(); |
3118 | GeomFill_Pipe aPipe2(SPL1,E); |
3119 | aPipe2.Perform(); |
3120 | Handle(Geom_Surface) aSurface2= aPipe2.Surface(); |
3121 | Standard_CString aSurfaceEntityTypeName2="Not Computed"; |
3122 | if (!aSurface2.IsNull()) { |
3123 | aSurfaceEntityTypeName2 = aSurface2->DynamicType()->Name(); |
3124 | aSurface2->Translate(gp_Vec(5,0,0)); } |
3125 | |
3126 | Handle(Geom_TrimmedCurve) TC1 = |
3127 | GC_MakeSegment(gp_Pnt(1,1,1),gp_Pnt(5,5,5)); |
3128 | Handle(Geom_TrimmedCurve) TC2 = |
3129 | GC_MakeSegment(gp_Pnt(1,1,0),gp_Pnt(4,5,6)); |
9e3ca93a |
3130 | GeomFill_Pipe aPipe3(Handle(Geom_Curve)::DownCast(SPL1),TC1,TC2); |
5c1f974e |
3131 | aPipe3.Perform(); |
3132 | Handle(Geom_Surface) aSurface3 = aPipe3.Surface(); |
3133 | Standard_CString aSurfaceEntityTypeName3="Not Computed"; |
3134 | if (!aSurface3.IsNull()) |
3135 | { |
3136 | aSurfaceEntityTypeName3 = aSurface3->DynamicType()->Name(); |
3137 | aSurface3->Translate(gp_Vec(10,0,0)); |
3138 | } |
3139 | |
3140 | //============================================================== |
7fd59977 |
3141 | TCollection_AsciiString Message (" \ |
3142 | \n\ |
3143 | \n\ |
3144 | TColgp_Array1OfPnt array1 (1,5); // sizing array \n\ |
3145 | array1.SetValue(1,gp_Pnt (-4,0,2 )); \n\ |
3146 | array1.SetValue(2,gp_Pnt (-5,1,0 )); \n\ |
3147 | array1.SetValue(3,gp_Pnt (-6,2,-2 )); \n\ |
3148 | array1.SetValue(4,gp_Pnt (-5,4,-7)); \n\ |
3149 | array1.SetValue(5,gp_Pnt (-3,5,-12)); \n\ |
3150 | \n\ |
3151 | Handle(Geom_BSplineCurve) SPL1 = \n\ |
3152 | GeomAPI_PointsToBSpline(array1).Curve(); \n\ |
3153 | \n\ |
3154 | GeomFill_Pipe aPipe(SPL1,1); \n\ |
3155 | aPipe.Perform(); \n\ |
3156 | Handle(Geom_Surface) aSurface= aPipe.Surface(); \n\ |
3157 | Standard_CString aSurfaceEntityTypeName=\"Not Computed\"; \n\ |
3158 | if (!aSurface.IsNull()) \n\ |
3159 | aSurfaceEntityTypeName = aSurface->DynamicType()->Name(); \n\ |
3160 | \n\ |
3161 | Handle(Geom_Ellipse) E = GC_MakeEllipse( gp::XOY() ,3,1).Value(); \n\ |
3162 | GeomFill_Pipe aPipe2(SPL1,E); \n\ |
3163 | aPipe2.Perform(); \n"); |
3164 | Message += "\ |
3165 | Handle(Geom_Surface) aSurface2= aPipe2.Surface(); \n\ |
3166 | Standard_CString aSurfaceEntityTypeName2=\"Not Computed\"; \n\ |
3167 | if (!aSurface2.IsNull()) { \n\ |
3168 | aSurfaceEntityTypeName2 = aSurface2->DynamicType()->Name(); \n\ |
3169 | aSurface2->Translate(gp_Vec(5,0,0)); } \n\ |
3170 | \n\ |
3171 | Handle(Geom_TrimmedCurve) TC1 = \n\ |
3172 | GC_MakeSegment(gp_Pnt(1,1,1),gp_Pnt(5,5,5)); \n\ |
3173 | Handle(Geom_TrimmedCurve) TC2 = \n\ |
3174 | GC_MakeSegment(gp_Pnt(1,1,0),gp_Pnt(4,5,6)); \n\ |
3175 | GeomFill_Pipe aPipe3(SPL1,TC1,TC2); \n\ |
3176 | aPipe3.Perform(); \n\ |
3177 | Handle(Geom_Surface) aSurface3 = aPipe3.Surface(); \n\ |
3178 | Standard_CString aSurfaceEntityTypeName3=\"Not Computed\"; \n\ |
3179 | if (!aSurface3.IsNull()) \n\ |
3180 | { \n\ |
3181 | aSurfaceEntityTypeName3 = aSurface3->DynamicType()->Name(); \n\ |
3182 | aSurface3->Translate(gp_Vec(10,0,0)); \n\ |
3183 | } \n\ |
3184 | \n"; |
5c1f974e |
3185 | AddSeparator(aDoc,Message); |
3186 | //-------------------------------------------------------------- |
7fd59977 |
3187 | |
5c1f974e |
3188 | if (!aSurface.IsNull()) |
3189 | { |
3190 | DisplaySurface(aDoc,aSurface,Quantity_NOC_YELLOW); |
3191 | } |
3192 | if (!aSurface2.IsNull()) |
3193 | { |
3194 | DisplaySurface(aDoc,aSurface2,Quantity_NOC_YELLOW); |
3195 | } |
3196 | if (!aSurface3.IsNull()) |
3197 | { |
3198 | DisplaySurface(aDoc,aSurface3,Quantity_NOC_YELLOW); |
3199 | } |
7fd59977 |
3200 | |
5c1f974e |
3201 | DisplayCurve(aDoc,SPL1,Quantity_NOC_RED ,false); |
7fd59977 |
3202 | |
5c1f974e |
3203 | Message += "SPL1 is Red; \n"; |
7fd59977 |
3204 | |
7fd59977 |
3205 | |
5c1f974e |
3206 | TCollection_AsciiString Message2(aSurfaceEntityTypeName); |
3207 | TCollection_AsciiString Message3(aSurfaceEntityTypeName2); |
3208 | TCollection_AsciiString Message4(aSurfaceEntityTypeName3); |
7fd59977 |
3209 | |
5c1f974e |
3210 | Message += " aSurfaceEntityTypeName = ";Message+= Message2; Message += "\n"; |
3211 | Message += " aSurfaceEntityTypeName2 = ";Message+= Message3; Message += "\n"; |
3212 | Message += " aSurfaceEntityTypeName3 = ";Message+= Message4; Message += "\n"; |
3213 | |
576f8b11 |
3214 | PostProcess(aDoc,ID_BUTTON_Test_40,TheDisplayType,Message); |
7fd59977 |
3215 | } |
3216 | |
3217 | void GeomSources::gpTest41(CGeometryDoc* aDoc) |
3218 | { |
5c1f974e |
3219 | DisplayType TheDisplayType = No2D3D; |
3220 | PreProcess(aDoc,TheDisplayType); |
3221 | //============================================================== |
3222 | |
3223 | TColgp_Array1OfPnt array1 (1,5); |
3224 | array1.SetValue(1,gp_Pnt (-4,0,2 )); |
3225 | array1.SetValue(2,gp_Pnt (-5,1,0 )); |
3226 | array1.SetValue(3,gp_Pnt (-6,2,-2 )); |
3227 | array1.SetValue(4,gp_Pnt (-5,4,-7)); |
3228 | array1.SetValue(5,gp_Pnt (-3,5,-12)); |
3229 | |
3230 | Handle(Geom_BSplineCurve) SPL1 = |
3231 | GeomAPI_PointsToBSpline(array1).Curve(); |
3232 | Handle(Geom_Curve) FirstSect = |
3233 | GC_MakeSegment(gp_Pnt(-4,0,2),gp_Pnt(-4,0,10)).Value(); |
3234 | |
3235 | GeomFill_Pipe aPipe(SPL1,FirstSect); |
3236 | aPipe.Perform(); |
3237 | |
3238 | Handle(Geom_BSplineSurface) aPipeSurface = |
3239 | Handle(Geom_BSplineSurface)::DownCast(aPipe.Surface()); |
3240 | Handle(Geom_BSplineSurface) anotherBSplineSurface = |
3241 | GeomConvert::SplitBSplineSurface(aPipeSurface,1,2,3,6); |
3242 | |
3243 | //============================================================== |
3244 | TCollection_AsciiString Message (" \ |
7fd59977 |
3245 | \n\ |
3246 | TColgp_Array1OfPnt array1 (1,5); \n\ |
3247 | array1.SetValue(1,gp_Pnt (-4,0,2 )); \n\ |
3248 | array1.SetValue(2,gp_Pnt (-5,1,0 )); \n\ |
3249 | array1.SetValue(3,gp_Pnt (-6,2,-2 )); \n\ |
3250 | array1.SetValue(4,gp_Pnt (-5,4,-7)); \n\ |
3251 | array1.SetValue(5,gp_Pnt (-3,5,-12)); \n\ |
3252 | \n\ |
3253 | Handle(Geom_BSplineCurve) SPL1 = \n\ |
3254 | GeomAPI_PointsToBSpline(array1).Curve(); \n\ |
3255 | Handle(Geom_Curve) FirstSect = \n\ |
3256 | GC_MakeSegment(gp_Pnt(-4,0,2),gp_Pnt(-4,0,10)).Value(); \n\ |
3257 | \n\ |
3258 | GeomFill_Pipe aPipe(SPL1,FirstSect); \n\ |
3259 | aPipe.Perform(); \n\ |
3260 | \n\ |
3261 | Handle(Geom_BSplineSurface) aPipeSurface = \n\ |
3262 | Handle(Geom_BSplineSurface)::DownCast(aPipe.Surface()); \n\ |
3263 | Handle(Geom_BSplineSurface) anotherBSplineSurface = \n\ |
3264 | GeomConvert::SplitBSplineSurface(aPipeSurface,1,2,3,6); \n\ |
3265 | \n"); |
5c1f974e |
3266 | AddSeparator(aDoc,Message); |
3267 | //-------------------------------------------------------------- |
7fd59977 |
3268 | |
5c1f974e |
3269 | if(!aPipeSurface.IsNull()) |
3270 | { |
3271 | DisplaySurface(aDoc,aPipeSurface,Quantity_NOC_YELLOW); |
3272 | } |
7fd59977 |
3273 | |
5c1f974e |
3274 | if(!anotherBSplineSurface.IsNull()) |
3275 | { |
3276 | DisplaySurface(aDoc,anotherBSplineSurface,Quantity_NOC_HOTPINK); |
3277 | } |
7fd59977 |
3278 | |
5c1f974e |
3279 | DisplayCurve(aDoc,SPL1,Quantity_NOC_RED ,false); |
3280 | DisplayCurve(aDoc,FirstSect,Quantity_NOC_GREEN ,false); |
7fd59977 |
3281 | |
5c1f974e |
3282 | Message += "SPL1 is Red; \n"; |
3283 | Message += "SPL2 is Green; \n"; |
3284 | Message += "SPL3 is Blue; \n"; |
3285 | Message += "aBSplineSurface is Yellow; \n"; |
3286 | Message += "anotherBSplineSurface is Hot Pink; \n"; |
7fd59977 |
3287 | |
576f8b11 |
3288 | PostProcess(aDoc,ID_BUTTON_Test_41,TheDisplayType,Message); |
7fd59977 |
3289 | } |
3290 | |
3291 | |
3292 | void GeomSources::gpTest42(CGeometryDoc* aDoc) |
3293 | { |
5c1f974e |
3294 | DisplayType TheDisplayType = No2D3D; |
3295 | PreProcess(aDoc,TheDisplayType); |
3296 | |
3297 | //============================================================== |
3298 | |
3299 | TColgp_Array2OfPnt array1(1,3,1,3); |
3300 | TColgp_Array2OfPnt array2(1,3,1,3); |
3301 | TColgp_Array2OfPnt array3(1,3,1,3); |
3302 | TColgp_Array2OfPnt array4(1,3,1,3); |
3303 | |
3304 | array1.SetValue(1,1,gp_Pnt(1,1,1)); |
3305 | array1.SetValue(1,2,gp_Pnt(2,1,2)); |
3306 | array1.SetValue(1,3,gp_Pnt(3,1,1)); |
3307 | array1.SetValue(2,1,gp_Pnt(1,2,1)); |
3308 | array1.SetValue(2,2,gp_Pnt(2,2,2)); |
3309 | array1.SetValue(2,3,gp_Pnt(3,2,0)); |
3310 | array1.SetValue(3,1,gp_Pnt(1,3,2)); |
3311 | array1.SetValue(3,2,gp_Pnt(2,3,1)); |
3312 | array1.SetValue(3,3,gp_Pnt(3,3,0)); |
3313 | |
3314 | array2.SetValue(1,1,gp_Pnt(3,1,1)); |
3315 | array2.SetValue(1,2,gp_Pnt(4,1,1)); |
3316 | array2.SetValue(1,3,gp_Pnt(5,1,2)); |
3317 | array2.SetValue(2,1,gp_Pnt(3,2,0)); |
3318 | array2.SetValue(2,2,gp_Pnt(4,2,1)); |
3319 | array2.SetValue(2,3,gp_Pnt(5,2,2)); |
3320 | array2.SetValue(3,1,gp_Pnt(3,3,0)); |
3321 | array2.SetValue(3,2,gp_Pnt(4,3,0)); |
3322 | array2.SetValue(3,3,gp_Pnt(5,3,1)); |
3323 | |
3324 | array3.SetValue(1,1,gp_Pnt(1,3,2)); |
3325 | array3.SetValue(1,2,gp_Pnt(2,3,1)); |
3326 | array3.SetValue(1,3,gp_Pnt(3,3,0)); |
3327 | array3.SetValue(2,1,gp_Pnt(1,4,1)); |
3328 | array3.SetValue(2,2,gp_Pnt(2,4,0)); |
3329 | array3.SetValue(2,3,gp_Pnt(3,4,1)); |
3330 | array3.SetValue(3,1,gp_Pnt(1,5,1)); |
3331 | array3.SetValue(3,2,gp_Pnt(2,5,1)); |
3332 | array3.SetValue(3,3,gp_Pnt(3,5,2)); |
3333 | |
3334 | array4.SetValue(1,1,gp_Pnt(3,3,0)); |
3335 | array4.SetValue(1,2,gp_Pnt(4,3,0)); |
3336 | array4.SetValue(1,3,gp_Pnt(5,3,1)); |
3337 | array4.SetValue(2,1,gp_Pnt(3,4,1)); |
3338 | array4.SetValue(2,2,gp_Pnt(4,4,1)); |
3339 | array4.SetValue(2,3,gp_Pnt(5,4,1)); |
3340 | array4.SetValue(3,1,gp_Pnt(3,5,2)); |
3341 | array4.SetValue(3,2,gp_Pnt(4,5,2)); |
3342 | array4.SetValue(3,3,gp_Pnt(5,5,1)); |
3343 | |
3344 | Handle(Geom_BezierSurface) BZ1 = |
7fd59977 |
3345 | new Geom_BezierSurface(array1); |
5c1f974e |
3346 | Handle(Geom_BezierSurface) BZ2 = |
7fd59977 |
3347 | new Geom_BezierSurface(array2); |
5c1f974e |
3348 | Handle(Geom_BezierSurface) BZ3 = |
7fd59977 |
3349 | new Geom_BezierSurface(array3); |
5c1f974e |
3350 | Handle(Geom_BezierSurface) BZ4 = |
7fd59977 |
3351 | new Geom_BezierSurface(array4); |
7fd59977 |
3352 | |
5c1f974e |
3353 | TColGeom_Array2OfBezierSurface bezierarray(1,2,1,2); |
3354 | bezierarray.SetValue(1,1,BZ1); |
3355 | bezierarray.SetValue(1,2,BZ2); |
3356 | bezierarray.SetValue(2,1,BZ3); |
3357 | bezierarray.SetValue(2,2,BZ4); |
7fd59977 |
3358 | |
5c1f974e |
3359 | GeomConvert_CompBezierSurfacesToBSplineSurface BB (bezierarray); |
3360 | Handle(Geom_BSplineSurface) BSPLSURF ; |
3361 | if (BB.IsDone()) |
3362 | { |
3363 | BSPLSURF = new Geom_BSplineSurface( |
3364 | BB.Poles()->Array2(), |
3365 | BB.UKnots()->Array1(), |
3366 | BB.VKnots()->Array1(), |
3367 | BB.UMultiplicities()->Array1(), |
3368 | BB.VMultiplicities()->Array1(), |
3369 | BB.UDegree(), |
3370 | BB.VDegree() ); |
3371 | BSPLSURF->Translate(gp_Vec(0,0,2)); |
3372 | } |
3373 | |
3374 | //============================================================== |
3375 | |
3376 | TCollection_AsciiString Message (" \ |
7fd59977 |
3377 | \n\ |
3378 | TColgp_Array2OfPnt array1(1,3,1,3); \n\ |
3379 | TColgp_Array2OfPnt array2(1,3,1,3); \n\ |
3380 | TColgp_Array2OfPnt array3(1,3,1,3); \n\ |
3381 | TColgp_Array2OfPnt array4(1,3,1,3); \n\ |
3382 | \n\ |
3383 | // array1.SetValue( ... \n\ |
3384 | \n\ |
3385 | Handle(Geom_BezierSurface) BZ1 = \n\ |
3386 | new Geom_BezierSurface(array1); \n\ |
3387 | Handle(Geom_BezierSurface) BZ2 = \n\ |
3388 | new Geom_BezierSurface(array2); \n\ |
3389 | Handle(Geom_BezierSurface) BZ3 = \n\ |
3390 | new Geom_BezierSurface(array3); \n\ |
3391 | Handle(Geom_BezierSurface) BZ4 = \n\ |
3392 | new Geom_BezierSurface(array4); \n\ |
3393 | \n\ |
3394 | TColGeom_Array2OfBezierSurface bezierarray(1,2,1,2); \n\ |
3395 | bezierarray.SetValue(1,1,BZ1); \n\ |
3396 | bezierarray.SetValue(1,2,BZ2); \n\ |
3397 | bezierarray.SetValue(2,1,BZ3); \n\ |
3398 | bezierarray.SetValue(2,2,BZ4); \n\ |
3399 | \n\ |
3400 | GeomConvert_CompBezierSurfacesToBSplineSurface BB (bezierarray); \n\ |
3401 | Handle(Geom_BSplineSurface) BSPLSURF ; \n\ |
3402 | if (BB.IsDone()){ \n\ |
3403 | BSPLSURF = new Geom_BSplineSurface( \n\ |
3404 | BB.Poles()->Array2(), \n\ |
3405 | BB.UKnots()->Array1(), \n"); |
3406 | Message += "\ |
3407 | BB.VKnots()->Array1(), \n\ |
3408 | BB.UMultiplicities()->Array1(), \n\ |
3409 | BB.VMultiplicities()->Array1(), \n\ |
3410 | BB.UDegree(), \n\ |
3411 | BB.VDegree() ); \n\ |
3412 | BSPLSURF->Translate(gp_Vec(0,0,2)); \n\ |
3413 | } \n\ |
3414 | \n"; |
5c1f974e |
3415 | AddSeparator(aDoc,Message); |
3416 | //-------------------------------------------------------------- |
7fd59977 |
3417 | |
5c1f974e |
3418 | DisplaySurface(aDoc,BZ1,Quantity_NOC_RED); |
3419 | DisplaySurface(aDoc,BZ2,Quantity_NOC_GREEN); |
3420 | DisplaySurface(aDoc,BZ3,Quantity_NOC_BLUE1); |
3421 | DisplaySurface(aDoc,BZ4,Quantity_NOC_BROWN); |
7fd59977 |
3422 | |
5c1f974e |
3423 | if (BB.IsDone()){ |
3424 | DisplaySurface(aDoc,BSPLSURF,Quantity_NOC_HOTPINK); |
3425 | } |
7fd59977 |
3426 | |
5c1f974e |
3427 | Message += "BZ1 is Red; \n"; |
3428 | Message += "BZ2 is Green; \n"; |
3429 | Message += "BZ3 is Blue; \n"; |
3430 | Message += "BZ4 is Brown; \n"; |
3431 | Message += "BSPLSURF is Hot Pink; \n"; |
3432 | |
576f8b11 |
3433 | PostProcess(aDoc,ID_BUTTON_Test_42,TheDisplayType,Message); |
7fd59977 |
3434 | } |
3435 | |
3436 | void GeomSources::gpTest43(CGeometryDoc* aDoc) |
3437 | { |
5c1f974e |
3438 | DisplayType TheDisplayType = No2D3D; |
3439 | PreProcess(aDoc,TheDisplayType); |
3440 | //============================================================== |
3441 | |
3442 | TColgp_Array1OfPnt array1 (1,5); |
3443 | array1.SetValue(1,gp_Pnt (-4,5,5 )); |
3444 | array1.SetValue(2,gp_Pnt (-3,6,6 )); |
3445 | array1.SetValue(3,gp_Pnt (-1,7,7 )); |
3446 | array1.SetValue(4,gp_Pnt (0,8,8)); |
3447 | array1.SetValue(5,gp_Pnt (2,9,9)); |
3448 | Handle(Geom_BSplineCurve) SPL1 = |
3449 | GeomAPI_PointsToBSpline(array1).Curve(); |
3450 | |
3451 | TColgp_Array1OfPnt array2 (1,5); |
3452 | array2.SetValue(1,gp_Pnt (-4,5,2 )); |
3453 | array2.SetValue(2,gp_Pnt (-3,6,3 )); |
3454 | array2.SetValue(3,gp_Pnt (-1,7,4 )); |
3455 | array2.SetValue(4,gp_Pnt (0,8,5)); |
3456 | array2.SetValue(5,gp_Pnt (2,9,6)); |
3457 | Handle(Geom_BSplineCurve) SPL2 = |
3458 | GeomAPI_PointsToBSpline(array2).Curve(); |
3459 | |
3460 | GeomFill_FillingStyle Type = GeomFill_StretchStyle; |
3461 | GeomFill_BSplineCurves aGeomFill1(SPL1,SPL2,Type); |
3462 | Handle(Geom_BSplineSurface) aGeomSurface = aGeomFill1.Surface(); |
3463 | Standard_Real offset = 1; |
3464 | Handle(Geom_OffsetSurface) GOS = new Geom_OffsetSurface(aGeomSurface, offset); |
3465 | offset = 2; |
3466 | Handle(Geom_OffsetSurface) GOS1 = new Geom_OffsetSurface(aGeomSurface, offset); |
3467 | offset = 3; |
3468 | Handle(Geom_OffsetSurface) GOS2 = new Geom_OffsetSurface(aGeomSurface, offset); |
3469 | |
3470 | //============================================================== |
3471 | TCollection_AsciiString Message (" \ |
7fd59977 |
3472 | \n\ |
3473 | TColgp_Array1OfPnt array1 (1,5); \n\ |
3474 | //array1.SetValue( ... \n\ |
3475 | Handle(Geom_BSplineCurve) SPL1 = \n\ |
3476 | GeomAPI_PointsToBSpline(array1).Curve(); \n\ |
3477 | \n\ |
3478 | TColgp_Array1OfPnt array2 (1,5); \n\ |
3479 | // array2.SetValue( ... \n\ |
3480 | \n\ |
3481 | Handle(Geom_BSplineCurve) SPL2 = \n\ |
3482 | GeomAPI_PointsToBSpline(array2).Curve(); \n\ |
3483 | \n\ |
3484 | GeomFill_FillingStyle Type = GeomFill_StretchStyle; \n\ |
3485 | GeomFill_BSplineCurves aGeomFill1(SPL1,SPL2,Type); \n\ |
3486 | Handle(Geom_BSplineSurface) aGeomSurface = aGeomFill1.Surface(); \n\ |
3487 | Standard_Real offset = 1; \n\ |
3488 | Handle(Geom_OffsetSurface) GOS = new Geom_OffsetSurface(aGeomSurface, offset); \n\ |
3489 | offset = 2; \n\ |
3490 | Handle(Geom_OffsetSurface) GOS1 = new Geom_OffsetSurface(aGeomSurface, offset); \n\ |
3491 | offset = 3; \n\ |
3492 | Handle(Geom_OffsetSurface) GOS2 = new Geom_OffsetSurface(aGeomSurface, offset); \n\ |
3493 | \n"); |
5c1f974e |
3494 | AddSeparator(aDoc,Message); |
3495 | //-------------------------------------------------------------- |
7fd59977 |
3496 | |
5c1f974e |
3497 | DisplaySurface(aDoc,aGeomSurface,Quantity_NOC_BLUE1); |
3498 | DisplaySurface(aDoc,GOS,Quantity_NOC_GREEN); |
3499 | DisplaySurface(aDoc,GOS1,Quantity_NOC_GREEN); |
3500 | DisplaySurface(aDoc,GOS2,Quantity_NOC_GREEN); |
7fd59977 |
3501 | |
5c1f974e |
3502 | DisplayCurve(aDoc,SPL1,Quantity_NOC_RED ,false); |
3503 | DisplayCurve(aDoc,SPL2,Quantity_NOC_HOTPINK ,false); |
7fd59977 |
3504 | |
5c1f974e |
3505 | Message += "aGeomSurface is Blue; \n"; |
3506 | Message += "GOS are Green; \n"; |
7fd59977 |
3507 | |
576f8b11 |
3508 | PostProcess(aDoc,ID_BUTTON_Test_43,TheDisplayType,Message); |
7fd59977 |
3509 | } |
3510 | |
3511 | void GeomSources::gpTest44(CGeometryDoc* aDoc) |
3512 | { |
5c1f974e |
3513 | DisplayType TheDisplayType = No2D3D; |
3514 | PreProcess(aDoc,TheDisplayType); |
3515 | //============================================================== |
3516 | |
3517 | gp_Pnt P1(0,0,1); |
3518 | gp_Pnt P2(1,2,2); |
3519 | gp_Pnt P3(2,3,3); |
3520 | gp_Pnt P4(4,3,4); |
3521 | gp_Pnt P5(5,5,5); |
3522 | TColgp_Array1OfPnt array (1,5); |
3523 | array.SetValue(1,P1); |
3524 | array.SetValue(2,P2); |
3525 | array.SetValue(3,P3); |
3526 | array.SetValue(4,P4); |
3527 | array.SetValue(5,P5); |
3528 | Handle(Geom_BSplineCurve) aCurve = |
3529 | GeomAPI_PointsToBSpline(array).Curve(); |
3530 | gp_Dir aDir(1,2,3); |
3531 | Handle(Geom_SurfaceOfLinearExtrusion) SOLE = |
3532 | new Geom_SurfaceOfLinearExtrusion(aCurve,aDir); |
3533 | |
3534 | Handle(Geom_RectangularTrimmedSurface) aTrimmedSurface = |
3535 | new Geom_RectangularTrimmedSurface(SOLE,-10,10,false); |
3536 | |
3537 | Standard_CString SOLEEntityTypeName="Not Computed"; |
3538 | if (!SOLE.IsNull()) |
3539 | { |
3540 | SOLEEntityTypeName = SOLE->DynamicType()->Name(); |
3541 | } |
3542 | |
3543 | //============================================================== |
3544 | |
3545 | TCollection_AsciiString Message (" \ |
7fd59977 |
3546 | \n\ |
3547 | gp_Pnt P1(0,0,1); \n\ |
3548 | gp_Pnt P2(1,2,2); \n\ |
3549 | gp_Pnt P3(2,3,3); \n\ |
3550 | gp_Pnt P4(4,3,4); \n\ |
3551 | gp_Pnt P5(5,5,5); \n\ |
3552 | TColgp_Array1OfPnt array (1,5); \n\ |
3553 | array.SetValue(1,P1); \n\ |
3554 | array.SetValue(2,P2); \n\ |
3555 | array.SetValue(3,P3); \n\ |
3556 | array.SetValue(4,P4); \n\ |
3557 | array.SetValue(5,P5); \n\ |
3558 | Handle(Geom_BSplineCurve) aCurve = \n\ |
3559 | GeomAPI_PointsToBSpline(array).Curve(); \n\ |
3560 | gp_Dir aDir(1,2,3); \n\ |
3561 | Handle(Geom_SurfaceOfLinearExtrusion) SOLE = \n\ |
3562 | new Geom_SurfaceOfLinearExtrusion(aCurve,aDir); \n\ |
3563 | \n\ |
3564 | Handle(Geom_RectangularTrimmedSurface) aTrimmedSurface = \n\ |
3565 | new Geom_RectangularTrimmedSurface(SOLE,-10,10,false); \n\ |
3566 | \n\ |
3567 | Standard_CString SOLEEntityTypeName=\"Not Computed\"; \n\ |
3568 | if (!SOLE.IsNull()) \n\ |
3569 | { \n\ |
3570 | SOLEEntityTypeName = SOLE->DynamicType()->Name(); \n\ |
3571 | } \n\ |
3572 | \n"); |
5c1f974e |
3573 | AddSeparator(aDoc,Message); |
3574 | //-------------------------------------------------------------- |
7fd59977 |
3575 | |
5c1f974e |
3576 | DisplaySurface(aDoc,aTrimmedSurface,Quantity_NOC_GREEN); |
3577 | DisplayCurve(aDoc,aCurve,Quantity_NOC_RED ,false); |
7fd59977 |
3578 | |
5c1f974e |
3579 | Message += "aCurve is Red; \n"; |
3580 | Message += "aTrimmedSurface is Green; \n"; |
7fd59977 |
3581 | |
5c1f974e |
3582 | TCollection_AsciiString Message2 (SOLEEntityTypeName); |
7fd59977 |
3583 | |
5c1f974e |
3584 | Message += " SOLEEntityTypeName = ";Message+= Message2; Message += "\n"; |
7fd59977 |
3585 | |
576f8b11 |
3586 | PostProcess(aDoc,ID_BUTTON_Test_44,TheDisplayType,Message); |
7fd59977 |
3587 | } |
3588 | |
3589 | void GeomSources::gpTest45(CGeometryDoc* aDoc) |
3590 | { |
5c1f974e |
3591 | DisplayType TheDisplayType = No2D3D; |
3592 | PreProcess(aDoc,TheDisplayType); |
3593 | |
3594 | //============================================================== |
3595 | |
3596 | TColgp_Array1OfPnt array (1,5); |
3597 | array.SetValue(1,gp_Pnt (0,0,1)); |
3598 | array.SetValue(2,gp_Pnt (1,2,2)); |
3599 | array.SetValue(3,gp_Pnt (2,3,3)); |
3600 | array.SetValue(4,gp_Pnt (4,3,4)); |
3601 | array.SetValue(5,gp_Pnt (5,5,5)); |
3602 | Handle(Geom_BSplineCurve) aCurve = |
3603 | GeomAPI_PointsToBSpline(array).Curve(); |
3604 | Handle(Geom_SurfaceOfRevolution) SOR = |
3605 | new Geom_SurfaceOfRevolution(aCurve,gp::OX()); |
3606 | |
3607 | Standard_CString SOREntityTypeName="Not Computed"; |
3608 | if (!SOR.IsNull()) |
3609 | SOREntityTypeName = SOR->DynamicType()->Name(); |
3610 | |
3611 | //============================================================== |
3612 | TCollection_AsciiString Message (" \ |
7fd59977 |
3613 | \n\ |
3614 | TColgp_Array1OfPnt array (1,5); \n\ |
3615 | array.SetValue(1,gp_Pnt 0,0,1)); \n\ |
3616 | array.SetValue(2,gp_Pnt (1,2,2)); \n\ |
3617 | array.SetValue(3,gp_Pnt (2,3,3)); \n\ |
3618 | array.SetValue(4,gp_Pnt (4,3,4)); \n\ |
3619 | array.SetValue(5,gp_Pnt (5,5,5)); \n\ |
3620 | Handle(Geom_BSplineCurve) aCurve = \n\ |
3621 | GeomAPI_PointsToBSpline(array).Curve(); \n\ |
3622 | Handle(Geom_SurfaceOfRevolution) SOR = \n\ |
3623 | new Geom_SurfaceOfRevolution(aCurve,gp::OX()); \n\ |
3624 | \n\ |
3625 | Standard_CString SOREntityTypeName=\"Not Computed\"; \n\ |
3626 | if (!SOR.IsNull()) \n\ |
3627 | SOREntityTypeName = SOR->DynamicType()->Name(); \n\ |
3628 | \n"); |
5c1f974e |
3629 | AddSeparator(aDoc,Message); |
3630 | |
3631 | //-------------------------------------------------------------- |
3632 | DisplaySurface(aDoc,SOR,Quantity_NOC_GREEN); |
3633 | DisplayCurve(aDoc,aCurve,Quantity_NOC_RED ,false); |
7fd59977 |
3634 | |
5c1f974e |
3635 | Message += "aCurve is Red; \n"; |
3636 | Message += "SOR is Green; \n"; |
3637 | TCollection_AsciiString Message2 (SOREntityTypeName); |
3638 | Message += " SOREntityTypeName = ";Message+= Message2; Message += "\n"; |
7fd59977 |
3639 | |
576f8b11 |
3640 | PostProcess(aDoc,ID_BUTTON_Test_45,TheDisplayType,Message); |
7fd59977 |
3641 | } |
3642 | |
3643 | void GeomSources::gpTest46(CGeometryDoc* aDoc) |
3644 | { |
5c1f974e |
3645 | DisplayType TheDisplayType = No2D3D; |
3646 | PreProcess(aDoc,TheDisplayType); |
3647 | //============================================================== |
3648 | |
3649 | TColgp_Array1OfPnt array1 (1,5); |
3650 | array1.SetValue(1,gp_Pnt (-4,5,5 )); |
3651 | array1.SetValue(2,gp_Pnt (-3,6,6 )); |
3652 | array1.SetValue(3,gp_Pnt (-1,6,7 )); |
3653 | array1.SetValue(4,gp_Pnt (0,8,8)); |
3654 | array1.SetValue(5,gp_Pnt (2,9,9)); |
3655 | Handle(Geom_BSplineCurve) SPL1 = |
3656 | GeomAPI_PointsToBSpline(array1).Curve(); |
3657 | |
3658 | TColgp_Array1OfPnt array2 (1,5); |
3659 | array2.SetValue(1,gp_Pnt (-4,5,2 )); |
3660 | array2.SetValue(2,gp_Pnt (-3,6,3 )); |
3661 | array2.SetValue(3,gp_Pnt (-1,7,4 )); |
3662 | array2.SetValue(4,gp_Pnt (0,8,5)); |
3663 | array2.SetValue(5,gp_Pnt (2,9,6)); |
3664 | Handle(Geom_BSplineCurve) SPL2 = |
3665 | GeomAPI_PointsToBSpline(array2).Curve(); |
3666 | |
3667 | GeomFill_FillingStyle Type = GeomFill_StretchStyle; |
3668 | GeomFill_BSplineCurves aGeomFill1(SPL1,SPL2,Type); |
3669 | Handle(Geom_BSplineSurface) aGeomSurface = aGeomFill1.Surface(); |
3670 | |
3671 | Handle(Geom_BSplineSurface) aTranslatedGeomSurface = |
3672 | Handle(Geom_BSplineSurface)::DownCast(aGeomSurface->Copy()); |
3673 | |
3674 | Standard_Real extension = 3; |
3675 | Standard_Integer continuity = 2; |
3676 | Standard_Boolean Udirection = Standard_True; |
3677 | Standard_Boolean after = Standard_True; |
3678 | GeomLib::ExtendSurfByLength (aTranslatedGeomSurface, |
3679 | extension,continuity,Udirection,after); |
3680 | |
3681 | //============================================================== |
7fd59977 |
3682 | TCollection_AsciiString Message (" \ |
3683 | \n\ |
3684 | TColgp_Array1OfPnt array1 (1,5); \n\ |
3685 | // ... \n\ |
3686 | Handle(Geom_BSplineCurve) SPL1 = \n\ |
3687 | GeomAPI_PointsToBSpline(array1).Curve(); \n\ |
3688 | \n\ |
3689 | TColgp_Array1OfPnt array2 (1,5); \n\ |
3690 | // ... \n\ |
3691 | Handle(Geom_BSplineCurve) SPL2 = \n\ |
3692 | GeomAPI_PointsToBSpline(array2).Curve(); \n\ |
3693 | \n\ |
3694 | GeomFill_FillingStyle Type = GeomFill_StretchStyle; \n\ |
3695 | GeomFill_BSplineCurves aGeomFill1(SPL1,SPL2,Type); \n\ |
3696 | Handle(Geom_BSplineSurface) aGeomSurface = aGeomFill1.Surface(); \n\ |
3697 | \n\ |
3698 | Handle(Geom_BSplineSurface) aTranslatedGeomSurface = \n\ |
3699 | Handle(Geom_BSplineSurface)::DownCast(aGeomSurface->Copy()); \n\ |
3700 | \n\ |
3701 | Standard_Real extension = 3; \n\ |
3702 | Standard_Integer continuity = 2; \n\ |
3703 | Standard_Boolean Udirection = Standard_True; \n\ |
3704 | Standard_Boolean after = Standard_True; \n\ |
3705 | GeomLib::ExtendSurfByLength (aTranslatedGeomSurface, \n\ |
3706 | extension,continuity,Udirection,after); \n\ |
3707 | \n"); |
5c1f974e |
3708 | AddSeparator(aDoc,Message); |
3709 | //-------------------------------------------------------------- |
7fd59977 |
3710 | |
5c1f974e |
3711 | if (!aGeomSurface.IsNull()) |
3712 | { |
3713 | DisplaySurface(aDoc,aGeomSurface,Quantity_NOC_HOTPINK); |
3714 | } |
7fd59977 |
3715 | |
5c1f974e |
3716 | if (!aTranslatedGeomSurface.IsNull()) |
3717 | { |
3718 | DisplaySurface(aDoc,aTranslatedGeomSurface,Quantity_NOC_BLUE1); |
3719 | } |
7fd59977 |
3720 | |
5c1f974e |
3721 | DisplayCurve(aDoc,SPL1,Quantity_NOC_RED ,false); |
3722 | DisplayCurve(aDoc,SPL2,Quantity_NOC_GREEN ,false); |
7fd59977 |
3723 | |
5c1f974e |
3724 | Message += "aGeomSurface is Hot Pink; \n"; |
3725 | Message += "aTranslatedGeomSurface is Blue; \n"; |
3726 | Message += "SPL1 is Red; \n"; |
3727 | Message += "SPL2 is Green; \n"; |
7fd59977 |
3728 | |
576f8b11 |
3729 | PostProcess(aDoc,ID_BUTTON_Test_46,TheDisplayType,Message); |
7fd59977 |
3730 | } |
3731 | |
7fd59977 |
3732 | void GeomSources::gpTest47(CGeometryDoc* aDoc) |
3733 | { |
5c1f974e |
3734 | DisplayType TheDisplayType = No2D3D; |
3735 | PreProcess(aDoc,TheDisplayType); |
7fd59977 |
3736 | |
5c1f974e |
3737 | //============================================================== |
3738 | |
3739 | |
3740 | TColgp_Array1OfPnt array1 (1,5); |
3741 | array1.SetValue(1,gp_Pnt (-5,1,2)); |
3742 | array1.SetValue(2,gp_Pnt (-5,2,2)); |
3743 | array1.SetValue(3,gp_Pnt (-5.3,3,1)); |
3744 | array1.SetValue(4,gp_Pnt (-5,4,1)); |
3745 | array1.SetValue(5,gp_Pnt (-5,5,2)); |
3746 | Handle(Geom_BSplineCurve) SPL1 = |
3747 | GeomAPI_PointsToBSpline(array1).Curve(); |
3748 | |
3749 | TColgp_Array1OfPnt array2 (1,5); |
3750 | array2.SetValue(1,gp_Pnt (4,1,2)); |
3751 | array2.SetValue(2,gp_Pnt (4,2,2)); |
3752 | array2.SetValue(3,gp_Pnt (3.7,3,1)); |
3753 | array2.SetValue(4,gp_Pnt (4,4,1)); |
3754 | array2.SetValue(5,gp_Pnt (4,5,2)); |
3755 | Handle(Geom_BSplineCurve) SPL2 = |
3756 | GeomAPI_PointsToBSpline(array2).Curve(); |
3757 | |
3758 | GeomFill_FillingStyle Type = GeomFill_StretchStyle; |
3759 | |
3760 | GeomFill_BSplineCurves aGeomFill1(SPL1,SPL2,Type); |
3761 | Handle(Geom_BSplineSurface) aSurf1 = aGeomFill1.Surface(); |
3762 | |
3763 | TColgp_Array2OfPnt array3 (1,5,1,5); |
3764 | array3.SetValue(1,1,gp_Pnt (-4,-4,5)); |
3765 | array3.SetValue(1,2,gp_Pnt (-4,-2,5)); |
3766 | array3.SetValue(1,3,gp_Pnt (-4,0,4)); |
3767 | array3.SetValue(1,4,gp_Pnt (-4,2,5)); |
3768 | array3.SetValue(1,5,gp_Pnt (-4,4,5)); |
3769 | |
3770 | array3.SetValue(2,1,gp_Pnt (-2,-4,4)); |
3771 | array3.SetValue(2,2,gp_Pnt (-2,-2,4)); |
3772 | array3.SetValue(2,3,gp_Pnt (-2,0,4)); |
3773 | array3.SetValue(2,4,gp_Pnt (-2,2,4)); |
3774 | array3.SetValue(2,5,gp_Pnt (-2,5,4)); |
3775 | |
3776 | array3.SetValue(3,1,gp_Pnt (0,-4,3.5)); |
3777 | array3.SetValue(3,2,gp_Pnt (0,-2,3.5)); |
3778 | array3.SetValue(3,3,gp_Pnt (0,0,3.5)); |
3779 | array3.SetValue(3,4,gp_Pnt (0,2,3.5)); |
3780 | array3.SetValue(3,5,gp_Pnt (0,5,3.5)); |
3781 | |
3782 | array3.SetValue(4,1,gp_Pnt (2,-4,4)); |
3783 | array3.SetValue(4,2,gp_Pnt (2,-2,4)); |
3784 | array3.SetValue(4,3,gp_Pnt (2,0,3.5)); |
3785 | array3.SetValue(4,4,gp_Pnt (2,2,5)); |
3786 | array3.SetValue(4,5,gp_Pnt (2,5,4)); |
3787 | |
3788 | array3.SetValue(5,1,gp_Pnt (4,-4,5)); |
3789 | array3.SetValue(5,2,gp_Pnt (4,-2,5)); |
3790 | array3.SetValue(5,3,gp_Pnt (4,0,5)); |
3791 | array3.SetValue(5,4,gp_Pnt (4,2,6)); |
3792 | array3.SetValue(5,5,gp_Pnt (4,5,5)); |
3793 | |
3794 | Handle(Geom_BSplineSurface) aSurf2 = |
3795 | GeomAPI_PointsToBSplineSurface(array3).Surface(); |
3796 | |
3797 | GeomAPI_ExtremaSurfaceSurface ESS(aSurf1,aSurf2); |
5c573e69 |
3798 | //Quantity_Length dist = ESS.LowerDistance(); |
5c1f974e |
3799 | gp_Pnt P1,P2; |
3800 | ESS.NearestPoints(P1,P2); |
3801 | |
3802 | gp_Pnt P3,P4; |
3803 | Handle(Geom_Curve) aCurve; |
3804 | Standard_Integer NbExtrema = ESS.NbExtrema(); |
3805 | for(Standard_Integer k=1;k<=NbExtrema;k++){ |
3806 | ESS.Points(k,P3,P4); |
7fd59977 |
3807 | aCurve= GC_MakeSegment(P3,P4).Value(); |
3808 | DisplayCurve(aDoc,aCurve,Quantity_NOC_YELLOW3,false); |
3809 | } |
3810 | |
7fd59977 |
3811 | //============================================================== |
5c1f974e |
3812 | |
7fd59977 |
3813 | TCollection_AsciiString Message (" \n\ |
3814 | GeomFill_FillingStyle Type = GeomFill_StretchStyle; \n\ |
3815 | \n\ |
3816 | GeomFill_BSplineCurves aGeomFill1(SPL1,SPL2,Type); \n\ |
3817 | Handle(Geom_BSplineSurface) aSurf1 = aGeomFill1.Surface(); \n\ |
3818 | \n\ |
3819 | Handle(Geom_BSplineSurface) aSurf2 = \n\ |
3820 | GeomAPI_PointsToBSplineSurface(array3).Surface(); \n\ |
3821 | \n\ |
3822 | GeomAPI_ExtremaSurfaceSurface ESS(aSurf1,aSurf2); \n\ |
3823 | Quantity_Length dist = ESS.LowerDistance(); \n\ |
3824 | gp_Pnt P1,P2; \n\ |
3825 | ESS.NearestPoints(P1,P2); \n\ |
3826 | \n"); |
3827 | |
5c1f974e |
3828 | AddSeparator(aDoc,Message); |
3829 | Message += "aSurf1 is Green; \n"; |
3830 | Message += "aSurf2 is Hot Pink; \n"; |
3831 | Message += "Nearest points P1 and P2 are shown; \n"; |
7fd59977 |
3832 | |
5c1f974e |
3833 | //-------------------------------------------------------------- |
7fd59977 |
3834 | |
3835 | //mfa |
3836 | |
5c1f974e |
3837 | DisplaySurface(aDoc,aSurf1,Quantity_NOC_GREEN); |
3838 | DisplaySurface(aDoc,aSurf2,Quantity_NOC_HOTPINK); |
3839 | DisplayCurve(aDoc,SPL1,Quantity_NOC_RED ,false); |
3840 | DisplayCurve(aDoc,SPL2,Quantity_NOC_AZURE ,false); |
3841 | |
3842 | DisplayPoint(aDoc,P1,Standard_CString("P1")); |
3843 | DisplayPoint(aDoc,P2,Standard_CString("P2")); |
7fd59977 |
3844 | |
576f8b11 |
3845 | PostProcess(aDoc,ID_BUTTON_Test_47,TheDisplayType,Message); |
7fd59977 |
3846 | } |
3847 | |
3848 | void GeomSources::gpTest48(CGeometryDoc* aDoc) |
3849 | { |
5c1f974e |
3850 | DisplayType TheDisplayType = a2DNo3D; |
3851 | PreProcess(aDoc,TheDisplayType); |
3852 | //============================================================== |
7fd59977 |
3853 | |
5c1f974e |
3854 | Standard_Real radius = 3; |
3855 | Handle(Geom2d_Circle) circle = |
3856 | new Geom2d_Circle(gp_Ax22d(gp_Pnt2d(-7,2),gp_Dir2d(1,0)),radius); |
7fd59977 |
3857 | |
5c1f974e |
3858 | Handle(Geom2d_TrimmedCurve) C = new Geom2d_TrimmedCurve(circle,1,5); |
3859 | |
3860 | Geom2dAdaptor_Curve GAC (C); |
3861 | |
3862 | |
3863 | TColgp_Array1OfPnt2d array (1,5); // sizing array |
3864 | array.SetValue(1,gp_Pnt2d (0,0)); |
3865 | array.SetValue(2,gp_Pnt2d (1,2)); |
3866 | array.SetValue(3,gp_Pnt2d (2,3)); |
3867 | array.SetValue(4,gp_Pnt2d (4,3)); |
3868 | array.SetValue(5,gp_Pnt2d (5,5)); |
3869 | Handle(Geom2d_BSplineCurve) SPL1 = |
3870 | Geom2dAPI_PointsToBSpline(array); |
3871 | |
3872 | |
3873 | Handle(TColgp_HArray1OfPnt2d) harray = |
3874 | new TColgp_HArray1OfPnt2d (1,5); // sizing harray |
3875 | harray->SetValue(1,gp_Pnt2d (13+ 0,0)); |
3876 | harray->SetValue(2,gp_Pnt2d (13+ 1,2)); |
3877 | harray->SetValue(3,gp_Pnt2d (13+ 2,3)); |
3878 | harray->SetValue(4,gp_Pnt2d (13+ 4,3)); |
3879 | harray->SetValue(5,gp_Pnt2d (13+ 5,5)); |
3880 | Geom2dAPI_Interpolate anInterpolation(harray,Standard_True,0.01); |
3881 | anInterpolation.Perform(); |
3882 | Handle(Geom2d_BSplineCurve) SPL2 = anInterpolation.Curve(); |
3883 | |
3884 | Bnd_Box2d aCBox; |
3885 | Geom2dAdaptor_Curve GACC (C); |
3886 | BndLib_Add2dCurve::Add (GACC,Precision::Approximation(),aCBox); |
3887 | |
3888 | Standard_Real aCXmin, aCYmin, aCXmax, aCYmax; |
3889 | aCBox.Get( aCXmin, aCYmin, aCXmax,aCYmax); |
3890 | |
3891 | Bnd_Box2d aSPL1Box; |
3892 | Geom2dAdaptor_Curve GAC1 (SPL1); |
3893 | BndLib_Add2dCurve::Add (GAC1,Precision::Approximation(),aSPL1Box); |
3894 | |
3895 | Standard_Real aSPL1Xmin,aSPL1Ymin,aSPL1Xmax,aSPL1Ymax; |
3896 | aSPL1Box.Get( aSPL1Xmin, aSPL1Ymin, aSPL1Xmax,aSPL1Ymax); |
3897 | |
3898 | Bnd_Box2d aSPL2Box; |
3899 | Geom2dAdaptor_Curve GAC2 (SPL2); |
3900 | BndLib_Add2dCurve::Add (GAC2,Precision::Approximation(),aSPL2Box); |
3901 | |
3902 | Standard_Real aSPL2Xmin,aSPL2Ymin,aSPL2Xmax,aSPL2Ymax; |
3903 | aSPL2Box.Get( aSPL2Xmin, aSPL2Ymin, aSPL2Xmax,aSPL2Ymax); |
3904 | |
3905 | //============================================================== |
7fd59977 |
3906 | TCollection_AsciiString Message (" \ |
3907 | \n\ |
3908 | Standard_Real radius = 3; \n\ |
3909 | Handle(Geom2d_Circle) circle = \n\ |
3910 | new Geom2d_Circle(gp_Ax22d(gp_Pnt2d(-7,2),gp_Dir2d(1,0)),radius); \n\ |
3911 | \n\ |
3912 | Handle(Geom2d_TrimmedCurve) C = new Geom2d_TrimmedCurve(circle,1,5); \n\ |
3913 | Geom2dAdaptor_Curve GAC (C); \n\ |
3914 | \n\ |
3915 | Handle(Geom2d_BSplineCurve) SPL1 ; // SPL1 = ... \n\ |
3916 | \n\ |
3917 | Handle(Geom2d_BSplineCurve) SPL2 ; // SPL2 = ... \n\ |
3918 | \n\ |
3919 | Bnd_Box2d aCBox; \n\ |
3920 | Geom2dAdaptor_Curve GACC (C); \n\ |
3921 | BndLib_Add2dCurve::Add (GACC,Precision::Approximation(),aCBox); \n\ |
3922 | \n\ |
3923 | Standard_Real aCXmin, aCYmin, aCXmax, aCYmax; \n\ |
3924 | aCBox.Get( aCXmin, aCYmin, aCXmax,aCYmax); \n\ |
3925 | \n\ |
3926 | Bnd_Box2d aSPL1Box; \n\ |
3927 | Geom2dAdaptor_Curve GAC1 (SPL1); \n\ |
3928 | BndLib_Add2dCurve::Add (GAC1,Precision::Approximation(),aSPL1Box); \n\ |
3929 | \n\ |
3930 | Standard_Real aSPL1Xmin,aSPL1Ymin,aSPL1Xmax,aSPL1Ymax; \n\ |
3931 | aSPL1Box.Get( aSPL1Xmin, aSPL1Ymin, aSPL1Xmax,aSPL1Ymax); \n"); |
3932 | Message += "\ |
3933 | \n\ |
3934 | Bnd_Box2d aSPL2Box; \n\ |
3935 | Geom2dAdaptor_Curve GAC2 (SPL2); \n\ |
3936 | BndLib_Add2dCurve::Add (GAC2,Precision::Approximation(),aSPL2Box); \n\ |
3937 | \n\ |
3938 | Standard_Real aSPL2Xmin,aSPL2Ymin,aSPL2Xmax,aSPL2Ymax; \n\ |
3939 | aSPL2Box.Get( aSPL2Xmin, aSPL2Ymin, aSPL2Xmax,aSPL2Ymax); \n\ |
3940 | \n"; |
5c1f974e |
3941 | AddSeparator(aDoc,Message); |
3942 | //-------------------------------------------------------------- |
3943 | |
3944 | DisplayCurve(aDoc,C ,5); |
3945 | DisplayCurve(aDoc,SPL1,6 ); |
3946 | DisplayCurve(aDoc,SPL2,7 ); |
3947 | |
3948 | DisplayPoint(aDoc,gp_Pnt2d(aCXmin,aCYmax),Standard_CString("aCXmin,aCYmax")); |
3949 | DisplayPoint(aDoc,gp_Pnt2d(aCXmax,aCYmax),Standard_CString("aCXmax,aCYmax")); |
3950 | DisplayPoint(aDoc,gp_Pnt2d(aCXmin,aCYmin),Standard_CString("aCXmin,aCYmin")); |
3951 | DisplayPoint(aDoc,gp_Pnt2d(aCXmax,aCYmin),Standard_CString("aCXmax,aCYmin")); |
3952 | |
9e3ca93a |
3953 | DisplayCurve(aDoc,GCE2d_MakeSegment(gp_Pnt2d(aCXmin,aCYmax),gp_Pnt2d(aCXmax,aCYmax)).Value() ,4); // X,Ymax |
3954 | DisplayCurve(aDoc,GCE2d_MakeSegment(gp_Pnt2d(aCXmin,aCYmin),gp_Pnt2d(aCXmax,aCYmin)).Value() ,4); // X,Ymin |
3955 | DisplayCurve(aDoc,GCE2d_MakeSegment(gp_Pnt2d(aCXmin,aCYmin),gp_Pnt2d(aCXmin,aCYmax)).Value() ,4); // Xmin,Y |
3956 | DisplayCurve(aDoc,GCE2d_MakeSegment(gp_Pnt2d(aCXmax,aCYmin),gp_Pnt2d(aCXmax,aCYmax)).Value() ,4); // Xmax,Y |
5c1f974e |
3957 | |
3958 | DisplayPoint(aDoc,gp_Pnt2d(aSPL1Xmin,aSPL1Ymax),Standard_CString("aSPL1Xmin,aSPL1Ymax")); |
3959 | DisplayPoint(aDoc,gp_Pnt2d(aSPL1Xmax,aSPL1Ymax),Standard_CString("aSPL1Xmax,aSPL1Ymax")); |
3960 | DisplayPoint(aDoc,gp_Pnt2d(aSPL1Xmin,aSPL1Ymin),Standard_CString("aSPL1Xmin,aSPL1Ymin")); |
3961 | DisplayPoint(aDoc,gp_Pnt2d(aSPL1Xmax,aSPL1Ymin),Standard_CString("aSPL1Xmax,aSPL1Ymin")); |
3962 | |
9e3ca93a |
3963 | DisplayCurve(aDoc,GCE2d_MakeSegment(gp_Pnt2d(aSPL1Xmin,aSPL1Ymax),gp_Pnt2d(aSPL1Xmax,aSPL1Ymax)).Value() ,4); // X,Ymax |
3964 | DisplayCurve(aDoc,GCE2d_MakeSegment(gp_Pnt2d(aSPL1Xmin,aSPL1Ymin),gp_Pnt2d(aSPL1Xmax,aSPL1Ymin)).Value() ,4); // X,Ymin |
3965 | DisplayCurve(aDoc,GCE2d_MakeSegment(gp_Pnt2d(aSPL1Xmin,aSPL1Ymin),gp_Pnt2d(aSPL1Xmin,aSPL1Ymax)).Value() ,4); // Xmin,Y |
3966 | DisplayCurve(aDoc,GCE2d_MakeSegment(gp_Pnt2d(aSPL1Xmax,aSPL1Ymin),gp_Pnt2d(aSPL1Xmax,aSPL1Ymax)).Value() ,4); // Xmax,Y |
5c1f974e |
3967 | |
5c573e69 |
3968 | DisplayPoint(aDoc,gp_Pnt2d(aSPL1Xmin,aSPL1Ymax),Standard_CString("aSPL2Xmin,aSPL2Ymax")); |
3969 | DisplayPoint(aDoc,gp_Pnt2d(aSPL1Xmax,aSPL1Ymax),Standard_CString("aSPL2Xmax,aSPL2Ymax")); |
3970 | DisplayPoint(aDoc,gp_Pnt2d(aSPL1Xmin,aSPL1Ymin),Standard_CString("aSPL2Xmin,aSPL2Ymin")); |
3971 | DisplayPoint(aDoc,gp_Pnt2d(aSPL1Xmax,aSPL1Ymin),Standard_CString("aSPL2Xmax,aSPL2Ymin")); |
5c1f974e |
3972 | |
9e3ca93a |
3973 | DisplayCurve(aDoc,GCE2d_MakeSegment(gp_Pnt2d(aSPL2Xmin,aSPL2Ymax),gp_Pnt2d(aSPL2Xmax,aSPL2Ymax)).Value() ,4); // X,Ymax |
3974 | DisplayCurve(aDoc,GCE2d_MakeSegment(gp_Pnt2d(aSPL2Xmin,aSPL2Ymin),gp_Pnt2d(aSPL2Xmax,aSPL2Ymin)).Value() ,4); // X,Ymin |
3975 | DisplayCurve(aDoc,GCE2d_MakeSegment(gp_Pnt2d(aSPL2Xmin,aSPL2Ymin),gp_Pnt2d(aSPL2Xmin,aSPL2Ymax)).Value() ,4); // Xmin,Y |
3976 | DisplayCurve(aDoc,GCE2d_MakeSegment(gp_Pnt2d(aSPL2Xmax,aSPL2Ymin),gp_Pnt2d(aSPL2Xmax,aSPL2Ymax)).Value() ,4); // Xmax,Y |
5c1f974e |
3977 | |
576f8b11 |
3978 | PostProcess(aDoc,ID_BUTTON_Test_48,TheDisplayType,Message); |
7fd59977 |
3979 | } |
3980 | |
3981 | |
3982 | void GeomSources::gpTest49(CGeometryDoc* aDoc) |
3983 | { |
5c1f974e |
3984 | DisplayType TheDisplayType = No2D3D; |
3985 | PreProcess(aDoc,TheDisplayType); |
3986 | |
3987 | //============================================================== |
3988 | |
3989 | Bnd_Box aBox; |
3990 | Standard_Real radius = 100; |
3991 | gp_Ax2 anAxis(gp_Pnt(0,0,0),gp_Dir(1,2,-5)); |
3992 | |
3993 | Handle(Geom_Circle) C = |
3994 | new Geom_Circle(anAxis,radius); |
3995 | GeomAdaptor_Curve GAC (C); |
3996 | BndLib_Add3dCurve::Add (GAC,Precision::Approximation(),aBox); |
3997 | |
3998 | Standard_Real aXmin, aYmin, aZmin, aXmax, aYmax, aZmax ; |
3999 | aBox.Get( aXmin, aYmin,aZmin, aXmax,aYmax,aZmax); |
4000 | |
4001 | //============================================================== |
4002 | |
7fd59977 |
4003 | TCollection_AsciiString Message (" \ |
4004 | \n\ |
4005 | Bnd_Box aBox; \n\ |
4006 | Standard_Real radius = 100; \n\ |
4007 | gp_Ax2 anAxis(gp_Pnt(0,0,0),gp_Dir(1,2,-5)); \n\ |
4008 | \n\ |
4009 | Handle(Geom_Circle) C = \n\ |
4010 | new Geom_Circle(anAxis,radius); \n\ |
4011 | GeomAdaptor_Curve GAC (C); \n\ |
4012 | BndLib_Add3dCurve::Add (GAC,Precision::Approximation(),aBox); \n\ |
4013 | \n\ |
4014 | Standard_Real aXmin, aYmin, aZmin, aXmax, aYmax, aZmax ; \n\ |
4015 | aBox.Get( aXmin, aYmin,aZmin, aXmax,aYmax,aZmax); \n\ |
4016 | \n"); |
5c1f974e |
4017 | AddSeparator(aDoc,Message); |
4018 | //-------------------------------------------------------------- |
4019 | |
4020 | DisplayCurve(aDoc,C,Quantity_NOC_BLUE1 ,false); |
4021 | |
4022 | DisplayPoint(aDoc,gp_Pnt(aXmin,aYmax,aZmin),Standard_CString("aXmin,aYmax,aZmin")); |
4023 | DisplayPoint(aDoc,gp_Pnt(aXmax,aYmax,aZmin),Standard_CString("aXmax,aYmax,aZmin")); |
4024 | DisplayPoint(aDoc,gp_Pnt(aXmin,aYmin,aZmin),Standard_CString("aXmin,aYmin,aZmin")); |
4025 | DisplayPoint(aDoc,gp_Pnt(aXmax,aYmin,aZmin),Standard_CString("aXmax,aYmin,aZmin")); |
4026 | |
4027 | DisplayPoint(aDoc,gp_Pnt(aXmin,aYmax,aZmax),Standard_CString("aXmin,aYmax,aZmax")); |
4028 | DisplayPoint(aDoc,gp_Pnt(aXmax,aYmax,aZmax),Standard_CString("aXmax,aYmax,aZmax")); |
4029 | DisplayPoint(aDoc,gp_Pnt(aXmin,aYmin,aZmax),Standard_CString("aXmin,aYmin,aZmax")); |
4030 | DisplayPoint(aDoc,gp_Pnt(aXmax,aYmin,aZmax),Standard_CString("aXmax,aYmin,aZmax")); |
4031 | |
4032 | DisplayCurve(aDoc,GC_MakeSegment(gp_Pnt(aXmin,aYmax,aZmin), |
9e3ca93a |
4033 | gp_Pnt(aXmax,aYmax,aZmin)).Value() ,Quantity_NOC_RED); // X,Ymax,ZMin |
5c1f974e |
4034 | DisplayCurve(aDoc,GC_MakeSegment(gp_Pnt(aXmin,aYmin,aZmin), |
9e3ca93a |
4035 | gp_Pnt(aXmax,aYmin,aZmin)).Value() ,Quantity_NOC_RED); // X,Ymin,ZMin |
5c1f974e |
4036 | DisplayCurve(aDoc,GC_MakeSegment(gp_Pnt(aXmin,aYmin,aZmin), |
9e3ca93a |
4037 | gp_Pnt(aXmin,aYmax,aZmin)).Value() ,Quantity_NOC_RED); // Xmin,Y,ZMin |
5c1f974e |
4038 | DisplayCurve(aDoc,GC_MakeSegment(gp_Pnt(aXmax,aYmin,aZmin), |
9e3ca93a |
4039 | gp_Pnt(aXmax,aYmax,aZmin)).Value() ,Quantity_NOC_RED); // Xmax,Y,ZMin |
5c1f974e |
4040 | DisplayCurve(aDoc,GC_MakeSegment(gp_Pnt(aXmin,aYmax,aZmax), |
9e3ca93a |
4041 | gp_Pnt(aXmax,aYmax,aZmax)).Value() ,Quantity_NOC_RED); // X,Ymax,ZMax |
5c1f974e |
4042 | DisplayCurve(aDoc,GC_MakeSegment(gp_Pnt(aXmin,aYmin,aZmax), |
9e3ca93a |
4043 | gp_Pnt(aXmax,aYmin,aZmax)).Value() ,Quantity_NOC_RED); // X,Ymin,ZMax |
5c1f974e |
4044 | DisplayCurve(aDoc,GC_MakeSegment(gp_Pnt(aXmin,aYmin,aZmax), |
9e3ca93a |
4045 | gp_Pnt(aXmin,aYmax,aZmax)).Value() ,Quantity_NOC_RED); // Xmin,Y,ZMax |
5c1f974e |
4046 | DisplayCurve(aDoc,GC_MakeSegment(gp_Pnt(aXmax,aYmin,aZmax), |
9e3ca93a |
4047 | gp_Pnt(aXmax,aYmax,aZmax)).Value() ,Quantity_NOC_RED); // Xmax,Y,ZMax |
5c1f974e |
4048 | DisplayCurve(aDoc,GC_MakeSegment(gp_Pnt(aXmin,aYmin,aZmin), |
9e3ca93a |
4049 | gp_Pnt(aXmin,aYmin,aZmax)).Value() ,Quantity_NOC_RED); // Xmin,Ymin,Z |
5c1f974e |
4050 | DisplayCurve(aDoc,GC_MakeSegment(gp_Pnt(aXmax,aYmin,aZmin), |
9e3ca93a |
4051 | gp_Pnt(aXmax,aYmin,aZmax)).Value() ,Quantity_NOC_RED); // Xmax,Ymin,Z |
5c1f974e |
4052 | DisplayCurve(aDoc,GC_MakeSegment(gp_Pnt(aXmin,aYmax,aZmin), |
9e3ca93a |
4053 | gp_Pnt(aXmin,aYmax,aZmax)).Value() ,Quantity_NOC_RED); // Xmin,Ymax,Z |
5c1f974e |
4054 | DisplayCurve(aDoc,GC_MakeSegment(gp_Pnt(aXmax,aYmax,aZmin), |
9e3ca93a |
4055 | gp_Pnt(aXmax,aYmax,aZmax)).Value() ,Quantity_NOC_RED); // Xmax,Ymax,Z |
5c1f974e |
4056 | |
576f8b11 |
4057 | PostProcess(aDoc,ID_BUTTON_Test_49,TheDisplayType,Message); |
7fd59977 |
4058 | } |
4059 | |
7fd59977 |
4060 | void GeomSources::gpTest50(CGeometryDoc* aDoc) |
4061 | { |
5c1f974e |
4062 | DisplayType TheDisplayType = No2D3D; |
4063 | PreProcess(aDoc,TheDisplayType); |
4064 | //============================================================== |
4065 | |
4066 | TColgp_Array1OfPnt array1 (1,5); |
4067 | array1.SetValue(1,gp_Pnt (-40,00,20 )); |
4068 | array1.SetValue(2,gp_Pnt (-70,20,20 )); |
4069 | array1.SetValue(3,gp_Pnt (-60,30,10 )); |
4070 | array1.SetValue(4,gp_Pnt (-40,30,-10)); |
4071 | array1.SetValue(5,gp_Pnt (-30,50,-20)); |
4072 | Handle(Geom_BSplineCurve) SPL1 = |
4073 | GeomAPI_PointsToBSpline(array1).Curve(); |
4074 | |
4075 | TColgp_Array1OfPnt array2 (1,5); |
4076 | array2.SetValue(1,gp_Pnt (-40,0, 20)); |
4077 | array2.SetValue(2,gp_Pnt (-20,20,0 )); |
4078 | array2.SetValue(3,gp_Pnt (20 ,30,-10)); |
4079 | array2.SetValue(4,gp_Pnt (30 ,70,-20)); |
4080 | array2.SetValue(5,gp_Pnt (40 ,90,-10)); |
4081 | Handle(Geom_BSplineCurve) SPL2 = |
4082 | GeomAPI_PointsToBSpline(array2).Curve(); |
4083 | |
4084 | GeomFill_FillingStyle Type = GeomFill_StretchStyle; |
4085 | GeomFill_BSplineCurves aGeomFill1(SPL1,SPL2,Type); |
4086 | Handle(Geom_BSplineSurface) aSurf = aGeomFill1.Surface(); |
4087 | GeomAdaptor_Surface GAS (aSurf); |
4088 | Bnd_Box aBox; |
4089 | BndLib_AddSurface::Add (GAS,Precision::Approximation(),aBox); |
4090 | |
4091 | Standard_Real aXmin, aYmin, aZmin, aXmax, aYmax, aZmax ; |
4092 | aBox.Get( aXmin, aYmin,aZmin, aXmax,aYmax,aZmax); |
4093 | |
4094 | //============================================================== |
4095 | TCollection_AsciiString Message (" \ |
7fd59977 |
4096 | \n\ |
4097 | TColgp_Array1OfPnt array1 (1,5); \n\ |
4098 | array1.SetValue(1,gp_Pnt (-40, 0, 20)); \n\ |
4099 | array1.SetValue(2,gp_Pnt (-70, 20, 20)); \n\ |
4100 | array1.SetValue(3,gp_Pnt (-60, 30, 10)); \n\ |
4101 | array1.SetValue(4,gp_Pnt (-40, 30,-10)); \n\ |
4102 | array1.SetValue(5,gp_Pnt (-30, 50,-20)); \n\ |
4103 | Handle(Geom_BSplineCurve) SPL1 = \n\ |
4104 | GeomAPI_PointsToBSpline(array1).Curve(); \n\ |
4105 | \n\ |
4106 | TColgp_Array1OfPnt array2 (1,5); \n\ |
4107 | array2.SetValue(1,gp_Pnt (-40, 0, 20)); \n\ |
4108 | array2.SetValue(2,gp_Pnt (-20, 20, 0)); \n\ |
4109 | array2.SetValue(3,gp_Pnt ( 20, 30,-10)); \n\ |
4110 | array2.SetValue(4,gp_Pnt ( 30, 70,-20)); \n\ |
4111 | array2.SetValue(5,gp_Pnt ( 40, 90,-10)); \n\ |
4112 | Handle(Geom_BSplineCurve) SPL2 = \n\ |
4113 | GeomAPI_PointsToBSpline(array2).Curve(); \n\ |
4114 | \n\ |
4115 | GeomFill_FillingStyle Type = GeomFill_StretchStyle; \n\ |
4116 | GeomFill_BSplineCurves aGeomFill1(SPL1,SPL2,Type); \n\ |
4117 | Handle(Geom_BSplineSurface) aSurf = aGeomFill1.Surface(); \n\ |
4118 | GeomAdaptor_Surface GAS (aSurf); \n\ |
4119 | Bnd_Box aBox; \n\ |
4120 | BndLib_AddSurface::Add (GAS,Precision::Approximation(),aBox); \n\ |
4121 | \n\ |
4122 | Standard_Real aXmin, aYmin, aZmin, aXmax, aYmax, aZmax ; \n\ |
4123 | aBox.Get( aXmin, aYmin,aZmin, aXmax,aYmax,aZmax); \n\ |
4124 | \n"); |
5c1f974e |
4125 | AddSeparator(aDoc,Message); |
4126 | //-------------------------------------------------------------- |
4127 | |
4128 | Quantity_NameOfColor aNameOfColor= Quantity_NOC_GREEN; |
4129 | Handle(ISession_Surface) aGraphicalSurface = new ISession_Surface(aSurf); |
4130 | aDoc->GetAISContext()->SetColor(aGraphicalSurface,aNameOfColor); |
4131 | aGraphicalSurface->Attributes()->FreeBoundaryAspect()->SetColor(aNameOfColor); |
4132 | aGraphicalSurface->Attributes()->UIsoAspect()->SetColor(aNameOfColor); |
4133 | aGraphicalSurface->Attributes()->VIsoAspect()->SetColor(aNameOfColor); |
4134 | |
4135 | aDoc->GetAISContext()->SetDisplayMode(aGraphicalSurface,1); |
4136 | aDoc->GetAISContext()->Display(aGraphicalSurface,false); |
4137 | // DisplaySurface(aDoc,aSurf,Quantity_NOC_GREEN); |
4138 | |
4139 | DisplayCurve(aDoc,GC_MakeSegment(gp_Pnt(aXmin,aYmax,aZmin), |
9e3ca93a |
4140 | gp_Pnt(aXmax,aYmax,aZmin)).Value() ,Quantity_NOC_RED); // X,Ymax,ZMin |
5c1f974e |
4141 | DisplayCurve(aDoc,GC_MakeSegment(gp_Pnt(aXmin,aYmin,aZmin), |
9e3ca93a |
4142 | gp_Pnt(aXmax,aYmin,aZmin)).Value() ,Quantity_NOC_RED); // X,Ymin,ZMin |
5c1f974e |
4143 | DisplayCurve(aDoc,GC_MakeSegment(gp_Pnt(aXmin,aYmin,aZmin), |
9e3ca93a |
4144 | gp_Pnt(aXmin,aYmax,aZmin)).Value() ,Quantity_NOC_RED); // Xmin,Y,ZMin |
5c1f974e |
4145 | DisplayCurve(aDoc,GC_MakeSegment(gp_Pnt(aXmax,aYmin,aZmin), |
9e3ca93a |
4146 | gp_Pnt(aXmax,aYmax,aZmin)).Value() ,Quantity_NOC_RED); // Xmax,Y,ZMin |
5c1f974e |
4147 | DisplayCurve(aDoc,GC_MakeSegment(gp_Pnt(aXmin,aYmax,aZmax), |
9e3ca93a |
4148 | gp_Pnt(aXmax,aYmax,aZmax)).Value() ,Quantity_NOC_RED); // X,Ymax,ZMax |
5c1f974e |
4149 | DisplayCurve(aDoc,GC_MakeSegment(gp_Pnt(aXmin,aYmin,aZmax), |
9e3ca93a |
4150 | gp_Pnt(aXmax,aYmin,aZmax)).Value() ,Quantity_NOC_RED); // X,Ymin,ZMax |
5c1f974e |
4151 | DisplayCurve(aDoc,GC_MakeSegment(gp_Pnt(aXmin,aYmin,aZmax), |
9e3ca93a |
4152 | gp_Pnt(aXmin,aYmax,aZmax)).Value() ,Quantity_NOC_RED); // Xmin,Y,ZMax |
5c1f974e |
4153 | DisplayCurve(aDoc,GC_MakeSegment(gp_Pnt(aXmax,aYmin,aZmax), |
9e3ca93a |
4154 | gp_Pnt(aXmax,aYmax,aZmax)).Value() ,Quantity_NOC_RED); // Xmax,Y,ZMax |
5c1f974e |
4155 | DisplayCurve(aDoc,GC_MakeSegment(gp_Pnt(aXmin,aYmin,aZmin), |
9e3ca93a |
4156 | gp_Pnt(aXmin,aYmin,aZmax)).Value() ,Quantity_NOC_RED); // Xmin,Ymin,Z |
5c1f974e |
4157 | DisplayCurve(aDoc,GC_MakeSegment(gp_Pnt(aXmax,aYmin,aZmin), |
9e3ca93a |
4158 | gp_Pnt(aXmax,aYmin,aZmax)).Value() ,Quantity_NOC_RED); // Xmax,Ymin,Z |
5c1f974e |
4159 | DisplayCurve(aDoc,GC_MakeSegment(gp_Pnt(aXmin,aYmax,aZmin), |
9e3ca93a |
4160 | gp_Pnt(aXmin,aYmax,aZmax)).Value() ,Quantity_NOC_RED); // Xmin,Ymax,Z |
5c1f974e |
4161 | DisplayCurve(aDoc,GC_MakeSegment(gp_Pnt(aXmax,aYmax,aZmin), |
9e3ca93a |
4162 | gp_Pnt(aXmax,aYmax,aZmax)).Value() ,Quantity_NOC_RED); // Xmax,Ymax,Z |
5c1f974e |
4163 | |
576f8b11 |
4164 | PostProcess(aDoc,ID_BUTTON_Test_50,TheDisplayType,Message); |
7fd59977 |
4165 | } |