diff --git a/EgtGraphics.rc b/EgtGraphics.rc index ee67fa7..9293092 100644 Binary files a/EgtGraphics.rc and b/EgtGraphics.rc differ diff --git a/SceneCamera.cpp b/SceneCamera.cpp index c993051..0870196 100644 --- a/SceneCamera.cpp +++ b/SceneCamera.cpp @@ -315,23 +315,31 @@ Scene::ZoomObject( int nId) int nMyId = m_pGeomDB->GetFirstSelectedObj() ; while ( nMyId != GDB_ID_NULL) { BBox3d b3Curr ; - if ( m_pGeomDB->GetGlobalBBox( nMyId, b3Curr)) + if ( m_pGeomDB->GetGlobalBBox( nMyId, b3Curr, BBF_ONLY_VISIBLE)) b3Obj.Add( b3Curr) ; nMyId = m_pGeomDB->GetNextSelectedObj() ; } } else - m_pGeomDB->GetGlobalBBox( nId, b3Obj) ; + m_pGeomDB->GetGlobalBBox( nId, b3Obj, BBF_ONLY_VISIBLE) ; - // recupero centro e diametro vista + // recupero centro Point3d ptCent ; - double dDiam ; - if ( ! b3Obj.GetCenter( ptCent) || ! b3Obj.GetDiameter( dDiam)) + if ( ! b3Obj.GetCenter( ptCent)) return false ; + // determino le dimensioni di vista nel riferimento di vista + Frame3d frView ; + if ( ! CalcCameraFrame( frView)) + return false ; + b3Obj.ToLoc( frView) ; + const double COEFF = 1.05 ; + double dHalfWidth = COEFF * ( b3Obj.GetMax().x - b3Obj.GetMin().x) / 2 ; + double dHalfHeight = COEFF * ( b3Obj.GetMax().y - b3Obj.GetMin().y) / 2 ; + // imposto il centro e le dimensioni di vista m_ptCenter = ptCent ; - return AdjustDimView( dDiam / 2, dDiam / 2) ; + return AdjustDimView( dHalfWidth, dHalfHeight) ; } //----------------------------------------------------------------------------