1 // Created on: 2013-12-20
2 // Created by: Denis BOGOLEPOV
3 // Copyright (c) 2013 OPEN CASCADE SAS
5 // This file is part of Open CASCADE Technology software library.
7 // This library is free software; you can redistribute it and / or modify it
8 // under the terms of the GNU Lesser General Public version 2.1 as published
9 // by the Free Software Foundation, with special exception defined in the file
10 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
11 // distribution for complete text of the license and disclaimer of any warranty.
13 // Alternatively, this file may be used under the terms of Open CASCADE
14 // commercial license or contractual agreement.
16 #ifndef _BVH_Box_Header
17 #define _BVH_Box_Header
19 #include <BVH_Types.hxx>
21 //! Axis aligned bounding box (AABB).
22 template<class T, int N>
27 typedef typename BVHTools::VectorType<T, N>::Type BVH_VecNt;
31 //! Creates uninitialized bounding box.
32 BVH_Box() : myInitialized (Standard_False) {}
34 //! Creates bounding box of given point.
35 BVH_Box (const BVH_VecNt& thePoint)
36 : myMinPoint (thePoint),
37 myMaxPoint (thePoint),
38 myInitialized (Standard_True) {}
40 //! Creates copy of another bounding box.
41 BVH_Box (const BVH_Box& theBox)
42 : myMinPoint (theBox.myMinPoint),
43 myMaxPoint (theBox.myMaxPoint),
44 myInitialized (theBox.myInitialized) {}
46 //! Creates bounding box from corner points.
47 BVH_Box (const BVH_VecNt& theMinPoint,
48 const BVH_VecNt& theMaxPoint)
49 : myMinPoint (theMinPoint),
50 myMaxPoint (theMaxPoint),
51 myInitialized (Standard_True) {}
55 //! Clears bounding box.
58 //! Is bounding box valid?
59 Standard_Boolean IsValid() const;
61 //! Appends new point to the bounding box.
62 void Add (const BVH_VecNt& thePoint);
64 //! Combines bounding box with another one.
65 void Combine (const BVH_Box& theVolume);
67 //! Returns minimum point of bounding box.
68 const BVH_VecNt& CornerMin() const;
70 //! Returns maximum point of bounding box.
71 const BVH_VecNt& CornerMax() const;
73 //! Returns minimum point of bounding box.
74 BVH_VecNt& CornerMin();
76 //! Returns maximum point of bounding box.
77 BVH_VecNt& CornerMax();
79 //! Returns surface area of bounding box.
82 //! Returns diagonal of bounding box.
83 BVH_VecNt Size() const;
85 //! Returns center of bounding box.
86 BVH_VecNt Center() const;
90 BVH_VecNt myMinPoint; //!< Minimum point of bounding box
91 BVH_VecNt myMaxPoint; //!< Maximum point of bounding box
92 Standard_Boolean myInitialized; //!< Is bounding box valid?
96 #include <BVH_Box.lxx>
98 #endif // _BVH_Box_Header