ROOT 6.12/07 Reference Guide |
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 30 of file TGLBoundingBox.h.
Public Types | |
enum | EFace { kFaceLowX, kFaceHighX, kFaceLowY, kFaceHighY, kFaceLowZ, kFaceHighZ, kFaceCount } |
Public Member Functions | |
TGLBoundingBox () | |
Construct an empty bounding box. More... | |
TGLBoundingBox (const TGLVertex3 vertex[8]) | |
Construct a bounding box from provided 8 vertices. More... | |
TGLBoundingBox (const Double_t vertex[8][3]) | |
Construct a bounding box from provided 8 vertices. More... | |
TGLBoundingBox (const TGLVertex3 &lowVertex, const TGLVertex3 &highVertex) | |
Construct an global axis ALIGNED bounding box from provided low/high vertex pair. More... | |
TGLBoundingBox (const TGLBoundingBox &other) | |
Construct a bounding box as copy of existing one. More... | |
virtual | ~TGLBoundingBox () |
Destroy bounding box. More... | |
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. More... | |
void | Dump () const |
Output to std::cout the vertices, center and volume of box. More... | |
void | ExpandAligned (const TGLVertex3 &point) |
Expand current bbox so that it includes the point. More... | |
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 More... | |
TGLPlane | GetNearPlane () const |
Return the near-plane. More... | |
Bool_t | IsEmpty () const |
TGLVertex3 | MaxAAVertex () const |
Find maximum vertex values. More... | |
void | MergeAligned (const TGLBoundingBox &other) |
Expand current bbox so that it includes other's bbox. More... | |
TGLVertex3 | MinAAVertex () const |
Find minimum vertex values. More... | |
Int_t | NumVertices () const |
TGLBoundingBox & | operator= (const TGLBoundingBox &other) |
const TGLVertex3 & | operator[] (UInt_t index) const |
Rgl::EOverlap | Overlap (const TGLPlane &plane) const |
Find overlap (Inside, Outside, Partial) of plane c.f. bounding box. More... | |
Rgl::EOverlap | Overlap (const TGLBoundingBox &box) const |
Find overlap (Inside, Outside, Partial) of other bounding box c.f. us. More... | |
void | PlaneSet (TGLPlaneSet_t &planeSet) const |
Fill out supplied plane set vector with TGLPlane objects representing six faces of box. More... | |
void | Scale (Double_t factor) |
Isotropically scale bounding box along it's LOCAL axes, preserving center. More... | |
void | Scale (Double_t xFactor, Double_t yFactor, Double_t zFactor) |
Asymmetrically scale box along it's LOCAL x,y,z axes, preserving center. More... | |
void | Set (const TGLVertex3 vertex[8]) |
Set a bounding box from provided 8 vertices. More... | |
void | Set (const Double_t vertex[8][3]) |
Set a bounding box from provided 8 vertices. More... | |
void | Set (const TGLBoundingBox &other) |
Set a bounding box from vertices of other. More... | |
void | SetAligned (const TGLVertex3 &lowVertex, const TGLVertex3 &highVertex) |
Set ALIGNED box from two low/high vertices. More... | |
void | SetAligned (UInt_t nbPnts, const Double_t *pnts) |
Set ALIGNED box from one or more points. More... | |
void | SetEmpty () |
Set bounding box empty - all vertices at (0,0,0) More... | |
void | Transform (const TGLMatrix &matrix) |
Transform all vertices with matrix. More... | |
void | Translate (const TGLVector3 &offset) |
Translate all vertices by offset. More... | |
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 |
Private Member Functions | |
Double_t | Max (UInt_t index) const |
Find maximum vertex value for axis of index X(0), Y(1), Z(2) More... | |
Double_t | Min (UInt_t index) const |
Find minimum vertex value for axis of index X(0), Y(1), Z(2) More... | |
void | UpdateCache () |
normalised box axes in global frame - cached for speed More... | |
Bool_t | ValidIndex (UInt_t index) const |
Private Attributes | |
TGLVector3 | fAxes [3] |
max box diagonal - cached for speed More... | |
TGLVector3 | fAxesNorm [3] |
box axes in global frame - cached for speed More... | |
Double_t | fDiagonal |
box volume - cached for speed More... | |
TGLVertex3 | fVertex [8] |
Double_t | fVolume |
the 8 bounding box vertices More... | |
#include <TGLBoundingBox.h>
Enumerator | |
---|---|
kFaceLowX | |
kFaceHighX | |
kFaceLowY | |
kFaceHighY | |
kFaceLowZ | |
kFaceHighZ | |
kFaceCount |
Definition at line 111 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 181 of file TGLBoundingBox.h.
|
inline |
Definition at line 172 of file TGLBoundingBox.h.
|
inline |
Definition at line 120 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 163 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.
|
inline |
Definition at line 205 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 109 of file TGLBoundingBox.h.
|
inline |
Definition at line 135 of file TGLBoundingBox.h.
|
inline |
Definition at line 145 of file TGLBoundingBox.h.
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.
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.
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.
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 TGLVertex3 | vertex[8] | ) |
Set a bounding box from provided 8 vertices.
Definition at line 134 of file TGLBoundingBox.cxx.
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::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.
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 64 of file TGLBoundingBox.h.
|
inline |
Definition at line 151 of file TGLBoundingBox.h.
|
inline |
Definition at line 157 of file TGLBoundingBox.h.
|
inline |
Definition at line 119 of file TGLBoundingBox.h.
|
inline |
Definition at line 99 of file TGLBoundingBox.h.
|
inline |
Definition at line 98 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.
|
private |
max box diagonal - cached for speed
Definition at line 59 of file TGLBoundingBox.h.
|
private |
box axes in global frame - cached for speed
Definition at line 60 of file TGLBoundingBox.h.
|
private |
box volume - cached for speed
Definition at line 58 of file TGLBoundingBox.h.
|
private |
Definition at line 56 of file TGLBoundingBox.h.
|
private |
the 8 bounding box vertices
Definition at line 57 of file TGLBoundingBox.h.