EgtExecutor:
- aggiunte funzioni Exe e Lua CDeBoxClosedSurfTm, ExeCDeCylClosedSurfTm e ExeCDeSpheClosedSurfTm - modificate funzioni Exe e Lua VolZmapAvoid* in CDe*VolZmap.
This commit is contained in:
@@ -0,0 +1,196 @@
|
||||
//----------------------------------------------------------------------------
|
||||
// EgalTech 2020-2020
|
||||
//----------------------------------------------------------------------------
|
||||
// File : LUA_CDeObjSolid.cpp Data : 09.01.20 Versione : 2.2a2
|
||||
// Contenuto : Funzioni di verifica collisioni tra oggetti e solidi.
|
||||
// Oggetti = Box, Sfere, Cilindri
|
||||
// Solidi = SurfTriMesh, VolZMap
|
||||
//
|
||||
// Modifiche : 09.01.20 DS Creazione modulo.
|
||||
//
|
||||
//
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
//--------------------------- Include ----------------------------------------
|
||||
#include "stdafx.h"
|
||||
#include "LUA.h"
|
||||
#include "/EgtDev/Include/EXeExecutor.h"
|
||||
#include "/EgtDev/Include/EXeConst.h"
|
||||
#include "/EgtDev/Include/EGkLuaAux.h"
|
||||
#include "/EgtDev/Include/EgnStringUtils.h"
|
||||
|
||||
using namespace std ;
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaCDeBoxClosedSurfTm( lua_State* L)
|
||||
{
|
||||
// 4 o 5 parametri : frBox, vtDiag, nStmId, dSafeDist [, nRefType]
|
||||
Frame3d frBox ;
|
||||
LuaCheckParam( L, 1, frBox)
|
||||
Vector3d vtDiag ;
|
||||
LuaCheckParam( L, 2, vtDiag)
|
||||
int nStmId ;
|
||||
LuaCheckParam( L, 3, nStmId)
|
||||
double dSafeDist ;
|
||||
LuaCheckParam( L, 4, dSafeDist)
|
||||
int nRefType = RTY_DEFAULT ;
|
||||
LuaGetParam( L, 5, nRefType) ;
|
||||
LuaClearStack( L) ;
|
||||
// assegno dati utensile generico per Collision Avoidance
|
||||
int nRes = ExeCDeBoxClosedSurfTm( frBox, vtDiag, nStmId, dSafeDist, nRefType) ;
|
||||
// restituisco il risultato
|
||||
if ( nRes >= 0)
|
||||
LuaSetParam( L, ( nRes != 0)) ;
|
||||
else
|
||||
LuaSetParam( L) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaCDeCylClosedSurfTm( lua_State* L)
|
||||
{
|
||||
// 5 o 6 parametri : frCyl, dH, dR, nStmId, dSafeDist [, nRefType]
|
||||
Frame3d frCyl ;
|
||||
LuaCheckParam( L, 1, frCyl)
|
||||
double dH ;
|
||||
LuaCheckParam( L, 2, dH)
|
||||
double dR ;
|
||||
LuaCheckParam( L, 3, dR)
|
||||
int nStmId ;
|
||||
LuaCheckParam( L, 4, nStmId)
|
||||
double dSafeDist ;
|
||||
LuaCheckParam( L, 5, dSafeDist)
|
||||
int nRefType = RTY_DEFAULT ;
|
||||
LuaGetParam( L, 6, nRefType) ;
|
||||
LuaClearStack( L) ;
|
||||
// assegno dati utensile generico per Collision Avoidance
|
||||
int nRes = ExeCDeCylClosedSurfTm( frCyl, dH, dR, nStmId, dSafeDist, nRefType) ;
|
||||
// restituisco il risultato
|
||||
if ( nRes >= 0)
|
||||
LuaSetParam( L, ( nRes != 0)) ;
|
||||
else
|
||||
LuaSetParam( L) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
static int
|
||||
LuaCDeSpheClosedSurfTm( lua_State* L)
|
||||
{
|
||||
// 4 o 5 parametri : ptCen, dRad, nStmId, dSafeDist [, nRefType]
|
||||
Point3d ptCen ;
|
||||
LuaCheckParam( L, 1, ptCen)
|
||||
double dR ;
|
||||
LuaCheckParam( L, 2, dR)
|
||||
int nStmId ;
|
||||
LuaCheckParam( L, 3, nStmId)
|
||||
double dSafeDist ;
|
||||
LuaCheckParam( L, 4, dSafeDist)
|
||||
int nRefType = RTY_DEFAULT ;
|
||||
LuaGetParam( L, 5, nRefType) ;
|
||||
LuaClearStack( L) ;
|
||||
// assegno dati utensile generico per Collision Avoidance
|
||||
int nRes = ExeCDeSpheClosedSurfTm( ptCen, dR, nStmId, dSafeDist, nRefType) ;
|
||||
// restituisco il risultato
|
||||
if ( nRes >= 0)
|
||||
LuaSetParam( L, ( nRes != 0)) ;
|
||||
else
|
||||
LuaSetParam( L) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
static int
|
||||
LuaCDeBoxVolZmap( lua_State* L)
|
||||
{
|
||||
// 4 o 5 parametri : frBox, vtDiag, nZmapId, dSafeDist [, nRefType]
|
||||
Frame3d frBox ;
|
||||
LuaCheckParam( L, 1, frBox)
|
||||
Vector3d vtDiag ;
|
||||
LuaCheckParam( L, 2, vtDiag)
|
||||
int nZmapId ;
|
||||
LuaCheckParam( L, 3, nZmapId)
|
||||
double dSafeDist ;
|
||||
LuaCheckParam( L, 4, dSafeDist)
|
||||
int nRefType = RTY_DEFAULT ;
|
||||
LuaGetParam( L, 5, nRefType) ;
|
||||
LuaClearStack( L) ;
|
||||
// verifico non interferenza
|
||||
int nRes = ExeCDeBoxVolZmap( frBox, vtDiag, nZmapId, dSafeDist, nRefType) ;
|
||||
// restituisco il risultato
|
||||
if ( nRes >= 0)
|
||||
LuaSetParam( L, ( nRes != 0)) ;
|
||||
else
|
||||
LuaSetParam( L) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
static int
|
||||
LuaCDeCylVolZmap( lua_State* L)
|
||||
{
|
||||
// 5 o 6 parametri : frCyl, dL, dR, nZmapId, dSafeDist [, nRefType]
|
||||
Frame3d frCyl ;
|
||||
LuaCheckParam( L, 1, frCyl)
|
||||
double dL ;
|
||||
LuaCheckParam( L, 2, dL)
|
||||
double dR ;
|
||||
LuaCheckParam( L, 3, dR)
|
||||
int nZmapId ;
|
||||
LuaCheckParam( L, 4, nZmapId)
|
||||
double dSafeDist ;
|
||||
LuaCheckParam( L, 5, dSafeDist)
|
||||
int nRefType = RTY_DEFAULT ;
|
||||
LuaGetParam( L, 6, nRefType) ;
|
||||
LuaClearStack( L) ;
|
||||
// verifico non interferenza
|
||||
int nRes = ExeCDeCylVolZmap( frCyl, dL, dR, nZmapId, dSafeDist, nRefType) ;
|
||||
// restituisco il risultato
|
||||
if ( nRes >= 0)
|
||||
LuaSetParam( L, ( nRes != 0)) ;
|
||||
else
|
||||
LuaSetParam( L) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
static int
|
||||
LuaCDeSpheVolZmap( lua_State* L)
|
||||
{
|
||||
// 4 o 5 parametri : ptCen, dRad, nZmapId, dSafeDist [, nRefType]
|
||||
Point3d ptCen ;
|
||||
LuaCheckParam( L, 1, ptCen)
|
||||
double dRad ;
|
||||
LuaCheckParam( L, 2, dRad)
|
||||
int nZmapId ;
|
||||
LuaCheckParam( L, 3, nZmapId)
|
||||
double dSafeDist ;
|
||||
LuaCheckParam( L, 4, dSafeDist)
|
||||
int nRefType = RTY_DEFAULT ;
|
||||
LuaGetParam( L, 5, nRefType) ;
|
||||
LuaClearStack( L) ;
|
||||
// verifico non interferenza
|
||||
int nRes = ExeCDeSpheVolZmap( ptCen, dRad, nZmapId, dSafeDist, nRefType) ;
|
||||
// restituisco il risultato
|
||||
if ( nRes >= 0)
|
||||
LuaSetParam( L, ( nRes != 0)) ;
|
||||
else
|
||||
LuaSetParam( L) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
bool
|
||||
LuaInstallCDeObjSolid( LuaMgr& luaMgr)
|
||||
{
|
||||
bool bOk = ( &luaMgr != nullptr) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtCDeBoxClosedSurfTm", LuaCDeBoxClosedSurfTm) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtCDeCylClosedSurfTm", LuaCDeCylClosedSurfTm) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtCDeSpheClosedSurfTm", LuaCDeSpheClosedSurfTm) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtCDeBoxVolZmap", LuaCDeBoxVolZmap) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtCDeCylVolZmap", LuaCDeCylVolZmap) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtCDeSpheVolZmap", LuaCDeSpheVolZmap) ;
|
||||
return bOk ;
|
||||
}
|
||||
Reference in New Issue
Block a user