1 // Created on: 2014-10-15
2 // Created by: Denis Bogolepov
3 // Copyright (c) 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 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 <OpenGl_Disk.hxx>
18 // =======================================================================
19 // function : OpenGl_Disk
21 // =======================================================================
22 OpenGl_Disk::OpenGl_Disk()
23 : myInnerRadius (1.0f),
29 // =======================================================================
32 // =======================================================================
33 Standard_Boolean OpenGl_Disk::Init (const Standard_ShortReal theInnerRadius,
34 const Standard_ShortReal theOuterRadius,
35 const Standard_Integer theNbSlices,
36 const Standard_Integer theNbStacks)
38 myInnerRadius = theInnerRadius;
39 myOuterRadius = theOuterRadius;
40 return OpenGl_Quadric::init (theNbSlices, theNbStacks);
43 // =======================================================================
44 // function : evalVertex
46 // =======================================================================
47 OpenGl_Vec3 OpenGl_Disk::evalVertex (const Standard_ShortReal theU,
48 const Standard_ShortReal theV) const
50 const Standard_ShortReal aU = static_cast<Standard_ShortReal> (theU * M_PI * 2.0);
51 const Standard_ShortReal aRadius = myInnerRadius + (myOuterRadius - myInnerRadius) * theV;
52 return OpenGl_Vec3 (cosf (aU) * aRadius, sinf (aU) * aRadius, 0.0f);
55 // =======================================================================
56 // function : evalNormal
58 // =======================================================================
59 OpenGl_Vec3 OpenGl_Disk::evalNormal (const Standard_ShortReal /*theU*/,
60 const Standard_ShortReal /*theV*/) const
62 return OpenGl_Vec3 (0.0f, 0.0f, -1.0f);