0024005: Intersecting a slightly off angle plane with a cylinder takes 7+ seconds
[occt.git] / src / QABugs / QABugs_19.cxx
CommitLineData
b311480e 1// Created on: 2002-05-21
2// Created by: QA Admin
3// Copyright (c) 2002-2012 OPEN CASCADE SAS
4//
5// The content of this file is subject to the Open CASCADE Technology Public
6// License Version 6.5 (the "License"). You may not use the content of this file
7// except in compliance with the License. Please obtain a copy of the License
8// at http://www.opencascade.org and read it completely before using this file.
9//
10// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
11// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
12//
13// The Original Code and all software distributed under the License is
14// distributed on an "AS IS" basis, without warranty of any kind, and the
15// Initial Developer hereby disclaims all such warranties, including without
16// limitation, any warranties of merchantability, fitness for a particular
17// purpose or non-infringement. Please see the License for the specific terms
18// and conditions governing the rights and limitations under the License.
19
7fd59977 20
1cd84fee 21#include <QABugs.hxx>
7fd59977 22
23#include <Draw_Interpretor.hxx>
24#include <DBRep.hxx>
25#include <DrawTrSurf.hxx>
26#include <AIS_InteractiveContext.hxx>
27#include <ViewerTest.hxx>
28#include <AIS_Shape.hxx>
29#include <TopoDS_Shape.hxx>
30
31#include <gp_Pnt2d.hxx>
f6f03db9 32#include <gp_Ax1.hxx>
7fd59977 33#include <GCE2d_MakeSegment.hxx>
34#include <Geom2d_TrimmedCurve.hxx>
35#include <DrawTrSurf.hxx>
36
f6f03db9 37#include <Precision.hxx>
38
7fd59977 39#include <PCollection_HAsciiString.hxx>
40
c2ae831c 41#include <cstdio>
42#include <cmath>
43#include <iostream>
44#include <OSD_PerfMeter.hxx>
45#include <OSD_Timer.hxx>
46#include <BRepPrimAPI_MakeBox.hxx>
47#include <BRepPrimAPI_MakeSphere.hxx>
48#include <BRepAlgo_Cut.hxx>
49
29cb310a 50#include <TCollection_HAsciiString.hxx>
51
52#define QCOMPARE(val1, val2) \
53 di << "Checking " #val1 " == " #val2 << \
54 ((val1) == (val2) ? ": OK\n" : ": Error\n")
d2786814 55
7fd59977 56static Standard_Integer OCC230 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
57{
58 if ( argc != 4) {
59 di << "ERROR OCC230: Usage : " << argv[0] << " TrimmedCurve Pnt2d Pnt2d" << "\n";
60 return 1;
61 }
62
63 gp_Pnt2d P1, P2;
64 if ( !DrawTrSurf::GetPoint2d(argv[2],P1)) {
65 di << "ERROR OCC230: " << argv[2] << " is not Pnt2d" << "\n";
66 return 1;
67 }
68 if ( !DrawTrSurf::GetPoint2d(argv[3],P2)) {
69 di << "ERROR OCC230: " << argv[3] << " is not Pnt2d" << "\n";
70 return 1;
71 }
72
73 GCE2d_MakeSegment MakeSegment(P1,P2);
74 Handle(Geom2d_TrimmedCurve) TrimmedCurve = MakeSegment.Value();
75 DrawTrSurf::Set(argv[1], TrimmedCurve);
76 return 0;
77}
78
79static Standard_Integer OCC142 (Draw_Interpretor& di, Standard_Integer /*argc*/, const char ** /*argv*/)
80{
81 for(Standard_Integer i= 0;i <= 20;i++){
82 Handle(PCollection_HAsciiString) pstr = new PCollection_HAsciiString("TEST");
83 pstr->Clear();
84 }
85 di << "OCC142: OK" << "\n";
86 return 0;
87}
88
f6f03db9 89static Standard_Integer OCC23361 (Draw_Interpretor& di, Standard_Integer /*argc*/, const char ** /*argv*/)
90{
91 gp_Pnt p(0, 0, 2);
92
93 gp_Trsf t1, t2;
94 t1.SetRotation(gp_Ax1(p, gp_Dir(0, 1, 0)), -0.49328285294022267);
95 t2.SetRotation(gp_Ax1(p, gp_Dir(0, 0, 1)), 0.87538474718473880);
96
97 gp_Trsf tComp = t2 * t1;
98
99 gp_Pnt p1(10, 3, 4);
100 gp_Pnt p2 = p1.Transformed(tComp);
101 gp_Pnt p3 = p1.Transformed(t1);
102 p3.Transform(t2);
103
104 // points must be equal
105 if ( ! p2.IsEqual(p3, Precision::Confusion()) )
106 di << "ERROR OCC23361: equivalent transformations does not produce equal points" << "\n";
107 else
108 di << "OCC23361: OK" << "\n";
109
110 return 0;
111}
112
c2ae831c 113static Standard_Integer OCC23237 (Draw_Interpretor& di, Standard_Integer /*argc*/, const char** /*argv*/)
114{
115 OSD_PerfMeter aPM("TestMeter",0);
116 OSD_Timer aTM;
117
118 // run some operation in cycle for about 2 seconds to have good values of times to compare
119 int count = 0;
120 printf("OSD_PerfMeter test.\nRunning Boolean operation on solids in loop.\n");
121 for (; aTM.ElapsedTime() < 2.; count++)
122 {
123 aPM.Start();
124 aTM.Start();
125
126 // do some operation that will take considerable time compared with time or starting / stopping timers
127 BRepPrimAPI_MakeBox aBox (10., 10., 10.);
128 BRepPrimAPI_MakeSphere aSphere (10.);
129 BRepAlgo_Cut (aBox.Shape(), aSphere.Shape());
130
131 aTM.Stop();
132 aPM.Stop();
133 }
134
135 int aNbEnters = 0;
136 Standard_Real aPerfMeter_CPUtime = 0., aTimer_ElapsedTime = aTM.ElapsedTime();
137
138 perf_get_meter("TestMeter", &aNbEnters, &aPerfMeter_CPUtime);
139
140 Standard_Real aTimeDiff = (fabs(aTimer_ElapsedTime - aPerfMeter_CPUtime) / aTimer_ElapsedTime);
141
142 printf("\nMeasurement results (%d cycles):\n", count);
143 printf("\nOSD_PerfMeter CPU time: %lf\nOSD_Timer elapsed time: %lf\n", aPerfMeter_CPUtime, aTimer_ElapsedTime);
144 printf("Time delta is: %.3lf %%\n", aTimeDiff * 100);
145
146 if (aTimeDiff > 0.2)
147 di << "OCC23237: Error: too much difference between CPU and elapsed times";
148 else if (aNbEnters != count)
149 di << "OCC23237: Error: counter reported by PerfMeter (" << aNbEnters << ") does not correspond to actual number of cycles";
150 else
151 di << "OCC23237: OK";
152
153 return 0;
154}
155
1365140b
RL
156#ifdef HAVE_TBB
157
158#include <Standard_Atomic.hxx>
159#include <tbb/blocked_range.h>
160#include <tbb/parallel_for.h>
161
162class IncrementerDecrementer
163{
164public:
165 IncrementerDecrementer (Standard_Integer* theVal, Standard_Boolean thePositive) : myVal (theVal), myPositive (thePositive)
166 {}
167 void operator() (const tbb::blocked_range<size_t>& r) const
168 {
169 if (myPositive)
170 for (size_t i = r.begin(); i != r.end(); ++i)
171 Standard_Atomic_Increment (myVal);
172 else
173 for (size_t i = r.begin(); i != r.end(); ++i)
174 Standard_Atomic_Decrement (myVal);
175 }
176private:
177 Standard_Integer* myVal;
178 Standard_Boolean myPositive;
179};
180#endif
181
1365140b
RL
182#ifdef HAVE_TBB
183static Standard_Integer OCC22980 (Draw_Interpretor& di, Standard_Integer /*argc*/, const char ** /*argv*/)
184{
185 int aSum = 0;
186
187 //check returned value
188 QCOMPARE (Standard_Atomic_Decrement (&aSum), -1);
189 QCOMPARE (Standard_Atomic_Increment (&aSum), 0);
190 QCOMPARE (Standard_Atomic_Increment (&aSum), 1);
191 QCOMPARE (Standard_Atomic_Increment (&aSum), 2);
192// QCOMPARE (Standard_Atomic_DecrementTest (&aSum), 0);
193// QCOMPARE (Standard_Atomic_DecrementTest (&aSum), 1);
194
195 //check atomicity
196 aSum = 0;
197 const int N = 1 << 24; //big enough to ensure concurrency
198
199 //increment
200 tbb::parallel_for (tbb::blocked_range<size_t> (0, N), IncrementerDecrementer (&aSum, true));
201 QCOMPARE (aSum, N);
202
203 //decrement
204 tbb::parallel_for (tbb::blocked_range<size_t> (0, N), IncrementerDecrementer (&aSum, false));
205 QCOMPARE (aSum, 0);
206
207 return 0;
208}
209
210#else /* HAVE_TBB */
211
212static Standard_Integer OCC22980 (Draw_Interpretor& di, Standard_Integer /*argc*/, const char **argv)
213{
214 di << "Test skipped: command " << argv[0] << " requires TBB library\n";
215 return 0;
216}
217
218#endif /* HAVE_TBB */
219
e6aad0ee
RL
220#include <TDocStd_Application.hxx>
221#include <XCAFApp_Application.hxx>
222#include <TDocStd_Document.hxx>
223#include <XCAFDoc_ShapeTool.hxx>
224#include <XCAFDoc_DocumentTool.hxx>
225#include <TDF_Label.hxx>
226#include <TDataStd_Name.hxx>
227
773f53f1 228static Standard_Integer OCC23595 (Draw_Interpretor& di, Standard_Integer /*argc*/, const char** /*argv*/)
e6aad0ee
RL
229{
230 const Handle(TDocStd_Application)& anApp = XCAFApp_Application::GetApplication();
231 Handle(TDocStd_Document) aDoc;
232 anApp->NewDocument ("XmlXCAF", aDoc);
233 QCOMPARE (!aDoc.IsNull(), Standard_True);
234
235 Handle(XCAFDoc_ShapeTool) aShTool = XCAFDoc_DocumentTool::ShapeTool (aDoc->Main());
236
237 //check default value
238 Standard_Boolean aValue = XCAFDoc_ShapeTool::AutoNaming();
239 QCOMPARE (aValue, Standard_True);
240
241 //true
242 XCAFDoc_ShapeTool::SetAutoNaming (Standard_True);
243 TopoDS_Shape aShape = BRepPrimAPI_MakeBox (100., 200., 300.).Shape();
244 TDF_Label aLabel = aShTool->AddShape (aShape);
245 Handle(TDataStd_Name) anAttr;
246 QCOMPARE (aLabel.FindAttribute (TDataStd_Name::GetID(), anAttr), Standard_True);
247
248 //false
249 XCAFDoc_ShapeTool::SetAutoNaming (Standard_False);
250 aShape = BRepPrimAPI_MakeBox (300., 200., 100.).Shape();
251 aLabel = aShTool->AddShape (aShape);
252 QCOMPARE (!aLabel.FindAttribute (TDataStd_Name::GetID(), anAttr), Standard_True);
253
254 //restore
255 XCAFDoc_ShapeTool::SetAutoNaming (aValue);
256
257 return 0;
258}
259
5d1833ef 260#include <ExprIntrp_GenExp.hxx>
261Standard_Integer OCC22611 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
262{
263
264 if (argc != 3) {
265 di << "Usage : " << argv[0] << " string nb\n";
266 return 1;
267 }
268
269 TCollection_AsciiString aToken = argv[1];
270 Standard_Integer aNb = atoi(argv[2]);
271
272 Handle(ExprIntrp_GenExp) aGen = ExprIntrp_GenExp::Create();
273 for (Standard_Integer i=0; i < aNb; i++)
274 {
275 aGen->Process(aToken);
276 Handle(Expr_GeneralExpression) aExpr = aGen->Expression();
277 }
278
279 return 0;
280}
281
35e08fe8 282Standard_Integer OCC22595 (Draw_Interpretor& di, Standard_Integer /*argc*/, const char ** /*argv*/)
e187cc0a 283{
284 gp_Mat M0;
285 di << "M0 = "
286 << " {" << M0(1,1) << "} {" << M0(1,2) << "} {" << M0(1,3) <<"}"
287 << " {" << M0(2,1) << "} {" << M0(2,2) << "} {" << M0(2,3) <<"}"
288 << " {" << M0(1,1) << "} {" << M0(1,2) << "} {" << M0(1,3) <<"}";
289 return 0;
290}
291
bead40f2 292#include <TopoDS_Face.hxx>
293#include <TopoDS_Face.hxx>
294#include <TopoDS.hxx>
295#include <BRepBuilderAPI_Transform.hxx>
296#include <BRepExtrema_DistShapeShape.hxx>
297#include <BRepTools.hxx>
298
299Standard_Boolean static OCC23774Test(const TopoDS_Face& grossPlateFace, const TopoDS_Shape& originalWire, Draw_Interpretor& di)
300{
301 BRepExtrema_DistShapeShape distShapeShape(grossPlateFace,originalWire,Extrema_ExtFlag_MIN);
302 if(!distShapeShape.IsDone()) {
303 di <<"Distance ShapeShape is Not Done\n";
304 return Standard_False;
305 }
306
307 if(distShapeShape.Value() > 0.01) {
308 di << "Wrong Dist = " <<distShapeShape.Value() << "\n";
309 return Standard_False;
310 } else
311 di << "Dist0 = " <<distShapeShape.Value() <<"\n";
312
313 //////////////////////////////////////////////////////////////////////////
314 /// First Flip Y
315 const gp_Pnt2d axis1P1(1474.8199035519228,1249.9995745636970);
316 const gp_Pnt2d axis1P2(1474.8199035519228,1250.9995745636970);
317
318 gp_Vec2d mirrorVector1(axis1P1,axis1P2);
319
320 gp_Trsf2d mirror1;
321 mirror1.SetMirror(gp_Ax2d(axis1P1,mirrorVector1));
322
323 BRepBuilderAPI_Transform transformer1(mirror1);
324 transformer1.Perform(originalWire);
325 if(!transformer1.IsDone()) {
326 di << "Not Done1 " << "\n";
327 return Standard_False;
328 }
329 const TopoDS_Shape& step1ModifiedShape = transformer1.ModifiedShape(originalWire);
330
331 BRepExtrema_DistShapeShape distShapeShape1(grossPlateFace,step1ModifiedShape,Extrema_ExtFlag_MIN);
332 if(!distShapeShape1.IsDone())
333 return Standard_False;
334 if(distShapeShape1.Value() > 0.01) {
335 di << "Dist = " <<distShapeShape1.Value() <<"\n";
336 return Standard_False;
337 } else
338 di << "Dist1 = " <<distShapeShape1.Value() <<"\n";
339
340 //////////////////////////////////////////////////////////////////////////
341 /// Second flip Y
342 transformer1.Perform(step1ModifiedShape);
343 if(!transformer1.IsDone()) {
344 di << "Not Done1 \n";
345 return Standard_False;
346 }
347 const TopoDS_Shape& step2ModifiedShape = transformer1.ModifiedShape(step1ModifiedShape);
bead40f2 348
349 //This is identity matrix for values but for type is gp_Rotation ?!
350 gp_Trsf2d mirror11 = mirror1;
351 mirror11.PreMultiply(mirror1);
352
353 BRepExtrema_DistShapeShape distShapeShape2(grossPlateFace,step2ModifiedShape);//,Extrema_ExtFlag_MIN);
354 if(!distShapeShape2.IsDone())
355 return Standard_False;
356
357 //This last test case give error (the value is 1008.8822038689706)
358 if(distShapeShape2.Value() > 0.01) {
359 di << "Wrong Dist2 = " <<distShapeShape2.Value() <<"\n";
360 Standard_Integer N = distShapeShape2.NbSolution();
361 di << "Nb = " <<N <<"\n";
362 for (Standard_Integer i=1;i <= N;i++)
363 di <<"Sol(" <<i<<") = " <<distShapeShape2.PointOnShape1(i).Distance(distShapeShape2.PointOnShape2(i)) <<"\n";
364 return Standard_False;
365 }
366 di << "Distance2 = " <<distShapeShape2.Value() <<"\n";
367
368 return Standard_True;
369}
370static Standard_Integer OCC23774(Draw_Interpretor& di, Standard_Integer n, const char** a)
371{
372
373 if (n != 3) {
374 di <<"OCC23774: invalid number of input parameters\n";
375 return 1;
376 }
377
378 const char *ns1 = (a[1]), *ns2 = (a[2]);
379 TopoDS_Shape S1(DBRep::Get(ns1)), S2(DBRep::Get(ns2));
380 if (S1.IsNull() || S2.IsNull()) {
381 di <<"OCC23774: Null input shapes\n";
382 return 1;
383 }
384 const TopoDS_Face& aFace = TopoDS::Face(S1);
385 if(!OCC23774Test(aFace, S2, di))
386 di << "Something is wrong\n";
387
388 return 0;
389}
390
1ef32e96
RL
391#include <GeomConvert_ApproxSurface.hxx>
392#include <Geom_BSplineSurface.hxx>
393#include <Draw.hxx>
394#include <OSD_Thread.hxx>
395static void GeomConvertTest (Draw_Interpretor& di, Standard_Integer theTargetNbUPoles, Standard_CString theFileName)
396{
397 Handle(Geom_Surface) aSurf = DrawTrSurf::GetSurface(theFileName);
398 GeomConvert_ApproxSurface aGAS (aSurf, 1e-4, GeomAbs_C1, GeomAbs_C1, 9, 9, 100, 1);
399 if (!aGAS.IsDone()) {
400 di << "ApproxSurface is not done!" << "\n";
401 return;
402 }
403 const Handle(Geom_BSplineSurface)& aBSurf = aGAS.Surface();
404 if (aBSurf.IsNull()) {
405 di << "BSplineSurface is not created!" << "\n";
406 return;
407 }
408 di << "Number of UPoles:" << aBSurf->NbUPoles() << "\n";
409 QCOMPARE (aBSurf->NbUPoles(), theTargetNbUPoles);
410}
411
412struct aData {
413 Draw_Interpretor* di;
414 Standard_Integer nbupoles;
415 Standard_CString filename;
416};
417
418Standard_EXPORT Standard_Address convert(Standard_Address data)
419{
420 aData* info = (aData*) data;
421 GeomConvertTest(*(info->di),info->nbupoles,info->filename);
422 return NULL;
423}
424
425static Standard_Integer OCC23952sweep (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
426{
427 if (argc != 3) {
428 di << "Usage: " << argv[0] << " invalid number of arguments" << "\n";
429 return 1;
430 }
431 struct aData aStorage;
432 aStorage.di = &di;
433 aStorage.nbupoles = Draw::Atoi(argv[1]);
434 aStorage.filename = argv[2];
435
436 OSD_Thread aThread1(convert);
437 aThread1.Run(&aStorage);
438 GeomConvertTest(di,aStorage.nbupoles,aStorage.filename);
85c44a05 439 cout << "result of thread: " << aThread1.Wait() << endl;
1ef32e96
RL
440
441 return 0;
442}
d2786814 443
1ef32e96
RL
444#include <GeomInt_IntSS.hxx>
445static void GeomIntSSTest (Draw_Interpretor& di, Standard_Integer theNbSol, Standard_CString theFileName1, Standard_CString theFileName2)
446{
447 Handle(Geom_Surface) aSurf1 = DrawTrSurf::GetSurface(theFileName1);
448 Handle(Geom_Surface) aSurf2 = DrawTrSurf::GetSurface(theFileName2);
449 GeomInt_IntSS anInter;
450 anInter.Perform(aSurf1, aSurf2, Precision::Confusion(), Standard_True);
451 if (!anInter.IsDone()) {
452 di << "An intersection is not done!" << "\n";
453 return;
454 }
455
456 di << "Number of Lines:" << anInter.NbLines() << "\n";
457 QCOMPARE (anInter.NbLines(), theNbSol);
458}
459
460struct aNewData {
461 Draw_Interpretor* di;
462 Standard_Integer nbsol;
463 Standard_CString filename1;
464 Standard_CString filename2;
465};
466Standard_EXPORT Standard_Address convert_inter(Standard_Address data)
467{
468 aNewData* info = (aNewData*) data;
469 GeomIntSSTest(*(info->di),info->nbsol,info->filename1,info->filename2);
470 return NULL;
471}
472
473static Standard_Integer OCC23952intersect (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
474{
475 if (argc != 4) {
476 di << "Usage: " << argv[0] << " invalid number of arguments" << "\n";
477 return 1;
478 }
479 struct aNewData aStorage;
480 aStorage.di = &di;
481 aStorage.nbsol = Draw::Atoi(argv[1]);
482 aStorage.filename1 = argv[2];
483 aStorage.filename2 = argv[3];
484
485 OSD_Thread aThread1(convert_inter);
486 aThread1.Run(&aStorage);
487 GeomIntSSTest(di,aStorage.nbsol,aStorage.filename1,aStorage.filename2);
85c44a05 488 cout << "result of thread: " << aThread1.Wait() << endl;
1ef32e96
RL
489
490 return 0;
491}
492
493#include <Geom_SurfaceOfRevolution.hxx>
06be28a4
RL
494static Standard_Integer OCC23683 (Draw_Interpretor& di, Standard_Integer argc,const char ** argv)
495{
496 if (argc < 2) {
497 di<<"Usage: " << argv[0] << " invalid number of arguments"<<"\n";
498 return 1;
499 }
500
501 Standard_Integer ucontinuity = 1;
502 Standard_Integer vcontinuity = 1;
503 Standard_Boolean iscnu = false;
504 Standard_Boolean iscnv = false;
505
506 Handle(Geom_Surface) aSurf = DrawTrSurf::GetSurface(argv[1]);
507
508 QCOMPARE (aSurf->IsCNu (ucontinuity), iscnu);
509 QCOMPARE (aSurf->IsCNv (vcontinuity), iscnv);
510
511 return 0;
512}
513
1939140c 514#include <gp_Ax1.hxx>
515#include <gp_Ax22d.hxx>
516#include <Geom_Plane.hxx>
517#include <Geom2d_Circle.hxx>
518#include <Geom2d_TrimmedCurve.hxx>
519#include <BRepBuilderAPI_MakeEdge.hxx>
520#include <BRepPrimAPI_MakeRevol.hxx>
521#include <Geom2d_OffsetCurve.hxx>
522
523static int test_offset(Draw_Interpretor& di, Standard_Integer argc, const char** argv)
524{
525 // Check the command arguments
526 if ( argc != 1 )
527 {
528 di << "Error: " << argv[0] << " - invalid number of arguments" << "\n";
529 di << "Usage: type help " << argv[0] << "\n";
530 return 1; // TCL_ERROR
531 }
532
533 gp_Ax1 RotoAx( gp::Origin(), gp::DZ() );
534 gp_Ax22d Ax2( gp::Origin2d(), gp::DY2d(), gp::DX2d() );
535 Handle(Geom_Surface) Plane = new Geom_Plane( gp::YOZ() );
536
537 di << "<<<< Preparing sample surface of revolution based on trimmed curve >>>>" << "\n";
538 di << "-----------------------------------------------------------------------" << "\n";
539
540 Handle(Geom2d_Circle) C2d1 = new Geom2d_Circle(Ax2, 1.0);
541 Handle(Geom2d_TrimmedCurve) C2d1Trimmed = new Geom2d_TrimmedCurve(C2d1, 0.0, M_PI/2.0);
542 TopoDS_Edge E1 = BRepBuilderAPI_MakeEdge(C2d1Trimmed, Plane);
543
544 DBRep::Set("e1", E1);
545
546 BRepPrimAPI_MakeRevol aRevolBuilder1(E1, RotoAx);
547 TopoDS_Face F1 = TopoDS::Face( aRevolBuilder1.Shape() );
548
549 DBRep::Set("f1", F1);
550
551 di << "Result: f1" << "\n";
552
553 di << "<<<< Preparing sample surface of revolution based on offset curve >>>>" << "\n";
554 di << "-----------------------------------------------------------------------" << "\n";
555
556 Handle(Geom2d_OffsetCurve) C2d2Offset = new Geom2d_OffsetCurve(C2d1Trimmed, -0.5);
557 TopoDS_Edge E2 = BRepBuilderAPI_MakeEdge(C2d2Offset, Plane);
558
559 DBRep::Set("e2", E2);
560
561 BRepPrimAPI_MakeRevol aRevolBuilder2(E2, RotoAx);
562 TopoDS_Face F2 = TopoDS::Face( aRevolBuilder2.Shape() );
563
564 DBRep::Set("f2", F2);
565
566 di << "Result: f2" << "\n";
567
568 return 0;
569}
570
470ebb43 571#include <GeomAdaptor_Surface.hxx>
572#include <Draw.hxx>
573//=======================================================================
574//function : OCC23945
575//purpose :
576//=======================================================================
577
35e08fe8 578static Standard_Integer OCC23945 (Draw_Interpretor& /*di*/,Standard_Integer n, const char** a)
470ebb43 579{
580 if (n < 5) return 1;
581
582 Handle(Geom_Surface) aS = DrawTrSurf::GetSurface(a[1]);
583 if (aS.IsNull()) return 1;
584
585 GeomAdaptor_Surface GS(aS);
586
587 Standard_Real U = Draw::Atof(a[2]);
588 Standard_Real V = Draw::Atof(a[3]);
589
590 Standard_Boolean DrawPoint = ( n%3 == 2);
591 if ( DrawPoint) n--;
592
593 gp_Pnt P;
594 if (n >= 13) {
595 gp_Vec DU,DV;
596 if (n >= 22) {
597 gp_Vec D2U,D2V,D2UV;
598 GS.D2(U,V,P,DU,DV,D2U,D2V,D2UV);
599 Draw::Set(a[13],D2U.X());
600 Draw::Set(a[14],D2U.Y());
601 Draw::Set(a[15],D2U.Z());
602 Draw::Set(a[16],D2V.X());
603 Draw::Set(a[17],D2V.Y());
604 Draw::Set(a[18],D2V.Z());
605 Draw::Set(a[19],D2UV.X());
606 Draw::Set(a[20],D2UV.Y());
607 Draw::Set(a[21],D2UV.Z());
608 }
609 else
610 GS.D1(U,V,P,DU,DV);
611
612 Draw::Set(a[7],DU.X());
613 Draw::Set(a[8],DU.Y());
614 Draw::Set(a[9],DU.Z());
615 Draw::Set(a[10],DV.X());
616 Draw::Set(a[11],DV.Y());
617 Draw::Set(a[12],DV.Z());
618 }
619 else
620 GS.D0(U,V,P);
621
622 if ( n > 6) {
623 Draw::Set(a[4],P.X());
624 Draw::Set(a[5],P.Y());
625 Draw::Set(a[6],P.Z());
626 }
627 if ( DrawPoint) {
628 DrawTrSurf::Set(a[n],P);
629 }
630
631 return 0;
632}
633
4bee43a9
P
634#include <Voxel_BoolDS.hxx>
635#include <Voxel_FastConverter.hxx>
636#include <Voxel_BooleanOperation.hxx>
637static Standard_Integer OCC24019 (Draw_Interpretor& di, Standard_Integer argc, const char** argv)
638{
639 if ( argc != 2 ) {
640 di << "Error: " << argv[0] << " - invalid number of arguments" << "\n";
641 return 1;
642 }
643
644 TCollection_AsciiString aFileName = argv[1];
645 TopoDS_Shape aShape;
646 BRep_Builder aBuilder;
647
648 if (!BRepTools::Read(aShape, aFileName.ToCString(), aBuilder)) {
649 di << "Error: Could not read a shape!" << "\n";
650 return 1;
651 }
652
653 TopoDS_Solid aShape1 = BRepPrimAPI_MakeSphere(gp_Pnt(20,25,35), 7);
654
655 Standard_Real deflection = 0.005;
656 Standard_Integer nbThreads = 1;
657 Standard_Integer nbx = 200, nby = 200, nbz = 200;
658 Voxel_BoolDS theVoxels(0,0,0, 50, 50, 50, nbx, nby, nbz);
659 Voxel_BoolDS theVoxels1(0,0,0, 50, 50, 50, nbx, nby, nbz);
660
661 Standard_Integer progress = 0;
662 Voxel_FastConverter fcp(aShape, theVoxels, deflection, nbx, nby, nbz, nbThreads);
663 fcp.ConvertUsingSAT(progress, 1);
664 fcp.FillInVolume(1);
665
666 Voxel_FastConverter fcp1(aShape1, theVoxels1, deflection, nbx, nby, nbz, nbThreads);
667 fcp1.ConvertUsingSAT(progress, 1);
668 fcp1.FillInVolume(1);
669
670 Voxel_BooleanOperation op;
671 Standard_Boolean result = op.Cut(theVoxels1, theVoxels);
672 if ( result != 1 ) {
673 di << "Error: invalid boolean operation" << "\n";
674 } else {
675 di << "OK: boolean operation is ok" << "\n";
676 }
677
678 return 0;
679}
680
29cb310a 681//=======================================================================
682//function : OCC11758
683//purpose :
684//=======================================================================
498ce76b 685static Standard_Integer OCC11758 (Draw_Interpretor& di, Standard_Integer n, const char**)
29cb310a 686{
687 if (n != 1) return 1;
688
689 const char* theStr = "0123456789";
690 Standard_Integer i, j;
691 for ( i = 0; i < 5; ++i ) {
692 // TCollection_AsciiString(const Standard_CString astring)
693 TCollection_AsciiString a(theStr+i);
694 // IsEqual (const Standard_CString other)const
695 //assert( a == theStr+i );
696 QCOMPARE ( a , theStr+i );
697
698 //TCollection_AsciiString(const Standard_CString astring,const Standard_Integer aLen )
699 TCollection_AsciiString b(theStr+i, 3);
700 //assert( b.Length() == 3 );
701 //assert( strncmp( b.ToCString(), theStr+i, 3 ) == 0 );
702 //assert( strlen( b.ToCString() ) == 3 );
703 QCOMPARE ( b.Length() , 3 );
704 QCOMPARE ( strncmp( b.ToCString() , theStr+i, 3 ) , 0 );
705 QCOMPARE ( b.Length() , 3 );
706
707 //TCollection_AsciiString(const Standard_Integer aValue)
708 TCollection_AsciiString c(i);
709 //assert( c.IsIntegerValue() );
710 //assert( c.IntegerValue() == i );
711 QCOMPARE ( c.IsIntegerValue() , Standard_True );
712 QCOMPARE ( c.IntegerValue() , i );
713
714 //TCollection_AsciiString(const Standard_Real aValue)
715 TCollection_AsciiString d( 0.1*i );
716 //assert( d.IsRealValue() );
717 //assert( TCollection_AsciiString(3.3) == "3.3");
718 QCOMPARE ( d.IsRealValue() , Standard_True );
719 QCOMPARE ( TCollection_AsciiString(3.3) , "3.3" );
720
721 //TCollection_AsciiString(const TCollection_AsciiString& astring)
722 TCollection_AsciiString e(d);
723 //assert( e == d );
724 //assert( e.Length() == d.Length() );
725 //assert( strcmp( e.ToCString(), d.ToCString() ) == 0 );
726 QCOMPARE ( e ,d );
727 QCOMPARE ( e.Length() , d.Length() );
728 QCOMPARE ( strcmp( e.ToCString(), d.ToCString() ) , 0 );
729
730 // TCollection_AsciiString(const TCollection_AsciiString& astring ,
731 // const Standard_Character other )
732 TCollection_AsciiString f(e,'\a');
733 //assert( f.Length() == e.Length() + 1 );
734 //assert( strncmp( f.ToCString(), e.ToCString(), e.Length() ) == 0 );
735 //assert( f.Value( f.Length() ) == '\a');
736 QCOMPARE ( f.Length() , e.Length() + 1 );
737 QCOMPARE ( strncmp( f.ToCString(), e.ToCString(), e.Length() ) , 0 );
738 QCOMPARE ( f.Value( f.Length() ) , '\a' );
739
740 // TCollection_AsciiString(const TCollection_AsciiString& astring ,
741 // const Standard_CString other )
742 TCollection_AsciiString g(f, theStr);
743 //assert( g.Length() == f.Length() + strlen( theStr ));
744 //assert( strncmp( g.ToCString(), f.ToCString(), f.Length() ) == 0 );
745 //assert( g.Search( theStr ) == f.Length() + 1 );
746 QCOMPARE ( g.Length() , f.Length() + (Standard_Integer)strlen( theStr ) );
747 QCOMPARE ( strncmp( g.ToCString(), f.ToCString(), f.Length() ) , 0 );
748 QCOMPARE ( g.Search( theStr ) , f.Length() + 1 );
749
750 // TCollection_AsciiString(const TCollection_AsciiString& astring ,
751 // const TCollection_AsciiString& other )
752 TCollection_AsciiString h(d,a);
753 //assert( h.Length() == d.Length() + a.Length() );
754 //assert( strncmp( h.ToCString(), d.ToCString(), d.Length() ) == 0 );
755 //assert( strncmp( h.ToCString() + d.Length(), a.ToCString(), a.Length() ) == 0 );
756 QCOMPARE ( h.Length() , d.Length() + a.Length() );
757 QCOMPARE ( strncmp( h.ToCString(), d.ToCString(), d.Length() ) , 0 );
758 QCOMPARE ( strncmp( h.ToCString() + d.Length(), a.ToCString(), a.Length() ) , 0 );
759
760 // AssignCat(const Standard_CString other)
761 c.AssignCat( a.ToCString() );
762 //assert( c.Length() == 1 + a.Length() );
763 //assert( c.Search( a ) == 2 );
764 QCOMPARE ( c.Length() , 1 + a.Length() );
765 QCOMPARE ( c.Search( a ) , 2 );
766
767 // AssignCat(const TCollection_AsciiString& other)
768 Standard_Integer dl = d.Length();
769 d.AssignCat( a );
770 //assert( d.Length() == dl + a.Length() );
771 //assert( d.Search( a ) == dl + 1 );
772 QCOMPARE ( d.Length() , dl + a.Length() );
773 QCOMPARE ( d.Search( a ) , dl + 1 );
774
775 // Capitalize()
776 TCollection_AsciiString capitalize("aBC");
777 capitalize.Capitalize();
778 //assert( capitalize == "Abc" );
779 QCOMPARE ( capitalize , "Abc" );
780
781 // Copy(const Standard_CString fromwhere)
782 d = theStr+i;
783 //assert( d == theStr+i );
784 QCOMPARE ( d , theStr+i );
785
786 // Copy(const TCollection_AsciiString& fromwhere)
787 d = h;
788 // IsEqual (const TCollection_AsciiString& other)const
789 //assert( d == h );
790 QCOMPARE ( d , h );
791
792 // Insert(const Standard_Integer where, const Standard_CString what)
793 dl = d.Length();
794 d.Insert( 2, theStr );
795 //assert( d.Length() == dl + strlen( theStr ));
796 //assert( strncmp( d.ToCString() + 1, theStr, strlen( theStr )) == 0 );
797 QCOMPARE ( d.Length() , dl + (Standard_Integer)strlen( theStr ) );
798 QCOMPARE ( strncmp( d.ToCString() + 1, theStr, strlen( theStr )) , 0 );
799
800 //Insert(const Standard_Integer where,const Standard_Character what)
801 d = theStr;
802 d.Insert( i+1, 'i' );
803 //assert( d.Length() == strlen( theStr ) + 1 );
804 //assert( d.Value( i+1 ) == 'i');
805 //assert( strcmp( d.ToCString() + i + 1, theStr+i ) == 0 );
806 QCOMPARE ( d.Length() , (Standard_Integer)strlen( theStr ) + 1 );
807 QCOMPARE ( d.Value( i+1 ) , 'i' );
808 QCOMPARE ( strcmp( d.ToCString() + i + 1, theStr+i ) , 0 );
809
810 //Insert(const Standard_Integer where,const TCollection_AsciiString& what)
811 d = theStr;
812 d.Insert( i+1, TCollection_AsciiString( "i" ));
813 //assert( d.Length() == strlen( theStr ) + 1 );
814 //assert( d.Value( i+1 ) == 'i');
815 //assert( strcmp( d.ToCString() + i + 1, theStr+i ) == 0 );
816 QCOMPARE ( d.Length() , (Standard_Integer)strlen( theStr ) + 1 );
817 QCOMPARE ( d.Value( i+1 ) , 'i' );
818 QCOMPARE ( strcmp( d.ToCString() + i + 1, theStr+i ) , 0 );
819
820 // IsDifferent (const Standard_CString other)const
821 //assert( d.IsDifferent( theStr ));
822 //assert( d.IsDifferent( "theStr" ));
823 //assert( d.IsDifferent( "" ));
824 //assert( !d.IsDifferent( d.ToCString() ));
825 QCOMPARE ( d.IsDifferent( theStr ) , Standard_True );
826 QCOMPARE ( d.IsDifferent( "theStr" ) , Standard_True );
827 QCOMPARE ( d.IsDifferent( "" ) , Standard_True );
828 QCOMPARE ( !d.IsDifferent( d.ToCString() ) , Standard_True );
829
830 // IsDifferent (const TCollection_AsciiString& other)const
831 //assert( d.IsDifferent( TCollection_AsciiString() ));
832 //assert( d.IsDifferent( a ));
833 //assert( d.IsDifferent( h ));
834 //assert( !d.IsDifferent( d ));
835 QCOMPARE ( d.IsDifferent( TCollection_AsciiString() ) , Standard_True );
836 QCOMPARE ( d.IsDifferent( a ) , Standard_True );
837 QCOMPARE ( d.IsDifferent( h ) , Standard_True );
838 QCOMPARE ( !d.IsDifferent( d ) , Standard_True );
839
840 // IsLess (const Standard_CString other)const
841 //assert( TCollection_AsciiString ("0"). IsLess("1"));
842 //assert( TCollection_AsciiString ("0"). IsLess("00"));
843 //assert( TCollection_AsciiString (""). IsLess("0"));
844 //assert( !TCollection_AsciiString("1"). IsLess("0"));
845 //assert( !TCollection_AsciiString("00").IsLess("0"));
846 //assert( !TCollection_AsciiString("0"). IsLess(""));
847 //assert( TCollection_AsciiString (theStr+i).IsLess(theStr+i+1));
848 QCOMPARE ( TCollection_AsciiString ("0"). IsLess("1") , Standard_True );
849 QCOMPARE ( TCollection_AsciiString ("0"). IsLess("00") , Standard_True );
850 QCOMPARE ( TCollection_AsciiString (""). IsLess("0") , Standard_True );
851 QCOMPARE ( !TCollection_AsciiString("1"). IsLess("0"), Standard_True );
852 QCOMPARE ( !TCollection_AsciiString("00").IsLess("0") , Standard_True );
853 QCOMPARE ( !TCollection_AsciiString("0"). IsLess("") , Standard_True );
854 QCOMPARE ( TCollection_AsciiString (theStr+i).IsLess(theStr+i+1) , Standard_True );
855
856 // IsLess (const TCollection_AsciiString& other)const
857 //assert( TCollection_AsciiString ("0"). IsLess(TCollection_AsciiString("1" )));
858 //assert( TCollection_AsciiString ("0"). IsLess(TCollection_AsciiString("00")));
859 //assert( TCollection_AsciiString (""). IsLess(TCollection_AsciiString("0" )));
860 //assert( !TCollection_AsciiString("1"). IsLess(TCollection_AsciiString("0" )));
861 //assert( !TCollection_AsciiString("00").IsLess(TCollection_AsciiString("0" )));
862 //assert( !TCollection_AsciiString("0"). IsLess(TCollection_AsciiString("" )));
863 //assert( TCollection_AsciiString (theStr+i).IsLess(TCollection_AsciiString(theStr+i+1)));
864 QCOMPARE ( TCollection_AsciiString ("0"). IsLess(TCollection_AsciiString("1" )) , Standard_True );
865 QCOMPARE ( TCollection_AsciiString ("0"). IsLess(TCollection_AsciiString("00")) , Standard_True );
866 QCOMPARE ( TCollection_AsciiString (""). IsLess(TCollection_AsciiString("0" )) , Standard_True );
867 QCOMPARE ( !TCollection_AsciiString("1"). IsLess(TCollection_AsciiString("0" )) , Standard_True );
868 QCOMPARE ( !TCollection_AsciiString("00").IsLess(TCollection_AsciiString("0" )) , Standard_True );
869 QCOMPARE ( !TCollection_AsciiString("0"). IsLess(TCollection_AsciiString("" )) , Standard_True );
870 QCOMPARE ( TCollection_AsciiString (theStr+i).IsLess(TCollection_AsciiString(theStr+i+1)) , Standard_True );
871
872 // IsGreater (const Standard_CString other)const
873 //assert( !TCollection_AsciiString("0"). IsGreater("1"));
874 //assert( !TCollection_AsciiString("0"). IsGreater("00"));
875 //assert( !TCollection_AsciiString(""). IsGreater("0"));
876 //assert( TCollection_AsciiString ("1"). IsGreater("0"));
877 //assert( TCollection_AsciiString ("00").IsGreater("0"));
878 //assert( TCollection_AsciiString ("0"). IsGreater(""));
879 //assert( TCollection_AsciiString (theStr+i+1).IsGreater(theStr+i));
880 QCOMPARE ( !TCollection_AsciiString("0"). IsGreater("1") , Standard_True );
881 QCOMPARE ( !TCollection_AsciiString("0"). IsGreater("00") , Standard_True );
882 QCOMPARE ( !TCollection_AsciiString(""). IsGreater("0") , Standard_True );
883 QCOMPARE ( TCollection_AsciiString ("1"). IsGreater("0") , Standard_True );
884 QCOMPARE ( TCollection_AsciiString ("00").IsGreater("0") , Standard_True );
885 QCOMPARE ( TCollection_AsciiString ("0"). IsGreater("") , Standard_True );
886 QCOMPARE ( TCollection_AsciiString (theStr+i+1).IsGreater(theStr+i) , Standard_True );
887
888 // IsGreater (const TCollection_AsciiString& other)const
889 //assert( !TCollection_AsciiString("0"). IsGreater(TCollection_AsciiString("1" )));
890 //assert( !TCollection_AsciiString("0"). IsGreater(TCollection_AsciiString("00")));
891 //assert( !TCollection_AsciiString(""). IsGreater(TCollection_AsciiString("0" )));
892 //assert( TCollection_AsciiString ("1"). IsGreater(TCollection_AsciiString("0" )));
893 //assert( TCollection_AsciiString ("00").IsGreater(TCollection_AsciiString("0" )));
894 //assert( TCollection_AsciiString ("0"). IsGreater(TCollection_AsciiString("" )));
895 //assert( TCollection_AsciiString (theStr+i+1).IsGreater(TCollection_AsciiString(theStr+i)));
896 QCOMPARE ( !TCollection_AsciiString("0"). IsGreater(TCollection_AsciiString("1" )) , Standard_True );
897 QCOMPARE ( !TCollection_AsciiString("0"). IsGreater(TCollection_AsciiString("00")) , Standard_True );
898 QCOMPARE ( !TCollection_AsciiString(""). IsGreater(TCollection_AsciiString("0" )) , Standard_True );
899 QCOMPARE ( TCollection_AsciiString ("1"). IsGreater(TCollection_AsciiString("0" )) , Standard_True );
900 QCOMPARE ( TCollection_AsciiString ("00").IsGreater(TCollection_AsciiString("0" )) , Standard_True );
901 QCOMPARE ( TCollection_AsciiString ("0"). IsGreater(TCollection_AsciiString("" )) , Standard_True );
902 QCOMPARE ( TCollection_AsciiString (theStr+i+1).IsGreater(TCollection_AsciiString(theStr+i)) , Standard_True );
903
904 // void Read(Standard_IStream& astream)
905 std::istringstream is( theStr );
906 e.Read( is );
907 //assert( e == theStr );
908 QCOMPARE ( e , theStr );
909
910 // Standard_Integer SearchFromEnd (const Standard_CString what)const
911 //assert( e.SearchFromEnd( theStr + i ) == i + 1 );
912 QCOMPARE ( e.SearchFromEnd( theStr + i ) , i + 1 );
913
914 // SetValue(const Standard_Integer where, const Standard_CString what)
915 e.SetValue( i+1, "what");
916 //assert( e.Search( "what" ) == i+1 );
917 //assert( e.Length() == strlen( theStr ));
918 QCOMPARE ( e.Search( "what" ) , i+1 );
919 QCOMPARE ( e.Length() , (Standard_Integer)strlen( theStr ) );
920
921 // TCollection_AsciiString Split (const Standard_Integer where)
922 e = theStr;
923 d = e.Split( i+1 );
924 //assert( d.Length() + e.Length() == strlen( theStr ));
925 QCOMPARE ( d.Length() + e.Length() , (Standard_Integer)strlen( theStr ) );
926
927 // TCollection_AsciiString SubString (const Standard_Integer FromIndex,
928 // const Standard_Integer ToIndex) const
929 e = theStr;
930 d = e.SubString( (unsigned int)i+1, (unsigned int)i+3 );
931 //assert( d.Length() == 3 );
932 //assert( d.Value(1) == theStr[ i ]);
933 QCOMPARE ( d.Length() , 3 );
934 QCOMPARE ( d.Value(1) , theStr[ i ] );
935
936 // TCollection_AsciiString Token (const Standard_CString separators,
937 // const Standard_Integer whichone) const
938 e = " ";
939 for ( j = 0; j < i; ++j ) {
940 e += TCollection_AsciiString( theStr[j] ) + " ";
941 //assert( e.Token(" ", j+1 ) == TCollection_AsciiString( theStr+j, 1 ));
942 QCOMPARE ( e.Token(" ", j+1 ) , TCollection_AsciiString( theStr+j, 1 ) );
943 }
944 }
945 for ( i = 0; i < 5; ++i )
946 {
947 // TCollection_ExtendedString (const Standard_CString astring,
948 // const Standard_Boolean isMultiByte)
949 const TCollection_ExtendedString a( theStr+i );
950 //assert( TCollection_AsciiString( a ) == theStr+i );
951 QCOMPARE ( TCollection_AsciiString( a ) , theStr+i );
952
953 //TCollection_ExtendedString (const Standard_ExtString astring)
954 const TCollection_ExtendedString b( a.ToExtString() );
955 //assert( a == b );
956 QCOMPARE ( a , b );
957
958 // TCollection_ExtendedString (const Standard_Integer length,
959 // const Standard_ExtCharacter filler )
960 const TCollection_ExtendedString c( i, 1 );
961 //assert( c.Length() == i );
962 QCOMPARE ( c.Length() , i );
963 if ( c.Length() > 0 ) {
964 //assert( c.Value( i ) == 1 );
965 QCOMPARE ( c.Value( i ) , 1 );
966 }
967
968 // TCollection_ExtendedString (const Standard_Integer aValue)
969 TCollection_ExtendedString d( i );
970 const TCollection_AsciiString da( d );
971 //assert( da.IsIntegerValue() );
972 //assert( da.IntegerValue() == i );
973 QCOMPARE ( da.IsIntegerValue() , Standard_True );
974 QCOMPARE ( da.IntegerValue(), i );
975
976 // TCollection_ExtendedString (const Standard_Real aValue)
977 const TCollection_ExtendedString e( 0.1 * i );
978 const TCollection_AsciiString ea( e );
979 //assert( ea.IsRealValue() );
980 //assert( Abs( ea.RealValue() - 0.1 * i ) < 1e-10 );
981 QCOMPARE ( ea.IsRealValue() , Standard_True );
982 QCOMPARE ( Abs( ea.RealValue() - 0.1 * i ) < 1e-10 , Standard_True );
983
984 // TCollection_ExtendedString (const TCollection_ExtendedString& astring)
985 const TCollection_ExtendedString f(e);
986 //assert( f.Length() == e.Length());
987 //assert( f == e );
988 QCOMPARE ( f.Length() , e.Length() );
989 QCOMPARE ( f , e );
990
991 // TCollection_ExtendedString (const TCollection_AsciiString& astring)
992 const TCollection_ExtendedString g( ea );
993 //assert( g.Length() == ea.Length() );
994 //assert( TCollection_AsciiString( g ) == ea );
995 QCOMPARE ( g.Length() , ea.Length() );
996 QCOMPARE ( TCollection_AsciiString( g ) , ea );
997
998 // AssignCat (const TCollection_ExtendedString& other)
999 const TCollection_ExtendedString sep(",");
1000 d.AssignCat( sep );
1001 d.AssignCat( g );
1002 //assert( d.Length() == 2 + g.Length() );
1003 //assert( d.Token( sep.ToExtString(), 1 ) == TCollection_ExtendedString( i ));
1004 //assert( d.Token( sep.ToExtString(), 2 ) == g );
1005 QCOMPARE ( d.Length() , 2 + g.Length() );
1006 QCOMPARE ( d.Token( sep.ToExtString(), 1 ) , TCollection_ExtendedString( i ) );
1007 QCOMPARE ( d.Token( sep.ToExtString(), 2 ) , g );
1008
1009 // TCollection_ExtendedString Cat (const TCollection_ExtendedString& other) const
1010 const TCollection_ExtendedString cat = a.Cat( sep );
1011 //assert( cat.Length() == a.Length() + sep.Length() );
1012 //assert( cat.Search( a ) == 1 );
1013 //assert( cat.Search( sep ) == a.Length() + 1 );
1014 QCOMPARE ( cat.Length() , a.Length() + sep.Length() );
1015 QCOMPARE ( cat.Search( a ) , 1 );
1016 QCOMPARE ( cat.Search( sep ) , a.Length() + 1 );
1017
1018 // Copy (const TCollection_ExtendedString& fromwhere)
1019 d = cat;
1020 //assert( d.Length() == cat.Length() );
1021 //assert( d == cat );
1022 QCOMPARE ( d.Length() , cat.Length() );
1023 QCOMPARE ( d , cat );
1024
1025 // IsEqual (const Standard_ExtString other) const
1026 //assert( d.IsEqual( d.ToExtString() ));
1027 QCOMPARE ( d.IsEqual( d.ToExtString() ) , Standard_True );
1028
1029 // IsDifferent (const Standard_ExtString other ) const
1030 //assert( d.IsDifferent( a.ToExtString() ));
1031 QCOMPARE ( d.IsDifferent( a.ToExtString() ) , Standard_True );
1032
1033 // IsDifferent (const TCollection_ExtendedString& other) const
1034 //assert( d.IsDifferent( a ));
1035 QCOMPARE ( d.IsDifferent( a ) , Standard_True );
1036
1037 // IsLess (const Standard_ExtString other) const
1038 const TCollection_ExtendedString l0("0"), l1("1"), l00("00"), l, ls(theStr+i), ls1(theStr+i+1);
1039 //assert( l0. IsLess( l1.ToExtString() ));
1040 //assert( l0. IsLess( l00.ToExtString() ));
1041 //assert( l. IsLess( l0.ToExtString() ));
1042 //assert( ! l1. IsLess( l0.ToExtString() ));
1043 //assert( ! l00.IsLess( l0.ToExtString() ));
1044 //assert( ! l0. IsLess( l.ToExtString() ));
1045 //assert( ls.IsLess( ls1.ToExtString() ));
1046 QCOMPARE ( l0. IsLess( l1.ToExtString() ) , Standard_True );
1047 QCOMPARE ( l0. IsLess( l00.ToExtString() ) , Standard_True );
1048 QCOMPARE ( l. IsLess( l0.ToExtString() ) , Standard_True );
1049 QCOMPARE ( ! l1. IsLess( l0.ToExtString() ) , Standard_True );
1050 QCOMPARE ( ! l00.IsLess( l0.ToExtString() ) , Standard_True );
1051 QCOMPARE ( ! l0. IsLess( l.ToExtString() ) , Standard_True );
1052 QCOMPARE ( ls.IsLess( ls1.ToExtString() ) , Standard_True );
1053
1054 // IsLess (const TCollection_ExtendedString& other) const
1055 //assert( l0. IsLess( l1 ));
1056 //assert( l0. IsLess( l00 ));
1057 //assert( l. IsLess( l0 ));
1058 //assert( ! l1. IsLess( l0 ));
1059 //assert( ! l00.IsLess( l0 ));
1060 //assert( ! l0. IsLess( l ));
1061 //assert( ls.IsLess( ls1 ));
1062 QCOMPARE ( l0. IsLess( l1 ) , Standard_True );
1063 QCOMPARE ( l0. IsLess( l00 ) , Standard_True );
1064 QCOMPARE ( l. IsLess( l0 ) , Standard_True );
1065 QCOMPARE ( ! l1. IsLess( l0 ) , Standard_True );
1066 QCOMPARE ( ! l00.IsLess( l0 ) , Standard_True );
1067 QCOMPARE ( ! l0. IsLess( l ) , Standard_True );
1068 QCOMPARE ( ls.IsLess( ls1 ) , Standard_True );
1069
1070 // IsGreater (const Standard_ExtString other) const
1071 //assert( ! l0.IsGreater( l1.ToExtString() ));
1072 //assert( ! l0.IsGreater( l00.ToExtString() ));
1073 //assert( ! l. IsGreater( l0.ToExtString() ));
1074 //assert( l1. IsGreater( l0.ToExtString() ));
1075 //assert( l00.IsGreater( l0.ToExtString() ));
1076 //assert( l0. IsGreater( l.ToExtString() ));
1077 //assert( ls1.IsGreater( ls.ToExtString() ));
1078 QCOMPARE ( ! l0.IsGreater( l1.ToExtString() ) , Standard_True );
1079 QCOMPARE ( ! l0.IsGreater( l00.ToExtString() ) , Standard_True );
1080 QCOMPARE ( ! l. IsGreater( l0.ToExtString() ) , Standard_True );
1081 QCOMPARE ( l1. IsGreater( l0.ToExtString() ) , Standard_True );
1082 QCOMPARE ( l00.IsGreater( l0.ToExtString() ) , Standard_True );
1083 QCOMPARE ( l0. IsGreater( l.ToExtString() ) , Standard_True );
1084 QCOMPARE ( ls1.IsGreater( ls.ToExtString() ) ,Standard_True );
1085
1086 // IsGreater (const TCollection_ExtendedString& other) const
1087 //assert( ! l0.IsGreater( l1));
1088 //assert( ! l0.IsGreater( l00));
1089 //assert( ! l. IsGreater( l0));
1090 //assert( l1. IsGreater( l0));
1091 //assert( l00.IsGreater( l0));
1092 //assert( l0. IsGreater( l));
1093 //assert( ls1.IsGreater( ls));
1094 QCOMPARE ( ! l0.IsGreater( l1) , Standard_True );
1095 QCOMPARE ( ! l0.IsGreater( l00) , Standard_True );
1096 QCOMPARE ( ! l. IsGreater( l0) , Standard_True );
1097 QCOMPARE ( l1. IsGreater( l0) , Standard_True );
1098 QCOMPARE ( l00.IsGreater( l0) , Standard_True );
1099 QCOMPARE ( l0. IsGreater( l) , Standard_True );
1100 QCOMPARE ( ls1.IsGreater( ls) , Standard_True );
1101
1102 // ==========================
1103 //TCollection_HAsciiString::
1104 // ==========================
1105
1106 // IsDifferent(const Handle(TCollection_HAsciiString)& S)
1107 Handle(TCollection_HAsciiString) ha1 = new TCollection_HAsciiString( theStr+i );
1108 Handle(TCollection_HAsciiString) ha2 = new TCollection_HAsciiString( theStr+i+1 );
1109 //assert( ha1->IsDifferent( ha2 ));
1110 //assert( !ha1->IsDifferent( ha1 ));
1111 QCOMPARE ( ha1->IsDifferent( ha2 ) , Standard_True );
1112 QCOMPARE ( !ha1->IsDifferent( ha1 ) , Standard_True );
1113
1114 // IsSameString (const Handle(TCollection_HAsciiString)& S)
1115 //assert( !ha1->IsSameString( ha2 ));
1116 //assert( ha1->IsSameString( ha1 ));
1117 QCOMPARE ( !ha1->IsSameString( ha2 ) , Standard_True );
1118 QCOMPARE ( ha1->IsSameString( ha1 ) , Standard_True );
1119
1120 // IsSameState (const Handle(TCollection_HAsciiString)& other) const
1121 //assert( !ha1->IsSameState( ha2 ));
1122 //assert( ha1->IsSameState( ha1 ));
1123 QCOMPARE ( !ha1->IsSameState( ha2 ) , Standard_True );
1124 QCOMPARE ( ha1->IsSameState( ha1 ) , Standard_True );
1125
1126 // IsSameString (const Handle(TCollection_HAsciiString)& S ,
1127 // const Standard_Boolean CaseSensitive) const
1128 //assert( !ha1->IsSameString( ha2, true ));
1129 //assert( ha1->IsSameString( ha1, true ));
1130 //assert( !ha1->IsSameString( ha2, false ));
1131 //assert( ha1->IsSameString( ha1, false ));
1132 QCOMPARE ( !ha1->IsSameString( ha2, Standard_True ) , Standard_True );
1133 QCOMPARE ( ha1->IsSameString( ha1, Standard_True ) , Standard_True );
1134 QCOMPARE ( !ha1->IsSameString( ha2, Standard_False ) , Standard_True );
1135 QCOMPARE ( ha1->IsSameString( ha1, Standard_False ) , Standard_True );
1136
1137 ha1->SetValue( 1, "AbC0000000");
1138 ha2->SetValue( 1, "aBc0000000");
1139 //assert( !ha1->IsSameString( ha2, true ));
1140 //assert( ha1->IsSameString( ha2, false ));
1141 QCOMPARE ( !ha1->IsSameString( ha2, Standard_True ) , Standard_True );
1142 QCOMPARE ( ha1->IsSameString( ha2, Standard_False ), Standard_True );
1143 }
1144 return 0;
1145}
1146
788cbaf4 1147#include <Geom_CylindricalSurface.hxx>
1148#include <IntTools_FaceFace.hxx>
1149#include <IntTools_Curve.hxx>
1150#include <IntTools_PntOn2Faces.hxx>
1151
1152static Standard_Integer OCC24005 (Draw_Interpretor& theDI, Standard_Integer theNArg, const char** theArgv)
1153{
1154 if(theNArg < 2)
1155 {
1156 theDI << "Wrong a number of arguments!\n";
1157 return 1;
1158 }
1159
1160 Handle_Geom_Plane plane(new Geom_Plane(
1161 gp_Ax3( gp_Pnt(-72.948737453424499, 754.30437716359393, 259.52151854671678),
1162 gp_Dir(6.2471473085930200e-007, -0.99999999999980493, 0.00000000000000000),
1163 gp_Dir(0.99999999999980493, 6.2471473085930200e-007, 0.00000000000000000))));
1164 Handle(Geom_CylindricalSurface) cylinder(
1165 new Geom_CylindricalSurface(
1166 gp_Ax3(gp_Pnt(-6.4812490053250649, 753.39408794522092, 279.16400974257465),
1167 gp_Dir(1.0000000000000000, 0.0, 0.00000000000000000),
1168 gp_Dir(0.0, 1.0000000000000000, 0.00000000000000000)),
1169 19.712534607908712));
1170
1171 DrawTrSurf::Set("pln", plane);
1172 theDI << "pln\n";
1173 DrawTrSurf::Set("cyl", cylinder);
1174 theDI << "cyl\n";
1175
1176 BRep_Builder builder;
1177 TopoDS_Face face1, face2;
1178 builder.MakeFace(face1, plane, Precision::Confusion());
1179 builder.MakeFace(face2, cylinder, Precision::Confusion());
1180 IntTools_FaceFace anInters;
1181 anInters.SetParameters(false, true, true, Precision::Confusion());
1182 anInters.Perform(face1, face2);
1183
1184 if (!anInters.IsDone())
1185 {
1186 theDI<<"No intersections found!"<<"\n";
1187
1188 return 1;
1189 }
1190
1191 //Handle(Geom_Curve) aResult;
1192 //gp_Pnt aPoint;
1193
1194 const IntTools_SequenceOfCurves& aCvsX=anInters.Lines();
1195 const IntTools_SequenceOfPntOn2Faces& aPntsX=anInters.Points();
1196
1197 char buf[1024];
1198 Standard_Integer aNbCurves, aNbPoints;
1199
1200 aNbCurves=aCvsX.Length();
1201 aNbPoints=aPntsX.Length();
1202
1203 if (aNbCurves >= 2)
1204 {
1205 for (Standard_Integer i=1; i<=aNbCurves; ++i)
1206 {
1207 Sprintf(buf, "%s_%d",theArgv[1],i);
1208 theDI << buf << " ";
1209
1210 const IntTools_Curve& aIC = aCvsX(i);
1211 const Handle(Geom_Curve)& aC3D= aIC.Curve();
1212 DrawTrSurf::Set(buf,aC3D);
1213 }
1214 }
1215 else if (aNbCurves == 1)
1216 {
1217 const IntTools_Curve& aIC = aCvsX(1);
1218 const Handle(Geom_Curve)& aC3D= aIC.Curve();
1219 Sprintf(buf, "%s",theArgv[1]);
1220 theDI << buf << " ";
1221 DrawTrSurf::Set(buf,aC3D);
1222 }
1223
1224 for (Standard_Integer i = 1; i<=aNbPoints; ++i)
1225 {
1226 const IntTools_PntOn2Faces& aPi=aPntsX(i);
1227 const gp_Pnt& aP=aPi.P1().Pnt();
1228
1229 Sprintf(buf,"%s_p_%d",theArgv[1],i);
1230 theDI << buf << " ";
1231 DrawTrSurf::Set(buf, aP);
1232 }
1233
1234 return 0;
1235}
1236
1cd84fee 1237void QABugs::Commands_19(Draw_Interpretor& theCommands) {
1365140b 1238 const char *group = "QABugs";
7fd59977 1239
1240 theCommands.Add ("OCC230", "OCC230 TrimmedCurve Pnt2d Pnt2d", __FILE__, OCC230, group);
1241 theCommands.Add ("OCC142", "OCC142", __FILE__, OCC142, group);
f6f03db9 1242 theCommands.Add ("OCC23361", "OCC23361", __FILE__, OCC23361, group);
1365140b
RL
1243 theCommands.Add ("OCC23237", "OCC23237", __FILE__, OCC23237, group);
1244 theCommands.Add ("OCC22980", "OCC22980", __FILE__, OCC22980, group);
e6aad0ee 1245 theCommands.Add ("OCC23595", "OCC23595", __FILE__, OCC23595, group);
5d1833ef 1246 theCommands.Add ("OCC22611", "OCC22611 string nb", __FILE__, OCC22611, group);
e187cc0a 1247 theCommands.Add ("OCC22595", "OCC22595", __FILE__, OCC22595, group);
bead40f2 1248 theCommands.Add ("OCC23774", "OCC23774 shape1 shape2", __FILE__, OCC23774, group);
06be28a4 1249 theCommands.Add ("OCC23683", "OCC23683 shape", __FILE__, OCC23683, group);
1ef32e96
RL
1250 theCommands.Add ("OCC23952sweep", "OCC23952sweep nbupoles shape", __FILE__, OCC23952sweep, group);
1251 theCommands.Add ("OCC23952intersect", "OCC23952intersect nbsol shape1 shape2", __FILE__, OCC23952intersect, group);
1939140c 1252 theCommands.Add ("test_offset", "test_offset", __FILE__, test_offset, group);
470ebb43 1253 theCommands.Add("OCC23945", "OCC23945 surfname U V X Y Z [DUX DUY DUZ DVX DVY DVZ [D2UX D2UY D2UZ D2VX D2VY D2VZ D2UVX D2UVY D2UVZ]]", __FILE__, OCC23945,group);
4bee43a9 1254 theCommands.Add ("OCC24019", "OCC24019 aShape", __FILE__, OCC24019, group);
29cb310a 1255 theCommands.Add ("OCC11758", "OCC11758", __FILE__, OCC11758, group);
788cbaf4 1256 theCommands.Add ("OCC24005", "OCC24005 result", __FILE__, OCC24005, group);
7fd59977 1257 return;
1258}