Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:03:03

0001 // Created on: 1991-01-08
0002 // Created by: Didier Piffault
0003 // Copyright (c) 1991-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 _Bnd_B2f_HeaderFile
0018 #define _Bnd_B2f_HeaderFile
0019 
0020 #include <Standard.hxx>
0021 #include <Standard_DefineAlloc.hxx>
0022 #include <Standard_Handle.hxx>
0023 
0024 #include <Standard_ShortReal.hxx>
0025 #include <gp_XY.hxx>
0026 class gp_XY;
0027 class gp_Pnt2d;
0028 class gp_Trsf2d;
0029 class gp_Ax2d;
0030 
0031 
0032 
0033 class Bnd_B2f 
0034 {
0035 public:
0036 
0037   DEFINE_STANDARD_ALLOC
0038 
0039   
0040   //! Empty constructor.
0041     Bnd_B2f();
0042   
0043   //! Constructor.
0044     Bnd_B2f(const gp_XY& theCenter, const gp_XY& theHSize);
0045   
0046   //! Returns True if the box is void (non-initialized).
0047     Standard_Boolean IsVoid() const;
0048   
0049   //! Reset the box data.
0050     void Clear();
0051   
0052   //! Update the box by a point.
0053   Standard_EXPORT void Add (const gp_XY& thePnt);
0054   
0055   //! Update the box by a point.
0056   void Add (const gp_Pnt2d& thePnt);
0057   
0058   //! Update the box by another box.
0059   void Add (const Bnd_B2f& theBox);
0060   
0061   //! Query a box corner: (Center - HSize). You must make sure that
0062   //! the box is NOT VOID (see IsVoid()), otherwise the method returns
0063   //! irrelevant result.
0064     gp_XY CornerMin() const;
0065   
0066   //! Query a box corner: (Center + HSize). You must make sure that
0067   //! the box is NOT VOID (see IsVoid()), otherwise the method returns
0068   //! irrelevant result.
0069     gp_XY CornerMax() const;
0070   
0071   //! Query the square diagonal. If the box is VOID (see method IsVoid())
0072   //! then a very big real value is returned.
0073     Standard_Real SquareExtent() const;
0074   
0075   //! Extend the Box by the absolute value of theDiff.
0076     void Enlarge (const Standard_Real theDiff);
0077   
0078   //! Limit the Box by the internals of theOtherBox.
0079   //! Returns True if the limitation takes place, otherwise False
0080   //! indicating that the boxes do not intersect.
0081   Standard_EXPORT Standard_Boolean Limit (const Bnd_B2f& theOtherBox);
0082   
0083   //! Transform the bounding box with the given transformation.
0084   //! The resulting box will be larger if theTrsf contains rotation.
0085   Standard_NODISCARD Standard_EXPORT Bnd_B2f Transformed (const gp_Trsf2d& theTrsf) const;
0086   
0087   //! Check the given point for the inclusion in the Box.
0088   //! Returns True if the point is outside.
0089     Standard_Boolean IsOut (const gp_XY& thePnt) const;
0090   
0091   //! Check a circle for the intersection with the current box.
0092   //! Returns True if there is no intersection between boxes.
0093   Standard_EXPORT Standard_Boolean IsOut (const gp_XY& theCenter, const Standard_Real theRadius, const Standard_Boolean isCircleHollow = Standard_False) const;
0094   
0095   //! Check the given box for the intersection with the current box.
0096   //! Returns True if there is no intersection between boxes.
0097     Standard_Boolean IsOut (const Bnd_B2f& theOtherBox) const;
0098   
0099   //! Check the given box oriented by the given transformation
0100   //! for the intersection with the current box.
0101   //! Returns True if there is no intersection between boxes.
0102   Standard_EXPORT Standard_Boolean IsOut (const Bnd_B2f& theOtherBox, const gp_Trsf2d& theTrsf) const;
0103   
0104   //! Check the given Line for the intersection with the current box.
0105   //! Returns True if there is no intersection.
0106   Standard_EXPORT Standard_Boolean IsOut (const gp_Ax2d& theLine) const;
0107   
0108   //! Check the Segment defined by the couple of input points
0109   //! for the intersection with the current box.
0110   //! Returns True if there is no intersection.
0111   Standard_EXPORT Standard_Boolean IsOut (const gp_XY& theP0, const gp_XY& theP1) const;
0112   
0113   //! Check that the box 'this' is inside the given box 'theBox'. Returns
0114   //! True if 'this' box is fully inside 'theBox'.
0115     Standard_Boolean IsIn (const Bnd_B2f& theBox) const;
0116   
0117   //! Check that the box 'this' is inside the given box 'theBox'
0118   //! transformed by 'theTrsf'. Returns True if 'this' box is fully
0119   //! inside the transformed 'theBox'.
0120   Standard_EXPORT Standard_Boolean IsIn (const Bnd_B2f& theBox, const gp_Trsf2d& theTrsf) const;
0121   
0122   //! Set the Center coordinates
0123     void SetCenter (const gp_XY& theCenter);
0124   
0125   //! Set the HSize (half-diagonal) coordinates.
0126   //! All components of theHSize must be non-negative.
0127     void SetHSize (const gp_XY& theHSize);
0128 
0129 
0130 
0131 
0132 protected:
0133 
0134 
0135 
0136   Standard_ShortReal myCenter[2];
0137   Standard_ShortReal myHSize[2];
0138 
0139 
0140 private:
0141 
0142 
0143 
0144 
0145 
0146 };
0147 
0148 #define RealType Standard_ShortReal
0149 #define RealType_hxx <Standard_ShortReal.hxx>
0150 #define Bnd_B2x Bnd_B2f
0151 #define Bnd_B2x_hxx <Bnd_B2f.hxx>
0152 
0153 #include <Bnd_B2x.lxx>
0154 
0155 #undef RealType
0156 #undef RealType_hxx
0157 #undef Bnd_B2x
0158 #undef Bnd_B2x_hxx
0159 
0160 
0161 
0162 
0163 #endif // _Bnd_B2f_HeaderFile