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_OtherCurve2d_HeaderFile
0015 #define GeomBndLib_OtherCurve2d_HeaderFile
0016 
0017 #include <Adaptor2d_Curve2d.hxx>
0018 #include <Bnd_Box2d.hxx>
0019 #include <Standard.hxx>
0020 #include <Standard_DefineAlloc.hxx>
0021 
0022 #include <functional>
0023 
0024 //! Computes bounding box for a general 2D curve via adaptor.
0025 //! Uses sampling + PSO/Brent numerical optimization for BoxOptimal.
0026 class GeomBndLib_OtherCurve2d
0027 {
0028 public:
0029   DEFINE_STANDARD_ALLOC
0030 
0031   GeomBndLib_OtherCurve2d(const Adaptor2d_Curve2d& theCurve)
0032       : myCurve(theCurve)
0033   {
0034   }
0035 
0036   GeomBndLib_OtherCurve2d(const GeomBndLib_OtherCurve2d&)            = delete;
0037   GeomBndLib_OtherCurve2d& operator=(const GeomBndLib_OtherCurve2d&) = delete;
0038   GeomBndLib_OtherCurve2d(GeomBndLib_OtherCurve2d&&)                 = delete;
0039   GeomBndLib_OtherCurve2d& operator=(GeomBndLib_OtherCurve2d&&)      = delete;
0040 
0041   //! Compute bounding box for full curve.
0042   [[nodiscard]] Standard_EXPORT Bnd_Box2d Box(double theTol) const;
0043 
0044   //! Compute bounding box for arc [theU1, theU2].
0045   [[nodiscard]] Standard_EXPORT Bnd_Box2d Box(double theU1, double theU2, double theTol) const;
0046 
0047   //! Compute precise bounding box for full curve.
0048   [[nodiscard]] Bnd_Box2d BoxOptimal(double theTol) const
0049   {
0050     return BoxOptimal(myCurve.get().FirstParameter(), myCurve.get().LastParameter(), theTol);
0051   }
0052 
0053   //! Compute precise bounding box using PSO + Brent optimization.
0054   [[nodiscard]] Standard_EXPORT Bnd_Box2d BoxOptimal(double theU1,
0055                                                      double theU2,
0056                                                      double theTol) const;
0057 
0058 private:
0059   std::reference_wrapper<const Adaptor2d_Curve2d> myCurve;
0060 };
0061 
0062 #endif // GeomBndLib_OtherCurve2d_HeaderFile