556e3579a6
- aggiunta interfaccia EgtPlaneSurfTmInters e modificata interfaccia EgtSurfTmSurfTmInters.
77 lines
2.9 KiB
C++
77 lines
2.9 KiB
C++
//----------------------------------------------------------------------------
|
|
// EgalTech 2018-2018
|
|
//----------------------------------------------------------------------------
|
|
// File : API_GeoInters.cpp Data : 15.12.18 Versione : 1.9l2
|
|
// Contenuto : Funzioni intersezione tra oggetti del DB geometrico per API.
|
|
//
|
|
//
|
|
//
|
|
// Modifiche : 15.12.18 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 EgtLineSurfTmInters( const double ptP[3], const double vtDir[3], int nId, int nRefType,
|
|
int*& vFlagInters, double*& vParInters, int* pnCount)
|
|
{
|
|
// verifica parametri
|
|
if ( ptP == nullptr || vtDir == nullptr || &vFlagInters == nullptr || &vParInters == nullptr || pnCount == nullptr)
|
|
return FALSE ;
|
|
// eseguo intersezione
|
|
INTDBLVECTOR vInters ;
|
|
if ( ! ExeLineSurfTmInters( ptP, vtDir, nId, nRefType, vInters))
|
|
return FALSE ;
|
|
// assegno risultati
|
|
int nDim = int( vInters.size()) ;
|
|
if ( nDim == 0) {
|
|
vFlagInters = nullptr ;
|
|
vParInters = nullptr ;
|
|
}
|
|
else {
|
|
vFlagInters = (int*) malloc( nDim * sizeof( int)) ;
|
|
if ( vFlagInters == nullptr)
|
|
return FALSE ;
|
|
vParInters = (double*) malloc( nDim * sizeof( double)) ;
|
|
if ( vParInters == nullptr) {
|
|
free( vFlagInters) ;
|
|
return FALSE ;
|
|
}
|
|
for ( int i = 0 ; i < nDim ; ++ i) {
|
|
vFlagInters[i] = vInters[i].first ;
|
|
vParInters[i] = vInters[i].second ;
|
|
}
|
|
}
|
|
*pnCount = nDim ;
|
|
return TRUE ;
|
|
}
|
|
|
|
//----------------------------------------------------------------------------
|
|
int
|
|
__stdcall EgtPlaneSurfTmInters( const double ptOn[3], const double vtN[3], int nId, int nDestGrpId, int nRefType, double dToler,
|
|
int* pnPntCount, int* pnCrvCount, int* pnSrfCount)
|
|
{
|
|
if ( ptOn == nullptr || vtN == nullptr || pnPntCount == nullptr || pnCrvCount == nullptr || pnSrfCount == nullptr)
|
|
return FALSE ;
|
|
return ExePlaneSurfTmInters( ptOn, vtN, nId, nDestGrpId, nRefType, dToler, pnPntCount, pnCrvCount, pnSrfCount) ;
|
|
}
|
|
|
|
//----------------------------------------------------------------------------
|
|
int
|
|
__stdcall EgtSurfTmSurfTmInters( int nId1, int nId2, int nDestGrpId, double dToler,
|
|
int* pnPntCount, int* pnCrvCount, int* pnSrfCount)
|
|
{
|
|
if ( pnPntCount == nullptr || pnCrvCount == nullptr || pnSrfCount == nullptr)
|
|
return FALSE ;
|
|
return ExeSurfTmSurfTmInters( nId1, nId2, nDestGrpId, dToler, pnPntCount, pnCrvCount, pnSrfCount) ;
|
|
}
|