Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-28 09:20:07

0001 // Copyright (c) 2025 OPEN CASCADE SAS
0002 //
0003 // This file is part of Open CASCADE Technology software library.
0004 //
0005 // This library is free software; you can redistribute it and/or modify it under
0006 // the terms of the GNU Lesser General Public License version 2.1 as published
0007 // by the Free Software Foundation, with special exception defined in the file
0008 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
0009 // distribution for complete text of the license and disclaimer of any warranty.
0010 //
0011 // Alternatively, this file may be used under the terms of Open CASCADE
0012 // commercial license or contractual agreement.
0013 
0014 #ifndef GeomBndLib_Sphere_HeaderFile
0015 #define GeomBndLib_Sphere_HeaderFile
0016 
0017 #include <Bnd_Box.hxx>
0018 #include <Geom_SphericalSurface.hxx>
0019 #include <Standard.hxx>
0020 #include <Standard_DefineAlloc.hxx>
0021 
0022 //! Computes bounding box for a spherical surface (Geom_SphericalSurface).
0023 //! Uses direct extremal-point computation and ElSLib iso-curves with
0024 //! GeomBndLib_ConicHelpers for circle arc bounding.
0025 class GeomBndLib_Sphere
0026 {
0027 public:
0028   DEFINE_STANDARD_ALLOC
0029 
0030   GeomBndLib_Sphere(const occ::handle<Geom_SphericalSurface>& theSurf)
0031       : myGeom(theSurf)
0032   {
0033   }
0034 
0035   GeomBndLib_Sphere(const GeomBndLib_Sphere&)            = delete;
0036   GeomBndLib_Sphere& operator=(const GeomBndLib_Sphere&) = delete;
0037   GeomBndLib_Sphere(GeomBndLib_Sphere&&)                 = delete;
0038   GeomBndLib_Sphere& operator=(GeomBndLib_Sphere&&)      = delete;
0039 
0040   const occ::handle<Geom_SphericalSurface>& Geometry() const { return myGeom; }
0041 
0042   //! Compute bounding box for full sphere.
0043   [[nodiscard]] Standard_EXPORT Bnd_Box Box(double theTol) const;
0044 
0045   //! Compute bounding box for sphere patch [theUMin, theUMax] x [theVMin, theVMax].
0046   [[nodiscard]] Standard_EXPORT Bnd_Box
0047     Box(double theUMin, double theUMax, double theVMin, double theVMax, double theTol) const;
0048 
0049   //! For analytical surfaces, BoxOptimal is same as Box.
0050   [[nodiscard]] Bnd_Box BoxOptimal(double theUMin,
0051                                    double theUMax,
0052                                    double theVMin,
0053                                    double theVMax,
0054                                    double theTol) const
0055   {
0056     return Box(theUMin, theUMax, theVMin, theVMax, theTol);
0057   }
0058 
0059   //! Compute optimal bounding box for full surface.
0060   [[nodiscard]] Bnd_Box BoxOptimal(double theTol) const { return Box(theTol); }
0061 
0062 private:
0063   occ::handle<Geom_SphericalSurface> myGeom;
0064 };
0065 
0066 #endif // GeomBndLib_Sphere_HeaderFile