EgtExecutor 1.6t3 :

- CompoChain prende estrusione di prima curva
- aggiunte Exe e Lua GetCurveLinearConvexHullXY e CurveMinAreaRectangleXY.
This commit is contained in:
Dario Sassi
2016-08-25 15:56:36 +00:00
parent 61f65bfe2a
commit 4de59fbd33
11 changed files with 177 additions and 27 deletions
+46 -4
View File
@@ -14,6 +14,7 @@
//--------------------------- Include ----------------------------------------
#include "stdafx.h"
#include "EXE.h"
#include "EXE_Const.h"
#include "EXE_Macro.h"
#include "GeoTools.h"
#include "/EgtDev/Include/EXeExecutor.h"
@@ -681,17 +682,57 @@ ExeCurveSelfIntersCount( int nId, int* pnCount)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
// verifico il parametro
if ( pnCount == nullptr)
return false ;
// recupero la curva
ICurve* pCurve = GetCurve( pGeomDB->GetGeoObj( nId)) ;
bool bOk = ( pCurve != nullptr) ;
if ( pCurve == nullptr)
return false ;
// calcolo le auto-intersezioni
SelfIntersCurve sintC( *pCurve) ;
// ne recupero il numero
if ( pnCount != nullptr)
*pnCount = sintC.GetIntersCount() ;
*pnCount = sintC.GetIntersCount() ;
return true ;
}
//----------------------------------------------------------------------------
bool
ExeCurveMinAreaRectangleXY( int nId, int nRefId, Frame3d& frRect, double& dDimX, double& dDimY)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
// recupero la curva
ICurve* pCurve = GetCurve( pGeomDB->GetGeoObj( nId)) ;
bool bOk = ( pCurve != nullptr) ;
// recupero il riferimento della curva
Frame3d frCrv ;
bOk = bOk && pGeomDB->GetGlobFrame( nId, frCrv) ;
// derivo la polilinea di approssimazione della curva entro la tolleranza standard
PolyLine PL ;
bOk = bOk && pCurve->ApproxWithLines( LIN_TOL_FINE, ANG_TOL_STD_DEG, APP_LINES, PL) ;
// eventuale trasformazione per riferimento di espressione
if ( bOk && nRefId == GDB_ID_ROOT)
PL.ToGlob( frCrv) ;
else if ( bOk && nRefId == GDB_ID_GRID)
PL.LocToLoc( frCrv, pGeomDB->GetGridFrame()) ;
else if ( bOk && nRefId != nId) {
Frame3d frDest ;
// nRefId può essere un gruppo o una entità
if ( pGeomDB->GetGroupGlobFrame( nRefId, frDest) ||
pGeomDB->GetGlobFrame( nRefId, frDest))
PL.LocToLoc( frCrv, frDest) ;
else
bOk = false ;
}
// derivo il rettangolo in XY di area minima di questa
Point3d ptCen ;
Vector3d vtAx ;
bOk = bOk && PL.GetMinAreaRectangleXY( ptCen, vtAx, dDimX, dDimY) &&
frRect.Set( ptCen, Z_AX, vtAx) ;
return bOk ;
}
//----------------------------------------------------------------------------
int
ExeClosedCurveClassify( int nId1, int nId2)
@@ -921,7 +962,8 @@ ExeSurfFrChunkSimpleClassify( int nId1, int nChunk1, int nId2, int nChunk2)
pSfr2L = pTmp ;
}
// classifico il chunk della prima regione rispetto a quello della seconda
return pSfr1->GetChunkSimpleClassification( nChunk1, *pSfr2L, nChunk2) ;
int nRes = ( bOk ? pSfr1->GetChunkSimpleClassification( nChunk1, *pSfr2L, nChunk2) : REGC_NULL) ;
return nRes ;
}
//----------------------------------------------------------------------------