#include <V3d_View.hxx>
#include <TopoDS_Shape.hxx>
#include <AIS_InteractiveContext.hxx>
+#include <AIS_LocalContext.hxx>
#include <AIS_TexturedShape.hxx>
#include <Image_PixMap.hxx>
#include <Image_Color.hxx>
#include <Precision.hxx>
-#include <PCollection_HAsciiString.hxx>
-
#include <cstdio>
#include <cmath>
#include <iostream>
#include <BRepAlgo_Cut.hxx>
#include <NCollection_Map.hxx>
#include <NCollection_Handle.hxx>
+#include <NCollection_IncAllocator.hxx>
#include <TCollection_HAsciiString.hxx>
#include <GeomFill_Trihedron.hxx>
#include <BRepOffsetAPI_MakePipe.hxx>
-#include <Standard_Atomic.hxx>
+#include <TopExp_Explorer.hxx>
#include <Standard_Version.hxx>
return 0;
}
-static Standard_Integer OCC142 (Draw_Interpretor& di, Standard_Integer /*argc*/, const char ** /*argv*/)
-{
- for(Standard_Integer i= 0;i <= 20;i++){
- Handle(PCollection_HAsciiString) pstr = new PCollection_HAsciiString("TEST");
- pstr->Clear();
- }
- di << "OCC142: OK" << "\n";
- return 0;
-}
-
static Standard_Integer OCC23361 (Draw_Interpretor& di, Standard_Integer /*argc*/, const char ** /*argv*/)
{
gp_Pnt p(0, 0, 2);
di << "Not Done1 " << "\n";
return Standard_False;
}
- const TopoDS_Shape& step1ModifiedShape = transformer1.ModifiedShape(originalWire);
+ TopoDS_Shape step1ModifiedShape = transformer1.ModifiedShape(originalWire);
BRepExtrema_DistShapeShape distShapeShape1(grossPlateFace,step1ModifiedShape,Extrema_ExtFlag_MIN);
if(!distShapeShape1.IsDone())
di << "Not Done1 \n";
return Standard_False;
}
- const TopoDS_Shape& step2ModifiedShape = transformer1.ModifiedShape(step1ModifiedShape);
+ TopoDS_Shape step2ModifiedShape = transformer1.ModifiedShape(step1ModifiedShape);
//This is identity matrix for values but for type is gp_Rotation ?!
gp_Trsf2d mirror11 = mirror1;
HT aHandle;
// QVERIFY (aHandle.IsNull());
QCOMPARE (aHandle.IsNull(), Standard_True);
- const T* p = aHandle.Access();
+ const T* p = aHandle.get();
#if OCC_VERSION_HEX > 0x060700
//QVERIFY (!p);
//QVERIFY (p == 0);
aHandle = new T;
//QVERIFY (!aHandle.IsNull());
QCOMPARE (!aHandle.IsNull(), Standard_True);
- p = aHandle.Access();
+ p = aHandle.get();
//QVERIFY (p);
//QVERIFY (p != 0);
QCOMPARE (p != NULL, Standard_True);
if (n != 1) return 1;
DoIsNull<Standard_Transient, Handle(Standard_Transient)>(di);
- DoIsNull<Standard_Persistent, Handle(Standard_Persistent)>(di);
return 0;
}
std::cerr << "QABugs_HandleClass[" << this << "] " << theArgVec[0] << "\n";
return 0;
}
- DEFINE_STANDARD_RTTI(QABugs_HandleClass) // Type definition
+ DEFINE_STANDARD_RTTI(QABugs_HandleClass, Standard_Transient) // Type definition
};
DEFINE_STANDARD_HANDLE (QABugs_HandleClass, Standard_Transient)
-IMPLEMENT_STANDARD_HANDLE (QABugs_HandleClass, Standard_Transient)
-IMPLEMENT_STANDARD_RTTIEXT(QABugs_HandleClass, Standard_Transient)
+
// Dummy class to test interface for compilation issues
struct QABugs_NHandleClass
return 0;
}
-#include <IGESControl_Reader.hxx>
-#include <IGESControl_Controller.hxx>
-#include <IGESData_IGESEntity.hxx>
-#include <BRepCheck_Analyzer.hxx>
-#include <PTColStd_TransientPersistentMap.hxx>
-#include <PTopoDS_HShape.hxx>
-#include <Storage_Data.hxx>
-#include <TopExp_Explorer.hxx>
-#include <MgtBRep.hxx>
-#include <FSD_File.hxx>
-#include <ShapeSchema.hxx>
-#include <TColStd_HSequenceOfTransient.hxx>
-#include <PTColStd_PersistentTransientMap.hxx>
-#include <Storage_Root.hxx>
-
-static Standard_Integer OCC24565 (Draw_Interpretor& di, Standard_Integer argc, const char** argv)
-{
- if (argc != 3) {
- di << "Usage : " << argv[0] << " FileNameIGS FileNameSTOR";
- return 1;
- }
-
- Standard_CString sFileNameIGS = argv[1];
- Standard_CString sFileNameSTOR = argv[2];
-
- IGESControl_Reader ICReader;
-
- /* * * * * * *
- * Read the IGES file and make sure it is valid
- *
- * * * * * * */
- IGESControl_Controller::Init();
-
- if (!ICReader.ReadFile(sFileNameIGS)) {
- printf("%s:%d - Error reading '%s'\n",__FUNCTION__,__LINE__,sFileNameIGS);fflush(stdout);
- return -1;
- }
-
- int nbShapes = ICReader.NbShapes();
-
- printf("%s:%d - nbShapes = '%d'\n",__FUNCTION__,__LINE__,nbShapes);fflush(stdout);
-
- TopoDS_Shape Shape;
- if(nbShapes == 0)
- {
- Handle(TColStd_HSequenceOfTransient) faces=ICReader.GiveList("iges-faces");
- Handle(TColStd_HSequenceOfTransient) surfaceList=ICReader.GiveList("xst-transferrable-roots",faces);
-
- if (surfaceList.IsNull())
- {
- printf("%s:%d - surfaceList.IsNull()\n",__FUNCTION__,__LINE__);fflush(stdout);
- return -1;
- }
- BRep_Builder builder;
- TopoDS_Compound* pC = new TopoDS_Compound();
- builder.MakeCompound(*pC);
-
- for (int j=1;j<=surfaceList->Length();j++)
- {
- Handle(IGESData_IGESEntity) igesEntity=Handle(IGESData_IGESEntity)::DownCast(surfaceList->Value(j));
- if (igesEntity.IsNull()) continue;
- ICReader.ClearShapes();
- Standard_Boolean rv;
- try {
- rv=ICReader.TransferEntity(igesEntity);
- }
- catch (...) {
- rv=Standard_False;
- }
- if (!rv) {
- printf("%s:%d - Error transferring IGES entity\n",__FUNCTION__,__LINE__);fflush(stdout);
- printf("%s:%d - FormNumber = %d, TypeNumber = %d\n",__FUNCTION__,__LINE__,igesEntity->FormNumber(),igesEntity->TypeNumber());fflush(stdout);
- return -1;
- }
-
- TopoDS_Shape S;
- try {
- S=ICReader.Shape();
- }
- catch(...) {
- printf("%s:%d - Error reading IGES entity\n",__FUNCTION__,__LINE__);fflush(stdout);
- printf("%s:%d - FormNumber = %d, TypeNumber = %d\n",__FUNCTION__,__LINE__,igesEntity->FormNumber(),igesEntity->TypeNumber());fflush(stdout);
- return -1;
- }
- if (S.IsNull()) {
- printf("%s:%d - NULL Surface encountered\n",__FUNCTION__,__LINE__);
- return -1;
- }
-
- try
- {
- builder.Add(*pC,S);
- }
- catch(...)
- {
- printf("%s: Exception adding face.\n",__FUNCTION__);
- }
- }
- Shape = TopoDS_Shape(*pC);
- }
- else
- {
- Shape = ICReader.OneShape();
- }
- {
- BRepCheck_Analyzer brca(Shape);
-
- if(!brca.IsValid())
- {
- printf("%s: Invalid shape after reading IGES file.\n",__FUNCTION__);
- }
- }
-
- /* * * * * * *
- * Write the contents of the Shape to a STOR file
- *
- * * * * * * */
- PTColStd_TransientPersistentMap aMapTP;
- Handle(PTopoDS_HShape) aPShape_write;
- Handle(Storage_Data) d_write=new Storage_Data;
- char Name[32];
-
- TopExp_Explorer Ex;
- int i;
- int max_i = 0;
-
- for (i=0,Ex.Init(Shape,TopAbs_FACE);Ex.More();i++,Ex.Next())
- {
-
- max_i = i;
- try {
- aPShape_write=MgtBRep::Translate(Ex.Current(),aMapTP,MgtBRep_WithoutTriangle);
- }
- catch (...) {
- printf("%s: Error translating surface '%d'\n",__FUNCTION__,i);
- }
-
- sprintf(Name,"S%010d",i);
-
- {
- BRepCheck_Analyzer brca(Ex.Current());
- if(!brca.IsValid())
- {
- printf("INVALID face '%s' in the shape, which will be written to the STOR file.\n",Name);
- }
- }
- try {
- d_write->AddRoot(Name,aPShape_write);
- }
- catch (...) {
- printf("%s: Error adding surface '%d', RootName = '%s'\n",__FUNCTION__,i,Name);
- }
- }
- printf("%s: Going to write %d surfaces.\n",__FUNCTION__,max_i+1);
-
- FSD_File f_write;
- if(f_write.Open(sFileNameSTOR, Storage_VSWrite)!=Storage_VSOk)
- {
- printf("%s: Error opening file: %s\n", __FUNCTION__,sFileNameSTOR);
- return -1;
- }
- Handle(ShapeSchema) s_write=new ShapeSchema;
- s_write->Write(f_write,d_write);
- f_write.Close();
- printf("%s: Wrote to the STOR file.\n",__FUNCTION__);
-
- /* * * * * * *
- * Read the contents of the Shape from a STOR file
- *
- * * * * * * */
- FSD_File f_read;
- if(f_read.Open(sFileNameSTOR, Storage_VSRead)!=Storage_VSOk)
- {
- printf("%s: Error opening file: %s\n", __FUNCTION__,sFileNameSTOR);
- return -1;
- }
- Handle(ShapeSchema) s_read=new ShapeSchema;
- Handle(Storage_Data) d_read=s_read->Read(f_read);
-
- Handle(Standard_Persistent) p;
- Handle(Storage_Root) r;
- Handle(PTopoDS_HShape) aPShape_read;
- PTColStd_PersistentTransientMap aMapPT;
- TopoDS_Shape S_read;
-
- printf("%s: Extracting %d faces from the STOR file.\n",__FUNCTION__,max_i+1);
- for(int i = 0; i <= max_i; ++i)
- {
- sprintf(Name,"S%010d",i);
- r=d_read->Find(Name);
- if(r.IsNull())
- {
- printf("%s:%d '%s' IsNull().\n",__FUNCTION__,__LINE__,Name);fflush(stdout);
- continue;
- }
- p=r->Object();
- aPShape_read = Handle(PTopoDS_HShape)::DownCast(p);
- try {
- MgtBRep::Translate(aPShape_read,aMapPT,S_read,MgtBRep_WithoutTriangle);
- }
- catch (Standard_Failure) {
- Handle(Standard_Failure) E=Standard_Failure::Caught();
- std::string str;
- str="Exception: ";
- str+=E->DynamicType()->Name();
- str+=" => ";
- str+=E->GetMessageString();
- printf("%s(1): %s: %s\n",__FUNCTION__,Name,str.c_str());fflush(stdout);
- }
- catch (...) {
- printf("%s(1): Unhandled exception in MgtBRep::Translate\n",__FUNCTION__);
- }
-
- BRepCheck_Analyzer brca(S_read);
-
- if(!brca.IsValid())
- {
- printf("%s: Read INVALID face (%s)!\n",__FUNCTION__,Name);
- }
- }
-
- printf("Completed.\n");fflush(stdout);
-
- return 0;
-}
-
-#include <Handle_BRepTools_NurbsConvertModification.hxx>
#include <BRepPrimAPI_MakeCylinder.hxx>
#include <BRepBuilderAPI_Copy.hxx>
#include <BRepTools_NurbsConvertModification.hxx>
BRep_Builder aBuilder;
aBuilder.MakeCompound (aComp);
//NURBS modifier is used to increase footprint of each shape
- Handle_BRepTools_NurbsConvertModification aNurbsModif = new BRepTools_NurbsConvertModification;
+ Handle(BRepTools_NurbsConvertModification) aNurbsModif = new BRepTools_NurbsConvertModification;
TopoDS_Shape aRefShape = BRepPrimAPI_MakeCylinder (50., 100.).Solid();
BRepTools_Modifier aModifier (aRefShape, aNurbsModif);
if (aModifier.IsDone()) {
Handle(TDocStd_Application) anApp = new AppStdL_Application;
Handle(TDocStd_Document) aDoc;
- anApp->NewDocument ("MDTV-Standard", aDoc);
+ anApp->NewDocument ("BinOcaf", aDoc);
TDF_Label aLab = aDoc->Main();
TDataStd_Integer::Set (aLab, 0);
TDataStd_Name::Set (aLab, "test");
Standard_Integer /*theNArg*/,
const char** /*theArgs*/)
{
- math_MultipleVarFunction* aFunc = new BraninFunction();
+ BraninFunction aFunc;
math_Vector aLower(1,2), aUpper(1,2);
aLower(1) = -5;
aCurrPnt1(1) = aLower(1) + (aUpper(1) - aLower(1)) * (i - 1) / (aGridOrder - 1.0);
aCurrPnt1(2) = aLower(2) + (aUpper(2) - aLower(2)) * (j - 1) / (aGridOrder - 1.0);
- aFunc->Value(aCurrPnt1, aFuncValues(idx));
+ aFunc.Value(aCurrPnt1, aFuncValues(idx));
idx++;
}
}
aLipConst = C;
}
- math_GlobOptMin aFinder(aFunc, aLower, aUpper, aLipConst);
+ math_GlobOptMin aFinder(&aFunc, aLower, aUpper, aLipConst);
aFinder.Perform();
//(-pi , 12.275), (pi , 2.275), (9.42478, 2.475)
std::string fileName=argv[1];
mOcafApplication *mCasApp = new mOcafApplication();
Handle(TDocStd_Document) doc;
- mCasApp->NewDocument("MDTV-XCAF", doc);
+ mCasApp->NewDocument("BinXCAF", doc);
STEPCAFControl_Reader stepReader;
IFSelect_ReturnStatus status = stepReader.ReadFile (fileName.c_str());
if (status != IFSelect_RetDone)
return 0;
}
+static Standard_Integer OCC26139 (Draw_Interpretor& theDI,
+ Standard_Integer argc,
+ const char ** argv)
+{
+
+ Handle(AIS_InteractiveContext) aCtx = ViewerTest::GetAISContext();
+ if (aCtx.IsNull())
+ {
+ theDI << "Use 'vinit' command before " << argv[0] << "\n";
+ return 1;
+ }
+
+ Standard_Integer aBoxGridSize = 100;
+ Standard_Integer aCompGridSize = 3;
+ Standard_Real aBoxSize = 5.0;
+
+ if (argc > 1)
+ {
+ for (Standard_Integer anArgIdx = 1; anArgIdx < argc; ++anArgIdx)
+ {
+ TCollection_AsciiString anArg (argv[anArgIdx]);
+ anArg.LowerCase();
+ if (anArg == "-boxgrid")
+ {
+ aBoxGridSize = Draw::Atoi (argv[++anArgIdx]);
+ }
+ else if (anArg == "-compgrid")
+ {
+ aCompGridSize = Draw::Atoi (argv[++anArgIdx]);
+ }
+ else if (anArg == "-boxsize")
+ {
+ aBoxSize = Draw::Atof (argv[++anArgIdx]);
+ }
+ }
+ }
+
+ NCollection_List<Handle(AIS_Shape)> aCompounds;
+ for (Standard_Integer aCompGridX = 0; aCompGridX < aCompGridSize; ++aCompGridX)
+ {
+ for (Standard_Integer aCompGridY = 0; aCompGridY < aCompGridSize; ++aCompGridY)
+ {
+ BRep_Builder aBuilder;
+ TopoDS_Compound aComp;
+ aBuilder.MakeCompound (aComp);
+ for (Standard_Integer aBoxGridX = 0; aBoxGridX < aBoxGridSize; ++aBoxGridX)
+ {
+ for (Standard_Integer aBoxGridY = 0; aBoxGridY < aBoxGridSize; ++aBoxGridY)
+ {
+ BRepPrimAPI_MakeBox aBox (gp_Pnt (aBoxGridX * aBoxSize, aBoxGridY * aBoxSize, 0.0),
+ aBoxSize, aBoxSize, aBoxSize);
+ aBuilder.Add (aComp, aBox.Shape());
+ }
+ }
+ gp_Trsf aTrsf;
+ aTrsf.SetTranslation (gp_Vec (aBoxGridSize * aBoxSize * aCompGridX,
+ aBoxGridSize * aBoxSize * aCompGridY,
+ 0.0));
+ TopLoc_Location aLoc (aTrsf);
+ aComp.Located (aLoc);
+ aCompounds.Append (new AIS_Shape (aComp));
+ }
+ }
+
+ OSD_Timer aTimer;
+ for (NCollection_List<Handle(AIS_Shape)>::Iterator aCompIter (aCompounds); aCompIter.More(); aCompIter.Next())
+ {
+ aTimer.Start();
+ aCtx->Display (aCompIter.Value(), Standard_False);
+ aTimer.Stop();
+ theDI << "Display time: " << aTimer.ElapsedTime() << "\n";
+ aTimer.Reset();
+ }
+
+ aTimer.Reset();
+ aTimer.Start();
+ for (NCollection_List<Handle(AIS_Shape)>::Iterator aCompIter (aCompounds); aCompIter.More(); aCompIter.Next())
+ {
+ aCtx->Remove (aCompIter.Value(), Standard_False);
+ }
+ aTimer.Stop();
+ theDI << "Remove time: " << aTimer.ElapsedTime() << "\n";
+
+ return 0;
+}
+
#include <TColStd_DataMapIteratorOfDataMapOfIntegerInteger.hxx>
#include <TColStd_DataMapOfIntegerInteger.hxx>
#include <OSD.hxx>
return 0;
}
+//=======================================================================
+//function : OCC26172
+//purpose :
+//=======================================================================
+static Standard_Integer OCC26172 (Draw_Interpretor& theDI, Standard_Integer theArgNb, const char** theArgVec)
+{
+ if (theArgNb != 1)
+ {
+ std::cerr << "Error: wrong number of arguments! See usage:\n";
+ theDI.PrintHelp (theArgVec[0]);
+ return 1;
+ }
+
+ Handle(AIS_InteractiveContext) anAISContext = ViewerTest::GetAISContext();
+ if(anAISContext.IsNull())
+ {
+ std::cerr << "Error: no active view. Please call vinit.\n";
+ return 1;
+ }
+
+ gp_Pnt aStart (100, 100, 100);
+ gp_Pnt anEnd (300, 400, 600);
+ BRepBuilderAPI_MakeEdge anEdgeBuilder (aStart, anEnd);
+ TopoDS_Edge anEdge = anEdgeBuilder.Edge();
+ Handle(AIS_Shape) aTestAISShape = new AIS_Shape (anEdge);
+ anAISContext->Display (aTestAISShape);
+
+ // 2. activate it in selection modes
+ TColStd_SequenceOfInteger aModes;
+ aModes.Append (AIS_Shape::SelectionMode ((TopAbs_ShapeEnum) TopAbs_VERTEX));
+ aModes.Append (AIS_Shape::SelectionMode ((TopAbs_ShapeEnum) TopAbs_EDGE));
+
+ anAISContext->OpenLocalContext();
+ anAISContext->Deactivate (aTestAISShape);
+ anAISContext->Load (aTestAISShape, -1, true);
+ for (Standard_Integer anIt = 1; anIt <= aModes.Length(); ++anIt)
+ {
+ anAISContext->Activate (aTestAISShape, aModes (anIt));
+ }
+
+ // select entities in vertex selection mode
+ Handle(SelectMgr_Selection) aSelection = aTestAISShape->Selection (aModes (1));
+ for (aSelection->Init(); aSelection->More(); aSelection->Next())
+ {
+ Handle(SelectBasics_SensitiveEntity) anEntity = aSelection->Sensitive()->BaseSensitive();
+ if (anEntity.IsNull())
+ {
+ continue;
+ }
+
+ Handle(SelectMgr_EntityOwner) anOwner =
+ Handle(SelectMgr_EntityOwner)::DownCast (anEntity->OwnerId());
+
+ if (anOwner.IsNull())
+ {
+ continue;
+ }
+
+ anAISContext->LocalContext()->AddOrRemoveSelected (anOwner);
+ }
+
+ // select entities in edge selection mode
+ aSelection = aTestAISShape->Selection (aModes (2));
+ for (aSelection->Init(); aSelection->More(); aSelection->Next())
+ {
+ Handle(SelectBasics_SensitiveEntity) anEntity = aSelection->Sensitive()->BaseSensitive();
+ if (anEntity.IsNull())
+ {
+ continue;
+ }
+
+ Handle(SelectMgr_EntityOwner) anOwner =
+ Handle(SelectMgr_EntityOwner)::DownCast (anEntity->OwnerId());
+
+ if (anOwner.IsNull())
+ {
+ continue;
+ }
+
+ anAISContext->LocalContext()->AddOrRemoveSelected (anOwner);
+ }
+
+ // deactivate vertex mode and check clearing of outdated selection
+ anAISContext->Deactivate (aTestAISShape, aModes (1));
+ anAISContext->LocalContext()->ClearOutdatedSelection (aTestAISShape, true);
+
+ return 0;
+}
+
+//=======================================================================
+//function : OCC26284
+//purpose :
+//=======================================================================
+static Standard_Integer OCC26284 (Draw_Interpretor& theDI, Standard_Integer theArgNb, const char** theArgVec)
+{
+ if (theArgNb != 1)
+ {
+ std::cerr << "Error: wrong number of arguments! See usage:\n";
+ theDI.PrintHelp (theArgVec[0]);
+ return 1;
+ }
+
+ Handle(AIS_InteractiveContext) anAISContext = ViewerTest::GetAISContext();
+ if (anAISContext.IsNull())
+ {
+ std::cerr << "Error: no active view. Please call vinit.\n";
+ return 1;
+ }
+
+ BRepPrimAPI_MakeSphere aSphereBuilder (gp_Pnt (0.0, 0.0, 0.0), 1.0);
+ Handle(AIS_Shape) aSphere = new AIS_Shape (aSphereBuilder.Shape());
+ anAISContext->Display (aSphere);
+ for (Standard_Integer aChildIdx = 0; aChildIdx < 5; ++aChildIdx)
+ {
+ BRepPrimAPI_MakeSphere aBuilder (gp_Pnt (1.0 + aChildIdx, 1.0 + aChildIdx, 1.0 + aChildIdx), 1.0);
+ Handle(AIS_Shape) aChild = new AIS_Shape (aBuilder.Shape());
+ aSphere->AddChild (aChild);
+ anAISContext->Display (aChild);
+ }
+
+ anAISContext->RecomputeSelectionOnly (aSphere);
+
+ return 0;
+}
+
+#include <IntTools_Context.hxx>
+#include <GeomAPI_ProjectPointOnSurf.hxx>
+
+//=======================================================================
+//function : xprojponf
+//purpose :
+//=======================================================================
+Standard_Integer xprojponf (Draw_Interpretor& di,
+ Standard_Integer n,
+ const char** a)
+{
+ if (n!=3) {
+ di<<" use xprojponf p f \n";
+ return 0;
+ }
+ //
+ gp_Pnt aP, aPS;
+ TopoDS_Shape aS;
+ TopoDS_Face aF;
+ Handle(IntTools_Context) aCtx;
+ //
+ DrawTrSurf::GetPoint(a[1], aP);
+ aS=DBRep::Get(a[2]);
+ //
+ if (aS.IsNull()) {
+ di<<" null shape is not allowed\n";
+ return 0;
+ }
+ //
+ if (aS.ShapeType()!=TopAbs_FACE) {
+ di << a[2] << " not a face\n";
+ return 0;
+ }
+ //
+ aCtx=new IntTools_Context;
+ //
+ aF=TopoDS::Face(aS);
+ GeomAPI_ProjectPointOnSurf& aPPS=aCtx->ProjPS(aF);
+ //
+ aPPS.Perform(aP);
+ if (!aPPS.IsDone()) {
+ di<<" projection failed\n";
+ return 0;
+ }
+ //
+ aPS=aPPS.NearestPoint();
+ di<< " point px " << aPS.X() << " " << aPS.Y() << " " << aPS.Z() << "\n";
+ //
+ return 0;
+}
+
+//=======================================================================
+//function : OCC25547
+//purpose :
+//=======================================================================
+#include <BRepMesh_CircleTool.hxx>
+#include <SelectMgr_EntityOwner.hxx>
+
+static Standard_Boolean inspect_point(const gp_XY& thePoint,
+ const gp_XY& theCenter,
+ const Standard_Real theRadius)
+{
+ static Standard_Real aPrecision = Precision::PConfusion();
+ static Standard_Real aSqPrecision = aPrecision * aPrecision;
+ const gp_XY aDistVec = thePoint - theCenter;
+ if (aDistVec.SquareModulus() - (theRadius * theRadius) < aSqPrecision)
+ return Standard_True;
+ else
+ return Standard_False;
+}
+
+static Standard_Integer OCC24923(
+ Draw_Interpretor& theDI,
+ Standard_Integer argc,
+ const char ** argv)
+{
+ srand(static_cast<unsigned int>(time(NULL)));
+
+ const Standard_Real aMaxDeviation = (argc > 1) ? Draw::Atof(argv[1]) : 0.01;
+ const Standard_Integer aPointsNb = 10000000;
+ const Standard_Real aMinAngle = 5 * M_PI / 180.;
+ static Standard_Real aSqPrecision = Precision::PConfusion() * Precision::PConfusion();
+
+ Standard_Integer aFailedNb = 0;
+ for (Standard_Integer i = 0; i < aPointsNb; ++i)
+ {
+ gp_XY p[3];
+ for (Standard_Integer j = 0; j < 3; ++j)
+ p[j].SetCoord(((Standard_Real)rand())/RAND_MAX, ((Standard_Real)rand())/RAND_MAX);
+
+ // Check that points do not compose degenerated triangle.
+ gp_XY aVec1 = p[1] - p[0];
+ gp_XY aVec2 = p[2] - p[0];
+ if (aVec1.SquareModulus() > aSqPrecision &&
+ aVec2.SquareModulus() > aSqPrecision &&
+ (aVec1 ^ aVec2) > aMinAngle)
+ {
+ gp_XY aCenter;
+ Standard_Real aRadius;
+ if (BRepMesh_CircleTool::MakeCircle(p[0], p[1], p[2], aCenter, aRadius))
+ {
+ if (!inspect_point(p[0], aCenter, aRadius) ||
+ !inspect_point(p[1], aCenter, aRadius) ||
+ !inspect_point(p[2], aCenter, aRadius))
+ {
+ /* theDI << "Missed: " <<
+ "p1=(" << p1.X() << ", " << p1.Y() << "), " <<
+ "p2=(" << p2.X() << ", " << p2.Y() << "), " <<
+ "p3=(" << p3.X() << ", " << p3.Y() << "), " <<
+ "c=(" << aCenter.X() << ", " << aCenter.Y() << "), " <<
+ "r=" << aRadius << "\n";*/
+
+ ++aFailedNb;
+ }
+
+ continue;
+ }
+ }
+
+ // Ensure that aPointsNb suitable for tests are generated
+ --i;
+ }
+
+ const Standard_Real aDeviation =
+ 1. - (Standard_Real)(aPointsNb - aFailedNb) / (Standard_Real)aPointsNb;
+
+ theDI << "Number of failed cases: " << aFailedNb << " (Total " << aPointsNb << ")\n";
+ if (aDeviation > aMaxDeviation)
+ {
+ theDI << "Failed. Number of incorrect results is too huge: " <<
+ aDeviation * 100 << "% (Max " << aMaxDeviation * 100 << "%)" << "\n";
+ return 1;
+ }
+
+ theDI << "Deviation of incorrect results is: " <<
+ aDeviation * 100 << "% (Max " << aMaxDeviation * 100 << "%)" << "\n";
+ theDI << "Test completed\n";
+ return 0;
+}
+
void QABugs::Commands_19(Draw_Interpretor& theCommands) {
const char *group = "QABugs";
__FILE__, aNClassPtr, &QABugs_NHandleClass::NHandleProc, group);
theCommands.Add ("OCC230", "OCC230 TrimmedCurve Pnt2d Pnt2d", __FILE__, OCC230, group);
- theCommands.Add ("OCC142", "OCC142", __FILE__, OCC142, group);
theCommands.Add ("OCC23361", "OCC23361", __FILE__, OCC23361, group);
theCommands.Add ("OCC23237", "OCC23237", __FILE__, OCC23237, group);
theCommands.Add ("OCC22980", "OCC22980", __FILE__, OCC22980, group);
theCommands.Add ("OCC24086", "OCC24086 face wire", __FILE__, OCC24086, group);
theCommands.Add ("OCC24622", "OCC24622 texture={1D|2D}\n Tests sourcing of 1D/2D pixmaps for AIS_TexturedShape", __FILE__, OCC24622, group);
theCommands.Add ("OCC24667", "OCC24667 result Wire_spine Profile [Mode [Approx]], no args to get help", __FILE__, OCC24667, group);
- theCommands.Add ("OCC24565", "OCC24565 FileNameIGS FileNameSTOR", __FILE__, OCC24565, group);
theCommands.Add ("OCC24755", "OCC24755", __FILE__, OCC24755, group);
theCommands.Add ("OCC24834", "OCC24834", __FILE__, OCC24834, group);
theCommands.Add ("OCC24889", "OCC24889", __FILE__, OCC24889, group);
__FILE__, OCC25545, group);
theCommands.Add ("OCC25547", "OCC25547", __FILE__, OCC25547, group);
theCommands.Add ("OCC24881", "OCC24881 shape", __FILE__, OCC24881, group);
+ theCommands.Add ("OCC26172", "OCC26172", __FILE__, OCC26172, group);
+ theCommands.Add ("xprojponf", "xprojponf p f", __FILE__, xprojponf, group);
+ theCommands.Add ("OCC24923", "OCC24923", __FILE__, OCC24923, group);
+ theCommands.Add ("OCC26139", "OCC26139 [-boxsize value] [-boxgrid value] [-compgrid value]", __FILE__, OCC26139, group);
+ theCommands.Add ("OCC26284", "OCC26284", __FILE__, OCC26284, group);
return;
}