Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-30 09:02:48

0001 // Created on: 1993-07-08
0002 // Created by: Isabelle GRIGNON
0003 // Copyright (c) 1993-1999 Matra Datavision
0004 // Copyright (c) 1999-2014 OPEN CASCADE SAS
0005 //
0006 // This file is part of Open CASCADE Technology software library.
0007 //
0008 // This library is free software; you can redistribute it and/or modify it under
0009 // the terms of the GNU Lesser General Public License version 2.1 as published
0010 // by the Free Software Foundation, with special exception defined in the file
0011 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
0012 // distribution for complete text of the license and disclaimer of any warranty.
0013 //
0014 // Alternatively, this file may be used under the terms of Open CASCADE
0015 // commercial license or contractual agreement.
0016 
0017 #ifndef _BndLib_HeaderFile
0018 #define _BndLib_HeaderFile
0019 
0020 #include <Standard.hxx>
0021 #include <Standard_DefineAlloc.hxx>
0022 #include <Standard_Handle.hxx>
0023 
0024 #include <Standard_Real.hxx>
0025 class gp_Lin;
0026 class Bnd_Box;
0027 class gp_Lin2d;
0028 class Bnd_Box2d;
0029 class gp_Circ;
0030 class gp_Circ2d;
0031 class gp_Elips;
0032 class gp_Elips2d;
0033 class gp_Parab;
0034 class gp_Parab2d;
0035 class gp_Hypr;
0036 class gp_Hypr2d;
0037 class gp_Cylinder;
0038 class gp_Cone;
0039 class gp_Sphere;
0040 class gp_Torus;
0041 
0042 //! The BndLib package provides functions to add a geometric primitive to a bounding box.
0043 //! Note: these functions work with gp objects, optionally
0044 //! limited by parameter values. If the curves and surfaces
0045 //! provided by the gp package are not explicitly
0046 //! parameterized, they still have an implicit parameterization,
0047 //! similar to that which they infer for the equivalent Geom or Geom2d objects.
0048 //! Add : Package to compute the bounding boxes for elementary
0049 //! objects from gp in 2d and 3d .
0050 //!
0051 //! AddCurve2d : A class to compute the bounding box for a curve
0052 //! in 2d dimensions ;the curve is defined by a tool
0053 //!
0054 //! AddCurve : A class to compute the bounding box for a curve
0055 //! in 3d dimensions ;the curve is defined by a tool
0056 //!
0057 //! AddSurface : A class to compute the bounding box for a surface.
0058 //! The surface is defined by a tool for the geometry and another
0059 //! tool for the topology (only the edges in 2d dimensions)
0060 class BndLib
0061 {
0062 public:
0063   DEFINE_STANDARD_ALLOC
0064 
0065   //! Bounding box for a surface trimmed or not
0066   //! Adds the segment of the line L limited by the two
0067   //! parameter values P1 and P2, to the bounding box B, and
0068   //! then enlarges B by the tolerance value Tol.
0069   //! Tol is the tolerance value to enlarge the minimum and maximum dimension
0070   //! P1 and P2 may represent infinite values.
0071   //! Exceptions
0072   //! Standard_Failure if P1 and P2 are either two negative
0073   //! infinite real numbers, or two positive infinite real numbers.
0074   Standard_EXPORT static void Add(const gp_Lin& L,
0075                                   const double  P1,
0076                                   const double  P2,
0077                                   const double  Tol,
0078                                   Bnd_Box&      B);
0079 
0080   Standard_EXPORT static void Add(const gp_Lin2d& L,
0081                                   const double    P1,
0082                                   const double    P2,
0083                                   const double    Tol,
0084                                   Bnd_Box2d&      B);
0085 
0086   Standard_EXPORT static void Add(const gp_Circ& C, const double Tol, Bnd_Box& B);
0087 
0088   //! P2-P1 can be in [0,2*pi]
0089   Standard_EXPORT static void Add(const gp_Circ& C,
0090                                   const double   P1,
0091                                   const double   P2,
0092                                   const double   Tol,
0093                                   Bnd_Box&       B);
0094 
0095   Standard_EXPORT static void Add(const gp_Circ2d& C, const double Tol, Bnd_Box2d& B);
0096 
0097   //! Adds the circle C, or the arc of the circle C
0098   //! limited by the two parameter values P1 and P2,
0099   //! to the bounding box B, and then enlarges B by the tolerance value Tol.
0100   //! P2-P1 can be in [0,2*pi]
0101   Standard_EXPORT static void Add(const gp_Circ2d& C,
0102                                   const double     P1,
0103                                   const double     P2,
0104                                   const double     Tol,
0105                                   Bnd_Box2d&       B);
0106 
0107   Standard_EXPORT static void Add(const gp_Elips& C, const double Tol, Bnd_Box& B);
0108 
0109   //! P2-P1 can be in [0,2*pi]
0110   Standard_EXPORT static void Add(const gp_Elips& C,
0111                                   const double    P1,
0112                                   const double    P2,
0113                                   const double    Tol,
0114                                   Bnd_Box&        B);
0115 
0116   Standard_EXPORT static void Add(const gp_Elips2d& C, const double Tol, Bnd_Box2d& B);
0117 
0118   //! Adds the ellipse E, or the arc of the ellipse E
0119   //! limited by the two parameter values P1 and P2,
0120   //! to the bounding box B, and then enlarges B by the tolerance value Tol.
0121   //! P2-P1 can be in [0,2*pi]
0122   Standard_EXPORT static void Add(const gp_Elips2d& C,
0123                                   const double      P1,
0124                                   const double      P2,
0125                                   const double      Tol,
0126                                   Bnd_Box2d&        B);
0127 
0128   Standard_EXPORT static void Add(const gp_Parab& P,
0129                                   const double    P1,
0130                                   const double    P2,
0131                                   const double    Tol,
0132                                   Bnd_Box&        B);
0133 
0134   //! Adds the arc of the parabola P limited by the two
0135   //! parameter values P1 and P2, to the bounding box B, and
0136   //! then enlarges B by the tolerance value Tol.
0137   //! P1 and P2 may represent infinite values.
0138   //! Exceptions
0139   //! Standard_Failure if P1 and P2 are either two negative
0140   //! infinite real numbers, or two positive infinite real numbers.
0141   Standard_EXPORT static void Add(const gp_Parab2d& P,
0142                                   const double      P1,
0143                                   const double      P2,
0144                                   const double      Tol,
0145                                   Bnd_Box2d&        B);
0146 
0147   Standard_EXPORT static void Add(const gp_Hypr& H,
0148                                   const double   P1,
0149                                   const double   P2,
0150                                   const double   Tol,
0151                                   Bnd_Box&       B);
0152 
0153   //! Adds the arc of the branch of hyperbola H limited by the
0154   //! two parameter values P1 and P2, to the bounding box B,
0155   //! and then enlarges B by the tolerance value Tol.
0156   //! P1 and P2 may represent infinite values.
0157   //! Exceptions
0158   //! Standard_Failure if P1 and P2 are either two negative
0159   //! infinite real numbers, or two positive infinite real numbers.
0160   Standard_EXPORT static void Add(const gp_Hypr2d& H,
0161                                   const double     P1,
0162                                   const double     P2,
0163                                   const double     Tol,
0164                                   Bnd_Box2d&       B);
0165 
0166   //! UMax -UMin can be in [0,2*pi]
0167   Standard_EXPORT static void Add(const gp_Cylinder& S,
0168                                   const double       UMin,
0169                                   const double       UMax,
0170                                   const double       VMin,
0171                                   const double       VMax,
0172                                   const double       Tol,
0173                                   Bnd_Box&           B);
0174 
0175   //! Adds to the bounding box B, the patch of the cylinder S limited
0176   //! -   in the v parametric direction, by the two parameter
0177   //! values VMin and VMax
0178   //! -   and optionally in the u parametric direction, by the two
0179   //! parameter values UMin and UMax.
0180   //! B is then enlarged by the tolerance value Tol.
0181   //! VMin and VMax may represent infinite values.
0182   //! Exceptions
0183   //! Standard_Failure if VMin and VMax are either two
0184   //! negative infinite real numbers, or two positive infinite real numbers.
0185   Standard_EXPORT static void Add(const gp_Cylinder& S,
0186                                   const double       VMin,
0187                                   const double       VMax,
0188                                   const double       Tol,
0189                                   Bnd_Box&           B);
0190 
0191   //! UMax-UMin can be in [0,2*pi]
0192   Standard_EXPORT static void Add(const gp_Cone& S,
0193                                   const double   UMin,
0194                                   const double   UMax,
0195                                   const double   VMin,
0196                                   const double   VMax,
0197                                   const double   Tol,
0198                                   Bnd_Box&       B);
0199 
0200   //! Adds to the bounding box B, the patch of the cone S limited
0201   //! -   in the v parametric direction, by the two parameter
0202   //! values VMin and VMax
0203   //! -   and optionally in the u parametric direction, by the two
0204   //! parameter values UMin and UMax,
0205   //! B is then enlarged by the tolerance value Tol.
0206   //! VMin and VMax may represent infinite values.
0207   //! Exceptions
0208   //! Standard_Failure if VMin and VMax are either two
0209   //! negative infinite real numbers, or two positive infinite real numbers.
0210   Standard_EXPORT static void Add(const gp_Cone& S,
0211                                   const double   VMin,
0212                                   const double   VMax,
0213                                   const double   Tol,
0214                                   Bnd_Box&       B);
0215 
0216   Standard_EXPORT static void Add(const gp_Sphere& S, const double Tol, Bnd_Box& B);
0217 
0218   //! Adds to the bounding box B the sphere S, or
0219   //! -   the patch of the sphere S, limited in the u parametric
0220   //! direction, by the two parameter values UMin and UMax,
0221   //! and in the v parametric direction, by the two parameter
0222   //! values VMin and VMax.
0223   //! B is then enlarged by the tolerance value Tol.
0224   //! UMax-UMin can be in [0,2*pi]
0225   //! VMin,VMax can be [-pi/2,pi/2]
0226   Standard_EXPORT static void Add(const gp_Sphere& S,
0227                                   const double     UMin,
0228                                   const double     UMax,
0229                                   const double     VMin,
0230                                   const double     VMax,
0231                                   const double     Tol,
0232                                   Bnd_Box&         B);
0233 
0234   Standard_EXPORT static void Add(const gp_Torus& P, const double Tol, Bnd_Box& B);
0235 
0236   //! Adds to the bounding box B
0237   //! -   the torus S, or
0238   //! -   the patch of the torus S, limited in the u parametric
0239   //! direction, by the two parameter values UMin and UMax,
0240   //! and in the v parametric direction, by the two parameter
0241   //! values VMin and VMax.
0242   //! B is then enlarged by the tolerance value Tol.
0243   //! UMax-UMin can be in [0,2*pi],
0244   //! VMin,VMax can be [-pi/2,pi/2]
0245   Standard_EXPORT static void Add(const gp_Torus& P,
0246                                   const double    UMin,
0247                                   const double    UMax,
0248                                   const double    VMin,
0249                                   const double    VMax,
0250                                   const double    Tol,
0251                                   Bnd_Box&        B);
0252 };
0253 
0254 #endif // _BndLib_HeaderFile