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