50b2d271ac
- aggiunto interprete Lua - portate in interfaccia API molte funzioni di base.
190 lines
7.2 KiB
C++
190 lines
7.2 KiB
C++
//----------------------------------------------------------------------------
|
|
// EgalTech 2014-2014
|
|
//----------------------------------------------------------------------------
|
|
// File : API_GeoTransform.cpp Data : 30.09.14 Versione : 1.5i5
|
|
// Contenuto : Funzioni di trasformazione geometrica per API.
|
|
//
|
|
//
|
|
//
|
|
// Modifiche : 30.09.14 DS Creazione modulo.
|
|
//
|
|
//
|
|
//----------------------------------------------------------------------------
|
|
|
|
//--------------------------- Include ----------------------------------------
|
|
#include "stdafx.h"
|
|
#include "API.h"
|
|
#include "API_Macro.h"
|
|
#include "/EgtDev/Include/EInAPI.h"
|
|
|
|
using namespace std ;
|
|
|
|
|
|
//-------------------------------------------------------------------------------
|
|
BOOL
|
|
__stdcall EgtMove( int nGseCtx, int nId, double vVtMove[3])
|
|
{
|
|
IGeomDB* pGeomDB = GetGeomDB( nGseCtx) ;
|
|
VERIFY_GEOMDB( pGeomDB, FALSE)
|
|
// eseguo traslazione
|
|
return ( pGeomDB->Translate( nId, Vector3d( vVtMove)) ? TRUE : FALSE) ;
|
|
}
|
|
|
|
//-------------------------------------------------------------------------------
|
|
BOOL
|
|
__stdcall EgtMoveGlob( int nGseCtx, int nId, double vVtMove[3])
|
|
{
|
|
IGeomDB* pGeomDB = GetGeomDB( nGseCtx) ;
|
|
VERIFY_GEOMDB( pGeomDB, FALSE)
|
|
// eseguo traslazione
|
|
return ( pGeomDB->TranslateGlob( nId, Vector3d( vVtMove)) ? TRUE : FALSE) ;
|
|
}
|
|
|
|
//-------------------------------------------------------------------------------
|
|
BOOL
|
|
__stdcall EgtMoveGroup( int nGseCtx, int nId, double vVtMove[3])
|
|
{
|
|
IGeomDB* pGeomDB = GetGeomDB( nGseCtx) ;
|
|
VERIFY_GEOMDB( pGeomDB, FALSE)
|
|
// eseguo traslazione
|
|
return ( pGeomDB->TranslateGroup( nId, Vector3d( vVtMove)) ? TRUE : FALSE) ;
|
|
}
|
|
|
|
//-------------------------------------------------------------------------------
|
|
BOOL
|
|
__stdcall EgtRotate( int nGseCtx, int nId, double vPtAx[3], double vVtAx[3], double dAngRotDeg)
|
|
{
|
|
IGeomDB* pGeomDB = GetGeomDB( nGseCtx) ;
|
|
VERIFY_GEOMDB( pGeomDB, FALSE)
|
|
// eseguo rotazione
|
|
return ( pGeomDB->Rotate( nId, Point3d( vPtAx), Vector3d( vVtAx), dAngRotDeg) ? TRUE : FALSE) ;
|
|
}
|
|
|
|
//-------------------------------------------------------------------------------
|
|
BOOL
|
|
__stdcall EgtRotateGlob( int nGseCtx, int nId, double vPtAx[3], double vVtAx[3], double dAngRotDeg)
|
|
{
|
|
IGeomDB* pGeomDB = GetGeomDB( nGseCtx) ;
|
|
VERIFY_GEOMDB( pGeomDB, FALSE)
|
|
// eseguo rotazione
|
|
return ( pGeomDB->RotateGlob( nId, Point3d( vPtAx), Vector3d( vVtAx), dAngRotDeg) ? TRUE : FALSE) ;
|
|
}
|
|
|
|
//-------------------------------------------------------------------------------
|
|
BOOL
|
|
__stdcall EgtRotateGroup( int nGseCtx, int nId, double vPtAx[3], double vVtAx[3], double dAngRotDeg)
|
|
{
|
|
IGeomDB* pGeomDB = GetGeomDB( nGseCtx) ;
|
|
VERIFY_GEOMDB( pGeomDB, FALSE)
|
|
// eseguo rotazione
|
|
return ( pGeomDB->RotateGroup( nId, Point3d( vPtAx), Vector3d( vVtAx), dAngRotDeg) ? TRUE : FALSE) ;
|
|
}
|
|
|
|
//-------------------------------------------------------------------------------
|
|
BOOL
|
|
__stdcall EgtScale( int nGseCtx, int nId, const double vOrig[3],
|
|
const double vX[3], const double vY[3], const double vZ[3],
|
|
double dCoeffX, double dCoeffY, double dCoeffZ)
|
|
{
|
|
IGeomDB* pGeomDB = GetGeomDB( nGseCtx) ;
|
|
VERIFY_GEOMDB( pGeomDB, FALSE)
|
|
// eseguo rotazione
|
|
Frame3d frFrame ;
|
|
if ( ! frFrame.Set( Point3d( vOrig), Vector3d( vX), Vector3d( vY), Vector3d( vZ)))
|
|
return FALSE ;
|
|
return ( pGeomDB->Scale( nId, frFrame, dCoeffX, dCoeffY, dCoeffZ) ? TRUE : FALSE) ;
|
|
}
|
|
|
|
//-------------------------------------------------------------------------------
|
|
BOOL
|
|
__stdcall EgtScaleGlob( int nGseCtx, int nId, const double vOrig[3],
|
|
const double vX[3], const double vY[3], const double vZ[3],
|
|
double dCoeffX, double dCoeffY, double dCoeffZ)
|
|
{
|
|
IGeomDB* pGeomDB = GetGeomDB( nGseCtx) ;
|
|
VERIFY_GEOMDB( pGeomDB, FALSE)
|
|
// eseguo rotazione
|
|
Frame3d frFrame ;
|
|
if ( ! frFrame.Set( Point3d( vOrig), Vector3d( vX), Vector3d( vY), Vector3d( vZ)))
|
|
return FALSE ;
|
|
return ( pGeomDB->ScaleGlob( nId, frFrame, dCoeffX, dCoeffY, dCoeffZ) ? TRUE : FALSE) ;
|
|
}
|
|
|
|
//-------------------------------------------------------------------------------
|
|
BOOL
|
|
__stdcall EgtScaleGroup( int nGseCtx, int nId, const double vOrig[3],
|
|
const double vX[3], const double vY[3], const double vZ[3],
|
|
double dCoeffX, double dCoeffY, double dCoeffZ)
|
|
{
|
|
IGeomDB* pGeomDB = GetGeomDB( nGseCtx) ;
|
|
VERIFY_GEOMDB( pGeomDB, FALSE)
|
|
// eseguo rotazione
|
|
Frame3d frFrame ;
|
|
if ( ! frFrame.Set( Point3d( vOrig), Vector3d( vX), Vector3d( vY), Vector3d( vZ)))
|
|
return FALSE ;
|
|
return ( pGeomDB->ScaleGroup( nId, frFrame, dCoeffX, dCoeffY, dCoeffZ) ? TRUE : FALSE) ;
|
|
}
|
|
|
|
//-------------------------------------------------------------------------------
|
|
BOOL
|
|
__stdcall EgtMirror( int nGseCtx, int nId, const double vPnt[3], const double vN[3])
|
|
{
|
|
IGeomDB* pGeomDB = GetGeomDB( nGseCtx) ;
|
|
VERIFY_GEOMDB( pGeomDB, FALSE)
|
|
// eseguo specularità
|
|
return ( pGeomDB->Mirror( nId, Point3d( vPnt), Vector3d( vN)) ? TRUE : FALSE) ;
|
|
}
|
|
|
|
//-------------------------------------------------------------------------------
|
|
BOOL
|
|
__stdcall EgtMirrorGlob( int nGseCtx, int nId, const double vPnt[3], const double vN[3])
|
|
{
|
|
IGeomDB* pGeomDB = GetGeomDB( nGseCtx) ;
|
|
VERIFY_GEOMDB( pGeomDB, FALSE)
|
|
// eseguo specularità
|
|
return ( pGeomDB->MirrorGlob( nId, Point3d( vPnt), Vector3d( vN)) ? TRUE : FALSE) ;
|
|
}
|
|
|
|
//-------------------------------------------------------------------------------
|
|
BOOL
|
|
__stdcall EgtMirrorGroup( int nGseCtx, int nId, const double vPnt[3], const double vN[3])
|
|
{
|
|
IGeomDB* pGeomDB = GetGeomDB( nGseCtx) ;
|
|
VERIFY_GEOMDB( pGeomDB, FALSE)
|
|
// eseguo specularità
|
|
return ( pGeomDB->MirrorGroup( nId, Point3d( vPnt), Vector3d( vN)) ? TRUE : FALSE) ;
|
|
}
|
|
|
|
//-------------------------------------------------------------------------------
|
|
BOOL
|
|
__stdcall EgtShear( int nGseCtx, int nId, const double vPnt[3], const double vN[3],
|
|
const double vDir[3], double dCoeff)
|
|
{
|
|
IGeomDB* pGeomDB = GetGeomDB( nGseCtx) ;
|
|
VERIFY_GEOMDB( pGeomDB, FALSE)
|
|
// eseguo stiramento
|
|
return ( pGeomDB->Shear( nId, Point3d( vPnt), Vector3d( vN), Vector3d( vDir), dCoeff) ? TRUE : FALSE) ;
|
|
}
|
|
|
|
//-------------------------------------------------------------------------------
|
|
BOOL
|
|
__stdcall EgtShearGlob( int nGseCtx, int nId, const double vPnt[3], const double vN[3],
|
|
const double vDir[3], double dCoeff)
|
|
{
|
|
IGeomDB* pGeomDB = GetGeomDB( nGseCtx) ;
|
|
VERIFY_GEOMDB( pGeomDB, FALSE)
|
|
// eseguo stiramento
|
|
return ( pGeomDB->ShearGlob( nId, Point3d( vPnt), Vector3d( vN), Vector3d( vDir), dCoeff) ? TRUE : FALSE) ;
|
|
}
|
|
|
|
//-------------------------------------------------------------------------------
|
|
BOOL
|
|
__stdcall EgtShearGroup( int nGseCtx, int nId, const double vPnt[3], const double vN[3],
|
|
const double vDir[3], double dCoeff)
|
|
{
|
|
IGeomDB* pGeomDB = GetGeomDB( nGseCtx) ;
|
|
VERIFY_GEOMDB( pGeomDB, FALSE)
|
|
// eseguo stiramento
|
|
return ( pGeomDB->ShearGroup( nId, Point3d( vPnt), Vector3d( vN), Vector3d( vDir), dCoeff) ? TRUE : FALSE) ;
|
|
}
|