EgtGraphics 2.1e4 :

- corretta funzione ZoomObject.
This commit is contained in:
Dario Sassi
2019-05-26 18:45:23 +00:00
parent de0f4eb76d
commit 60fd504668
2 changed files with 14 additions and 6 deletions
+14 -6
View File
@@ -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) ;
}
//----------------------------------------------------------------------------