class TGLBoundingBox


Concrete class describing an orientated (free) or axis aligned box
of 8 verticies. 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.

Function Members (Methods)

TGLBoundingBox(const TGLVertex3* vertex)
TGLBoundingBox(const Double_t** vertex)
TGLBoundingBox(const TGLBoundingBox& other)
TGLBoundingBox(const TGLVertex3& lowVertex, const TGLVertex3& highVertex)
const TGLVector3&Axis(UInt_t i, Bool_t normalised = kTRUE) const
TGLVertex3Center() const
static TClass*Class()
Double_tDiagonal() const
voidDraw(Bool_t solid = kFALSE) const
voidDump() const
TGLVector3Extents() const
const vector<UInt_t>&FaceVertices(TGLBoundingBox::EFace face) const
TGLPlaneGetNearPlane() const
virtual TClass*IsA() const
Bool_tIsEmpty() const
TGLVertex3MaxAAVertex() const
voidMergeAligned(const TGLBoundingBox& other)
TGLVertex3MinAAVertex() const
TGLBoundingBox&operator=(const TGLBoundingBox& other)
const TGLVertex3&operator[](UInt_t index) const
EOverlapOverlap(const TGLPlane& plane) const
EOverlapOverlap(const TGLBoundingBox& box) const
voidPlaneSet(TGLPlaneSet_t& planeSet) const
voidScale(Double_t factor)
voidScale(Double_t xFactor, Double_t yFactor, Double_t zFactor)
voidSet(const TGLVertex3* vertex)
voidSet(const Double_t** vertex)
voidSet(const TGLBoundingBox& other)
voidSetAligned(const TGLVertex3& lowVertex, const TGLVertex3& highVertex)
voidSetAligned(UInt_t nbPnts, const Double_t* pnts)
virtual voidShowMembers(TMemberInspector& insp, char* parent)
virtual voidStreamer(TBuffer& b)
voidStreamerNVirtual(TBuffer& b)
voidTransform(const TGLMatrix& matrix)
voidTranslate(const TGLVector3& offset)
const TGLVertex3&Vertex(UInt_t index) const
const vector<TGLVertex3>&Vertices() const
Double_tVolume() const
Double_tXMax() const
Double_tXMin() const
Double_tYMax() const
Double_tYMin() const
Double_tZMax() const
Double_tZMin() const
Double_tMax(UInt_t index) const
Double_tMin(UInt_t index) const
Bool_tValidIndex(UInt_t index) const

Data Members

enum EFace { kFaceLowX
TGLVector3fAxes[3]! box axes in global frame - cached for speed
TGLVector3fAxesNorm[3]! normalised box axes in global frame - cached for speed
Double_tfDiagonal! max box diagonal - cached for speed
vector<TGLVertex3>fVertex! the 8 bounding box vertices
Double_tfVolume! box volume - cached for speed

Class Charts

Inheritance Inherited Members Includes Libraries
Class Charts

Function documentation

 Construct an empty bounding box
TGLBoundingBox(const TGLVertex3 vertex[8])
 Construct a bounding box from provided 8 vertices
TGLBoundingBox(const Double_t vertex[8][3])
 Construct a bounding box from provided 8 vertices
TGLBoundingBox(const TGLVertex3& lowVertex, const TGLVertex3& highVertex)
 Construct an global axis ALIGNED bounding box from provided low/high vertex pair
TGLBoundingBox(const TGLBoundingBox & other)
 Construct a bounding box as copy of existing one
 Destroy bounding box
void UpdateCache()
 Update the internally cached volume and axes vectors - these are retained
 for efficiency - many more reads than modifications
void Set(const TGLVertex3 vertex[8])
 Set a bounding box from provided 8 vertices
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 SetEmpty()
 Set bounding box empty - all vertices at (0,0,0)
void 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.
void SetAligned(UInt_t nbPnts, const Double_t * pnts)
 Set ALIGNED box from one or more points. Box axes are aligned with
 global frame axes that points are specified in.
void MergeAligned(const TGLBoundingBox& other)
 Expand current bbox so that it includes other's bbox.
 This make the bbox axis-aligned.
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)
 Asymetrically scale box along it's LOCAL x,y,z axes, preserving center
void Translate(const TGLVector3& offset)
 Translate all vertices by offset
void Transform(const TGLMatrix& matrix)
 Transform all vertices with matrix.
const std::vector<UInt_t> & FaceVertices(TGLBoundingBox::EFace face) const
return a vector of face vertices
   /  3-------2
  /  /|      /|
 z  7-------6 |
    | 0-----|-1
    |/      |

void PlaneSet(TGLPlaneSet_t& planeSet) const
 Fill out supplied plane set vector with TGLPlane objects
 representing six faces of box
TGLPlane GetNearPlane()
 Return the near-plane.
EOverlap Overlap(const TGLPlane & plane)
 Find overlap (Inside, Outside, Partial) of plane c.f. bounding box.
EOverlap Overlap(const TGLBoundingBox & other)
 Find overlap (Inside, Outside, Partial) of other bounding box c.f. us.
void Draw(Bool_t solid = kFALSE) const
 Draw the bounding box as either wireframe (default) of solid
 using current GL color.
Double_t Min(UInt_t index) const
 Find minimum vertex value for axis of index X(0), Y(1), Z(2)
Double_t Max(UInt_t index) const
 Find maximum vertex value for axis of index X(0), Y(1), Z(2)
TGLVertex3 MinAAVertex()
 Find minimum vertex values.
TGLVertex3 MaxAAVertex()
 Find maximum vertex values.
void Dump()
 Output to std::cout the vertices, center and volume of box
const TGLVertex3 & Vertex(UInt_t index) const
const std::vector<TGLVertex3> & Vertices()
TGLVector3 Extents()
TGLVertex3 Center()
const TGLVector3 & Axis(UInt_t i, Bool_t normalised = kTRUE) const
Bool_t IsEmpty()
Bool_t ValidIndex(UInt_t index) const
{ return (index < 8); }
Double_t XMin()
{ return Min(0); }
Double_t XMax()
{ return Max(0); }
Double_t YMin()
{ return Min(1); }
Double_t YMax()
{ return Max(1); }
Double_t ZMin()
{ return Min(2); }
Double_t ZMax()
{ return Max(2); }
Double_t Volume()
{ return fVolume; }
Double_t Diagonal()
{ return fDiagonal; }

Author: Richard Maunder 25/05/2005
Last update: root/gl:$Id: TGLBoundingBox.h 21702 2008-01-14 18:55:14Z matevz $
Copyright (C) 1995-2004, Rene Brun and Fons Rademakers. *

This page has been automatically generated. If you have any comments or suggestions about the page layout send a mail to ROOT support, or contact the developers with any questions or problems regarding ROOT.