1 // Created on: 2011-06-30
2 // Created by: jgv@ROLEX
3 // Copyright (c) 2011-2014 OPEN CASCADE SAS
5 // This file is part of Open CASCADE Technology software library.
7 // This library is free software; you can redistribute it and / or modify it
8 // under the terms of the GNU Lesser General Public version 2.1 as published
9 // by the Free Software Foundation, with special exception defined in the file
10 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
11 // distribution for complete text of the license and disclaimer of any warranty.
13 // Alternatively, this file may be used under the terms of Open CASCADE
14 // commercial license or contractual agreement.
16 #include <GeometryTest.hxx>
17 #include <Geom_Curve.hxx>
18 #include <Geom_Surface.hxx>
19 #include <GeomAPI_ProjectPointOnSurf.hxx>
22 #include <DBRep_DrawableShape.hxx>
23 #include <Draw_Interpretor.hxx>
24 #include <Draw_Appli.hxx>
25 #include <DrawTrSurf.hxx>
26 #include <Draw_Marker3D.hxx>
30 Standard_IMPORT Draw_Viewer dout;
33 //=======================================================================
36 //=======================================================================
37 static Standard_Integer xdistcs(Draw_Interpretor& , Standard_Integer n, const char** a)
40 cout<<" Use xdistcs c s t1 t2 nbp"<<endl;
44 Standard_Boolean bRet;
45 Standard_Integer i, aNbP, iSize;
46 Standard_Real aTol, aD, aT, aT1, aT2, dT;
48 Handle(Geom_Curve) aC;
49 Handle(Geom_Surface) aS;
50 GeomAPI_ProjectPointOnSurf aPPS;
51 Handle(Draw_Marker3D) aMr;
52 Draw_Color aColor(Draw_rouge);
56 aC=DrawTrSurf::GetCurve(a[1]);
58 cout<<a[1]<<" is null curve"<<endl;
62 aS=DrawTrSurf::GetSurface(a[2]);
64 cout<<a[2]<<" is null"<<endl;
73 aNbP=Draw::Atoi(a[5]);
78 dT=(aT2-aT1)/(aNbP-1);
79 for (i=0; i<aNbP; ++i) {
86 aPPS.Init(aP, aS, aTol);
89 cout<<" GeomAPI_ProjectPointOnSurf failed"<<endl;
93 aD=aPPS.LowerDistance();
94 printf(" T=%lg\tD=%lg\n", aT, aD);
96 aMr=new Draw_Marker3D(aP, Draw_Plus, aColor, iSize);
103 //=======================================================================
104 //function : TestProjCommands
106 //=======================================================================
108 void GeometryTest::TestProjCommands(Draw_Interpretor& theCommands)
111 static Standard_Boolean loaded = Standard_False;
113 loaded = Standard_True;
115 DrawTrSurf::BasicCommands(theCommands);
119 g = "Testing of projection (geometric objects)";
121 theCommands.Add("xdistcs", "xdistcs c s t1 t2 nbp", __FILE__, xdistcs, g);