4e1dddee86
- gestione estrusione con facce di chiusura - gestione rivoluzione con facce di chiusura - razionalizzazione passaggio a locale.
90 lines
2.8 KiB
C++
90 lines
2.8 KiB
C++
//----------------------------------------------------------------------------
|
|
// EgalTech 2015-2015
|
|
//----------------------------------------------------------------------------
|
|
// File : GeoTools.cpp Data : 01.02.15 Versione : 1.6b1
|
|
// Contenuto : Funzioni geometriche ausiliarie.
|
|
//
|
|
//
|
|
//
|
|
// Modifiche : 01.02.15 DS Creazione modulo.
|
|
//
|
|
//
|
|
//----------------------------------------------------------------------------
|
|
|
|
#include "stdafx.h"
|
|
#include "GeoTools.h"
|
|
#include "/EgtDev/Include/EInConst.h"
|
|
#include "/EgtDev/Include/EGkGeomDB.h"
|
|
|
|
//----------------------------------------------------------------------------
|
|
Vector3d
|
|
GetVectorLocal( IGeomDB* pGeomDB, const double vtV[3], int nRefType, const Frame3d& frLoc)
|
|
{
|
|
Vector3d vtVL( vtV) ;
|
|
if ( nRefType == RTY_GLOB)
|
|
vtVL.ToLoc( frLoc) ;
|
|
else if ( nRefType == RTY_GRID)
|
|
vtVL.LocToLoc( pGeomDB->GetGridFrame(), frLoc) ;
|
|
return vtVL ;
|
|
}
|
|
|
|
//----------------------------------------------------------------------------
|
|
Point3d
|
|
GetPointLocal( IGeomDB* pGeomDB, const double ptP[3], int nRefType, const Frame3d& frLoc)
|
|
{
|
|
Point3d ptPL( ptP) ;
|
|
if ( nRefType == RTY_GLOB)
|
|
ptPL.ToLoc( frLoc) ;
|
|
else if ( nRefType == RTY_GRID)
|
|
ptPL.LocToLoc( pGeomDB->GetGridFrame(), frLoc) ;
|
|
return ptPL ;
|
|
}
|
|
|
|
//----------------------------------------------------------------------------
|
|
bool
|
|
VerifySameFrame( IGeomDB* pGeomDB, INTVECTOR& vIds)
|
|
{
|
|
// verifico puntatore a GeomDB
|
|
if ( pGeomDB == nullptr)
|
|
return false ;
|
|
// ciclo sul vettore degli identificativi
|
|
bool bFirst = true ;
|
|
Frame3d frFirst ;
|
|
for ( size_t i = 0 ; i < vIds.size() ; ++ i) {
|
|
// se si deve agire su un singolo oggetto ( gruppo o entità)
|
|
if ( vIds[i] != GDB_ID_SEL) {
|
|
Frame3d frLoc ;
|
|
if ( ! pGeomDB->GetGroupGlobFrame( vIds[i], frLoc) &&
|
|
! pGeomDB->GetGlobFrame( vIds[i], frLoc))
|
|
return false ;
|
|
if ( bFirst) {
|
|
frFirst = frLoc ;
|
|
bFirst = false ;
|
|
}
|
|
else {
|
|
if ( ! AreSameFrame( frFirst, frLoc))
|
|
return false ;
|
|
}
|
|
}
|
|
// altrimenti si deve agire sugli oggetti selezionati
|
|
else {
|
|
int nI = pGeomDB->GetFirstSelectedObj() ;
|
|
while ( nI != GDB_ID_NULL) {
|
|
Frame3d frLoc ;
|
|
if ( ! pGeomDB->GetGlobFrame( nI, frLoc))
|
|
return false ;
|
|
if ( bFirst) {
|
|
frFirst = frLoc ;
|
|
return false ;
|
|
}
|
|
else {
|
|
if ( ! AreSameFrame( frFirst, frLoc))
|
|
return false ;
|
|
}
|
|
// passo alla successiva
|
|
nI = pGeomDB->GetNextSelectedObj() ;
|
|
}
|
|
}
|
|
}
|
|
return true ;
|
|
} |