1 // Created on: 2019-02-25
2 // Created by: Artem NOVIKOV
3 // Copyright (c) 2019 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 under
8 // the terms of the GNU Lesser General Public License 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 <Prs3d_ToolSector.hxx>
18 #include <Graphic3d_ArrayOfTriangles.hxx>
19 #include <Poly_Array1OfTriangle.hxx>
20 #include <Prs3d_ToolQuadric.hxx>
22 //=======================================================================
23 //function : Constructor
25 //=======================================================================
26 Prs3d_ToolSector::Prs3d_ToolSector (const Standard_Real theRadius,
27 const Standard_Integer theNbSlices,
28 const Standard_Integer theNbStacks)
29 : myRadius (theRadius)
31 mySlicesNb = theNbSlices;
32 myStacksNb = theNbStacks;
35 //=======================================================================
38 //=======================================================================
39 gp_Pnt Prs3d_ToolSector::Vertex (const Standard_Real theU, const Standard_Real theV) const
41 const Standard_Real aU = theU * M_PI / 2.0;
42 const Standard_Real aRadius = myRadius * theV;
43 return gp_Pnt (Cos (aU) * aRadius,
48 //=======================================================================
51 //=======================================================================
52 Handle(Graphic3d_ArrayOfTriangles) Prs3d_ToolSector::Create (const Standard_Real theRadius,
53 const Standard_Integer theNbSlices,
54 const Standard_Integer theNbStacks,
55 const gp_Trsf& theTrsf)
57 Handle(Graphic3d_ArrayOfTriangles) anArray;
58 Prs3d_ToolSector aTool (theRadius, theNbSlices, theNbStacks);
59 aTool.FillArray (anArray, theTrsf);