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_Circle2d_HeaderFile
0015 #define GeomBndLib_Circle2d_HeaderFile
0016 
0017 #include <Bnd_Box2d.hxx>
0018 #include <Geom2d_Circle.hxx>
0019 #include <Standard.hxx>
0020 #include <Standard_DefineAlloc.hxx>
0021 #include <gp_Circ2d.hxx>
0022 
0023 //! Computes bounding box for a 2D circle (Geom2d_Circle).
0024 //! Uses analytical per-coordinate extrema computation.
0025 //!
0026 //! Static methods accepting gp_Circ2d can be used directly without
0027 //! constructing a Geom2d_Circle handle.
0028 class GeomBndLib_Circle2d
0029 {
0030 public:
0031   DEFINE_STANDARD_ALLOC
0032 
0033   GeomBndLib_Circle2d(const occ::handle<Geom2d_Circle>& theCircle)
0034       : myGeom(theCircle)
0035   {
0036   }
0037 
0038   GeomBndLib_Circle2d(const GeomBndLib_Circle2d&)            = delete;
0039   GeomBndLib_Circle2d& operator=(const GeomBndLib_Circle2d&) = delete;
0040   GeomBndLib_Circle2d(GeomBndLib_Circle2d&&)                 = delete;
0041   GeomBndLib_Circle2d& operator=(GeomBndLib_Circle2d&&)      = delete;
0042 
0043   const occ::handle<Geom2d_Circle>& Geometry() const { return myGeom; }
0044 
0045   //! Compute bounding box for full circle.
0046   [[nodiscard]] Bnd_Box2d Box(double theTol) const { return Box(myGeom->Circ2d(), theTol); }
0047 
0048   //! Compute bounding box for arc [theU1, theU2].
0049   [[nodiscard]] Bnd_Box2d Box(double theU1, double theU2, double theTol) const
0050   {
0051     return Box(myGeom->Circ2d(), theU1, theU2, theTol);
0052   }
0053 
0054   //! For analytical curves, BoxOptimal is same as Box.
0055   [[nodiscard]] Bnd_Box2d BoxOptimal(double theU1, double theU2, double theTol) const
0056   {
0057     return Box(theU1, theU2, theTol);
0058   }
0059 
0060   //! Compute bounding box for a full circle defined by gp_Circ2d.
0061   [[nodiscard]] Standard_EXPORT static Bnd_Box2d Box(const gp_Circ2d& theCirc, double theTol);
0062 
0063   //! Compute bounding box for a circle arc [theU1, theU2] defined by gp_Circ2d.
0064   [[nodiscard]] Standard_EXPORT static Bnd_Box2d Box(const gp_Circ2d& theCirc,
0065                                                      double           theU1,
0066                                                      double           theU2,
0067                                                      double           theTol);
0068 
0069 private:
0070   occ::handle<Geom2d_Circle> myGeom;
0071 };
0072 
0073 #endif // GeomBndLib_Circle2d_HeaderFile