EgtInterface 2.6c3 :

- aggiunta interfaccia EgtGetCalcAnglesEx
- modificate interfacce EgtGetCalcPositions, EgtGetCalcTipFromPositions e EgtGetCalcToolDirFromAngles.
This commit is contained in:
Dario Sassi
2024-03-27 16:20:57 +01:00
parent 4cc9be61d7
commit 2cd376bbd8
2 changed files with 66 additions and 21 deletions
+66 -21
View File
@@ -2123,40 +2123,85 @@ __stdcall EgtGetCalcAngles( const double vtDirT[3], const double vtDirA[3],
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtGetCalcPositions( const double ptP[3], double dAngA, double dAngB,
int* pnStat, double* pdX, double* pdY, double* pdZ)
__stdcall EgtGetCalcAnglesEx( const double vtDirT[3], const double vtDirA[3],
int* pnStat, double*& vAngs1, double*& vAngs2, int* pnCount)
{
if ( ptP == nullptr ||
pnStat == nullptr || pdX == nullptr || pdY == nullptr || pdZ == nullptr)
if ( vtDirT == nullptr || vtDirA == nullptr ||
pnStat == nullptr || pnCount == nullptr || &vAngs1 == nullptr || &vAngs2 == nullptr)
return FALSE ;
return ( ExeGetCalcPositions( ptP, dAngA, dAngB, *pnStat, *pdX, *pdY, *pdZ) ? TRUE : FALSE) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtGetCalcTipFromPositions( double dX, double dY, double dZ, double dAngA, double dAngB,
BOOL bBottom, double ptTip[3])
{
Point3d ptTmp ;
if ( ! ExeGetCalcTipFromPositions( dX, dY, dZ, dAngA, dAngB, ( bBottom != FALSE), ptTmp))
DBLVECTOR vA1, vA2 ;
if ( ! ExeGetCalcAngles( vtDirT, vtDirA, *pnStat, vA1, vA2) || vA1.size() != vA2.size())
return FALSE ;
// ritorno i dati
if ( ptTip != nullptr)
VEC_FROM_3D( ptTip, ptTmp) ;
// restituzione vettori angoli
int nDim = int( vA1.size()) ;
if ( nDim == 0) {
vAngs1 = nullptr ;
vAngs2 = nullptr ;
}
else {
vAngs1 = (double*) malloc( nDim * sizeof( double)) ;
if ( vAngs1 == nullptr)
return FALSE ;
vAngs2 = (double*) malloc( nDim * sizeof( double)) ;
if ( vAngs2 == nullptr) {
free( vAngs1) ;
return FALSE ;
}
for ( int i = 0 ; i < nDim ; ++ i) {
vAngs1[i] = vA1[i] ;
vAngs2[i] = vA2[i] ;
}
}
*pnCount = nDim ;
return TRUE ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtGetCalcToolDirFromAngles( double dAngA, double dAngB, double vtDir[3])
__stdcall EgtGetCalcPositions( const double ptP[3], int nCount, const double dAngs[],
int* pnStat, double* pdX, double* pdY, double* pdZ)
{
DBLVECTOR vAng( 2) ; vAng[0] = dAngA ; vAng[1] = dAngB ;
if ( ptP == nullptr || dAngs == nullptr ||
pnStat == nullptr || pdX == nullptr || pdY == nullptr || pdZ == nullptr)
return FALSE ;
DBLVECTOR vAng ;
for ( int i = 0 ; i < nCount ; ++i)
vAng.push_back( dAngs[i]) ;
return ( ExeGetCalcPositions( ptP, vAng, *pnStat, *pdX, *pdY, *pdZ) ? TRUE : FALSE) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtGetCalcTipFromPositions( double dX, double dY, double dZ, int nCount, const double dAngs[],
BOOL bBottom, double ptTip[3])
{
if ( dAngs == nullptr || ptTip == nullptr)
return FALSE ;
DBLVECTOR vAng ;
for ( int i = 0 ; i < nCount ; ++i)
vAng.push_back( dAngs[i]) ;
Point3d ptTmp ;
if ( ! ExeGetCalcTipFromPositions( dX, dY, dZ, vAng, ( bBottom != FALSE), ptTmp))
return FALSE ;
// ritorno i dati
VEC_FROM_3D( ptTip, ptTmp) ;
return TRUE ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtGetCalcToolDirFromAngles( int nCount, const double dAngs[], double vtDir[3])
{
if ( dAngs == nullptr || vtDir == nullptr)
return FALSE ;
DBLVECTOR vAng ;
for ( int i = 0 ; i < nCount ; ++i)
vAng.push_back( dAngs[i]) ;
Vector3d vtTmp ;
if ( ! ExeGetCalcToolDirFromAngles( vAng, vtTmp))
return FALSE ;
// ritorno i dati
if ( vtDir != nullptr)
VEC_FROM_3D( vtDir, vtTmp) ;
VEC_FROM_3D( vtDir, vtTmp) ;
return TRUE ;
}