#include <QABugs.hxx>
#include <gp_Ax2.hxx>
+#include <Extrema_GenLocateExtPS.hxx>
#include <Geom_Circle.hxx>
#include <Geom_SurfaceOfLinearExtrusion.hxx>
+#include <NCollection_List.hxx>
#include <TColgp_Array2OfPnt.hxx>
#include <TColStd_Array2OfReal.hxx>
#include <TColStd_Array1OfReal.hxx>
#include <TColStd_Array1OfInteger.hxx>
#include <Geom_BSplineSurface.hxx>
+#include <Geom2d_Curve.hxx>
+#include <Geom2d_Line.hxx>
+#include <Draw.hxx>
#include <DrawTrSurf.hxx>
+#include <ShapeConstruct_ProjectCurveOnSurface.hxx>
#include <TopExp.hxx>
#include <TopoDS_Vertex.hxx>
#include <TopoDS_Edge.hxx>
#include <BRep_Builder.hxx>
#include <BRepTools.hxx>
+#include <BRepAdaptor_Surface.hxx>
#include <TopoDS.hxx>
#include <DBRep.hxx>
+#include <BRepGProp.hxx>
+#include <DDocStd.hxx>
+#include <GProp_GProps.hxx>
+#include <TDocStd_Document.hxx>
+#include <XCAFDimTolObjects_DatumObject.hxx>
+#include <XCAFDimTolObjects_DimensionObject.hxx>
+#include <XCAFDimTolObjects_GeomToleranceObject.hxx>
+#include <XCAFDoc_Datum.hxx>
+#include <XCAFDoc_Dimension.hxx>
+#include <XCAFDoc_DimTolTool.hxx>
+#include <XCAFDoc_DocumentTool.hxx>
+#include <XCAFDoc_GeomTolerance.hxx>
+#include <XCAFDoc_ShapeTool.hxx>
+
+#include <HLRAppli_ReflectLines.hxx>
+
//=======================================================================
//function : SurfaceGenOCC26675_1
//purpose : Generates a surface for intersect (in corresponding
return 0;
}
+namespace AllocTest
+{
+ // The test is based of occupying of all available virtual memory.
+ // Obviously it has no sense on 64-bit platforms.
+
+ enum Status
+ {
+ NotApplicable = 0x1,
+ OUMCatchOK = 0x2,
+ OUMCatchFail = 0x4
+ };
+
+ template<int> int test()
+ {
+ // non-32-bit implementation
+ return NotApplicable;
+ }
+
+ template<> int test<4>()
+ {
+ // 32-bit implementation
+ NCollection_List<Standard_Address> aList;
+ const Standard_Integer aBlockSizes[] = {100000, 10000, 10};
+ int aStatus = 0;
+
+ // start populate memory with blocks of large size, then
+ // smaller ones and so on according to content of the array aBlockSizes
+ for (size_t i=0; i < sizeof(aBlockSizes)/sizeof(int); i++)
+ {
+ try
+ {
+ for (;;)
+ aList.Append(Standard::Allocate(aBlockSizes[i]));
+ }
+ catch (Standard_Failure)
+ {
+ aStatus |= OUMCatchOK;
+ }
+ catch (...)
+ {
+ aStatus |= OUMCatchFail;
+ break;
+ }
+ }
+ // release all allocated blocks
+ for (NCollection_List<Standard_Address>::Iterator it(aList); it.More(); it.Next())
+ {
+ Standard::Free(it.Value());
+ }
+ return aStatus;
+ }
+}
+
+//=======================================================================
+//function : OCC24836
+//purpose :
+//=======================================================================
+static Standard_Integer OCC24836 (Draw_Interpretor& theDI, Standard_Integer n, const char** a)
+{
+ if (n != 1)
+ {
+ theDI << "Usage : " << a[0] << "\n";
+ return 1;
+ }
+
+ int aStatus = AllocTest::test<sizeof(size_t)>();
+
+ if (aStatus & AllocTest::NotApplicable)
+ theDI << "This test case is not applicable for 64-bit and higher platforms\n";
+ if (aStatus & AllocTest::OUMCatchOK)
+ theDI << "out-of-memory has been caught: OK\n";
+ if (aStatus & AllocTest::OUMCatchFail)
+ theDI << "Error: out-of-memory is not always caught\n";
+ return 0;
+}
+
//=======================================================================
//function : OCC27021
return 0;
}
+//=======================================================================
+//function : OCC27235
+//purpose : check presentation in GDT document
+//=======================================================================
+static Standard_Integer OCC27235 (Draw_Interpretor& theDI, Standard_Integer n, const char** a)
+{
+ if (n < 2) {
+ theDI<<"Use: OCC27235 Doc";
+ return 1;
+ }
+
+ Handle(TDocStd_Document) Doc;
+ DDocStd::GetDocument(a[1], Doc);
+ if ( Doc.IsNull() ) { theDI << a[1] << " is not a document\n"; return 1; }
+ Handle(XCAFDoc_DimTolTool) aDimTolTool= XCAFDoc_DocumentTool::DimTolTool(Doc->Main());
+ Handle(XCAFDoc_ShapeTool) aShapeTool= XCAFDoc_DocumentTool::ShapeTool(Doc->Main());
+ TopoDS_Compound aPresentations;
+ BRep_Builder B;
+ B.MakeCompound(aPresentations);
+
+ TDF_LabelSequence aLabels;
+ aShapeTool->GetShapes(aLabels);
+ for ( Standard_Integer i=1; i <= aLabels.Length(); i++ )
+ {
+ aShapeTool->GetSubShapes(aLabels.Value(i), aLabels);
+ }
+
+ TDF_LabelSequence aGDTs;
+ aDimTolTool->GetDimensionLabels(aGDTs);
+ for (Standard_Integer i = 1; i <= aGDTs.Length(); i++) {
+ Handle(XCAFDoc_Dimension) aDimAttr;
+ if (!aGDTs.Value(i).FindAttribute(XCAFDoc_Dimension::GetID(),aDimAttr))
+ continue;
+ Handle(XCAFDimTolObjects_DimensionObject) anObject = aDimAttr->GetObject();
+ if (anObject.IsNull())
+ continue;
+ TopoDS_Shape aShape = anObject->GetPresentation();
+ if (!aShape.IsNull())
+ B.Add(aPresentations, aShape);
+ }
+
+ aGDTs.Clear();
+ aDimTolTool->GetGeomToleranceLabels(aGDTs);
+ for (Standard_Integer i = 1; i <= aGDTs.Length(); i++) {
+ Handle(XCAFDoc_GeomTolerance) aGTAttr;
+ if (!aGDTs.Value(i).FindAttribute(XCAFDoc_GeomTolerance::GetID(),aGTAttr))
+ continue;
+ Handle(XCAFDimTolObjects_GeomToleranceObject) anObject = aGTAttr->GetObject();
+ if (anObject.IsNull())
+ continue;
+ TopoDS_Shape aShape = anObject->GetPresentation();
+ if (!aShape.IsNull())
+ B.Add(aPresentations, aShape);
+ }
+
+ for ( Standard_Integer i=1; i <= aLabels.Length(); i++ )
+ {
+ TDF_LabelSequence aDatL;
+ if(aDimTolTool->GetRefDatumLabel(aLabels.Value(i), aDatL))
+ {
+ for(Standard_Integer j = aDatL.Lower(); j <= aDatL.Upper(); j++)
+ {
+ Handle(XCAFDoc_Datum) aDat;
+ if(!aDatL.Value(j).FindAttribute(XCAFDoc_Datum::GetID(), aDat))
+ continue;
+ Handle(XCAFDimTolObjects_DatumObject) anObject = aDat->GetObject();
+ if (anObject.IsNull())
+ continue;
+ TopoDS_Shape aShape = anObject->GetPresentation();
+ if (!aShape.IsNull())
+ B.Add(aPresentations, aShape);
+ }
+ }
+ }
+
+ GProp_GProps aG;
+ BRepGProp::LinearProperties(aPresentations, aG);
+ gp_Pnt aPnt = aG.CentreOfMass();
+ theDI << "Centre of mass: " << aPnt.X() << " " << aPnt.Y() << " " << aPnt.Z() << "\n";
+ theDI << "Mass: " << aG.Mass() << "\n";
+
+ return 0;
+}
+
+//=======================================================================
+//function : OCC24836
+//purpose :
+//=======================================================================
+static Standard_Integer OCC26930(Draw_Interpretor& theDI,
+ Standard_Integer theNArg,
+ const char ** theArgVal)
+{
+ if (theNArg != 5)
+ {
+ cout << "Use: " << theArgVal[0] <<" surface curve start end" << endl;
+ return 1;
+ }
+
+
+
+
+
+ Handle(Geom_Surface) aSurface = DrawTrSurf::GetSurface(theArgVal[1]);
+ Handle(Geom_Curve) aCurve = DrawTrSurf::GetCurve(theArgVal[2]);
+ Standard_Real aStart = Draw::Atof(theArgVal[3]);
+ Standard_Real anEnd = Draw::Atof(theArgVal[4]);
+
+ //project
+ Handle (Geom2d_Curve) aPCurve;
+
+ ShapeConstruct_ProjectCurveOnSurface aProj;
+ aProj.Init(aSurface, Precision::Confusion());
+ {
+ try {
+ Handle (Geom_Curve) aTmpCurve = aCurve; //to use reference in Perform()
+ aProj.Perform (aTmpCurve, aStart, anEnd, aPCurve);
+ } catch (const Standard_Failure&) {
+ }
+ }
+
+ //check results
+ if (aPCurve.IsNull()) {
+ theDI << "Error: pcurve is null\n";
+ }
+ else {
+ if (aPCurve->IsKind(STANDARD_TYPE(Geom2d_Line))) {
+ theDI << "Pcurve is line: OK\n";
+ }
+ else {
+ theDI << "Error: PCurve is not line\n";
+ }
+ }
+
+ return 0;
+}
+
+//=======================================================================
+//function : OCC27341
+//purpose : check exact HLR algorighm's work
+//=======================================================================
+static Standard_Integer OCC27341 (Draw_Interpretor& , Standard_Integer n, const char** a)
+{
+ if (n != 4)
+ {
+ cout << "Use: OCC27341 res shape axo/top/bottom/front/back/left/right" << endl;
+ return 1;
+ }
+
+ TopoDS_Shape aShape = DBRep::Get(a[2]);
+ if (aShape.IsNull())
+ return 1;
+
+ gp_Pnt anOrigin(0.,0.,0.);
+ gp_Dir aNormal(0.57735026918962573, -0.57735026918962573, 0.57735026918962573);
+ gp_Ax2 anAxes(anOrigin, aNormal);
+ gp_Dir aDX = anAxes.XDirection();
+
+ HLRAppli_ReflectLines Reflector(aShape);
+
+ if (strcmp(a[3],"axo") == 0)
+ {
+ aNormal.SetCoord(0.57735026918962573, -0.57735026918962573, 0.57735026918962573);
+ aDX.SetCoord(-0.40824829046386307, 0.40824829046386307, 0.81649658092772615);
+ }
+ else if (strcmp(a[3],"top") == 0)
+ {
+ aNormal.SetCoord(0,0,1);
+ aDX.SetCoord(0,1,0);
+ }
+ else if (strcmp(a[3],"bottom") == 0)
+ {
+ aNormal.SetCoord(0,0,-1);
+ aDX.SetCoord(0,-1,0);
+ }
+ else if (strcmp(a[3],"front") == 0)
+ {
+ aNormal.SetCoord(0,-1,0);
+ aDX.SetCoord(0,0,1);
+ }
+ else if (strcmp(a[3],"back") == 0)
+ {
+ aNormal.SetCoord(0,1,0);
+ aDX.SetCoord(0,0,1);
+ }
+ else if (strcmp(a[3],"left") == 0)
+ {
+ aNormal.SetCoord(-1,0,0);
+ aDX.SetCoord(0,0,1);
+ }
+ else if (strcmp(a[3],"right") == 0)
+ {
+ aNormal.SetCoord(1,0,0);
+ aDX.SetCoord(0,0,1);
+ }
+
+ Reflector.SetAxes(aNormal.X(), aNormal.Y(), aNormal.Z(),
+ anOrigin.X(), anOrigin.Y(), anOrigin.Z(),
+ aDX.X(), aDX.Y(), aDX.Z());
+
+ Reflector.Perform();
+
+ TopoDS_Compound Result;
+ BRep_Builder BB;
+ BB.MakeCompound(Result);
+
+ TopoDS_Shape SharpEdges = Reflector.GetCompoundOf3dEdges(HLRBRep_Sharp, Standard_True, Standard_False);
+ if (!SharpEdges.IsNull())
+ BB.Add(Result, SharpEdges);
+ TopoDS_Shape OutLines = Reflector.GetCompoundOf3dEdges(HLRBRep_OutLine, Standard_True, Standard_False);
+ if (!OutLines.IsNull())
+ BB.Add(Result, OutLines);
+ TopoDS_Shape SmoothEdges = Reflector.GetCompoundOf3dEdges(HLRBRep_Rg1Line, Standard_True, Standard_False);
+ if (!SmoothEdges.IsNull())
+ BB.Add(Result, SmoothEdges);
+
+ DBRep::Set(a[1], Result);
+
+ return 0;
+}
+
+//=======================================================================
+//function : OCC27466
+//purpose :
+//=======================================================================
+static Standard_Integer OCC27466(Draw_Interpretor& theDI,
+ Standard_Integer theNArg,
+ const char ** theArgVal)
+{
+ if (theNArg != 4)
+ {
+ cout << "Use: " << theArgVal[0] << " face point start_pnt2d" << endl;
+ return 1;
+ }
+
+ TopoDS_Face aFace = TopoDS::Face(DBRep::Get(theArgVal[1], TopAbs_FACE, Standard_True));
+ if (aFace.IsNull())
+ return 1;
+ gp_Pnt aPnt;
+ if (!DrawTrSurf::GetPoint(theArgVal[2], aPnt))
+ return 1;
+ gp_Pnt2d aUV;
+ if (!DrawTrSurf::GetPoint2d(theArgVal[3], aUV))
+ return 1;
+ BRepAdaptor_Surface aSurf(aFace);
+
+ Standard_Real aTolU = Precision::PConfusion();
+ Standard_Real aTolV = Precision::PConfusion();
+
+ Extrema_GenLocateExtPS anExtrema(aSurf, aTolU, aTolV);
+ anExtrema.Perform(aPnt, aUV.X(), aUV.Y(), Standard_True);
+
+ if (!anExtrema.IsDone())
+ {
+ theDI << "Error: Extrema is not done";
+ }
+ else
+ {
+ Standard_Real aSqDist = anExtrema.SquareDistance();
+ gp_Pnt aResPnt = anExtrema.Point().Value();
+ Standard_Real u, v;
+ anExtrema.Point().Parameter(u, v);
+ gp_Pnt2d aResUV(u, v);
+ DrawTrSurf::Set((TCollection_AsciiString(theArgVal[2]) + "_res").ToCString(), aResPnt);
+ DrawTrSurf::Set((TCollection_AsciiString(theArgVal[3]) + "_res").ToCString(), aResUV);
+ theDI << theArgVal[2] << "_res and " << theArgVal[3] << "_res are created, dist=" << sqrt(aSqDist);
+ }
+ return 0;
+}
+
+#include <GCE2d_MakeParabola.hxx>
+#include <gp_Ax22d.hxx>
+#include <Geom2d_Parabola.hxx>
+#include <gp_Parab2d.hxx>
+
+namespace Parab2d_Bug26747
+{
+ //Directrix and X-axe direction
+ gp_Ax2d Axes;
+
+ //Focus
+ gp_Pnt2d FocusPoint;
+
+ //Focal length
+ Standard_Real FocalLength;
+
+ //Coordiantes of the vertex
+ Standard_Real VertX, VertY;
+
+ //Parameter
+ Standard_Real Parameter;
+
+ //Coefficients
+ Standard_Real Coeffs[6];
+}
+
+//========================================================================
+//function : OCC26747_CheckParabola
+//purpose : Checks if created parabola is correct
+//========================================================================
+static void OCC26747_CheckParabola(Draw_Interpretor& theDI,
+ const char *theName,
+ const Standard_Boolean theSense = Standard_True)
+{
+ const Standard_Real aCompareTol = 1.0e-12;
+
+ // Directrix, Focus
+ GCE2d_MakeParabola aPrb(Parab2d_Bug26747::Axes, Parab2d_Bug26747::FocusPoint, theSense);
+
+ DrawTrSurf::Set(theName, aPrb.Value());
+
+ gp_Pnt2d aVert(aPrb.Value()->Parab2d().Location());
+
+ theDI << "Focal Length: " << aPrb.Value()->Parab2d().Focal() << "\n";
+ theDI << "Vertex (" << aVert.X() << ", " << aVert.Y() << ")\n";
+ theDI << "Parameter = " << aPrb.Value()->Parab2d().Parameter() << "\n";
+
+ Standard_Real aF[6] = {RealLast(), RealLast(), RealLast(),
+ RealLast(), RealLast(), RealLast()};
+ aPrb.Value()->Parab2d().Coefficients(aF[0], aF[1], aF[2], aF[3], aF[4], aF[5]);
+ theDI << "A = " << aF[0] << ", B = " << aF[1] << ", C = " << aF[2] <<
+ ", D = " << aF[3] << ", E = " << aF[4] << ", F = " << aF[5] << "\n";
+
+ if(Abs(aPrb.Value()->Parab2d().Focal() -
+ Parab2d_Bug26747::FocalLength) > aCompareTol)
+ theDI << "Error in focal length computation!\n";
+
+ if( (Abs(aVert.X() - Parab2d_Bug26747::VertX) > aCompareTol) ||
+ (Abs(aVert.Y() - Parab2d_Bug26747::VertY) > aCompareTol))
+ theDI << "Error in vertex computation!\n";
+
+ if(Abs(aPrb.Value()->Parab2d().Parameter() -
+ Parab2d_Bug26747::Parameter) > aCompareTol)
+ theDI << "Error in parameter computation!\n";
+
+ for(int i = 0; i < 6; i++)
+ {
+ if(Abs(aF[i] - Parab2d_Bug26747::Coeffs[i]) > aCompareTol)
+ {
+ theDI << "Error in " << i << "-th coefficient computation!\n";
+ }
+ }
+}
+
+//========================================================================
+//function : OCC26747_1
+//purpose : Creates a 2D-parabola for testing
+//========================================================================
+static Standard_Integer OCC26747_1(Draw_Interpretor& theDI,
+ Standard_Integer theNArg,
+ const char ** theArgVal)
+{
+ if(theNArg < 2)
+ {
+ theDI << "Use: OCC26747_1 result\n";
+ return 1;
+ }
+
+ //Expected parabola:
+
+ // ^ Y
+ // |
+ // |
+ // |
+ // |
+ // | o
+ // | A o F
+ // | o x
+ // | o
+ // | o
+ // |
+ // ---------------------------> X
+
+ // where
+ // Y-axe is the directrix of the parabola,
+ // A(0.5, 3.0) is a Vertex of the parabola,
+ // F(1.0, 3.0) is the focus of the parabola,
+ // Focal length is 0.5,
+ // Parameter of the parabola is 1.
+ // Equation: (y-3)^2=2*p*(x-0.5), i.e. (y-3)^2=2*(x-0.5)
+ // A * X^2 + B * Y^2 + 2*C*X*Y + 2*D*X + 2*E*Y + F = 0.
+ // OR
+ // 0 * X^2 + 1 * Y^2 + 2*0*X*Y + 2*(-1)*X + 2*(-3)*Y + 10 = 0.
+
+ Parab2d_Bug26747::Axes = gp_Ax2d(gp_Pnt2d(0.0, 3.0), gp_Dir2d(0.0, 1.0));
+ Parab2d_Bug26747::FocusPoint.SetCoord(1.0, 3.0);
+
+ Parab2d_Bug26747::FocalLength = 0.5;
+
+ Parab2d_Bug26747::VertX = 0.5;
+ Parab2d_Bug26747::VertY = 3.0;
+
+ Parab2d_Bug26747::Parameter = 1.0;
+
+ Parab2d_Bug26747::Coeffs[0] = 0.0;
+ Parab2d_Bug26747::Coeffs[1] = 1.0;
+ Parab2d_Bug26747::Coeffs[2] = 0.0;
+ Parab2d_Bug26747::Coeffs[3] = -1.0;
+ Parab2d_Bug26747::Coeffs[4] = -3.0;
+ Parab2d_Bug26747::Coeffs[5] = 10.0;
+
+ OCC26747_CheckParabola(theDI, theArgVal[1]);
+
+ return 0;
+}
+
+//=======================================================================
+//function : OCC26747_2
+//purpose : Creates a 2D-parabola for testing
+//=======================================================================
+static Standard_Integer OCC26747_2(Draw_Interpretor& theDI,
+ Standard_Integer theNArg,
+ const char ** theArgVal)
+{
+ if(theNArg < 2)
+ {
+ theDI << "Use: OCC26747_2 result\n";
+ return 1;
+ }
+
+ //Expected parabola:
+
+ // ^ Y
+ // |
+ // o |
+ // o |
+ // F x o A |
+ // o |
+ // o |
+ // |
+ // <------------------------
+ // X
+
+ // where (in UCS - User Coordinate System, - which
+ // is shown in the picture):
+ // Y-axe is the directrix of the parabola,
+ // A(0.5, 3.0) is a Vertex of the parabola,
+ // F(1.0, 3.0) is the focus of the parabola.
+ //
+ // In WCS (World Coordinate System) these points have coordinates:
+ // A(-0.5, 3.0), F(-1.0, 3.0).
+ //
+ // Focal length is 0.5,
+ // Parameter of the parabola is 1.
+ // Equation (in WCS): (y-3)^2=2*p*(-x-0.5), i.e. (y-3)^2=2*(-x-0.5)
+ // A * X^2 + B * (Y^2) + 2*C*(X*Y) + 2*D*X + 2*E*Y + F = 0.
+ // 0 * X^2 + 1 * (Y^2) + 2*0*(X*Y) + 2*1*X + 2*(-3)*Y + 10 = 0.
+
+
+ Parab2d_Bug26747::Axes = gp_Ax2d(gp_Pnt2d(0.0, 0.0), gp_Dir2d(0.0, 1.0));
+ Parab2d_Bug26747::FocusPoint.SetCoord(-1.0, 3.0);
+
+ Parab2d_Bug26747::FocalLength = 0.5;
+
+ Parab2d_Bug26747::VertX = -0.5;
+ Parab2d_Bug26747::VertY = 3.0;
+
+ Parab2d_Bug26747::Parameter = 1.0;
+
+ Parab2d_Bug26747::Coeffs[0] = 0.0;
+ Parab2d_Bug26747::Coeffs[1] = 1.0;
+ Parab2d_Bug26747::Coeffs[2] = 0.0;
+ Parab2d_Bug26747::Coeffs[3] = 1.0;
+ Parab2d_Bug26747::Coeffs[4] = -3.0;
+ Parab2d_Bug26747::Coeffs[5] = 10.0;
+
+ OCC26747_CheckParabola(theDI, theArgVal[1], Standard_False);
+
+ return 0;
+}
+
+//=======================================================================
+//function : OCC26747_3
+//purpose : Creates a 2D-parabola for testing
+//=======================================================================
+static Standard_Integer OCC26747_3(Draw_Interpretor& theDI,
+ Standard_Integer theNArg,
+ const char ** theArgVal)
+{
+ if(theNArg < 2)
+ {
+ theDI << "Use: OCC26747_2 result\n";
+ return 1;
+ }
+
+ //Expected parabola:
+
+ // ^ Y
+ // |
+ // o |
+ // o |
+ // F x o A
+ // o |
+ // o |
+ // |
+ // <------------------
+ // X
+
+ // where (in UCS - User Coordinate System, - which
+ // is shown in the picture):
+ // Y-axe is the directrix of the parabola,
+ // A(0.0, 3.0) is a Vertex of the parabola,
+ // F(0.0, 3.0) is the focus of the parabola (the Focus
+ // matches with the Apex).
+ //
+ // In WCS (World Coordinate System) these points have coordinates:
+ // A(0.0, 3.0), F(0.0, 3.0).
+ //
+ // Focal length is 0.0,
+ // Parameter of the parabola is 0.0.
+ // Equation (in WCS): (y-3)^2=2*p*(-x-0.0), i.e. (y-3)^2=0 (looks like a line y=3)
+ // A * X^2 + B * (Y^2) + 2*C*(X*Y) + 2*D*X + 2*E*Y + F = 0.
+ // 0 * X^2 + 1 * (Y^2) + 2*0*(X*Y) + 2*0*X + 2*(-3)*Y + 9 = 0.
+
+ Parab2d_Bug26747::Axes = gp_Ax2d(gp_Pnt2d(0.0, 0.0), gp_Dir2d(0.0, 1.0));
+ Parab2d_Bug26747::FocusPoint.SetCoord(0.0, 3.0);
+
+ Parab2d_Bug26747::FocalLength = 0.0;
+
+ Parab2d_Bug26747::VertX = 0.0;
+ Parab2d_Bug26747::VertY = 3.0;
+
+ Parab2d_Bug26747::Parameter = 0.0;
+
+ Parab2d_Bug26747::Coeffs[0] = 0.0;
+ Parab2d_Bug26747::Coeffs[1] = 1.0;
+ Parab2d_Bug26747::Coeffs[2] = 0.0;
+ Parab2d_Bug26747::Coeffs[3] = 0.0;
+ Parab2d_Bug26747::Coeffs[4] = -3.0;
+ Parab2d_Bug26747::Coeffs[5] = 9.0;
+
+ OCC26747_CheckParabola(theDI, theArgVal[1], Standard_False);
+
+ return 0;
+}
+
+#include "Geom2d_BezierCurve.hxx"
+#include "Geom2dGcc_QualifiedCurve.hxx"
+#include "Geom2dAdaptor_Curve.hxx"
+#include "Geom2dAPI_ProjectPointOnCurve.hxx"
+#include "Geom2dGcc_Circ2d2TanOn.hxx"
+//=======================================================================
+//function : OCC27357
+//purpose :
+//=======================================================================
+static Standard_Integer OCC27357(Draw_Interpretor& theDI,
+ Standard_Integer,
+ const char **)
+{
+ TColgp_Array1OfPnt2d aPoles(1,3);
+ aPoles.SetValue(1, gp_Pnt2d(0.,0.));
+ aPoles.SetValue(2, gp_Pnt2d(0.,1.));
+ aPoles.SetValue(3, gp_Pnt2d(6.,0.));
+
+ Handle(Geom2d_BezierCurve) aCurve1 = new Geom2d_BezierCurve(aPoles);
+ aPoles.SetValue(2, gp_Pnt2d(0.,1.5));
+ Handle(Geom2d_BezierCurve) aCurve2 = new Geom2d_BezierCurve(aPoles);
+ NCollection_List<Standard_Integer> aDuumyList;
+ int nP = 100;
+ for(int i = 0 ; i < nP ; i++){
+ Standard_Real u = i / (nP-1.);
+ gp_Pnt2d aP1;
+ gp_Vec2d aTangent;
+ aCurve1->D1(u,aP1,aTangent);
+ gp_Vec2d aNormal(-aTangent.Y(),aTangent.X());
+ Handle(Geom2d_Line) normalLine=new Geom2d_Line(aP1, gp_Dir2d(aNormal));
+ Geom2dGcc_QualifiedCurve qualifiedC1(Geom2dAdaptor_Curve(aCurve1),GccEnt_unqualified);
+ Geom2dGcc_QualifiedCurve qualifiedC2(Geom2dAdaptor_Curve(aCurve2),GccEnt_unqualified);
+
+ try
+ {
+ Geom2dAPI_ProjectPointOnCurve projPc1(aP1, aCurve1);
+ double g1 = projPc1.LowerDistanceParameter();
+ Geom2dAPI_ProjectPointOnCurve projPc3(aP1, normalLine);
+ double g3 = projPc3.LowerDistanceParameter();
+ Geom2dGcc_Circ2d2TanOn aCircleBuilder(qualifiedC1,qualifiedC2,
+ Geom2dAdaptor_Curve(normalLine),1e-9,g1,g1,g3);
+ aDuumyList.Append(aCircleBuilder.NbSolutions());
+ }
+ catch(Standard_Failure)
+ {
+ theDI << "Exception was caught\n";
+ }
+ }
+ return 0;
+}
+#include <Standard_ErrorHandler.hxx>
+#include <TColGeom_SequenceOfCurve.hxx>
+#include <GeomFill_NSections.hxx>
+#include <Geom_TrimmedCurve.hxx>
+#include <TopExp_Explorer.hxx>
+#include <BRepBuilderAPI_MakeFace.hxx>
+//=======================================================================
+//function : OCC26270
+//purpose :
+//=======================================================================
+static Standard_Integer OCC26270(Draw_Interpretor& theDI,
+ Standard_Integer theNArg,
+ const char **theArgVal)
+{
+ if (theNArg != 3)
+ {
+ theDI << "Usage :" << theArgVal[0] << " shape result\n";
+ return 0;
+ }
+ TopoDS_Shape aShape = DBRep::Get(theArgVal[1]);
+ TopExp_Explorer anExp(aShape, TopAbs_EDGE);
+ TColGeom_SequenceOfCurve aCurveSeq;
+ for (; anExp.More(); anExp.Next())
+ {
+ Standard_Real f, l;
+ Handle(Geom_Curve) aCurve = BRep_Tool::Curve(TopoDS::Edge(anExp.Current()), f, l);
+ if (!aCurve.IsNull())
+ {
+ aCurve = new Geom_TrimmedCurve(aCurve, f, l);
+ aCurveSeq.Append(aCurve);
+ }
+ }
+ if (aCurveSeq.Length() > 1)
+ {
+ try
+ {
+ OCC_CATCH_SIGNALS
+ GeomFill_NSections aBSurface(aCurveSeq);
+ Handle(Geom_BSplineSurface) aRes = aBSurface.BSplineSurface();
+ if (!aRes.IsNull())
+ {
+ BRepBuilderAPI_MakeFace b_face1(aRes, Precision::Confusion());
+ TopoDS_Face bsp_face1 = b_face1.Face();
+ DBRep::Set(theArgVal[2], bsp_face1);
+ }
+ }
+ catch (Standard_Failure)
+ {
+ theDI << "ERROR: Exception in GeomFill_NSections\n";
+ }
+ }
+ return 0;
+}
+
+#include "BRepBuilderAPI_MakeWire.hxx"
+#include "BRepBuilderAPI_MakeEdge.hxx"
+static Standard_Integer OCC27552(Draw_Interpretor&,
+ Standard_Integer,
+ const char ** )
+{
+ BRep_Builder BB;
+ TopoDS_Vertex V1, V2, V3;
+ TopoDS_Edge E1, E2;
+ BB.MakeVertex(V1, gp_Pnt(0,0,0), 0.1);
+ BB.MakeVertex(V2, gp_Pnt(5,0,0), 0.1);
+ BB.MakeVertex(V3, gp_Pnt(10,0,0), 0.1);
+ E1 = BRepBuilderAPI_MakeEdge(V1, V2).Edge();
+ E2 = BRepBuilderAPI_MakeEdge(V2, V3).Edge();
+ BRepBuilderAPI_MakeWire MW;
+ MW.Add(E1);
+ MW.Add(E2);
+ TopoDS_Vertex V4, V5, V6, V7;
+ TopoDS_Edge E3, E4;
+ BB.MakeVertex(V4, gp_Pnt(10,0+0.05,0), 0.07);
+ BB.MakeVertex(V5, gp_Pnt(10,0-0.05,0), 0.07);
+ BB.MakeVertex(V6, gp_Pnt(10,0+2,0), 0.07);
+ BB.MakeVertex(V7, gp_Pnt(10,0-2,0), 0.07);
+ E3 = BRepBuilderAPI_MakeEdge(V4, V6).Edge();
+ E4 = BRepBuilderAPI_MakeEdge(V5, V7).Edge();
+ TopTools_ListOfShape LLE;
+ LLE.Append(E3);
+ LLE.Append(E4);
+ MW.Add(LLE);
+ TopoDS_Shape W = MW.Wire();
+ DBRep::Set("outw", W);
+
+ return 0;
+}
+
+#include <NCollection_IncAllocator.hxx>
+static Standard_Integer OCC27875(Draw_Interpretor& theDI,
+ Standard_Integer theNArg,
+ const char ** theArgVal)
+{
+ if (theNArg < 2)
+ {
+ theDI << "Use: OCC27875 curve\n";
+ }
+
+ TColGeom_SequenceOfCurve aNC(new NCollection_IncAllocator());
+
+ const Handle(Geom_Curve) aC = Handle(Geom_Curve)::DownCast(DrawTrSurf::Get(theArgVal[1]));
+
+ aNC.Append(aC);
+
+ GeomFill_NSections aNS(aNC);
+
+ if (aNS.BSplineSurface().IsNull())
+ {
+ theDI << "GeomFill_NSections is not done.\n";
+ }
+
+ return 0;
+}
+
+#include <OSD_Parallel.hxx>
+
+namespace {
+ struct ExceptionRaiser
+ {
+ void operator () (int i) const
+ {
+ try
+ {
+ f (i);
+ }
+ catch (Standard_ProgramError)
+ {
+ strlen (Standard_Failure::Caught()->GetMessageString());
+ }
+ }
+
+ void f(int i) const;
+ };
+
+ void ExceptionRaiser::f (int i) const
+ {
+ const char str[] = "0123456789";
+ Standard_ProgramError::Raise (str + i % 10);
+ }
+};
+
+static Standard_Integer OCC28217(Draw_Interpretor& theDI,
+ Standard_Integer /*theNArg*/,
+ const char ** /*theArgVal*/)
+{
+ NCollection_Array1<int> aVec (1, 10000);
+ for (int i=1; i < aVec.Length(); i++)
+ aVec(i) = i;
+
+ ExceptionRaiser aProc;
+ OSD_Parallel::For (1, aVec.Length(), aProc);
+
+ theDI << "OCC28217: OK";
+ return 0;
+}
+
void QABugs::Commands_20(Draw_Interpretor& theCommands) {
const char *group = "QABugs";
theCommands.Add ("OCC26675_1", "OCC26675_1 result", __FILE__, SurfaceGenOCC26675_1, group);
+ theCommands.Add ("OCC24836", "OCC24836", __FILE__, OCC24836, group);
theCommands.Add("OCC27021", "OCC27021", __FILE__, OCC27021, group);
+ theCommands.Add("OCC27235", "OCC27235", __FILE__, OCC27235, group);
+ theCommands.Add("OCC26930", "OCC26930", __FILE__, OCC26930, group);
+ theCommands.Add("OCC27466", "OCC27466", __FILE__, OCC27466, group);
+ theCommands.Add("OCC27341",
+ "OCC27341 res shape axo/top/bottom/front/back/left/right",
+ __FILE__, OCC27341, group);
+ theCommands.Add ("OCC26747_1", "OCC26747_1 result", __FILE__, OCC26747_1, group);
+ theCommands.Add ("OCC26747_2", "OCC26747_2 result", __FILE__, OCC26747_2, group);
+ theCommands.Add ("OCC26747_3", "OCC26747_3 result", __FILE__, OCC26747_3, group);
+ theCommands.Add ("OCC27357", "OCC27357", __FILE__, OCC27357, group);
+ theCommands.Add("OCC26270", "OCC26270 shape result", __FILE__, OCC26270, group);
+ theCommands.Add ("OCC27552", "OCC27552", __FILE__, OCC27552, group);
+ theCommands.Add("OCC27875", "OCC27875 curve", __FILE__, OCC27875, group);
+ theCommands.Add("OCC28217", "OCC28217", __FILE__, OCC28217, group);
return;
}