Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-16 09:18:22

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_ToolSphere_HeaderFile
0017 #define _Prs3d_ToolSphere_HeaderFile
0018 
0019 #include <Prs3d_ToolQuadric.hxx>
0020 
0021 //! Standard presentation algorithm that outputs graphical primitives for spherical surface.
0022 class Prs3d_ToolSphere : public Prs3d_ToolQuadric
0023 {
0024 public:
0025   //! Generate primitives for 3D quadric surface.
0026   //! @param[in] theRadius    sphere radius
0027   //! @param[in] theNbSlices  number of slices within U parameter
0028   //! @param[in] theNbStacks  number of stacks within V parameter
0029   //! @param[in] theTrsf      optional transformation to apply
0030   //! @return generated triangulation
0031   Standard_EXPORT static occ::handle<Graphic3d_ArrayOfTriangles> Create(const double   theRadius,
0032                                                                         const int      theNbSlices,
0033                                                                         const int      theNbStacks,
0034                                                                         const gp_Trsf& theTrsf);
0035 
0036 public:
0037   //! Initializes the algorithm creating a sphere.
0038   //! @param[in] theRadius    sphere radius
0039   //! @param[in] theNbSlices  number of slices within U parameter
0040   //! @param[in] theNbStacks  number of stacks within V parameter
0041   Standard_EXPORT Prs3d_ToolSphere(const double theRadius,
0042                                    const int    theNbSlices,
0043                                    const int    theNbStacks);
0044 
0045 protected:
0046   //! Computes vertex at given parameter location of the surface.
0047   Standard_EXPORT gp_Pnt Vertex(const double theU, const double theV) const override;
0048 
0049   //! Computes normal at given parameter location of the surface.
0050   Standard_EXPORT gp_Dir Normal(const double theU, const double theV) const override;
0051 
0052 protected:
0053   double myRadius; //!< sphere radius
0054 };
0055 
0056 #endif