1 // File: GeometryTest_TestProjCommands.cxx
2 // Created: 30.06.11 17:21:02
4 // Copyright: Open CASCADE 2011
6 #include <GeometryTest.hxx>
7 #include <Geom_Curve.hxx>
8 #include <Geom_Surface.hxx>
9 #include <GeomAPI_ProjectPointOnSurf.hxx>
12 #include <DBRep_DrawableShape.hxx>
13 #include <Draw_Interpretor.hxx>
14 #include <Draw_Appli.hxx>
15 #include <DrawTrSurf.hxx>
16 #include <Draw_Marker3D.hxx>
20 Standard_IMPORT Draw_Viewer dout;
23 //=======================================================================
26 //=======================================================================
27 static Standard_Integer xdistcs(Draw_Interpretor& , Standard_Integer n, const char** a)
30 cout<<" Use xdistcs c s t1 t2 nbp"<<endl;
34 Standard_Boolean bRet;
35 Standard_Integer i, aNbP, iSize;
36 Standard_Real aTol, aD, aT, aT1, aT2, dT;
38 Handle(Geom_Curve) aC;
39 Handle(Geom_Surface) aS;
40 GeomAPI_ProjectPointOnSurf aPPS;
41 Handle(Draw_Marker3D) aMr;
42 Draw_Color aColor(Draw_rouge);
46 aC=DrawTrSurf::GetCurve(a[1]);
48 cout<<a[1]<<" is null curve"<<endl;
52 aS=DrawTrSurf::GetSurface(a[2]);
54 cout<<a[2]<<" is null"<<endl;
68 dT=(aT2-aT1)/(aNbP-1);
69 for (i=0; i<aNbP; ++i) {
76 aPPS.Init(aP, aS, aTol);
79 cout<<" GeomAPI_ProjectPointOnSurf failed"<<endl;
83 aD=aPPS.LowerDistance();
84 printf(" T=%lg\tD=%lg\n", aT, aD);
86 aMr=new Draw_Marker3D(aP, Draw_Plus, aColor, iSize);
93 //=======================================================================
94 //function : TestProjCommands
96 //=======================================================================
98 void GeometryTest::TestProjCommands(Draw_Interpretor& theCommands)
101 static Standard_Boolean loaded = Standard_False;
103 loaded = Standard_True;
105 DrawTrSurf::BasicCommands(theCommands);
109 g = "Testing of projection (geometric objects)";
111 theCommands.Add("xdistcs", "xdistcs c s t1 t2 nbp", __FILE__, xdistcs, g);