Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-11-26 10:22:59

0001 // Created on: 2016-02-04
0002 // Created by: Anastasia BORISOVA
0003 // Copyright (c) 2016 OPEN CASCADE SAS
0004 //
0005 // This file is part of Open CASCADE Technology software library.
0006 //
0007 // This library is free software; you can redistribute it and/or modify it under
0008 // the terms of the GNU Lesser General Public License version 2.1 as published
0009 // by the Free Software Foundation, with special exception defined in the file
0010 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
0011 // distribution for complete text of the license and disclaimer of any warranty.
0012 //
0013 // Alternatively, this file may be used under the terms of Open CASCADE
0014 // commercial license or contractual agreement.
0015 
0016 #ifndef _Prs3d_ToolCylinder_HeaderFile
0017 #define _Prs3d_ToolCylinder_HeaderFile
0018 
0019 #include <Prs3d_ToolQuadric.hxx>
0020 
0021 //! Standard presentation algorithm that outputs graphical primitives for cylindrical surface.
0022 class Prs3d_ToolCylinder : public Prs3d_ToolQuadric
0023 {
0024 public:
0025   //! Generate primitives for 3D quadric surface and return a filled array.
0026   //! @param[in] theBottomRad  cylinder bottom radius
0027   //! @param[in] theTopRad     cylinder top radius
0028   //! @param[in] theHeight     cylinder height
0029   //! @param[in] theNbSlices   number of slices within U parameter
0030   //! @param[in] theNbStacks   number of stacks within V parameter
0031   //! @param[in] theTrsf       optional transformation to apply
0032   //! @return generated triangulation
0033   Standard_EXPORT static occ::handle<Graphic3d_ArrayOfTriangles> Create(const double   theBottomRad,
0034                                                                         const double   theTopRad,
0035                                                                         const double   theHeight,
0036                                                                         const int      theNbSlices,
0037                                                                         const int      theNbStacks,
0038                                                                         const gp_Trsf& theTrsf);
0039 
0040 public:
0041   //! Initializes the algorithm creating a cylinder.
0042   //! @param[in] theBottomRad  cylinder bottom radius
0043   //! @param[in] theTopRad     cylinder top radius
0044   //! @param[in] theHeight     cylinder height
0045   //! @param[in] theNbSlices   number of slices within U parameter
0046   //! @param[in] theNbStacks   number of stacks within V parameter
0047   Standard_EXPORT Prs3d_ToolCylinder(const double theBottomRad,
0048                                      const double theTopRad,
0049                                      const double theHeight,
0050                                      const int    theNbSlices,
0051                                      const int    theNbStacks);
0052 
0053 protected:
0054   //! Computes vertex at given parameter location of the surface.
0055   Standard_EXPORT gp_Pnt Vertex(const double theU, const double theV) const override;
0056 
0057   //! Computes normal at given parameter location of the surface.
0058   Standard_EXPORT gp_Dir Normal(const double theU, const double theV) const override;
0059 
0060 protected:
0061   double myBottomRadius; //!< cylinder bottom radius
0062   double myTopRadius;    //!< cylinder top radius
0063   double myHeight;       //!< cylinder height
0064 };
0065 
0066 #endif // _Prs3d_ToolCylinder_HeaderFile