ROOT logo
// @(#)root/base:$Id: TAttBBox.cxx 20877 2007-11-19 11:17:07Z rdm $
// Author: Matevz Tadel  7/4/2006

/*************************************************************************
 * Copyright (C) 1995-2006, Rene Brun and Fons Rademakers.               *
 * All rights reserved.                                                  *
 *                                                                       *
 * For the licensing terms see $ROOTSYS/LICENSE.                         *
 * For the list of contributors see $ROOTSYS/README/CREDITS.             *
 *************************************************************************/


#include "TAttBBox.h"


//______________________________________________________________________
// TAttBBox
//
// Helper for management of bounding-box information.
// Optionally used by classes that use direct OpenGL rendering
// via <Class>GL class.

ClassImp(TAttBBox)

//______________________________________________________________________________
void TAttBBox::BBoxInit(Float_t infinity)
{
   // Allocate and prepare for incremental filling.

   if (fBBox == 0) fBBox = new Float_t[6];

   fBBox[0] =  infinity;   fBBox[1] = -infinity;
   fBBox[2] =  infinity;   fBBox[3] = -infinity;
   fBBox[4] =  infinity;   fBBox[5] = -infinity;
}

//______________________________________________________________________________
void TAttBBox::BBoxZero(Float_t epsilon, Float_t x, Float_t y, Float_t z)
{
   // Create cube of volume (2*epsiolon)^3 at (x,y,z).
   // epsilon iz zero by default.

   if (fBBox == 0) fBBox = new Float_t[6];

   fBBox[0] = x - epsilon;   fBBox[1] = x + epsilon;
   fBBox[2] = y - epsilon;   fBBox[3] = y + epsilon;
   fBBox[4] = z - epsilon;   fBBox[5] = z + epsilon;
}

//______________________________________________________________________________
void TAttBBox::BBoxClear()
{
   // Remove BBox information.

   delete [] fBBox; fBBox = 0;
}

//______________________________________________________________________________
void TAttBBox::AssertBBoxExtents(Float_t epsilon)
{
   // Assert extents of all sides of the bounding-box are at least epsilon.

   for (Int_t i=0; i<6; i+=2) {
      if (fBBox[i+1] - fBBox[i] < epsilon) {
         Float_t b  = 0.5*(fBBox[i] + fBBox[i+1]);
         fBBox[i]   = b - 0.5*epsilon;
         fBBox[i+1] = b + 0.5*epsilon;
      }
   } 
}
 TAttBBox.cxx:1
 TAttBBox.cxx:2
 TAttBBox.cxx:3
 TAttBBox.cxx:4
 TAttBBox.cxx:5
 TAttBBox.cxx:6
 TAttBBox.cxx:7
 TAttBBox.cxx:8
 TAttBBox.cxx:9
 TAttBBox.cxx:10
 TAttBBox.cxx:11
 TAttBBox.cxx:12
 TAttBBox.cxx:13
 TAttBBox.cxx:14
 TAttBBox.cxx:15
 TAttBBox.cxx:16
 TAttBBox.cxx:17
 TAttBBox.cxx:18
 TAttBBox.cxx:19
 TAttBBox.cxx:20
 TAttBBox.cxx:21
 TAttBBox.cxx:22
 TAttBBox.cxx:23
 TAttBBox.cxx:24
 TAttBBox.cxx:25
 TAttBBox.cxx:26
 TAttBBox.cxx:27
 TAttBBox.cxx:28
 TAttBBox.cxx:29
 TAttBBox.cxx:30
 TAttBBox.cxx:31
 TAttBBox.cxx:32
 TAttBBox.cxx:33
 TAttBBox.cxx:34
 TAttBBox.cxx:35
 TAttBBox.cxx:36
 TAttBBox.cxx:37
 TAttBBox.cxx:38
 TAttBBox.cxx:39
 TAttBBox.cxx:40
 TAttBBox.cxx:41
 TAttBBox.cxx:42
 TAttBBox.cxx:43
 TAttBBox.cxx:44
 TAttBBox.cxx:45
 TAttBBox.cxx:46
 TAttBBox.cxx:47
 TAttBBox.cxx:48
 TAttBBox.cxx:49
 TAttBBox.cxx:50
 TAttBBox.cxx:51
 TAttBBox.cxx:52
 TAttBBox.cxx:53
 TAttBBox.cxx:54
 TAttBBox.cxx:55
 TAttBBox.cxx:56
 TAttBBox.cxx:57
 TAttBBox.cxx:58
 TAttBBox.cxx:59
 TAttBBox.cxx:60
 TAttBBox.cxx:61
 TAttBBox.cxx:62
 TAttBBox.cxx:63
 TAttBBox.cxx:64
 TAttBBox.cxx:65
 TAttBBox.cxx:66
 TAttBBox.cxx:67
 TAttBBox.cxx:68
 TAttBBox.cxx:69
 TAttBBox.cxx:70