EgtExecutor 2.1d1 :

- aggiunta funzione Exe e Lua VolZmapAvoidCylinder
- aggiunto parametro dSafeDist  alle funzioni VolZmapAvoid*.
This commit is contained in:
Dario Sassi
2019-04-08 10:06:40 +00:00
parent e762dd6a72
commit 70457f5ce3
3 changed files with 74 additions and 10 deletions
+38 -4
View File
@@ -478,7 +478,7 @@ ExeVolZmapGetDepth( int nId, const Point3d& ptP, const Vector3d& vtDir, int nRef
//----------------------------------------------------------------------------
bool
ExeVolZmapAvoidBox( int nId, const Frame3d& frBox, const Vector3d& vtDiag, int nRefType)
ExeVolZmapAvoidBox( int nId, const Frame3d& frBox, const Vector3d& vtDiag, double dSafeDist, int nRefType)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
@@ -489,7 +489,7 @@ ExeVolZmapAvoidBox( int nId, const Frame3d& frBox, const Vector3d& vtDiag, int n
Frame3d frBoxL = GetFrameLocal( pGeomDB, frBox, nRefType, frLoc) ;
// recupero lo Zmap e calcolo collisione
IVolZmap* pVZM = GetVolZmap( pGeomDB->GetGeoObj( nId)) ;
bOk = bOk && ( pVZM != nullptr && pVZM->AvoidBox( frBoxL, vtDiag)) ;
bOk = bOk && ( pVZM != nullptr && pVZM->AvoidBox( frBoxL, vtDiag, dSafeDist)) ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtVolZmapAvoidBox(" + IdToString( nId) + ",{" +
@@ -498,6 +498,7 @@ ExeVolZmapAvoidBox( int nId, const Frame3d& frBox, const Vector3d& vtDiag, int n
ToString( frBox.VersY()) + "},{" +
ToString( frBox.VersZ()) + "}},{" +
ToString( vtDiag) + "}," +
ToString( dSafeDist) + "," +
RefTypeToString( nRefType) + ")" +
" -- Ok=" + ToString( bOk) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
@@ -508,7 +509,7 @@ ExeVolZmapAvoidBox( int nId, const Frame3d& frBox, const Vector3d& vtDiag, int n
//----------------------------------------------------------------------------
bool
ExeVolZmapAvoidSphere( int nId, const Point3d& ptCen, double dRad, int nRefType)
ExeVolZmapAvoidSphere( int nId, const Point3d& ptCen, double dRad, double dSafeDist, int nRefType)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
@@ -519,12 +520,13 @@ ExeVolZmapAvoidSphere( int nId, const Point3d& ptCen, double dRad, int nRefType)
Point3d ptCenL = GetPointLocal( pGeomDB, ptCen, nRefType, frLoc) ;
// recupero lo Zmap e calcolo collisione
IVolZmap* pVZM = GetVolZmap( pGeomDB->GetGeoObj( nId)) ;
bOk = bOk && ( pVZM != nullptr && pVZM->AvoidSphere( ptCenL, dRad)) ;
bOk = bOk && ( pVZM != nullptr && pVZM->AvoidSphere( ptCenL, dRad, dSafeDist)) ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtVolZmapAvoidSphere(" + IdToString( nId) + ",{" +
ToString( ptCen) + "}," +
ToString( dRad) + "," +
ToString( dSafeDist) + "," +
RefTypeToString( nRefType) + ")" +
" -- Ok=" + ToString( bOk) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
@@ -533,6 +535,38 @@ ExeVolZmapAvoidSphere( int nId, const Point3d& ptCen, double dRad, int nRefType)
return bOk ;
}
//----------------------------------------------------------------------------
bool
ExeVolZmapAvoidCylinder( int nId, const Frame3d& frCyl, double dL, double dR, double dSafeDist, int nRefType)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
// recupero il riferimento locale
Frame3d frLoc ;
bool bOk = pGeomDB->GetGlobFrame( nId, frLoc) ;
// porto in locale il riferimento
Frame3d frBoxL = GetFrameLocal( pGeomDB, frCyl, nRefType, frLoc) ;
// recupero lo Zmap e calcolo collisione
IVolZmap* pVZM = GetVolZmap( pGeomDB->GetGeoObj( nId)) ;
bOk = bOk && ( pVZM != nullptr && pVZM->AvoidCylinder( frBoxL, dL, dR, dSafeDist)) ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtVolZmapAvoidCylinder(" + IdToString( nId) + ",{" +
ToString( frCyl.Orig()) + "},{" +
ToString( frCyl.VersX()) + "},{" +
ToString( frCyl.VersY()) + "},{" +
ToString( frCyl.VersZ()) + "}}," +
ToString( dL) + "," +
ToString( dR) + "," +
ToString( dSafeDist) + "," +
RefTypeToString( nRefType) + ")" +
" -- Ok=" + ToString( bOk) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco risultato
return bOk ;
}
//-------------------------------------------------------------------------------
bool
ExeCutVolZmapPlane( int nId, const Point3d& ptOn, const Vector3d& vtN, int nRefType)