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_B3f_HeaderFile
0018 #define _Bnd_B3f_HeaderFile
0019 
0020 #include <Standard.hxx>
0021 #include <Standard_DefineAlloc.hxx>
0022 
0023 class gp_XYZ;
0024 class gp_Pnt;
0025 class gp_Trsf;
0026 class gp_Ax1;
0027 class gp_Ax3;
0028 
0029 
0030 
0031 class Bnd_B3f 
0032 {
0033 public:
0034 
0035   DEFINE_STANDARD_ALLOC
0036 
0037   
0038   //! Empty constructor.
0039     Bnd_B3f();
0040   
0041   //! Constructor.
0042     Bnd_B3f(const gp_XYZ& theCenter, const gp_XYZ& theHSize);
0043   
0044   //! Returns True if the box is void (non-initialized).
0045     Standard_Boolean IsVoid() const;
0046   
0047   //! Reset the box data.
0048     void Clear();
0049   
0050   //! Update the box by a point.
0051   Standard_EXPORT void Add (const gp_XYZ& thePnt);
0052   
0053   //! Update the box by a point.
0054     void Add (const gp_Pnt& thePnt);
0055   
0056   //! Update the box by another box.
0057     void Add (const Bnd_B3f& theBox);
0058   
0059   //! Query the lower corner: (Center - HSize). You must make sure that
0060   //! the box is NOT VOID (see IsVoid()), otherwise the method returns
0061   //! irrelevant result.
0062     gp_XYZ CornerMin() const;
0063   
0064   //! Query the upper corner: (Center + HSize). You must make sure that
0065   //! the box is NOT VOID (see IsVoid()), otherwise the method returns
0066   //! irrelevant result.
0067     gp_XYZ CornerMax() const;
0068   
0069   //! Query the square diagonal. If the box is VOID (see method IsVoid())
0070   //! then a very big real value is returned.
0071     Standard_Real SquareExtent() const;
0072   
0073   //! Extend the Box by the absolute value of theDiff.
0074     void Enlarge (const Standard_Real theDiff);
0075   
0076   //! Limit the Box by the internals of theOtherBox.
0077   //! Returns True if the limitation takes place, otherwise False
0078   //! indicating that the boxes do not intersect.
0079   Standard_EXPORT Standard_Boolean Limit (const Bnd_B3f& theOtherBox);
0080   
0081   //! Transform the bounding box with the given transformation.
0082   //! The resulting box will be larger if theTrsf contains rotation.
0083   Standard_NODISCARD Standard_EXPORT Bnd_B3f Transformed (const gp_Trsf& theTrsf) const;
0084   
0085   //! Check the given point for the inclusion in the Box.
0086   //! Returns True if the point is outside.
0087     Standard_Boolean IsOut (const gp_XYZ& thePnt) const;
0088   
0089   //! Check a sphere for the intersection with the current box.
0090   //! Returns True if there is no intersection between boxes. If the
0091   //! parameter 'IsSphereHollow' is True, then the intersection is not
0092   //! reported for a box that is completely inside the sphere (otherwise
0093   //! this method would report an intersection).
0094   Standard_EXPORT Standard_Boolean IsOut (const gp_XYZ& theCenter, const Standard_Real theRadius, const Standard_Boolean isSphereHollow = 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_B3f& 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_B3f& theOtherBox, const gp_Trsf& theTrsf) const;
0104   
0105   //! Check the given Line for the intersection with the current box.
0106   //! Returns True if there is no intersection.
0107   //! isRay==True means intersection check with the positive half-line
0108   //! theOverthickness is the addition to the size of the current box
0109   //! (may be negative). If positive, it can be treated as the thickness
0110   //! of the line 'theLine' or the radius of the cylinder along 'theLine'
0111   Standard_EXPORT Standard_Boolean IsOut (const gp_Ax1& theLine, const Standard_Boolean isRay = Standard_False, const Standard_Real theOverthickness = 0.0) const;
0112   
0113   //! Check the given Plane for the intersection with the current box.
0114   //! Returns True if there is no intersection.
0115   Standard_EXPORT Standard_Boolean IsOut (const gp_Ax3& thePlane) const;
0116   
0117   //! Check that the box 'this' is inside the given box 'theBox'. Returns
0118   //! True if 'this' box is fully inside 'theBox'.
0119     Standard_Boolean IsIn (const Bnd_B3f& theBox) const;
0120   
0121   //! Check that the box 'this' is inside the given box 'theBox'
0122   //! transformed by 'theTrsf'. Returns True if 'this' box is fully
0123   //! inside the transformed 'theBox'.
0124   Standard_EXPORT Standard_Boolean IsIn (const Bnd_B3f& theBox, const gp_Trsf& theTrsf) const;
0125   
0126   //! Set the Center coordinates
0127     void SetCenter (const gp_XYZ& theCenter);
0128   
0129   //! Set the HSize (half-diagonal) coordinates.
0130   //! All components of theHSize must be non-negative.
0131     void SetHSize (const gp_XYZ& theHSize);
0132 
0133 
0134 
0135 
0136 protected:
0137 
0138 
0139 
0140   Standard_ShortReal myCenter[3];
0141   Standard_ShortReal myHSize[3];
0142 
0143 
0144 private:
0145 
0146 
0147 
0148 
0149 
0150 };
0151 
0152 #define RealType Standard_ShortReal
0153 #define RealType_hxx <Standard_ShortReal.hxx>
0154 #define Bnd_B3x Bnd_B3f
0155 #define Bnd_B3x_hxx <Bnd_B3f.hxx>
0156 
0157 #include <Bnd_B3x.lxx>
0158 
0159 #undef RealType
0160 #undef RealType_hxx
0161 #undef Bnd_B3x
0162 #undef Bnd_B3x_hxx
0163 
0164 
0165 
0166 
0167 #endif // _Bnd_B3f_HeaderFile