Back to home page

EIC code displayed by LXR

 
 

    


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

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_SurfaceOfRevolution_HeaderFile
0015 #define GeomBndLib_SurfaceOfRevolution_HeaderFile
0016 
0017 #include <Bnd_Box.hxx>
0018 #include <Geom_SurfaceOfRevolution.hxx>
0019 #include <Standard.hxx>
0020 #include <Standard_DefineAlloc.hxx>
0021 
0022 //! Computes bounding box for a surface of revolution (Geom_SurfaceOfRevolution).
0023 //! Uses analytical approach: samples the basis curve at multiple V values,
0024 //! constructs the revolution circle for each sample point, and bounds each
0025 //! circle arc using GeomBndLib_Circle.
0026 class GeomBndLib_SurfaceOfRevolution
0027 {
0028 public:
0029   DEFINE_STANDARD_ALLOC
0030 
0031   GeomBndLib_SurfaceOfRevolution(const occ::handle<Geom_SurfaceOfRevolution>& theSurf)
0032       : myGeom(theSurf)
0033   {
0034   }
0035 
0036   GeomBndLib_SurfaceOfRevolution(const GeomBndLib_SurfaceOfRevolution&)            = delete;
0037   GeomBndLib_SurfaceOfRevolution& operator=(const GeomBndLib_SurfaceOfRevolution&) = delete;
0038   GeomBndLib_SurfaceOfRevolution(GeomBndLib_SurfaceOfRevolution&&)                 = delete;
0039   GeomBndLib_SurfaceOfRevolution& operator=(GeomBndLib_SurfaceOfRevolution&&)      = delete;
0040 
0041   const occ::handle<Geom_SurfaceOfRevolution>& Geometry() const { return myGeom; }
0042 
0043   //! Compute bounding box for full surface.
0044   [[nodiscard]] Standard_EXPORT Bnd_Box Box(double theTol) const;
0045 
0046   //! Compute bounding box for surface patch [theUMin, theUMax] x [theVMin, theVMax].
0047   [[nodiscard]] Standard_EXPORT Bnd_Box
0048     Box(double theUMin, double theUMax, double theVMin, double theVMax, double theTol) const;
0049 
0050   //! Compute precise bounding box using tight basis curve bounds.
0051   [[nodiscard]] Standard_EXPORT Bnd_Box
0052     BoxOptimal(double theUMin, double theUMax, double theVMin, double theVMax, double theTol) const;
0053 
0054   //! Compute precise bounding box for full surface.
0055   [[nodiscard]] Bnd_Box BoxOptimal(double theTol) const
0056   {
0057     double aU1 = 0., aU2 = 0., aV1 = 0., aV2 = 0.;
0058     myGeom->Bounds(aU1, aU2, aV1, aV2);
0059     return BoxOptimal(aU1, aU2, aV1, aV2, theTol);
0060   }
0061 
0062 private:
0063   occ::handle<Geom_SurfaceOfRevolution> myGeom;
0064 };
0065 
0066 #endif // GeomBndLib_SurfaceOfRevolution_HeaderFile