library: libRGL #include "TGLBoundingBox.h"

# TGLBoundingBox

class description - source file - inheritance tree (.pdf)

## class TGLBoundingBox

| Inheritance Chart:
`TGLBoundingBox` |

        private:

          Double_t Max(UInt_t index) const
          Double_t Min(UInt_t index) const
              void UpdateVolume()
            Bool_t ValidIndex(UInt_t index) const

        public:

                            TGLBoundingBox()
                            TGLBoundingBox(const TGLVertex3* vertex)
                            TGLBoundingBox(const Double_t** vertex)
                            TGLBoundingBox(const TGLVertex3& lowVertex, const TGLVertex3& highVertex)
                            TGLBoundingBox(const TGLBoundingBox& other)
                    virtual ~TGLBoundingBox()
                     Bool_t AlignedContains(const TGLBoundingBox& other) const
                 TGLVector3 Axis(UInt_t i, Bool_t normalised = true) const
                 TGLVertex3 Center() const
             static TClass* Class()
                       void Draw() const
                       void Dump() const
                 TGLVector3 Extents() const
              static Bool_t Intersect(const TGLBoundingBox& a, const TGLBoundingBox& b)
            virtual TClass* IsA() const
                     Bool_t IsEmpty() const
            TGLBoundingBox& operator=(const TGLBoundingBox& other)
          const TGLVertex3& operator[](UInt_t index) const
                   EOverlap Overlap(const TGLPlane& plane) const
                       void Scale(Double_t val)
                       void Set(const TGLVertex3* vertex)
                       void Set(const Double_t** vertex)
                       void Set(const TGLBoundingBox& other)
                       void SetAligned(const TGLVertex3& lowVertex, const TGLVertex3& highVertex)
                       void SetAligned(UInt_t nbPnts, const Double_t* pnts)
                       void SetEmpty()
               virtual void ShowMembers(TMemberInspector& insp, char* parent)
               virtual void Streamer(TBuffer& b)
                       void StreamerNVirtual(TBuffer& b)
                       void Transform(const TGLMatrix& matrix)
                       void Translate(const TGLVector3& offset)
                   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

### Data Members

        private:

          TGLVertex3 fVertex[8]  ! the 8 bounding box vertices
            Double_t fVolume     ! box volume - cached for speed

## Class Description

TGLBoundingBox()

TGLBoundingBox(const TGLVertex3 vertex[8])

TGLBoundingBox(const Double_t vertex[8][3])

TGLBoundingBox(const TGLVertex3 & lowVertex, const TGLVertex3 & highVertex)

TGLBoundingBox(const TGLBoundingBox & other)

~TGLBoundingBox()

void Set(const TGLVertex3 vertex[8])

void Set(const Double_t vertex[8][3])

void Set(const TGLBoundingBox & other)

void SetEmpty()

void SetAligned(const TGLVertex3 & lowVertex, const TGLVertex3 & highVertex)

     Set aligned box from two axis aligned low/high vertices
       7-------6
      /|      /|
     3-------2 |
     | 4-----|-5
     |/      |
     0-------1

void SetAligned(UInt_t nbPnts, const Double_t * pnts)

     Set aligned box using one or more points

void Scale(Double_t scale)

void Translate(const TGLVector3 & offset)

void Transform(const TGLMatrix & matrix)

EOverlap Overlap(const TGLPlane & plane) const

     TODO: Cheaper sphere test
     Test all 8 box vertices against plane

Bool_t AlignedContains(const TGLBoundingBox & other) const

     Test is passed box is contained by us. This will ONLY work if we are axis aligned

Bool_t Intersect(const TGLBoundingBox & a, const TGLBoundingBox & b)

     TODO: For some reason this intersection test gives incorrect result if first
     BB is smaller than other - no idea why as should be symetric - need to investigate.
    assert(Volume() > other.Volume());

void Draw() const

Double_t Min(UInt_t index) const

Double_t Max(UInt_t index) const

void Dump() const

### Inline Functions

                         void UpdateVolume()
                       Bool_t ValidIndex(UInt_t index) const
              TGLBoundingBox& operator=(const TGLBoundingBox& other)
            const TGLVertex3& operator[](UInt_t index) const
                     Double_t XMin() const
                     Double_t XMax() const
                     Double_t YMin() const
                     Double_t YMax() const
                     Double_t ZMin() const
                     Double_t ZMax() const
                   TGLVertex3 Center() const
                   TGLVector3 Extents() const
                   TGLVector3 Axis(UInt_t i, Bool_t normalised = true) const
                     Double_t Volume() const
                       Bool_t IsEmpty() const
                      TClass* Class()
                      TClass* IsA() const
                         void ShowMembers(TMemberInspector& insp, char* parent)
                         void Streamer(TBuffer& b)
                         void StreamerNVirtual(TBuffer& b)

Author: Richard Maunder 25/05/2005
Last update: root/gl:$Name: $:$Id: TGLBoundingBox.cxx,v 1.8 2005/06/24 14:53:02 brun Exp $
Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. *