625e1958 |
1 | // Created on: 2016-02-04 |
2 | // Created by: Anastasia BORISOVA |
3 | // Copyright (c) 2016 OPEN CASCADE SAS |
4 | // |
5 | // This file is part of Open CASCADE Technology software library. |
6 | // |
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. |
12 | // |
13 | // Alternatively, this file may be used under the terms of Open CASCADE |
14 | // commercial license or contractual agreement. |
15 | |
16 | |
17 | #include <StdPrs_ToolDisk.hxx> |
18 | |
19 | #include <Graphic3d_ArrayOfTriangles.hxx> |
20 | #include <Poly_Array1OfTriangle.hxx> |
21 | #include <StdPrs_ToolQuadric.hxx> |
22 | |
23 | //======================================================================= |
24 | //function : Constructor |
25 | //purpose : |
26 | //======================================================================= |
27 | StdPrs_ToolDisk::StdPrs_ToolDisk (const Standard_ShortReal theInnerRadius, |
28 | const Standard_ShortReal theOuterRadius, |
29 | const Standard_Integer theSlicesNb, |
30 | const Standard_Integer theStacksNb) |
31 | : myInnerRadius (theInnerRadius), |
32 | myOuterRadius (theOuterRadius) |
33 | { |
34 | mySlicesNb = theSlicesNb; |
35 | myStacksNb = theStacksNb; |
36 | } |
37 | |
38 | //======================================================================= |
39 | //function : Vertex |
40 | //purpose : |
41 | //======================================================================= |
42 | gp_Pnt StdPrs_ToolDisk::Vertex (const Standard_Real theU, const Standard_Real theV) |
43 | { |
44 | const Standard_ShortReal aU = static_cast<Standard_ShortReal> (theU * M_PI * 2.0); |
45 | const Standard_ShortReal aRadius = myInnerRadius + (myOuterRadius - myInnerRadius) * (Standard_ShortReal)theV; |
46 | return gp_Pnt (cosf(aU) * aRadius, |
47 | sinf(aU) * aRadius, |
48 | 0.0f); |
49 | } |
50 | |
51 | //======================================================================= |
52 | //function : Add |
53 | //purpose : |
54 | //======================================================================= |
55 | gp_Dir StdPrs_ToolDisk::Normal (const Standard_Real /*theU*/, const Standard_Real /*theV*/) |
56 | { |
57 | return gp_Dir(0.0f, 0.0f, -1.0f); |
58 | } |