diff --git a/graf3d/gl/inc/TGLBoundingBox.h b/graf3d/gl/inc/TGLBoundingBox.h index 74e605001e71db02a91c917da9ce3625c4908bfe..2ccec17037eb96cec7ddf5debe250876c52df92c 100644 --- a/graf3d/gl/inc/TGLBoundingBox.h +++ b/graf3d/gl/inc/TGLBoundingBox.h @@ -55,7 +55,7 @@ private: // For axis aligned 2 verticies would suffice. // Rest could be calculated on demand - however speed more important // than memory considerations - std::vector<TGLVertex3> fVertex; //! the 8 bounding box vertices + TGLVertex3 fVertex[8]; //! the 8 bounding box vertices Double_t fVolume; //! box volume - cached for speed Double_t fDiagonal; //! max box diagonal - cached for speed TGLVector3 fAxes[3]; //! box axes in global frame - cached for speed @@ -107,7 +107,9 @@ public: TGLVertex3 MaxAAVertex() const; // Multiple vertices accessors - const std::vector<TGLVertex3> & Vertices() const; // All 8 box vertices + const TGLVertex3* Vertices() const; // All 8 box vertices + Int_t NumVertices() const { return 8; } + enum EFace { kFaceLowX, kFaceHighX, kFaceLowY, kFaceHighY, kFaceLowZ, kFaceHighZ, kFaceCount }; const std::vector<UInt_t> & FaceVertices(EFace face) const; // 4 box face vertices @@ -154,7 +156,7 @@ inline const TGLVertex3 & TGLBoundingBox::Vertex(UInt_t index) const } //______________________________________________________________________________ -inline const std::vector<TGLVertex3> & TGLBoundingBox::Vertices() const +inline const TGLVertex3* TGLBoundingBox::Vertices() const { return fVertex; } diff --git a/graf3d/gl/src/TGLBoundingBox.cxx b/graf3d/gl/src/TGLBoundingBox.cxx index ef591c36dbedebe3c8684aa7cb495e1e8f9a6665..301090604d1ee18e1c5a8c76b01c848067e9e1f5 100644 --- a/graf3d/gl/src/TGLBoundingBox.cxx +++ b/graf3d/gl/src/TGLBoundingBox.cxx @@ -28,40 +28,35 @@ ClassImp(TGLBoundingBox) //______________________________________________________________________________ -TGLBoundingBox::TGLBoundingBox() : - fVertex(8) +TGLBoundingBox::TGLBoundingBox() { // Construct an empty bounding box SetEmpty(); } //______________________________________________________________________________ -TGLBoundingBox::TGLBoundingBox(const TGLVertex3 vertex[8]) : - fVertex(8) +TGLBoundingBox::TGLBoundingBox(const TGLVertex3 vertex[8]) { // Construct a bounding box from provided 8 vertices Set(vertex); } //______________________________________________________________________________ -TGLBoundingBox::TGLBoundingBox(const Double_t vertex[8][3]) : - fVertex(8) +TGLBoundingBox::TGLBoundingBox(const Double_t vertex[8][3]) { // Construct a bounding box from provided 8 vertices Set(vertex); } //______________________________________________________________________________ -TGLBoundingBox::TGLBoundingBox(const TGLVertex3 & lowVertex, const TGLVertex3 & highVertex) : - fVertex(8) +TGLBoundingBox::TGLBoundingBox(const TGLVertex3 & lowVertex, const TGLVertex3 & highVertex) { // Construct an global axis ALIGNED bounding box from provided low/high vertex pair SetAligned(lowVertex, highVertex); } //______________________________________________________________________________ -TGLBoundingBox::TGLBoundingBox(const TGLBoundingBox & other) : - fVertex(8) +TGLBoundingBox::TGLBoundingBox(const TGLBoundingBox & other) { // Construct a bounding box as copy of existing one Set(other); diff --git a/graf3d/gl/src/TGLCamera.cxx b/graf3d/gl/src/TGLCamera.cxx index cef0303275a7a880a3cf89a80a86b5363d70821c..cc6cfcea510ee8dd4f284f36756315ee79d335d6 100644 --- a/graf3d/gl/src/TGLCamera.cxx +++ b/graf3d/gl/src/TGLCamera.cxx @@ -359,13 +359,13 @@ TGLRect TGLCamera::ViewportRect(const TGLBoundingBox & box, if (face) { vertexCount = box.FaceVertices(*face).size(); } else { - vertexCount = box.Vertices().size(); + vertexCount = box.NumVertices(); } for (UInt_t i = 0; i < vertexCount; i++) { - const TGLVertex3 & vertex = face ? box.Vertices().at(box.FaceVertices(*face).at(i)) : - box.Vertices().at(i); + const TGLVertex3 & vertex = face ? box.Vertex(box.FaceVertices(*face).at(i)) : + box.Vertex(i); gluProject(vertex.X(), vertex.Y(), vertex.Z(), fModVM.CArr(), fProjM.CArr(), fViewport.CArr(), diff --git a/graf3d/gl/src/TGLScene.cxx b/graf3d/gl/src/TGLScene.cxx index 65ee5271807385d053a114bdd1652d318e57c988..a898ccf65760bd28bc937458b2726d2960584d21 100644 --- a/graf3d/gl/src/TGLScene.cxx +++ b/graf3d/gl/src/TGLScene.cxx @@ -926,7 +926,7 @@ void TGLScene::CalcBoundingBox() const assert(kFALSE); continue; } - TGLBoundingBox box = physicalShape->BoundingBox(); + const TGLBoundingBox& box = physicalShape->BoundingBox(); if (physicalShapeIt == fPhysicalShapes.begin()) { xMin = box.XMin(); xMax = box.XMax(); yMin = box.YMin(); yMax = box.YMax();