From 60fd504668859cf779d659b275199b5a99e1b52d Mon Sep 17 00:00:00 2001 From: Dario Sassi Date: Sun, 26 May 2019 18:45:23 +0000 Subject: [PATCH] EgtGraphics 2.1e4 : - corretta funzione ZoomObject. --- EgtGraphics.rc | Bin 11604 -> 11604 bytes SceneCamera.cpp | 20 ++++++++++++++------ 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/EgtGraphics.rc b/EgtGraphics.rc index ee67fa7972bad711146038e28e222f7980a668a5..929309211ee5b060b8f73930b96547c891414dd2 100644 GIT binary patch delta 103 zcmcZ-btP)UFE&P#%?J7RGfm>rnVhGn#%MD6ptSDhKaxI-o7=dpn8C8TKng4@BhrnVhGn#%MhGptSDhKaxI-o7=dpn8C8TKng4@BhGetFirstSelectedObj() ; 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) ; } //----------------------------------------------------------------------------