Files
EgtInterface/API_GdbGetCurve.cpp
T
Dario Sassi 847380b1db EgtInterface :
- aggiunta interfaccia per funzione EgtExtractSurfBezierLoops
- riordinate funzioni per GdbGet
- in Release cambiate opzioni di ottimizzazione da /Ox  a /O2.
2020-03-30 11:08:03 +00:00

207 lines
6.2 KiB
C++

//----------------------------------------------------------------------------
// EgalTech 2020-2020
//----------------------------------------------------------------------------
// File : API_GetCurve.cpp Data : 30.03.20 Versione : 2.2c3
// Contenuto : Funzioni di interrogazione delle curve per API.
//
//
//
// Modifiche : 30.03.20 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 EgtCurveDomain( int nId, double* pdStart, double* pdEnd)
{
return ( ExeCurveDomain( nId, pdStart, pdEnd) ? TRUE : FALSE) ;
}
//----------------------------------------------------------------------------
BOOL
__stdcall EgtCurveLength( int nId, double* pdLen)
{
return ( ExeCurveLength( nId, pdLen) ? TRUE : FALSE) ;
}
//----------------------------------------------------------------------------
BOOL
__stdcall EgtCurveLengthAtPoint( int nId, const double ptOn[3], double dExtend, double* pdLen)
{
return ( ExeCurveLengthAtPoint( nId, ptOn, dExtend, pdLen) ? TRUE : FALSE) ;
}
//----------------------------------------------------------------------------
BOOL
__stdcall EgtCurveIsClosed( int nId)
{
return ( ExeCurveIsClosed( nId) ? TRUE : FALSE) ;
}
//----------------------------------------------------------------------------
BOOL
__stdcall EgtCurveIsFlat( int nId, double vtN[3], double* pdDist)
{
if ( vtN == nullptr || pdDist == nullptr)
return FALSE ;
Plane3d Plane ;
if ( ! ExeCurveIsFlat( nId, Plane))
return FALSE ;
VEC_FROM_3D( vtN, Plane.GetVersN())
*pdDist = Plane.GetDist() ;
return TRUE ;
}
//----------------------------------------------------------------------------
BOOL
__stdcall EgtCurveAreaXY( int nId, double* pdArea)
{
return ( ExeCurveAreaXY( nId, *pdArea) ? TRUE : FALSE) ;
}
//----------------------------------------------------------------------------
BOOL
__stdcall EgtCurveArea( int nId, double vtN[3], double* pdDist, double* pdArea)
{
if ( vtN == nullptr || pdDist == nullptr || pdArea == nullptr)
return FALSE ;
Plane3d Plane ;
if ( ! ExeCurveArea( nId, Plane, *pdArea))
return FALSE ;
VEC_FROM_3D( vtN, Plane.GetVersN())
*pdDist = Plane.GetDist() ;
return TRUE ;
}
//----------------------------------------------------------------------------
BOOL
__stdcall EgtCurveNearestExtremityToPoint( int nId, const double ptP[3], BOOL* pbStart)
{
if ( pbStart == nullptr)
return FALSE ;
bool bStart ;
if ( ! ExeCurveNearestExtremityToPoint( nId, ptP, bStart))
return FALSE ;
*pbStart = ( bStart ? TRUE : FALSE) ;
return TRUE ;
}
//----------------------------------------------------------------------------
BOOL
__stdcall EgtCurveExtrusion( int nId, int nRefId, double vtExtr[3])
{
// recupero il vettore estrusione
Vector3d vtTmp ;
if ( ! ExeCurveExtrusion( nId, nRefId, vtTmp))
return FALSE ;
// lo assegno
VEC_FROM_3D( vtExtr, vtTmp)
return TRUE ;
}
//----------------------------------------------------------------------------
BOOL
__stdcall EgtCurveThickness( int nId, double* pdThick)
{
return ( ExeCurveThickness( nId, pdThick) ? TRUE : FALSE) ;
}
//----------------------------------------------------------------------------
BOOL
__stdcall EgtCurveSelfIntersCount( int nId, int* pnCount)
{
return ( ExeCurveSelfIntersCount( nId, pnCount) ? TRUE : FALSE) ;
}
//----------------------------------------------------------------------------
BOOL
__stdcall EgtCurveMinAreaRectangleXY( int nId, int nRefId,
double ptOrig[3], double vtX[3], double vtY[3], double vtZ[3], double* pdDimX, double* pdDimY)
{
// eseguo calcoli
Frame3d frRect ;
double dDimX, dDimY ;
if ( ! ExeCurveMinAreaRectangleXY( nId, nRefId, frRect, dDimX, dDimY))
return FALSE ;
// assegno l'origine
if ( ptOrig != nullptr)
VEC_FROM_3D( ptOrig, frRect.Orig())
// assegno il versore X
if ( vtX != nullptr)
VEC_FROM_3D( vtX, frRect.VersX())
// assegno il versore Y
if ( vtY != nullptr)
VEC_FROM_3D( vtY, frRect.VersY())
// assegno il versore Z
if ( vtZ != nullptr)
VEC_FROM_3D( vtZ, frRect.VersZ())
if ( pdDimX != nullptr)
*pdDimX = dDimX ;
if ( pdDimY != nullptr)
*pdDimY = dDimY ;
return TRUE ;
}
//----------------------------------------------------------------------------
int
__stdcall EgtClosedCurveClassify( int nId1, int nId2)
{
return ExeClosedCurveClassify( nId1, nId2) ;
}
//----------------------------------------------------------------------------
BOOL
__stdcall EgtArcRadius( int nId, double* pdRad)
{
return ( ExeArcRadius( nId, pdRad) ? TRUE : FALSE) ;
}
//----------------------------------------------------------------------------
BOOL
__stdcall EgtArcAngCenter( int nId, double* pdAngDeg)
{
return ( ExeArcAngCenter( nId, pdAngDeg) ? TRUE : FALSE) ;
}
//----------------------------------------------------------------------------
BOOL
__stdcall EgtArcDeltaN( int nId, double* pdDeltaN)
{
return ( ExeArcDeltaN( nId, pdDeltaN) ? TRUE : FALSE) ;
}
//----------------------------------------------------------------------------
BOOL
__stdcall EgtArcNormVersor( int nId, int nRefId, double vtNorm[3])
{
// recupero il vettore normale
Vector3d vtTmp ;
if ( ! ExeArcNormVersor( nId, nRefId, vtTmp))
return FALSE ;
// lo assegno
VEC_FROM_3D( vtNorm, vtTmp)
return TRUE ;
}
//----------------------------------------------------------------------------
BOOL
__stdcall EgtCurveCompoCenter( int nId, int nSimpCrv, int nRefId, double ptCen[3])
{
// recupero il centro
Point3d ptTmp ;
if ( ! ExeCurveCompoCenter( nId, nSimpCrv, nRefId, ptTmp))
return FALSE ;
// lo assegno
VEC_FROM_3D( ptCen, ptTmp)
return TRUE ;
}