EgtMachKernel 2.3e3 :
- modificata funzione gestione solidi semplici di collisione in simulazione (aggiunto parametro spiazzamento da riferimento) - aggiunta funzione Lua EmtAddCollisionObjEx che estende la quasi omonima con lo spiazzamento indicato sopra - a queste funzioni aggiunta la gestione dei tronchi di cono.
This commit is contained in:
+19
-4
@@ -24,6 +24,7 @@
|
||||
#include "/EgtDev/Include/EGkCDeBoxClosedSurfTm.h"
|
||||
#include "/EgtDev/Include/EGkCDeCylClosedSurfTm.h"
|
||||
#include "/EgtDev/Include/EGkCDeSpheClosedSurfTm.h"
|
||||
#include "/EgtDev/Include/EGkCDeConeFrustumClosedSurfTm.h"
|
||||
#include "/EgtDev/Include/EGkVolZmap.h"
|
||||
#include "/EgtDev/Include/EGkStringUtils3d.h"
|
||||
#include "/EgtDev/Include/EXeConst.h"
|
||||
@@ -1231,6 +1232,10 @@ Simulator::ExecCollisionCheck( int& nCdInd, int& nObjInd, int nMoveType)
|
||||
// esecuzione controlli di collisione
|
||||
bool bOk = true ;
|
||||
Frame3d frObj = pGeoFrame->GetFrame() ;
|
||||
if ( ! m_CollObj[j].vtMove.IsSmall())
|
||||
frObj.Translate( m_CollObj[j].vtMove.x * frObj.VersX() +
|
||||
m_CollObj[j].vtMove.y * frObj.VersY() +
|
||||
m_CollObj[j].vtMove.z * frObj.VersZ()) ;
|
||||
Frame3d frParent ; m_pGeomDB->GetGlobFrame( m_CollObj[j].nFrameId, frParent) ;
|
||||
frObj.LocToLoc( frParent, frCd) ;
|
||||
if ( m_CollObj[j].nType == MCH_SIM_COB_BOX) {
|
||||
@@ -1252,6 +1257,12 @@ Simulator::ExecCollisionCheck( int& nCdInd, int& nObjInd, int nMoveType)
|
||||
else
|
||||
bOk = ! CDeSpheClosedSurfTm( frObj.Orig(), m_CollObj[j].dPar1, m_dSafeDist, *pSTM) ;
|
||||
}
|
||||
else if ( m_CollObj[j].nType == MCH_SIM_COB_CONE) {
|
||||
if ( pVZM != nullptr)
|
||||
bOk = pVZM->AvoidConeFrustum( frObj, m_CollObj[j].dPar1, m_CollObj[j].dPar2, m_CollObj[j].dPar3, m_dSafeDist) ;
|
||||
else
|
||||
bOk = ! CDeConeFrustumClosedSurfTm( frObj, m_CollObj[j].dPar1, m_CollObj[j].dPar2, m_CollObj[j].dPar3, m_dSafeDist, *pSTM) ;
|
||||
}
|
||||
if ( ! bOk) {
|
||||
nCdInd = i ;
|
||||
nObjInd = j ;
|
||||
@@ -1752,7 +1763,7 @@ Simulator::OnResetMachine( void)
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Simulator::AddCollisionObj( int nInd, int nFrameId, int nType, double dPar1, double dPar2, double dPar3)
|
||||
Simulator::AddCollisionObj( int nInd, int nFrameId, int nType, const Vector3d& vtMove, double dPar1, double dPar2, double dPar3)
|
||||
{
|
||||
// verifiche sui parametri
|
||||
if ( nInd <= 0 || nFrameId <= GDB_ID_NULL)
|
||||
@@ -1763,17 +1774,21 @@ Simulator::AddCollisionObj( int nInd, int nFrameId, int nType, double dPar1, dou
|
||||
return false ;
|
||||
break ;
|
||||
case MCH_SIM_COB_CYL :
|
||||
if ( abs( dPar1) < EPS_SMALL || abs( dPar2) < EPS_SMALL)
|
||||
if ( dPar1 < EPS_SMALL || abs( dPar2) < EPS_SMALL)
|
||||
return false ;
|
||||
break ;
|
||||
case MCH_SIM_COB_SPHE :
|
||||
if ( abs( dPar1) < EPS_SMALL)
|
||||
if ( dPar1 < EPS_SMALL)
|
||||
return false ;
|
||||
break ;
|
||||
case MCH_SIM_COB_CONE :
|
||||
if ( ( dPar1 < EPS_SMALL && dPar2 < EPS_SMALL) || dPar3 < EPS_SMALL)
|
||||
return false ;
|
||||
break ;
|
||||
default :
|
||||
return false ;
|
||||
}
|
||||
// aggiungo al vettore
|
||||
m_CollObj.emplace_back( nInd, nFrameId, nType, dPar1, dPar2, dPar3) ;
|
||||
m_CollObj.emplace_back( nInd, nFrameId, nType, vtMove, dPar1, dPar2, dPar3) ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user