From 1e8bd1fb8fb784b1791935e8b52bb7e65c9caea3 Mon Sep 17 00:00:00 2001
From: marco <marco@5a81b35b-ba03-0410-adc8-b2c5c5119f08>
Date: Mon, 5 Jul 2010 06:58:30 +0000
Subject: [PATCH] introduce GetBounds() method for entity, chains and residues

GetGeometricStart()/GetGeometricEnd() has been deprecated and
will be removed sooner or later.

git-svn-id: https://dng.biozentrum.unibas.ch/svn/openstructure/trunk@2501 5a81b35b-ba03-0410-adc8-b2c5c5119f08
---
 code_fragments/entity/gfx_symmetry.py         |  2 +-
 demos/bbox.py                                 |  2 -
 modules/geom/pymod/export_composite3.cc       |  6 ++
 modules/geom/src/vec3.cc                      |  6 ++
 modules/geom/src/vec3.hh                      |  2 +
 modules/gui/src/scene_menu.cc                 |  6 +-
 modules/mol/base/pymod/bounds.hh              | 36 ++++++++++++
 modules/mol/base/pymod/export_chain.cc        | 11 ++--
 modules/mol/base/pymod/export_chain_view.cc   | 11 ++--
 modules/mol/base/pymod/export_entity.cc       | 17 ++++--
 modules/mol/base/pymod/export_entity_view.cc  | 11 ++--
 modules/mol/base/pymod/export_residue.cc      | 12 ++--
 modules/mol/base/pymod/export_residue_view.cc | 11 ++--
 modules/mol/base/src/bounding_box.cc          |  4 +-
 modules/mol/base/src/chain_handle.cc          | 16 +-----
 modules/mol/base/src/chain_handle.hh          | 13 +----
 modules/mol/base/src/chain_view.cc            | 45 +++++----------
 modules/mol/base/src/chain_view.hh            | 10 +---
 modules/mol/base/src/entity_handle.cc         | 19 +------
 modules/mol/base/src/entity_handle.hh         | 14 +----
 modules/mol/base/src/entity_view.cc           | 36 ++++--------
 modules/mol/base/src/entity_view.hh           | 10 +---
 modules/mol/base/src/impl/chain_impl.cc       | 34 ++++--------
 modules/mol/base/src/impl/chain_impl.hh       |  7 ++-
 modules/mol/base/src/impl/entity_impl.cc      | 55 ++++---------------
 modules/mol/base/src/impl/entity_impl.hh      |  9 +--
 modules/mol/base/src/impl/residue_impl.cc     | 40 ++++++--------
 modules/mol/base/src/impl/residue_impl.hh     |  6 +-
 modules/mol/base/src/residue_handle.cc        | 16 +-----
 modules/mol/base/src/residue_handle.hh        | 17 ++----
 modules/mol/base/src/residue_view.cc          | 31 ++---------
 modules/mol/base/src/residue_view.hh          |  9 +--
 32 files changed, 204 insertions(+), 320 deletions(-)
 create mode 100644 modules/mol/base/pymod/bounds.hh

diff --git a/code_fragments/entity/gfx_symmetry.py b/code_fragments/entity/gfx_symmetry.py
index a0d795ece..bfef9fb1b 100644
--- a/code_fragments/entity/gfx_symmetry.py
+++ b/code_fragments/entity/gfx_symmetry.py
@@ -8,7 +8,7 @@ ent=io.LoadEntity(filename)
 
 edi=ent.RequestXCSEditor()
 m=geom.Mat4()
-m.PasteTranslation(-ent.GetGeometricStart())
+m.PasteTranslation(-ent.bounds.min)
 edi.ApplyTransform(m)
 edi.UpdateICS()
 frag=gfx.Entity('frag', ent)
diff --git a/demos/bbox.py b/demos/bbox.py
index 1e4215f45..242ba49b1 100644
--- a/demos/bbox.py
+++ b/demos/bbox.py
@@ -10,8 +10,6 @@ def RenderBBox(bbox):
   bb.SetFillColor(gfx.Color(0.5, 0.8, 0.5, 0.2))
   scene.Add(bb)
 
-print 'Center:',(helix.GetGeometricStart()+helix.GetGeometricEnd())*.5
-  
 RenderBBox(bbox)
 scene.center=go.center
 print 'Demo2: Translucent bounding box around an OpenStructure entity'
diff --git a/modules/geom/pymod/export_composite3.cc b/modules/geom/pymod/export_composite3.cc
index bf269d552..ed69d1ae4 100644
--- a/modules/geom/pymod/export_composite3.cc
+++ b/modules/geom/pymod/export_composite3.cc
@@ -161,6 +161,12 @@ scope PlaneScope =
          return_value_policy<copy_const_reference>())
     .def("GetMax", &AlignedCuboid::GetMax, 
          return_value_policy<copy_const_reference>())
+    .def("GetCenter", &AlignedCuboid::GetCenter)
+    .add_property("max", make_function(&AlignedCuboid::GetMax,
+         return_value_policy<copy_const_reference>()))
+    .add_property("min", make_function(&AlignedCuboid::GetMin,
+         return_value_policy<copy_const_reference>()))
+    .add_property("center", &AlignedCuboid::GetCenter)
   ;
 }
 
diff --git a/modules/geom/src/vec3.cc b/modules/geom/src/vec3.cc
index 1e48f270c..e84c2b64a 100644
--- a/modules/geom/src/vec3.cc
+++ b/modules/geom/src/vec3.cc
@@ -34,6 +34,12 @@ Vec3::Vec3(Real x, Real y, Real z)
   this->set(x,y,z);
 }
 
+Vec3::Vec3(Real v)
+{
+  this->set(v, v, v);
+}
+
+
 //#if OST_DOUBLE_PRECISION
 //Vec3::Vec3(float x, float y, float z)
 //{
diff --git a/modules/geom/src/vec3.hh b/modules/geom/src/vec3.hh
index fecac3370..1e534f1d1 100644
--- a/modules/geom/src/vec3.hh
+++ b/modules/geom/src/vec3.hh
@@ -64,6 +64,8 @@ public:
   //! explicit initialization with an array of doubles
   explicit Vec3(const Real[3]);
 
+  explicit Vec3(Real v);
+  
 #if OST_DOUBLE_PRECISION
   //! explicit initialization with an array of floats
   explicit Vec3(const float[3]);
