847380b1db
- aggiunta interfaccia per funzione EgtExtractSurfBezierLoops - riordinate funzioni per GdbGet - in Release cambiate opzioni di ottimizzazione da /Ox a /O2.
249 lines
6.7 KiB
C++
249 lines
6.7 KiB
C++
//----------------------------------------------------------------------------
|
|
// EgalTech 2014-2014
|
|
//----------------------------------------------------------------------------
|
|
// File : API_GeoSnap.cpp Data : 02.10.14 Versione : 1.5i5
|
|
// Contenuto : Funzioni di snap ad oggetti del DB geometrico per API.
|
|
//
|
|
//
|
|
//
|
|
// Modifiche : 02.10.14 DS Creazione modulo.
|
|
//
|
|
//
|
|
//----------------------------------------------------------------------------
|
|
|
|
//--------------------------- Include ----------------------------------------
|
|
#include "stdafx.h"
|
|
#include "API.h"
|
|
#include "/EgtDev/Include/EInAPI.h"
|
|
#include "/EgtDev/Include/EXeExecutor.h"
|
|
|
|
using namespace std ;
|
|
|
|
//----------------------------------------------------------------------------
|
|
BOOL
|
|
__stdcall EgtStartPoint( int nId, int nRefId, double ptP[3])
|
|
{
|
|
// recupero il punto
|
|
Point3d ptStart ;
|
|
if ( ! ExeStartPoint( nId, nRefId, ptStart))
|
|
return FALSE ;
|
|
// ritorno il punto
|
|
VEC_FROM_3D( ptP, ptStart)
|
|
return TRUE ;
|
|
}
|
|
|
|
//----------------------------------------------------------------------------
|
|
BOOL
|
|
__stdcall EgtEndPoint( int nId, int nRefId, double ptP[3])
|
|
{
|
|
// recupero il punto
|
|
Point3d ptEnd ;
|
|
if ( ! ExeEndPoint( nId, nRefId, ptEnd))
|
|
return FALSE ;
|
|
// ritorno il punto
|
|
VEC_FROM_3D( ptP, ptEnd)
|
|
return TRUE ;
|
|
}
|
|
|
|
//----------------------------------------------------------------------------
|
|
BOOL
|
|
__stdcall EgtMidPoint( int nId, int nRefId, double ptP[3])
|
|
{
|
|
// recupero il punto
|
|
Point3d ptMid ;
|
|
if ( ! ExeMidPoint( nId, nRefId, ptMid))
|
|
return FALSE ;
|
|
// ritorno il punto
|
|
VEC_FROM_3D( ptP, ptMid)
|
|
return TRUE ;
|
|
}
|
|
|
|
//----------------------------------------------------------------------------
|
|
BOOL
|
|
__stdcall EgtCenterPoint( int nId, int nRefId, double ptP[3])
|
|
{
|
|
// recupero il punto
|
|
Point3d ptCent ;
|
|
if ( ! ExeCenterPoint( nId, nRefId, ptCent))
|
|
return FALSE ;
|
|
// ritorno il punto
|
|
VEC_FROM_3D( ptP, ptCent)
|
|
return TRUE ;
|
|
}
|
|
|
|
//----------------------------------------------------------------------------
|
|
BOOL
|
|
__stdcall EgtCentroid( int nId, int nRefId, double ptP[3])
|
|
{
|
|
// recupero il punto
|
|
Point3d ptCent ;
|
|
if ( ! ExeCentroid( nId, nRefId, ptCent))
|
|
return FALSE ;
|
|
// ritorno il punto
|
|
VEC_FROM_3D( ptP, ptCent)
|
|
return TRUE ;
|
|
}
|
|
|
|
//----------------------------------------------------------------------------
|
|
BOOL
|
|
__stdcall EgtAtParamPoint( int nId, double dU, int nRefId, double ptP[3])
|
|
{
|
|
// recupero il punto
|
|
Point3d ptAtPar ;
|
|
if ( ! ExeAtParamPoint( nId, dU, nRefId, ptAtPar))
|
|
return FALSE ;
|
|
// ritorno il punto
|
|
VEC_FROM_3D( ptP, ptAtPar)
|
|
return TRUE ;
|
|
}
|
|
|
|
//----------------------------------------------------------------------------
|
|
BOOL
|
|
__stdcall EgtNearPoint( int nId, const double ptNear[3], int nRefId, double ptP[3])
|
|
{
|
|
// recupero il punto
|
|
Point3d ptInt ;
|
|
if ( ! ExeNearPoint( nId, ptNear, nRefId, ptInt))
|
|
return FALSE ;
|
|
// ritorno il punto
|
|
VEC_FROM_3D( ptP, ptInt)
|
|
return TRUE ;
|
|
}
|
|
|
|
//----------------------------------------------------------------------------
|
|
BOOL
|
|
__stdcall EgtIntersectionPoint( int nId1, int nId2, const double ptNear[3], int nRefId, double ptP[3])
|
|
{
|
|
// recupero il punto
|
|
Point3d ptInt ;
|
|
if ( ! ExeIntersectionPoint( nId1, nId2, ptNear, nRefId, ptInt))
|
|
return FALSE ;
|
|
// ritorno il punto
|
|
VEC_FROM_3D( ptP, ptInt)
|
|
return TRUE ;
|
|
}
|
|
|
|
//----------------------------------------------------------------------------
|
|
BOOL
|
|
__stdcall EgtStartVector( int nId, int nRefId, double vtV[3])
|
|
{
|
|
// recupero il vettore
|
|
Vector3d vtStart ;
|
|
if ( ! ExeStartVector( nId, nRefId, vtStart))
|
|
return FALSE ;
|
|
// ritorno il vettore
|
|
VEC_FROM_3D( vtV, vtStart)
|
|
return TRUE ;
|
|
}
|
|
|
|
//----------------------------------------------------------------------------
|
|
BOOL
|
|
__stdcall EgtEndVector( int nId, int nRefId, double vtV[3])
|
|
{
|
|
// recupero il vettore
|
|
Vector3d vtEnd ;
|
|
if ( ! ExeEndVector( nId, nRefId, vtEnd))
|
|
return FALSE ;
|
|
// ritorno il vettore
|
|
VEC_FROM_3D( vtV, vtEnd)
|
|
return TRUE ;
|
|
}
|
|
|
|
//----------------------------------------------------------------------------
|
|
BOOL
|
|
__stdcall EgtMidVector( int nId, int nRefId, double vtV[3])
|
|
{
|
|
// recupero il vettore
|
|
Vector3d vtMid ;
|
|
if ( ! ExeMidVector( nId, nRefId, vtMid))
|
|
return FALSE ;
|
|
// ritorno il vettore
|
|
VEC_FROM_3D( vtV, vtMid)
|
|
return TRUE ;
|
|
}
|
|
|
|
//----------------------------------------------------------------------------
|
|
BOOL
|
|
__stdcall EgtAtParamVector( int nId, double dU, int nSide, int nRefId, double vtV[3])
|
|
{
|
|
// recupero il vettore
|
|
Vector3d vtAtPar ;
|
|
if ( ! ExeAtParamVector( nId, dU, nSide, nRefId, vtAtPar))
|
|
return FALSE ;
|
|
// ritorno il vettore
|
|
VEC_FROM_3D( vtV, vtAtPar)
|
|
return TRUE ;
|
|
}
|
|
|
|
//----------------------------------------------------------------------------
|
|
BOOL
|
|
__stdcall EgtFrame( int nId, int nRefId, double ptOrig[3], double vtX[3], double vtY[3], double vtZ[3])
|
|
{
|
|
// recupero il frame
|
|
Frame3d frFrame ;
|
|
if ( ! ExeFrame( nId, nRefId, frFrame))
|
|
return FALSE ;
|
|
// assegno l'origine
|
|
VEC_FROM_3D( ptOrig, frFrame.Orig())
|
|
// assegno il versore X
|
|
VEC_FROM_3D( vtX, frFrame.VersX())
|
|
// assegno il versore Y
|
|
VEC_FROM_3D( vtY, frFrame.VersY())
|
|
// assegno il versore Z
|
|
VEC_FROM_3D( vtZ, frFrame.VersZ())
|
|
return TRUE ;
|
|
}
|
|
|
|
//-------------------------------------------------------------------------------
|
|
BOOL
|
|
__stdcall EgtPointToIdGlob( double ptP[3], int nId)
|
|
{
|
|
// trasformo il punto
|
|
Point3d ptTmp( ptP) ;
|
|
if ( ! ExePointToIdGlob( ptTmp, nId))
|
|
return FALSE ;
|
|
// ritorno il punto
|
|
VEC_FROM_3D( ptP, ptTmp)
|
|
return TRUE ;
|
|
}
|
|
|
|
//-------------------------------------------------------------------------------
|
|
BOOL
|
|
__stdcall EgtPointToIdLoc( double ptP[3], int nId)
|
|
{
|
|
// trasformo il punto
|
|
Point3d ptTmp( ptP) ;
|
|
if ( ! ExePointToIdLoc( ptTmp, nId))
|
|
return FALSE ;
|
|
// ritorno il punto
|
|
VEC_FROM_3D( ptP, ptTmp)
|
|
return TRUE ;
|
|
}
|
|
|
|
//-------------------------------------------------------------------------------
|
|
BOOL
|
|
__stdcall EgtVectorToIdGlob( double vtV[3], int nId)
|
|
{
|
|
// trasformo il vettore
|
|
Vector3d vtTmp( vtV) ;
|
|
if ( ! ExeVectorToIdGlob( vtTmp, nId))
|
|
return FALSE ;
|
|
// ritorno il punto
|
|
VEC_FROM_3D( vtV, vtTmp)
|
|
return TRUE ;
|
|
}
|
|
|
|
//-------------------------------------------------------------------------------
|
|
BOOL
|
|
__stdcall EgtVectorToIdLoc( double vtV[3], int nId)
|
|
{
|
|
// trasformo il vettore
|
|
Vector3d vtTmp( vtV) ;
|
|
if ( ! ExeVectorToIdLoc( vtTmp, nId))
|
|
return FALSE ;
|
|
// ritorno il punto
|
|
VEC_FROM_3D( vtV, vtTmp)
|
|
return TRUE ;
|
|
}
|
|
|