EgtExecutor 2.5k6 :
- aggiunte funzioni Exe e Lua CurveGetVoronoi e CurveGetFatCurve.
This commit is contained in:
@@ -26,6 +26,7 @@
|
||||
#include "/EgtDev/Include/EGkDistPointCurve.h"
|
||||
#include "/EgtDev/Include/EGkIntersCurves.h"
|
||||
#include "/EgtDev/Include/EGkSurfFlatRegion.h"
|
||||
#include "EgtDev/Include/EGkVoronoi.h"
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
@@ -676,3 +677,93 @@ ExeCurveCompoNormVersor( int nId, int nSimpCrv, int nRefId, Vector3d& vtNorm)
|
||||
// gestione trasformazione ( eventuale)
|
||||
return TransformVector( pGeomDB, nId, nRefId, vtNorm) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
int
|
||||
ExeCurveGetVoronoi( int nId, int nDestGrpId, int nBound, int* pnCount)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, false)
|
||||
// recupero la curva
|
||||
const ICurve* pCrv = GetCurve( pGeomDB->GetGeoObj( nId)) ;
|
||||
if ( pCrv == nullptr)
|
||||
return GDB_ID_NULL ;
|
||||
// recupero il riferimento della curva
|
||||
Frame3d frCrv ;
|
||||
if ( ! pGeomDB->GetGlobFrame( nId, frCrv))
|
||||
return GDB_ID_NULL ;
|
||||
// recupero il riferimento di destinazione
|
||||
Frame3d frDest ;
|
||||
if ( ! pGeomDB->GetGroupGlobFrame( nDestGrpId, frDest))
|
||||
return GDB_ID_NULL ;
|
||||
|
||||
// recupero oggetto voronoi e calcolo diagramma di Voronoi
|
||||
Voronoi* voronoi = pCrv->GetVoronoiObject() ;
|
||||
if ( voronoi == nullptr)
|
||||
return GDB_ID_NULL ;
|
||||
ICURVEPOVECTOR vCrv ;
|
||||
voronoi->CalcVoronoiDiagram( vCrv, nBound) ;
|
||||
|
||||
// inserisco i risultati nel DB geometrico
|
||||
int nFirstId = GDB_ID_NULL ;
|
||||
int nCount = 0 ;
|
||||
for ( int i = 0 ; i < int( vCrv.size()) ; i++) {
|
||||
vCrv[i]->LocToLoc( frCrv, frDest) ;
|
||||
int nId = pGeomDB->AddGeoObj( GDB_ID_NULL, nDestGrpId, Release( vCrv[i])) ;
|
||||
if ( nId != GDB_ID_NULL) {
|
||||
nCount ++ ;
|
||||
if ( nFirstId == GDB_ID_NULL)
|
||||
nFirstId = nId ;
|
||||
}
|
||||
}
|
||||
|
||||
// restituisco risultati
|
||||
if ( pnCount != nullptr)
|
||||
*pnCount = nCount ;
|
||||
return nFirstId ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
int
|
||||
ExeCurveGetFatCurve( int nId, int nDestGrpId, double dRad, bool bSquareEnds, bool bSquareMids, int* pnCount)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, false)
|
||||
// recupero la curva
|
||||
const ICurve* pCrv = GetCurve( pGeomDB->GetGeoObj( nId)) ;
|
||||
if ( pCrv == nullptr)
|
||||
return GDB_ID_NULL ;
|
||||
// recupero il riferimento della curva
|
||||
Frame3d frCrv ;
|
||||
if ( ! pGeomDB->GetGlobFrame( nId, frCrv))
|
||||
return GDB_ID_NULL ;
|
||||
// recupero il riferimento di destinazione
|
||||
Frame3d frDest ;
|
||||
if ( ! pGeomDB->GetGroupGlobFrame( nDestGrpId, frDest))
|
||||
return GDB_ID_NULL ;
|
||||
|
||||
// recupero oggetto voronoi e calcolo la curva ingrossata
|
||||
Voronoi* voronoi = pCrv->GetVoronoiObject() ;
|
||||
if ( voronoi == nullptr)
|
||||
return GDB_ID_NULL ;
|
||||
ICURVEPOVECTOR vCrv ;
|
||||
voronoi->CalcFatCurve( vCrv, dRad, bSquareEnds, bSquareMids) ;
|
||||
|
||||
// inserisco i risultati nel DB geometrico
|
||||
int nFirstId = GDB_ID_NULL ;
|
||||
int nCount = 0 ;
|
||||
for ( int i = 0 ; i < int( vCrv.size()) ; i++) {
|
||||
vCrv[i]->LocToLoc( frCrv, frDest) ;
|
||||
int nId = pGeomDB->AddGeoObj( GDB_ID_NULL, nDestGrpId, Release( vCrv[i])) ;
|
||||
if ( nId != GDB_ID_NULL) {
|
||||
nCount ++ ;
|
||||
if ( nFirstId == GDB_ID_NULL)
|
||||
nFirstId = nId ;
|
||||
}
|
||||
}
|
||||
|
||||
// restituisco risultati
|
||||
if ( pnCount != nullptr)
|
||||
*pnCount = nCount ;
|
||||
return nFirstId ;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user