12 #ifndef ROOT_TGLBoundingBox
13 #define ROOT_TGLBoundingBox
56 TGLVertex3 fVertex[8];
60 TGLVector3 fAxesNorm[3];
64 Bool_t ValidIndex(UInt_t index)
const {
return (index < 8); }
65 Double_t Min(UInt_t index)
const;
66 Double_t Max(UInt_t index)
const;
70 TGLBoundingBox(
const TGLVertex3 vertex[8]);
71 TGLBoundingBox(
const Double_t vertex[8][3]);
72 TGLBoundingBox(
const TGLVertex3 & lowVertex,
const TGLVertex3 & highVertex);
73 TGLBoundingBox(
const TGLBoundingBox & other);
74 virtual ~TGLBoundingBox();
77 TGLBoundingBox & operator =(
const TGLBoundingBox & other);
78 void Set(
const TGLVertex3 vertex[8]);
79 void Set(
const Double_t vertex[8][3]);
80 void Set(
const TGLBoundingBox & other);
84 void SetAligned(
const TGLVertex3 & lowVertex,
const TGLVertex3 & highVertex);
85 void SetAligned(UInt_t nbPnts,
const Double_t * pnts);
86 void MergeAligned(
const TGLBoundingBox & other);
87 void ExpandAligned(
const TGLVertex3 & point);
90 void Transform(
const TGLMatrix & matrix);
91 void Scale(Double_t factor);
92 void Scale(Double_t xFactor, Double_t yFactor, Double_t zFactor);
93 void Translate(
const TGLVector3 & offset);
96 const TGLVertex3 & operator [] (UInt_t index)
const;
97 const TGLVertex3 & Vertex(UInt_t index)
const;
98 Double_t XMin()
const {
return Min(0); }
99 Double_t XMax()
const {
return Max(0); }
100 Double_t YMin()
const {
return Min(1); }
101 Double_t YMax()
const {
return Max(1); }
102 Double_t ZMin()
const {
return Min(2); }
103 Double_t ZMax()
const {
return Max(2); }
104 TGLVertex3 MinAAVertex()
const;
105 TGLVertex3 MaxAAVertex()
const;
108 const TGLVertex3* Vertices()
const;
109 Int_t NumVertices()
const {
return 8; }
111 enum EFace { kFaceLowX, kFaceHighX, kFaceLowY, kFaceHighY, kFaceLowZ, kFaceHighZ, kFaceCount };
112 const std::vector<UInt_t> & FaceVertices(EFace face)
const;
115 TGLVertex3 Center()
const;
116 TGLVector3 Extents()
const;
117 const TGLVector3 & Axis(UInt_t i, Bool_t normalised = kTRUE)
const;
118 Bool_t IsEmpty()
const;
119 Double_t Volume()
const {
return fVolume; }
120 Double_t Diagonal()
const {
return fDiagonal; }
121 void PlaneSet(TGLPlaneSet_t & planeSet)
const;
122 TGLPlane GetNearPlane()
const;
125 Rgl::EOverlap Overlap(
const TGLPlane & plane)
const;
126 Rgl::EOverlap Overlap(
const TGLBoundingBox & box)
const;
128 void Draw(Bool_t solid = kFALSE)
const;
131 ClassDef(TGLBoundingBox,0);
135 inline TGLBoundingBox & TGLBoundingBox::operator =(
const TGLBoundingBox & other)
138 if (
this != &other) {
145 inline const TGLVertex3 & TGLBoundingBox::operator [] (UInt_t index)
const
147 return fVertex[index];
151 inline const TGLVertex3 & TGLBoundingBox::Vertex(UInt_t index)
const
153 return fVertex[index];
157 inline const TGLVertex3* TGLBoundingBox::Vertices()
const
163 inline TGLVector3 TGLBoundingBox::Extents()
const
166 return TGLVector3(Axis(0,kFALSE).Mag(),
167 Axis(1,kFALSE).Mag(),
168 Axis(2,kFALSE).Mag());
172 inline TGLVertex3 TGLBoundingBox::Center()
const
175 return TGLVertex3((fVertex[0].X() + fVertex[6].X())/2.0,
176 (fVertex[0].Y() + fVertex[6].Y())/2.0,
177 (fVertex[0].Z() + fVertex[6].Z())/2.0);
181 inline const TGLVector3 & TGLBoundingBox::Axis(UInt_t i, Bool_t normalised)
const
205 inline Bool_t TGLBoundingBox::IsEmpty()
const
210 return (Diagonal() == 0.0);
213 #endif // ROOT_TGLBoundingBox