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