Concrete class describing an orientated (free) or axis aligned box of 8 vertices.
Supports methods for setting aligned or orientated boxes, find volume, axes, extents, centers, face planes etc. Also tests for overlap testing of planes and other bounding boxes, with fast sphere approximation.
Definition at line 32 of file TGLBoundingBox.h.
Public Types | |
enum | EFace { kFaceLowX , kFaceHighX , kFaceLowY , kFaceHighY , kFaceLowZ , kFaceHighZ , kFaceCount } |
Public Member Functions | |
TGLBoundingBox () | |
Construct an empty bounding box. | |
TGLBoundingBox (const Double_t vertex[8][3]) | |
Construct a bounding box from provided 8 vertices. | |
TGLBoundingBox (const TGLBoundingBox &other) | |
Construct a bounding box as copy of existing one. | |
TGLBoundingBox (const TGLVertex3 &lowVertex, const TGLVertex3 &highVertex) | |
Construct an global axis ALIGNED bounding box from provided low/high vertex pair. | |
TGLBoundingBox (const TGLVertex3 vertex[8]) | |
Construct a bounding box from provided 8 vertices. | |
virtual | ~TGLBoundingBox () |
Destroy bounding box. | |
const TGLVector3 & | Axis (UInt_t i, Bool_t normalised=kTRUE) const |
TGLVertex3 | Center () const |
Double_t | Diagonal () const |
void | Draw (Bool_t solid=kFALSE) const |
Draw the bounding box as either wireframe (default) of solid using current GL color. | |
void | Dump () const |
Output to std::cout the vertices, center and volume of box. | |
void | ExpandAligned (const TGLVertex3 &point) |
Expand current bbox so that it includes the point. | |
TGLVector3 | Extents () const |
const std::vector< UInt_t > & | FaceVertices (EFace face) const |
return a vector of face vertices y | | |________x / 3----—2 / /| /| z 7----—6 | | 0--—|-1 |/ |/ 4----—5 | |
TGLPlane | GetNearPlane () const |
Return the near-plane. | |
virtual TClass * | IsA () const |
Bool_t | IsEmpty () const |
TGLVertex3 | MaxAAVertex () const |
Find maximum vertex values. | |
void | MergeAligned (const TGLBoundingBox &other) |
Expand current bbox so that it includes other's bbox. | |
TGLVertex3 | MinAAVertex () const |
Find minimum vertex values. | |
Int_t | NumVertices () const |
TGLBoundingBox & | operator= (const TGLBoundingBox &other) |
const TGLVertex3 & | operator[] (UInt_t index) const |
Rgl::EOverlap | Overlap (const TGLBoundingBox &box) const |
Find overlap (Inside, Outside, Partial) of other bounding box c.f. us. | |
Rgl::EOverlap | Overlap (const TGLPlane &plane) const |
Find overlap (Inside, Outside, Partial) of plane c.f. bounding box. | |
void | PlaneSet (TGLPlaneSet_t &planeSet) const |
Fill out supplied plane set vector with TGLPlane objects representing six faces of box. | |
void | Scale (Double_t factor) |
Isotropically scale bounding box along it's LOCAL axes, preserving center. | |
void | Scale (Double_t xFactor, Double_t yFactor, Double_t zFactor) |
Asymmetrically scale box along it's LOCAL x,y,z axes, preserving center. | |
void | Set (const Double_t vertex[8][3]) |
Set a bounding box from provided 8 vertices. | |
void | Set (const TGLBoundingBox &other) |
Set a bounding box from vertices of other. | |
void | Set (const TGLVertex3 vertex[8]) |
Set a bounding box from provided 8 vertices. | |
void | SetAligned (const TGLVertex3 &lowVertex, const TGLVertex3 &highVertex) |
Set ALIGNED box from two low/high vertices. | |
void | SetAligned (UInt_t nbPnts, const Double_t *pnts) |
Set ALIGNED box from one or more points. | |
void | SetEmpty () |
Set bounding box empty - all vertices at (0,0,0) | |
virtual void | Streamer (TBuffer &) |
void | StreamerNVirtual (TBuffer &ClassDef_StreamerNVirtual_b) |
void | Transform (const TGLMatrix &matrix) |
Transform all vertices with matrix. | |
void | Translate (const TGLVector3 &offset) |
Translate all vertices by offset. | |
const TGLVertex3 & | Vertex (UInt_t index) const |
const TGLVertex3 * | Vertices () const |
Double_t | Volume () const |
Double_t | XMax () const |
Double_t | XMin () const |
Double_t | YMax () const |
Double_t | YMin () const |
Double_t | ZMax () const |
Double_t | ZMin () const |
Static Public Member Functions | |
static TClass * | Class () |
static const char * | Class_Name () |
static constexpr Version_t | Class_Version () |
static const char * | DeclFileName () |
Private Member Functions | |
Double_t | Max (UInt_t index) const |
Find maximum vertex value for axis of index X(0), Y(1), Z(2) | |
Double_t | Min (UInt_t index) const |
Find minimum vertex value for axis of index X(0), Y(1), Z(2) | |
void | UpdateCache () |
normalised box axes in global frame - cached for speed | |
Bool_t | ValidIndex (UInt_t index) const |
Private Attributes | |
TGLVector3 | fAxes [3] |
max box diagonal - cached for speed | |
TGLVector3 | fAxesNorm [3] |
box axes in global frame - cached for speed | |
Double_t | fDiagonal |
box volume - cached for speed | |
TGLVertex3 | fVertex [8] |
Double_t | fVolume |
the 8 bounding box vertices | |
#include <TGLBoundingBox.h>
Enumerator | |
---|---|
kFaceLowX | |
kFaceHighX | |
kFaceLowY | |
kFaceHighY | |
kFaceLowZ | |
kFaceHighZ | |
kFaceCount |
Definition at line 113 of file TGLBoundingBox.h.
TGLBoundingBox::TGLBoundingBox | ( | ) |
Construct an empty bounding box.
Definition at line 33 of file TGLBoundingBox.cxx.
TGLBoundingBox::TGLBoundingBox | ( | const TGLVertex3 | vertex[8] | ) |
Construct a bounding box from provided 8 vertices.
Definition at line 41 of file TGLBoundingBox.cxx.
TGLBoundingBox::TGLBoundingBox | ( | const Double_t | vertex[8][3] | ) |
Construct a bounding box from provided 8 vertices.
Definition at line 49 of file TGLBoundingBox.cxx.
TGLBoundingBox::TGLBoundingBox | ( | const TGLVertex3 & | lowVertex, |
const TGLVertex3 & | highVertex | ||
) |
Construct an global axis ALIGNED bounding box from provided low/high vertex pair.
Definition at line 57 of file TGLBoundingBox.cxx.
TGLBoundingBox::TGLBoundingBox | ( | const TGLBoundingBox & | other | ) |
Construct a bounding box as copy of existing one.
Definition at line 65 of file TGLBoundingBox.cxx.
|
virtual |
Destroy bounding box.
Definition at line 73 of file TGLBoundingBox.cxx.
|
inline |
Definition at line 183 of file TGLBoundingBox.h.
|
inline |
Definition at line 174 of file TGLBoundingBox.h.
|
static |
|
inlinestaticconstexpr |
Definition at line 133 of file TGLBoundingBox.h.
|
inlinestatic |
Definition at line 133 of file TGLBoundingBox.h.
|
inline |
Definition at line 122 of file TGLBoundingBox.h.
Draw the bounding box as either wireframe (default) of solid using current GL color.
Definition at line 652 of file TGLBoundingBox.cxx.
void TGLBoundingBox::Dump | ( | ) | const |
Output to std::cout the vertices, center and volume of box.
Definition at line 777 of file TGLBoundingBox.cxx.
void TGLBoundingBox::ExpandAligned | ( | const TGLVertex3 & | point | ) |
Expand current bbox so that it includes the point.
This make the bbox axis-aligned.
Definition at line 273 of file TGLBoundingBox.cxx.
|
inline |
Definition at line 165 of file TGLBoundingBox.h.
return a vector of face vertices y | | |________x / 3----—2 / /| /| z 7----—6 | | 0--—|-1 |/ |/ 4----—5
Definition at line 369 of file TGLBoundingBox.cxx.
TGLPlane TGLBoundingBox::GetNearPlane | ( | ) | const |
Return the near-plane.
Definition at line 440 of file TGLBoundingBox.cxx.
|
inlinevirtual |
Definition at line 133 of file TGLBoundingBox.h.
|
inline |
Definition at line 207 of file TGLBoundingBox.h.
Find maximum vertex value for axis of index X(0), Y(1), Z(2)
Definition at line 747 of file TGLBoundingBox.cxx.
TGLVertex3 TGLBoundingBox::MaxAAVertex | ( | ) | const |
Find maximum vertex values.
Definition at line 769 of file TGLBoundingBox.cxx.
void TGLBoundingBox::MergeAligned | ( | const TGLBoundingBox & | other | ) |
Expand current bbox so that it includes other's bbox.
This make the bbox axis-aligned.
Definition at line 251 of file TGLBoundingBox.cxx.
Find minimum vertex value for axis of index X(0), Y(1), Z(2)
Definition at line 733 of file TGLBoundingBox.cxx.
TGLVertex3 TGLBoundingBox::MinAAVertex | ( | ) | const |
Find minimum vertex values.
Definition at line 761 of file TGLBoundingBox.cxx.
|
inline |
Definition at line 111 of file TGLBoundingBox.h.
|
inline |
Definition at line 137 of file TGLBoundingBox.h.
|
inline |
Definition at line 147 of file TGLBoundingBox.h.
Rgl::EOverlap TGLBoundingBox::Overlap | ( | const TGLBoundingBox & | box | ) | const |
Find overlap (Inside, Outside, Partial) of other bounding box c.f. us.
Definition at line 478 of file TGLBoundingBox.cxx.
Rgl::EOverlap TGLBoundingBox::Overlap | ( | const TGLPlane & | plane | ) | const |
Find overlap (Inside, Outside, Partial) of plane c.f. bounding box.
Definition at line 448 of file TGLBoundingBox.cxx.
void TGLBoundingBox::PlaneSet | ( | TGLPlaneSet_t & | planeSet | ) | const |
Fill out supplied plane set vector with TGLPlane objects representing six faces of box.
Definition at line 413 of file TGLBoundingBox.cxx.
void TGLBoundingBox::Scale | ( | Double_t | factor | ) |
Isotropically scale bounding box along it's LOCAL axes, preserving center.
Definition at line 287 of file TGLBoundingBox.cxx.
Asymmetrically scale box along it's LOCAL x,y,z axes, preserving center.
Definition at line 297 of file TGLBoundingBox.cxx.
void TGLBoundingBox::Set | ( | const Double_t | vertex[8][3] | ) |
Set a bounding box from provided 8 vertices.
Definition at line 146 of file TGLBoundingBox.cxx.
void TGLBoundingBox::Set | ( | const TGLBoundingBox & | other | ) |
Set a bounding box from vertices of other.
Definition at line 160 of file TGLBoundingBox.cxx.
void TGLBoundingBox::Set | ( | const TGLVertex3 | vertex[8] | ) |
Set a bounding box from provided 8 vertices.
Definition at line 134 of file TGLBoundingBox.cxx.
void TGLBoundingBox::SetAligned | ( | const TGLVertex3 & | lowVertex, |
const TGLVertex3 & | highVertex | ||
) |
Set ALIGNED box from two low/high vertices.
Box axes are aligned with global frame axes that vertices are specified in.
Definition at line 185 of file TGLBoundingBox.cxx.
Set ALIGNED box from one or more points.
Box axes are aligned with global frame axes that points are specified in.
Definition at line 222 of file TGLBoundingBox.cxx.
void TGLBoundingBox::SetEmpty | ( | ) |
Set bounding box empty - all vertices at (0,0,0)
Definition at line 172 of file TGLBoundingBox.cxx.
|
virtual |
|
inline |
Definition at line 133 of file TGLBoundingBox.h.
void TGLBoundingBox::Transform | ( | const TGLMatrix & | matrix | ) |
Transform all vertices with matrix.
Definition at line 345 of file TGLBoundingBox.cxx.
void TGLBoundingBox::Translate | ( | const TGLVector3 & | offset | ) |
Translate all vertices by offset.
Definition at line 333 of file TGLBoundingBox.cxx.
|
private |
normalised box axes in global frame - cached for speed
Update the internally cached volume and axes vectors - these are retained for efficiency - many more reads than modifications.
Definition at line 81 of file TGLBoundingBox.cxx.
Definition at line 66 of file TGLBoundingBox.h.
|
inline |
Definition at line 153 of file TGLBoundingBox.h.
|
inline |
Definition at line 159 of file TGLBoundingBox.h.
|
inline |
Definition at line 121 of file TGLBoundingBox.h.
|
inline |
Definition at line 101 of file TGLBoundingBox.h.
|
inline |
Definition at line 100 of file TGLBoundingBox.h.
|
inline |
Definition at line 103 of file TGLBoundingBox.h.
|
inline |
Definition at line 102 of file TGLBoundingBox.h.
|
inline |
Definition at line 105 of file TGLBoundingBox.h.
|
inline |
Definition at line 104 of file TGLBoundingBox.h.
|
private |
max box diagonal - cached for speed
Definition at line 61 of file TGLBoundingBox.h.
|
private |
box axes in global frame - cached for speed
Definition at line 62 of file TGLBoundingBox.h.
|
private |
box volume - cached for speed
Definition at line 60 of file TGLBoundingBox.h.
|
private |
Definition at line 58 of file TGLBoundingBox.h.
|
private |
the 8 bounding box vertices
Definition at line 59 of file TGLBoundingBox.h.