From 70457f5ce35142e96c12cf49c2dfe473f742624a Mon Sep 17 00:00:00 2001 From: Dario Sassi Date: Mon, 8 Apr 2019 10:06:40 +0000 Subject: [PATCH] EgtExecutor 2.1d1 : - aggiunta funzione Exe e Lua VolZmapAvoidCylinder - aggiunto parametro dSafeDist alle funzioni VolZmapAvoid*. --- EXE_GdbModifyVol.cpp | 42 ++++++++++++++++++++++++++++++++++++++---- EgtExecutor.rc | Bin 16176 -> 16176 bytes LUA_GdbModifyVol.cpp | 42 ++++++++++++++++++++++++++++++++++++------ 3 files changed, 74 insertions(+), 10 deletions(-) diff --git a/EXE_GdbModifyVol.cpp b/EXE_GdbModifyVol.cpp index e7b30dc..d29a16e 100644 --- a/EXE_GdbModifyVol.cpp +++ b/EXE_GdbModifyVol.cpp @@ -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) diff --git a/EgtExecutor.rc b/EgtExecutor.rc index 0dae6264ed06cb826eb46d0407fc01c18c98d91b..d9c238fd5abaaffa941c0898bea2256c717dd34a 100644 GIT binary patch delta 103 zcmdl`x1nysH#Sxi1|0^&&A-{4nVD073`efTEO4>oOp`YVR)EAOJ8~s&?h~?r$(psNd^E>=^kSM delta 103 zcmdl`x1nysH#Syd1|0_D&A-{4nVFM;3`efTEO4>oOp`YVR)EAOJ8~s&?h~?r$(psNd^E@Z60d? diff --git a/LUA_GdbModifyVol.cpp b/LUA_GdbModifyVol.cpp index 23f88e8..d1a1472 100644 --- a/LUA_GdbModifyVol.cpp +++ b/LUA_GdbModifyVol.cpp @@ -345,18 +345,20 @@ LuaVolZmapGetDepth( lua_State* L) static int LuaVolZmapAvoidBox( lua_State* L) { - // 3 o 4 parametri : nId, frBox, vtDiag [, nRefType] + // 4 o 5 parametri : nId, frBox, vtDiag, dSafeDist [, nRefType] int nId ; LuaCheckParam( L, 1, nId) Frame3d frBox ; LuaCheckParam( L, 2, frBox) Vector3d vtDiag ; LuaCheckParam( L, 3, vtDiag) + double dSafeDist ; + LuaCheckParam( L, 4, dSafeDist) int nRefType = RTY_DEFAULT ; - LuaGetParam( L, 4, nRefType) ; + LuaGetParam( L, 5, nRefType) ; LuaClearStack( L) ; // verifico non interferenza - bool bOk = ExeVolZmapAvoidBox( nId, frBox, vtDiag, nRefType) ; + bool bOk = ExeVolZmapAvoidBox( nId, frBox, vtDiag, dSafeDist, nRefType) ; // restituisco il risultato LuaSetParam( L, bOk) ; return 1 ; @@ -366,18 +368,45 @@ LuaVolZmapAvoidBox( lua_State* L) static int LuaVolZmapAvoidSphere( lua_State* L) { - // 3 o 4 parametri : nId, ptCen, dRad [, nRefType] + // 4 o 5 parametri : nId, ptCen, dRad, dSafeDist [, nRefType] int nId ; LuaCheckParam( L, 1, nId) Point3d ptCen ; LuaCheckParam( L, 2, ptCen) double dRad ; LuaCheckParam( L, 3, dRad) + double dSafeDist ; + LuaCheckParam( L, 4, dSafeDist) int nRefType = RTY_DEFAULT ; - LuaGetParam( L, 4, nRefType) ; + LuaGetParam( L, 5, nRefType) ; LuaClearStack( L) ; // verifico non interferenza - bool bOk = ExeVolZmapAvoidSphere( nId, ptCen, dRad, nRefType) ; + bool bOk = ExeVolZmapAvoidSphere( nId, ptCen, dRad, dSafeDist, nRefType) ; + // restituisco il risultato + LuaSetParam( L, bOk) ; + return 1 ; +} + +//---------------------------------------------------------------------------- +static int +LuaVolZmapAvoidCylinder( lua_State* L) +{ + // 5 o 6 parametri : nId, frCyl, dL, dR, dSafeDist [, nRefType] + int nId ; + LuaCheckParam( L, 1, nId) + Frame3d frCyl ; + LuaCheckParam( L, 2, frCyl) + double dL ; + LuaCheckParam( L, 3, dL) + double dR ; + LuaCheckParam( L, 4, dR) + double dSafeDist ; + LuaCheckParam( L, 5, dSafeDist) + int nRefType = RTY_DEFAULT ; + LuaGetParam( L, 6, nRefType) ; + LuaClearStack( L) ; + // verifico non interferenza + bool bOk = ExeVolZmapAvoidCylinder( nId, frCyl, dL, dR, dSafeDist, nRefType) ; // restituisco il risultato LuaSetParam( L, bOk) ; return 1 ; @@ -423,6 +452,7 @@ LuaInstallGdbModifyVol( LuaMgr& luaMgr) bOk = bOk && luaMgr.RegisterFunction( "EgtVolZmapGetDepth", LuaVolZmapGetDepth) ; bOk = bOk && luaMgr.RegisterFunction( "EgtVolZmapAvoidBox", LuaVolZmapAvoidBox) ; bOk = bOk && luaMgr.RegisterFunction( "EgtVolZmapAvoidSphere", LuaVolZmapAvoidSphere) ; + bOk = bOk && luaMgr.RegisterFunction( "EgtVolZmapAvoidCylinder", LuaVolZmapAvoidCylinder) ; bOk = bOk && luaMgr.RegisterFunction( "EgtCutVolZmapPlane", LuaCutVolZmapPlane) ; return bOk ; } \ No newline at end of file