diff --git a/modules/gui/src/scene_menu.cc b/modules/gui/src/scene_menu.cc
index ceba5546a..597064469 100644
--- a/modules/gui/src/scene_menu.cc
+++ b/modules/gui/src/scene_menu.cc
@@ -102,20 +102,20 @@ void SceneMenu::CenterOnResidue()
 void SceneMenu::CenterOnChain()
 {
   mol::ChainHandle chain=picked_.second.GetResidue().GetChain();
-  gfx::Scene::Instance().SetCenter(chain.GetGeometricCenter());
+  gfx::Scene::Instance().SetCenter(chain.GetBounds().GetCenter());
 }
 
 void SceneMenu::CenterOnView()
 {
   mol::ResidueHandle res=picked_.second.GetResidue();
-  gfx::Scene::Instance().SetCenter(res.GetGeometricCenter());
+  gfx::Scene::Instance().SetCenter(res.GetBounds().GetCenter());
 }
 
 void SceneMenu::CenterOnSelection()
 {
   gfx::EntityP e=dyn_cast<gfx::Entity>(picked_.first);
   if (e->GetSelection() && e->GetSelection().GetAtomCount()>0) {
-    geom::Vec3 center=e->GetSelection().GetGeometricCenter();
+    geom::Vec3 center=e->GetSelection().GetBounds().GetCenter();
     gfx::Scene::Instance().SetCenter(center);
   }
 }
diff --git a/modules/mol/base/pymod/bounds.hh b/modules/mol/base/pymod/bounds.hh
new file mode 100644
index 000000000..9182f67ee
--- /dev/null
+++ b/modules/mol/base/pymod/bounds.hh
@@ -0,0 +1,36 @@
+#ifndef OST_MOL_EXPORT_BOUNDS_HH
+#define OST_MOL_EXPORT_BOUNDS_HH
+
+#include <ost/log.hh>
+  
+template <typename H>
+geom::Vec3 geom_center(const H& h)
+{
+  return h.GetBounds().GetCenter();
+}
+
+template <typename H>
+geom::Vec3 geom_size(const H& h)
+{
+  LOGN_MESSAGE("GetBoundarySize()/boundary_size is deprecated. Use bounds.size"
+               " instead")
+  return h.GetBounds().GetSize();
+}
+
+template <typename H>
+geom::Vec3 geom_start(const H& h)
+{
+  LOGN_MESSAGE("GetGeometricStart()/geometric_start is deprecated. Use "
+               "bounds.min instead")
+  return h.GetBounds().GetMin();
+}
+
+template <typename H>
+geom::Vec3 geom_end(const H& h)
+{
+  LOGN_MESSAGE("GetGeometricEnd()/geometric_end is deprecated. Use "
+               "bounds.max instead")
+  return h.GetBounds().GetMax();
+}
+
+#endif
diff --git a/modules/mol/base/pymod/export_chain.cc b/modules/mol/base/pymod/export_chain.cc
index a0c603fd7..1e2e59285 100644
--- a/modules/mol/base/pymod/export_chain.cc
+++ b/modules/mol/base/pymod/export_chain.cc
@@ -25,6 +25,7 @@ using namespace boost::python;
 using namespace ost;
 using namespace ost::mol;
 #include <ost/export_helper/generic_property_def.hh>
+#include "bounds.hh"
 
 namespace {
   typedef void (ChainHandle::*RnumMethod)(const ResNum&);
@@ -83,15 +84,17 @@ void export_Chain()
     .def("GetMass", &ChainHandle::GetMass)
     .def("GetCenterOfMass", &ChainHandle::GetCenterOfMass)
     .def("GetCenterOfAtoms", &ChainHandle::GetCenterOfAtoms)
-    .def("GetGeometricCenter", &ChainHandle::GetGeometricCenter)
-    .add_property("geometric_center", &ChainHandle::GetGeometricCenter)
+    .def("GetGeometricCenter", geom_center<ChainHandle>)
+    .add_property("geometric_center", geom_center<ChainHandle>)
     .add_property("mass", &ChainHandle::GetMass)
     .add_property("center_of_mass", &ChainHandle::GetCenterOfMass)
     .add_property("center_of_atoms", &ChainHandle::GetCenterOfAtoms)  
     .add_property("in_sequence", &ChainHandle::InSequence)  
     .add_property("valid", &ChainHandle::IsValid)    
-    .def("GetGeometricStart", &ChainHandle::GetGeometricStart)
-    .def("GetGeometricEnd", &ChainHandle::GetGeometricEnd)
+    .def("GetBounds", &ChainHandle::GetBounds)
+    .add_property("bounds", &ChainHandle::GetBounds)
+    .def("GetGeometricStart", geom_start<ChainHandle>)
+    .def("GetGeometricEnd", geom_end<ChainHandle>)
   ;
   
   class_<ChainHandleList>("ChainHandleList", no_init)
diff --git a/modules/mol/base/pymod/export_chain_view.cc b/modules/mol/base/pymod/export_chain_view.cc
index ee6753b52..471b592a1 100644
--- a/modules/mol/base/pymod/export_chain_view.cc
+++ b/modules/mol/base/pymod/export_chain_view.cc
@@ -27,6 +27,7 @@ using namespace boost::python;
 #include <ost/export_helper/vector.hh>
 using namespace ost;
 using namespace ost::mol;
+#include "bounds.hh"
 
 namespace {
 typedef ResidueView (ChainView::*RnumMethod)(const ResNum&) const;
@@ -92,15 +93,17 @@ void export_ChainView()
     .def("GetMass", &ChainView::GetMass)
     .def("GetCenterOfMass", &ChainView::GetCenterOfMass)
     .def("GetCenterOfAtoms", &ChainView::GetCenterOfAtoms)
-    .def("GetGeometricCenter", &ChainView::GetGeometricCenter)
-    .add_property("geometric_center", &ChainView::GetGeometricCenter)
+    .def("GetGeometricCenter", geom_center<ChainView>)
+    .add_property("geometric_center", geom_center<ChainView>)
     .add_property("mass", &ChainView::GetMass)
     .add_property("center_of_mass", &ChainView::GetCenterOfMass)
     .add_property("center_of_atoms", &ChainView::GetCenterOfAtoms)
     .add_property("valid", &ChainView::IsValid)      
     .add_property("in_sequence", &ChainView::InSequence)    
-    .def("GetGeometricStart", &ChainView::GetGeometricStart)
-    .def("GetGeometricEnd", &ChainView::GetGeometricEnd)
+    .def("GetGeometricStart", geom_start<ChainView>)
+    .def("GetGeometricEnd", geom_end<ChainView>)
+    .def("GetBounds", &ChainView::GetBounds)
+    .add_property("bounds", &ChainView::GetBounds)
   ;
 
 
diff --git a/modules/mol/base/pymod/export_entity.cc b/modules/mol/base/pymod/export_entity.cc
index a8fa1c8d8..b0df16c0c 100644
--- a/modules/mol/base/pymod/export_entity.cc
+++ b/modules/mol/base/pymod/export_entity.cc
@@ -23,7 +23,7 @@ using namespace boost::python;
 #include <ost/mol/entity_view.hh>
 #include <ost/mol/query.hh>
 #include <ost/mol/mol.hh>
-
+#include "bounds.hh"
 
 using namespace ost;
 using namespace ost::mol;
@@ -55,6 +55,7 @@ BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(X_xcs_editor_overloads,
 BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(X_ics_editor_overloads, 
                                       EntityHandle::RequestICSEditor, 0, 1)                                      
 
+
 }
 
 void export_Entity()
@@ -81,11 +82,13 @@ void export_Entity()
     .def("GetMass", &EntityHandle::GetMass)
     .def("GetCenterOfMass", &EntityHandle::GetCenterOfMass)
     .def("GetCenterOfAtoms", &EntityHandle::GetCenterOfAtoms)
-    .def("GetGeometricCenter", &EntityHandle::GetGeometricCenter)
-    .add_property("geometric_center", &EntityHandle::GetGeometricCenter)
-    .def("GetGeometricStart", &EntityHandle::GetGeometricStart)
-    .def("GetGeometricEnd", &EntityHandle::GetGeometricEnd)
-    .def("GetBoundarySize", &EntityHandle::GetBoundarySize)
+    .def("GetGeometricCenter", geom_center<EntityHandle>)
+    .add_property("geometric_center", geom_center<EntityHandle>)
+    .add_property("geometric_end", geom_end<EntityHandle>)
+    .add_property("geometric_start", geom_start<EntityHandle>)
+    .def("GetGeometricStart", geom_start<EntityHandle>)
+    .def("GetGeometricEnd", geom_end<EntityHandle>)
+    .def("GetBoundarySize", geom_size<EntityHandle>)
     .def("GetResidueCount", &EntityHandle::GetResidueCount)
     .def("GetAtomCount", &EntityHandle::GetAtomCount)
     .def("GetBondCount", &EntityHandle::GetBondCount)
@@ -111,6 +114,8 @@ void export_Entity()
     .add_property("chains", &EntityHandle::GetChainList)
     .add_property("bonds", &EntityHandle::GetBondList)
     .add_property("valid", &EntityHandle::IsValid)
+    .def("GetBounds", &EntityHandle::GetBounds)
+    .add_property("bounds", &EntityHandle::GetBounds)
     .def("GetTransformationMatrix", &EntityHandle::GetTransformationMatrix,
          return_value_policy<copy_const_reference>())
     .add_property("transform", 
diff --git a/modules/mol/base/pymod/export_entity_view.cc b/modules/mol/base/pymod/export_entity_view.cc
index aaa75efb7..3b3eadab2 100644
--- a/modules/mol/base/pymod/export_entity_view.cc
+++ b/modules/mol/base/pymod/export_entity_view.cc
@@ -26,6 +26,7 @@ using namespace boost::python;
 #include <ost/mol/view_op.hh>
 using namespace ost;
 using namespace ost::mol;
+#include "bounds.hh"
 
 namespace {
 
@@ -90,10 +91,10 @@ void export_EntityView()
     .def("FindAtom", find_atom_a)
     .def("FindAtom", find_atom_b)    
     .def("GetAtomCount", &EntityView::GetAtomCount)
-    .def("GetGeometricStart", &EntityView::GetGeometricStart)
-    .def("GetGeometricEnd", &EntityView::GetGeometricEnd)
-    .def("GetGeometricCenter", &EntityView::GetGeometricCenter)
-    .add_property("geometric_center", &EntityView::GetGeometricCenter)
+    .def("GetGeometricStart", geom_start<EntityView>)
+    .def("GetGeometricEnd", geom_end<EntityView>)
+    .def("GetGeometricCenter", geom_center<EntityView>)
+    .add_property("geometric_center", geom_center<EntityView>)
     .def("GetCenterOfMass", &EntityView::GetCenterOfMass)
     .def("GetCenterOfAtoms", &EntityView::GetCenterOfAtoms)
     .def("GetMass", &EntityView::GetMass)
@@ -153,6 +154,8 @@ void export_EntityView()
     .def(self==self)
     .def(self!=self)
     .def("Dump", &EntityView::Dump)
+    .def("GetBounds", &EntityView::GetBounds)
+    .add_property("bounds", &EntityView::GetBounds)    
   ;
   def("Union", &Union);
   def("Difference", &Difference);
diff --git a/modules/mol/base/pymod/export_residue.cc b/modules/mol/base/pymod/export_residue.cc
index 532f4b0a2..ef844831c 100644
--- a/modules/mol/base/pymod/export_residue.cc
+++ b/modules/mol/base/pymod/export_residue.cc
@@ -27,7 +27,7 @@ using namespace ost;
 using namespace ost::mol;
 
 #include <ost/export_helper/generic_property_def.hh>
-
+#include "bounds.hh"
 namespace {
   
   
@@ -165,20 +165,22 @@ void export_Residue()
     .def("GetMass", &ResidueHandle::GetMass)
     .def("GetCenterOfMass", &ResidueHandle::GetCenterOfMass)
     .def("GetCenterOfAtoms", &ResidueHandle::GetCenterOfAtoms)
-    .def("GetGeometricCenter", &ResidueHandle::GetGeometricCenter)
+    .def("GetGeometricCenter", geom_center<ResidueHandle>)
     .add_property("mass", &ResidueHandle::GetMass)
     .add_property("center_of_mass", &ResidueHandle::GetCenterOfMass)
     .add_property("center_of_atoms", &ResidueHandle::GetCenterOfAtoms)  
-    .add_property("geometric_center", &ResidueHandle::GetGeometricCenter)
+    .add_property("geometric_center", geom_center<ResidueHandle>)
     .add_property("phi_torsion", &ResidueHandle::GetPhiTorsion)
     .add_property("psi_torsion", &ResidueHandle::GetPsiTorsion)
     .add_property("omega_torsion", &ResidueHandle::GetOmegaTorsion)
     .add_property("valid", &ResidueHandle::IsValid) 
-    .def("GetGeometricStart", &ResidueHandle::GetGeometricStart)
-    .def("GetGeometricEnd", &ResidueHandle::GetGeometricEnd)
+    .def("GetGeometricStart", geom_start<ResidueHandle>)
+    .def("GetGeometricEnd", geom_end<ResidueHandle>)
     .def(self==self)
     .def(self!=self)
     .def("__hash__", &ResidueHandle::GetHashCode)
+    .def("GetBounds", &ResidueHandle::GetBounds)
+    .add_property("bounds", &ResidueHandle::GetBounds)    
   ;
 
   class_<ResidueHandleList>("ResidueHandleList", no_init)
diff --git a/modules/mol/base/pymod/export_residue_view.cc b/modules/mol/base/pymod/export_residue_view.cc
index 63bd1c746..f8dbd0896 100644
--- a/modules/mol/base/pymod/export_residue_view.cc
+++ b/modules/mol/base/pymod/export_residue_view.cc
@@ -25,6 +25,7 @@ using namespace boost::python;
 #include <ost/export_helper/vector.hh>
 using namespace ost;
 using namespace ost::mol;
+#include "bounds.hh"
 
 namespace {
 typedef AtomView (ResidueView::*StringMethod)(const String&) const;
@@ -79,14 +80,16 @@ void export_ResidueView()
     .def("GetMass", &ResidueView::GetMass)
     .def("GetCenterOfMass", &ResidueView::GetCenterOfMass)
     .def("GetCenterOfAtoms", &ResidueView::GetCenterOfAtoms)
-    .def("GetGeometricCenter", &ResidueView::GetGeometricCenter)
+    .def("GetGeometricCenter", geom_center<ResidueView>)
     .add_property("mass", &ResidueView::GetMass)
     .add_property("center_of_mass", &ResidueView::GetCenterOfMass)
     .add_property("center_of_atoms", &ResidueView::GetCenterOfAtoms)    
-    .add_property("geometric_center", &ResidueView::GetGeometricCenter)
+    .add_property("geometric_center", geom_center<ResidueView>)
     .add_property("valid", &ResidueView::IsValid)    
-    .def("GetGeometricStart", &ResidueView::GetGeometricStart)
-    .def("GetGeometricEnd", &ResidueView::GetGeometricEnd) 
+    .def("GetGeometricStart", geom_start<ResidueView>)
+    .def("GetGeometricEnd", geom_end<ResidueView>) 
+    .def("GetBounds", &ResidueView::GetBounds)
+    .add_property("bounds", &ResidueView::GetBounds)    
   ;
 
 
diff --git a/modules/mol/base/src/bounding_box.cc b/modules/mol/base/src/bounding_box.cc
index 8fd6a49d8..15473b5de 100644
--- a/modules/mol/base/src/bounding_box.cc
+++ b/modules/mol/base/src/bounding_box.cc
@@ -36,7 +36,7 @@ public:
   PrincipalAxisCalc(const EntityHandle& ent): 
     natoms_(ent.GetAtomCount())
   {
-    mean_=ent.GetGeometricCenter();
+    mean_=ent.GetBounds().GetCenter();
     cov_.setZero();
   }
   PrincipalAxisCalc(const AtomHandleList& atoms):
@@ -55,7 +55,7 @@ public:
   PrincipalAxisCalc(const EntityView& ent): 
     natoms_(ent.GetAtomCount())
   {
-    mean_=ent.GetGeometricCenter();
+    mean_=ent.GetBounds().GetCenter();
     cov_.setZero();
   }  
   virtual bool VisitAtom(const AtomHandle& atom)
diff --git a/modules/mol/base/src/chain_handle.cc b/modules/mol/base/src/chain_handle.cc
index 842017ae4..1f0e8094c 100644
--- a/modules/mol/base/src/chain_handle.cc
+++ b/modules/mol/base/src/chain_handle.cc
@@ -197,22 +197,10 @@ void ChainHandle::AssignSecondaryStructure(SecStructure ss,
   Impl()->AssignSecondaryStructure(ss, start, end);
 }
 
-geom::Vec3 ChainHandle::GetGeometricCenter() const
+geom::AlignedCuboid ChainHandle::GetBounds() const
 {
   this->CheckValidity();
-  return Impl()->GetGeometricCenter();
-}
-
-geom::Vec3 ChainHandle::GetGeometricStart() const
-{
-  this->CheckValidity();
-  return Impl()->GetGeometricStart();
-}
-
-geom::Vec3 ChainHandle::GetGeometricEnd() const
-{
-  this->CheckValidity();
-  return Impl()->GetGeometricEnd();
+  return Impl()->GetBounds();
 }
 
 geom::Vec3 ChainHandle::GetCenterOfMass() const
diff --git a/modules/mol/base/src/chain_handle.hh b/modules/mol/base/src/chain_handle.hh
index 0faa7ee8f..6337818de 100644
--- a/modules/mol/base/src/chain_handle.hh
+++ b/modules/mol/base/src/chain_handle.hh
@@ -166,18 +166,7 @@ public:
   /// similar to GetCenterOfMass(), but the atoms are not mass weighted
   geom::Vec3 GetCenterOfAtoms() const;
   
-  /// \brief Get entity's geometric center
-  ///
-  /// Returns the geometric center of the entity's bounding box
-  /// by calculating (GetGeometricStart()+GetGeometricEnd())/2
-  geom::Vec3 GetGeometricCenter() const;
-  
-  /// \brief Get entity's minimum cartesian coordinates
-  geom::Vec3 GetGeometricStart() const;
-  
-  /// \brief Get entity's maximum cartesian coordinates
-  geom::Vec3 GetGeometricEnd() const;
-  
+  geom::AlignedCuboid GetBounds() const;  
   /// \brief assign secondary structure to the inclusive residue range 
   ///        start, end
   void AssignSecondaryStructure(SecStructure ss, 
diff --git a/modules/mol/base/src/chain_view.cc b/modules/mol/base/src/chain_view.cc
index fac143b85..1c5ba252e 100644
--- a/modules/mol/base/src/chain_view.cc
+++ b/modules/mol/base/src/chain_view.cc
@@ -327,44 +327,29 @@ Real ChainView::GetMass() const {
   return mass;
 }
 
-geom::Vec3 ChainView::GetGeometricStart() const
+geom::AlignedCuboid ChainView::GetBounds() const
 {
   this->CheckValidity();
-  geom::Vec3 minimum(std::numeric_limits<Real>::max(),
-                     std::numeric_limits<Real>::max(),
-                     std::numeric_limits<Real>::max());
-  ResidueViewList::const_iterator i;
-  for (i=data_->residues.begin(); i!=data_->residues.end(); ++i) {
-    ResidueView r=*i;
-    for (AtomViewList::const_iterator j=r.GetAtomList().begin(),
-         e2=r.GetAtomList().end(); j!=e2; ++j) {
-      minimum=geom::Min(minimum, j->GetPos());
-    }
-  }
-  return minimum;
-}
+  geom::Vec3 mmin( std::numeric_limits<Real>::max());
+  geom::Vec3 mmax(-std::numeric_limits<Real>::max());
 
-geom::Vec3 ChainView::GetGeometricEnd() const
-{
-  this->CheckValidity();
-  geom::Vec3 maximum(-std::numeric_limits<Real>::max(),
-                     -std::numeric_limits<Real>::max(),
-                     -std::numeric_limits<Real>::max());
-  ResidueViewList::const_iterator i;
-  for (i=data_->residues.begin(); i!=data_->residues.end(); ++i) {
+  
+  bool atoms=false;
+  for (ResidueViewList::const_iterator
+       i=data_->residues.begin(); i!=data_->residues.end(); ++i) {
     ResidueView r=*i;
     for (AtomViewList::const_iterator j=r.GetAtomList().begin(),
          e2=r.GetAtomList().end(); j!=e2; ++j) {
-      maximum=geom::Max(maximum, j->GetPos());
+      mmin=geom::Min(mmin, j->GetPos());
+      mmax=geom::Max(mmax, j->GetPos());
+      atoms=true;
     }
   }
-  return maximum;
-}
-
-geom::Vec3 ChainView::GetGeometricCenter() const
-{
-  this->CheckValidity();
-  return (this->GetGeometricStart() + this->GetGeometricEnd())/2;
+  if (atoms) {
+    return geom::AlignedCuboid(mmin, mmax);
+  } else {
+    return geom::AlignedCuboid(geom::Vec3(), geom::Vec3());
+  }
 }
 
 geom::Vec3 ChainView::GetCenterOfAtoms() const
diff --git a/modules/mol/base/src/chain_view.hh b/modules/mol/base/src/chain_view.hh
index 3be942a56..800d1fc82 100644
--- a/modules/mol/base/src/chain_view.hh
+++ b/modules/mol/base/src/chain_view.hh
@@ -143,14 +143,8 @@ public:
   /// similar to GetCenterOfMass(), but the atoms are not mass weighted
   geom::Vec3 GetCenterOfAtoms() const;
   
-  /// \brief Get entity's geometric center
-  ///
-  /// Returns the geometric center of the entity's bounding box
-  /// by calculating (GetGeometricStart()+GetGeometricEnd())/2
-  geom::Vec3 GetGeometricCenter() const;
-  
-  geom::Vec3 GetGeometricStart() const;
-  geom::Vec3 GetGeometricEnd() const;
+  /// \brief Get entity's axis aligned bounding box
+  geom::AlignedCuboid GetBounds() const;
   
   /// /// \brief remove all residues from the view
   void RemoveResidues();
diff --git a/modules/mol/base/src/entity_handle.cc b/modules/mol/base/src/entity_handle.cc
index b7fad6713..17c47cd81 100644
--- a/modules/mol/base/src/entity_handle.cc
+++ b/modules/mol/base/src/entity_handle.cc
@@ -55,25 +55,12 @@ geom::Vec3 EntityHandle::GetCenterOfAtoms() const {
   return Impl()->GetCenterOfAtoms();
 }
 
-geom::Vec3 EntityHandle::GetGeometricCenter() const {
-  this->CheckValidity();
-  return Impl()->GetGeometricCenter();
-}
-
-geom::Vec3 EntityHandle::GetGeometricStart() const {
-  this->CheckValidity();
-  return Impl()->GetGeometricStart();
-}
-
-geom::Vec3 EntityHandle::GetGeometricEnd() const {
+geom::AlignedCuboid EntityHandle::GetBounds() const 
+{
   this->CheckValidity();
-  return Impl()->GetGeometricEnd();
+  return Impl()->GetBounds();
 }
 
-geom::Vec3 EntityHandle::GetBoundarySize() const {
-  this->CheckValidity();
-  return Impl()->GetBoundarySize();
-}
 
 EntityHandle::EntityHandle(const impl::EntityImplPtr& e)
   : EntityBase(e)
diff --git a/modules/mol/base/src/entity_handle.hh b/modules/mol/base/src/entity_handle.hh
index 9bb291d8e..540425c70 100644
--- a/modules/mol/base/src/entity_handle.hh
+++ b/modules/mol/base/src/entity_handle.hh
@@ -84,20 +84,8 @@ public:
   
   /// \brief Get entity's center of mass (mass weighted)
   geom::Vec3 GetCenterOfMass() const;  
-  /// \brief Get entity's geometric center
-  ///
-  /// Returns the geometric center of the entity's bounding box
-  /// by calculating (GetGeometricStart()+GetGeometricEnd())/2
-  geom::Vec3 GetGeometricCenter() const;
-
-  /// \brief Get entity's minimum cartesian coordinates
-  geom::Vec3 GetGeometricStart() const;
-
-  /// \brief Get entity's maximum cartesian coordinates
-  geom::Vec3 GetGeometricEnd() const;
 
-  /// \brief Get size of the entity
-  geom::Vec3 GetBoundarySize() const;
+  geom::AlignedCuboid GetBounds() const;
   //@}
   
   /// \brief
diff --git a/modules/mol/base/src/entity_view.cc b/modules/mol/base/src/entity_view.cc
index b6c5deabc..6be3145f3 100644
--- a/modules/mol/base/src/entity_view.cc
+++ b/modules/mol/base/src/entity_view.cc
@@ -171,13 +171,6 @@ geom::Vec3 EntityView::GetCenterOfAtoms() const
   return center;
 }
 
-geom::Vec3 EntityView::GetGeometricCenter() const 
-{
-  geom::Vec3 center;
-  center = (this->GetGeometricEnd() + this->GetGeometricStart())/2;
-  return center;
-}
-
 geom::Vec3 EntityView::GetCenterOfMass() const 
 {
   geom::Vec3 center;
@@ -726,17 +719,6 @@ AtomView EntityView::FindXAtom(const AtomHandle& ah)
 }
 #endif
 
-geom::Vec3 EntityView::GetGeometricStart() const
-{
-  this->CheckValidity();
-  geom::Vec3 m(std::numeric_limits<Real>::max(),
-               std::numeric_limits<Real>::max(),
-               std::numeric_limits<Real>::max());
-  for(AtomViewIter it=AtomsBegin(); it!=this->AtomsEnd(); ++it) {
-    m=geom::Min(m, (*it).GetPos());
-  }
-  return m;
-}
 
 AtomView EntityView::FindAtom(const String& chain_name, 
                               const ResNum& num,
@@ -749,16 +731,20 @@ AtomView EntityView::FindAtom(const String& chain_name,
   }
   return AtomView();
 }
-geom::Vec3 EntityView::GetGeometricEnd() const
+geom::AlignedCuboid EntityView::GetBounds() const
 {
   this->CheckValidity();
-  geom::Vec3 m(-std::numeric_limits<Real>::max(),
-               -std::numeric_limits<Real>::max(),
-               -std::numeric_limits<Real>::max());
-  for(AtomViewIter it=AtomsBegin(); it!=this->AtomsEnd(); ++it) {
-    m=geom::Max(m, (*it).GetPos());
+  geom::Vec3 mmin( std::numeric_limits<Real>::max());
+  geom::Vec3 mmax(-std::numeric_limits<Real>::max());
+  if (this->GetAtomCount()) {
+    for(AtomViewIter it=AtomsBegin(); it!=this->AtomsEnd(); ++it) {
+      mmax=geom::Max(mmax, (*it).GetPos());
+      mmin=geom::Min(mmin, (*it).GetPos());
+    }    
+    return geom::AlignedCuboid(mmin, mmax);
+  } else {
+    return geom::AlignedCuboid(geom::Vec3(), geom::Vec3());
   }
-  return m;
 }
 
 
diff --git a/modules/mol/base/src/entity_view.hh b/modules/mol/base/src/entity_view.hh
index e55894da5..6e3aa7bf8 100644
--- a/modules/mol/base/src/entity_view.hh
+++ b/modules/mol/base/src/entity_view.hh
@@ -108,14 +108,8 @@ public:
   /// similar to GetCenterOfMass(), but the atoms are not mass weighted
   geom::Vec3 GetCenterOfAtoms() const;
   
-  /// \brief Get entity's geometric center
-  ///
-  /// Returns the geometric center of the entity's bounding box
-  /// by calculating (GetGeometricStart()+GetGeometricEnd())/2
-  geom::Vec3 GetGeometricCenter() const;
-             
-  geom::Vec3 GetGeometricStart() const;
-  geom::Vec3 GetGeometricEnd() const;
+  geom::AlignedCuboid GetBounds() const;
+  
 public:
   /// \name Internal
   //@{
diff --git a/modules/mol/base/src/impl/chain_impl.cc b/modules/mol/base/src/impl/chain_impl.cc
index 02f4636c1..8b9d74876 100644
--- a/modules/mol/base/src/impl/chain_impl.cc
+++ b/modules/mol/base/src/impl/chain_impl.cc
@@ -363,41 +363,27 @@ Real ChainImpl::GetMass() const
   return mass;
 }
 
-geom::Vec3 ChainImpl::GetGeometricStart() const 
+geom::AlignedCuboid ChainImpl::GetBounds() const 
 {
-  geom::Vec3 minimum(std::numeric_limits<Real>::infinity(),
-                     std::numeric_limits<Real>::infinity(),
-                     std::numeric_limits<Real>::infinity());
+  geom::Vec3 mmin( std::numeric_limits<Real>::infinity());
+  geom::Vec3 mmax(-std::numeric_limits<Real>::infinity());
+  bool atoms=false;
   for (ResidueImplList::const_iterator i=residue_list_.begin(); 
         i!=residue_list_.end(); ++i) {
     ResidueImplPtr r=*i;
     for (AtomImplList::iterator j=r->GetAtomList().begin(); 
           j!=r->GetAtomList().end(); ++j) {
-      minimum=geom::Min(minimum,(*j)->GetPos());
+      mmin=geom::Min(mmin, (*j)->GetPos());
+      mmax=geom::Max(mmax, (*j)->GetPos());
+      atoms=true;
     }
   }
-  return minimum;
-}
-
-geom::Vec3 ChainImpl::GetGeometricEnd() const {
-  geom::Vec3 maximum(-std::numeric_limits<Real>::infinity(),
-                     -std::numeric_limits<Real>::infinity(),
-                     -std::numeric_limits<Real>::infinity());
-  for (ResidueImplList::const_iterator i=residue_list_.begin(); 
-        i!=residue_list_.end(); ++i) {
-    ResidueImplPtr r=*i;
-    for (AtomImplList::iterator j=r->GetAtomList().begin(); 
-          j!=r->GetAtomList().end(); ++j) {
-      maximum=geom::Max(maximum,(*j)->GetPos());
-    }
+  if (!atoms) {
+    return geom::AlignedCuboid(geom::Vec3(), geom::Vec3());
   }
-  return maximum;
+  return geom::AlignedCuboid(mmin, mmax);
 }
 
-geom::Vec3 ChainImpl::GetGeometricCenter() const
-{
-  return (this->GetGeometricStart() + this->GetGeometricEnd()) / 2;
-}
 
 geom::Vec3 ChainImpl::GetCenterOfAtoms() const
 {
diff --git a/modules/mol/base/src/impl/chain_impl.hh b/modules/mol/base/src/impl/chain_impl.hh
index 644bed1e7..1737ca4f5 100644
--- a/modules/mol/base/src/impl/chain_impl.hh
+++ b/modules/mol/base/src/impl/chain_impl.hh
@@ -81,9 +81,10 @@ public:
   Real GetMass() const;
   geom::Vec3 GetCenterOfMass() const;
   geom::Vec3 GetCenterOfAtoms() const;
-  geom::Vec3 GetGeometricCenter() const;
-  geom::Vec3 GetGeometricStart() const;
-  geom::Vec3 GetGeometricEnd() const;
+  
+  /// \brief returns the axis-aligned bounding box of the entity
+  geom::AlignedCuboid GetBounds() const;
+  
   
   ///\brief  Get residue by number. Returns a invalid pointer if the chain
   ///        does not have any residue with this number.
diff --git a/modules/mol/base/src/impl/entity_impl.cc b/modules/mol/base/src/impl/entity_impl.cc
index e71734222..8d17d4a13 100644
--- a/modules/mol/base/src/impl/entity_impl.cc
+++ b/modules/mol/base/src/impl/entity_impl.cc
@@ -262,60 +262,29 @@ EntityImpl::~EntityImpl()
     it->second->OnDestroy();
   }
 }
-
-geom::Vec3 EntityImpl::GetGeometricStart() const 
+geom::AlignedCuboid EntityImpl::GetBounds() const
 {
-  geom::Vec3 minimum(std::numeric_limits<Real>::infinity(),
-                     std::numeric_limits<Real>::infinity(),
-                     std::numeric_limits<Real>::infinity());
-  if (this->GetAtomCount()>0) {
-    for(AtomImplMap::const_iterator it = atom_map_.begin();it!=atom_map_.end();++it) {
-      minimum=geom::Min(minimum,it->second->GetPos());
-    }
-  }
-  return minimum;
-}
-
-geom::Vec3 EntityImpl::GetGeometricEnd() const {
-  geom::Vec3 maximum(-std::numeric_limits<Real>::infinity(),
-                     -std::numeric_limits<Real>::infinity(),
-                     -std::numeric_limits<Real>::infinity());
-  if (this->GetAtomCount()>0) {
-    for(AtomImplMap::const_iterator it = atom_map_.begin();it!=atom_map_.end();++it) {
-      maximum=geom::Max(maximum,it->second->GetPos());
-    }
-  }
-  return maximum;
-}
 
-geom::Vec3 EntityImpl::GetBoundarySize() const {
-  geom::Vec3 size;
-  geom::Vec3 minimum(std::numeric_limits<Real>::infinity(),
-                     std::numeric_limits<Real>::infinity(),
-                     std::numeric_limits<Real>::infinity());
-  geom::Vec3 maximum(-std::numeric_limits<Real>::infinity(),
-                     -std::numeric_limits<Real>::infinity(),
-                     -std::numeric_limits<Real>::infinity());
   if (this->GetAtomCount()>0) {
-    for(AtomImplMap::const_iterator it = atom_map_.begin();it!=atom_map_.end();++it) {
-      minimum=geom::Min(minimum,it->second->GetPos());
-      maximum=geom::Max(maximum,it->second->GetPos());
+    geom::Vec3 mmin, mmax;    
+    AtomImplMap::const_iterator it=atom_map_.begin();
+    mmin=mmax=it->second->GetPos();
+    for (++it; it!=atom_map_.end();++it) {
+      mmin=geom::Min(mmin,it->second->GetPos());
+      mmax=geom::Min(mmax,it->second->GetPos());      
     }
+    return geom::AlignedCuboid(mmin, mmax);    
+  } else {
+    return geom::AlignedCuboid(geom::Vec3(), geom::Vec3());
   }
-  size=maximum-minimum;
-  return size;
-}
 
-geom::Vec3 EntityImpl::GetGeometricCenter() const {
-  geom::Vec3 center;
-  center = (this->GetGeometricEnd() + this->GetGeometricStart())/2;
-  return center;
 }
 
 geom::Vec3 EntityImpl::GetCenterOfAtoms() const {
   geom::Vec3 center;
   if (this->GetAtomCount()>0) {
-    for(AtomImplMap::const_iterator it = atom_map_.begin();it!=atom_map_.end();++it) {
+    for (AtomImplMap::const_iterator it = atom_map_.begin();
+         it!=atom_map_.end();++it) {
       center+=it->second->GetPos();
     }
     center/=static_cast<Real>(atom_map_.size());
diff --git a/modules/mol/base/src/impl/entity_impl.hh b/modules/mol/base/src/impl/entity_impl.hh
index ca83cf254..ae1208f5e 100644
--- a/modules/mol/base/src/impl/entity_impl.hh
+++ b/modules/mol/base/src/impl/entity_impl.hh
@@ -93,10 +93,11 @@ public:
   Real GetMass() const;
   geom::Vec3 GetCenterOfMass() const;
   geom::Vec3 GetCenterOfAtoms() const;
-  geom::Vec3 GetGeometricCenter() const;
-  geom::Vec3 GetGeometricStart() const;
-  geom::Vec3 GetGeometricEnd() const;
-  geom::Vec3 GetBoundarySize() const;
+  
+  /// \brief returns the axis-aligned bounding box of the entity
+  geom::AlignedCuboid GetBounds() const;
+  
+
 
   // default copy ctor and assignment op should work for now
   AtomImplPtr CreateAtom(const ResidueImplPtr& rp, const String& name,
diff --git a/modules/mol/base/src/impl/residue_impl.cc b/modules/mol/base/src/impl/residue_impl.cc
index bfee30477..225c5a974 100644
--- a/modules/mol/base/src/impl/residue_impl.cc
+++ b/modules/mol/base/src/impl/residue_impl.cc
@@ -427,31 +427,23 @@ Real ResidueImpl::GetMass() const
   return mass;
 }
 
-geom::Vec3 ResidueImpl::GetGeometricEnd() const {
-  geom::Vec3 maximum(-std::numeric_limits<Real>::infinity(),
-                     -std::numeric_limits<Real>::infinity(),
-                     -std::numeric_limits<Real>::infinity());
-  for (AtomImplList::const_iterator i=atom_list_.begin(); 
-       i!=atom_list_.end(); ++i) {
-    maximum=geom::Max(maximum,(*i)->GetPos());
-  }
-  return maximum;
-}
-
-geom::Vec3 ResidueImpl::GetGeometricStart() const {
-  geom::Vec3 minimum(std::numeric_limits<Real>::infinity(),
-                     std::numeric_limits<Real>::infinity(),
-                     std::numeric_limits<Real>::infinity());
-  for (AtomImplList::const_iterator i=atom_list_.begin(); 
-       i!=atom_list_.end(); ++i) {
-    minimum=geom::Min(minimum,(*i)->GetPos());
-  }
-  return minimum;
-}
-
-geom::Vec3 ResidueImpl::GetGeometricCenter() const
+geom::AlignedCuboid ResidueImpl::GetBounds() const 
 {
-  return (this->GetGeometricStart() + this->GetGeometricEnd())/2;
+  
+  geom::Vec3 mmin( std::numeric_limits<Real>::infinity());
+  geom::Vec3 mmax(-std::numeric_limits<Real>::infinity());  
+
+  if (atom_list_.size()>0) {
+    AtomImplList::const_iterator i=atom_list_.begin();
+    mmin=mmax=(*i)->GetPos();
+    for (++i; i!=atom_list_.end(); ++i) {
+      mmax=geom::Max(mmax,(*i)->GetPos());
+      mmin=geom::Min(mmin,(*i)->GetPos());      
+    }    
+    return geom::AlignedCuboid(mmin, mmax);
+  } else {
+    return geom::AlignedCuboid(geom::Vec3(), geom::Vec3());
+  }
 }
 
 geom::Vec3 ResidueImpl::GetCenterOfAtoms() const
diff --git a/modules/mol/base/src/impl/residue_impl.hh b/modules/mol/base/src/impl/residue_impl.hh
index 22e816b6e..0e0393767 100644
--- a/modules/mol/base/src/impl/residue_impl.hh
+++ b/modules/mol/base/src/impl/residue_impl.hh
@@ -131,9 +131,9 @@ public:
   Real GetMass() const;
   geom::Vec3 GetCenterOfMass() const;
   geom::Vec3 GetCenterOfAtoms() const;
-  geom::Vec3 GetGeometricCenter() const;
-  geom::Vec3 GetGeometricStart() const;
-  geom::Vec3 GetGeometricEnd() const;
+  
+  geom::AlignedCuboid GetBounds() const;
+  
 
   void DeleteAtom(const AtomImplPtr& atom);
   void DeleteAtoms(const String& atom_name);
diff --git a/modules/mol/base/src/residue_handle.cc b/modules/mol/base/src/residue_handle.cc
index 1719708c9..6c9e007d8 100644
--- a/modules/mol/base/src/residue_handle.cc
+++ b/modules/mol/base/src/residue_handle.cc
@@ -226,22 +226,10 @@ geom::Vec3 ResidueHandle::GetAltAtomPos(const AtomHandle& atom,
   return Impl()->GetAltAtomPos(atom.Impl(), group);
 }
 
-geom::Vec3 ResidueHandle::GetGeometricStart() const
+geom::AlignedCuboid ResidueHandle::GetBounds() const
 {
   this->CheckValidity();
-  return Impl()->GetGeometricStart();
-}
-
-geom::Vec3 ResidueHandle::GetGeometricEnd() const
-{
-  this->CheckValidity();
-  return Impl()->GetGeometricEnd();
-}
-
-geom::Vec3 ResidueHandle::GetGeometricCenter() const
-{
-  this->CheckValidity();
-  return Impl()->GetGeometricCenter();
+  return Impl()->GetBounds();
 }
 
 geom::Vec3 ResidueHandle::GetCenterOfMass() const
diff --git a/modules/mol/base/src/residue_handle.hh b/modules/mol/base/src/residue_handle.hh
index 0d85e6e7f..57b7c5619 100644
--- a/modules/mol/base/src/residue_handle.hh
+++ b/modules/mol/base/src/residue_handle.hh
@@ -19,9 +19,11 @@
 #ifndef OST_RESIDUE_HANDLE_HU
 #define OST_RESIDUE_HANDLE_HU
 
+#include <ost/geom/vec3.hh>
+#include <ost/geom/aligned_cuboid.hh>
+
 #include <ost/mol/query.hh>
 #include <ost/mol/module_config.hh>
-#include <ost/geom/vec3.hh>
 #include <ost/mol/residue_base.hh>
 #include <ost/mol/atom_prop.hh>
 #include <ost/mol/entity_visitor_fw.hh>
@@ -77,17 +79,8 @@ public:
   /// similar to GetCenterOfMass(), but the atoms are not mass weighted
   geom::Vec3 GetCenterOfAtoms() const;
   
-  /// \brief Get entity's geometric center
-  ///
-  /// Returns the geometric center of the entity's bounding box
-  /// by calculating (GetGeometricStart()+GetGeometricEnd())/2
-  geom::Vec3 GetGeometricCenter() const;
-  
-  /// \brief Get entity's minimum cartesian coordinates
-  geom::Vec3 GetGeometricStart() const;
-  
-  /// \brief Get entity's maximum cartesian coordinates
-  geom::Vec3 GetGeometricEnd() const;
+  /// \brief get axis-aligned bounding box of residue
+  geom::AlignedCuboid GetBounds() const;
   
   /// \brief The chain this residue is attached to
   ChainHandle GetChain() const;
diff --git a/modules/mol/base/src/residue_view.cc b/modules/mol/base/src/residue_view.cc
index 72c5ff76f..53e0a3eaa 100644
--- a/modules/mol/base/src/residue_view.cc
+++ b/modules/mol/base/src/residue_view.cc
@@ -205,36 +205,17 @@ double ResidueView::GetMass() const
   return mass;
 }
 
-geom::Vec3 ResidueView::GetGeometricStart() const 
+geom::AlignedCuboid ResidueView::GetBounds() const 
 {
   this->CheckValidity();
-  geom::Vec3 minimum(std::numeric_limits<Real>::max(),
-                     std::numeric_limits<Real>::max(),
-                     std::numeric_limits<Real>::max());
+  geom::Vec3 mmin( std::numeric_limits<Real>::max());
+  geom::Vec3 mmax(-std::numeric_limits<Real>::max());  
   AtomViewList::const_iterator i;
   for (i=data_->atoms.begin(); i!=data_->atoms.end(); ++i) {
-    minimum=geom::Min(minimum, (*i).GetPos());
+    mmin=geom::Min(mmin, (*i).GetPos());
+    mmax=geom::Max(mmax, (*i).GetPos());
   }
-  return minimum;
-}
-
-geom::Vec3 ResidueView::GetGeometricEnd() const 
-{
-  this->CheckValidity();
-  geom::Vec3 maximum(-std::numeric_limits<Real>::max(),
-                     -std::numeric_limits<Real>::max(),
-                     -std::numeric_limits<Real>::max());
-  AtomViewList::const_iterator i;
-  for (i=data_->atoms.begin(); i!=data_->atoms.end(); ++i) {
-    maximum=geom::Max(maximum, (*i).GetPos());
-  }
-  return maximum;
-}
-
-geom::Vec3 ResidueView::GetGeometricCenter() const
-{
-  this->CheckValidity();
-  return (this->GetGeometricStart() + this->GetGeometricEnd())/2;
+  return geom::AlignedCuboid(mmin, mmax);
 }
 
 geom::Vec3 ResidueView::GetCenterOfMass() const 
diff --git a/modules/mol/base/src/residue_view.hh b/modules/mol/base/src/residue_view.hh
index 0cd381e86..d771a95ce 100644
--- a/modules/mol/base/src/residue_view.hh
+++ b/modules/mol/base/src/residue_view.hh
@@ -153,14 +153,9 @@ public:
   /// similar to GetCenterOfMass(), but the atoms are not mass weighted
   geom::Vec3 GetCenterOfAtoms() const;
   
-  /// \brief Get entity's geometric center
-  ///
-  /// Returns the geometric center of the entity's bounding box
-  /// by calculating (GetGeometricStart()+GetGeometricEnd())/2
-  geom::Vec3 GetGeometricCenter() const;
+  /// \brief Get entity's axis-aligned bounding box
+  geom::AlignedCuboid GetBounds() const;
   
-  geom::Vec3 GetGeometricStart() const;
-  geom::Vec3 GetGeometricEnd() const;
 
   /// \brief return view based on a query object
   /// \sa Query
-- 
GitLab