EgtExecutor :

- a funzione ExeSurfTmFacetElevationInBBox aggiunto parametro bAcceptOutFacet (anche a corrispondente funzione lua come opzionale)
This commit is contained in:
Dario Sassi
2023-11-28 10:57:40 +01:00
parent 68af08cf32
commit b522f4cea2
2 changed files with 13 additions and 7 deletions
+6 -4
View File
@@ -592,7 +592,7 @@ ExeSurfTmFacetMinAreaRectangle( int nId, int nFacet, int nRefId, Frame3d& frRect
//----------------------------------------------------------------------------
bool
ExeSurfTmFacetElevationInBBox( int nId, int nFacet, const BBox3d& b3Box, int nRefId, double& dElev)
ExeSurfTmFacetElevationInBBox( int nId, int nFacet, const BBox3d& b3Box, bool bAcceptOutFacet, int nRefId, double& dElev)
{
// La faccia deve essere tutta contenuta nel Box
IGeomDB* pGeomDB = GetCurrGeomDB() ;
@@ -630,10 +630,12 @@ ExeSurfTmFacetElevationInBBox( int nId, int nFacet, const BBox3d& b3Box, int nRe
if ( vPL.empty())
return false ;
vPL[0].LocToLoc( frStm, frBox) ;
// verifico sia contenuto nella faccia
// se richiesto, verifico sia contenuto nella faccia
BBox3d b3Fac ;
if ( ! vPL[0].GetLocalBBox( b3Fac))
return false ;
BBox3d b3ExpBox = b3Box ; b3ExpBox.Expand( 100 * EPS_SMALL) ;
if ( ! vPL[0].GetLocalBBox( b3Fac) || ! b3ExpBox.Encloses( b3Fac))
if ( ! bAcceptOutFacet && ! b3ExpBox.Encloses( b3Fac))
return false ;
// calcolo elevazione massima del contorno della faccia
const double RAY_LEN = 100000 ;
@@ -645,7 +647,7 @@ ExeSurfTmFacetElevationInBBox( int nId, int nFacet, const BBox3d& b3Box, int nRe
IntersLineBox( ptP, vtN, RAY_LEN, b3Box, vInters, true) ;
for ( int i = 0 ; i < int( vInters.size()) ; ++ i) {
if ( i == 0 && vInters[i].first == ILBT_IN) {
if ( vInters[i].second > 100 * EPS_SMALL)
if ( ! bAcceptOutFacet && vInters[i].second > 100 * EPS_SMALL)
break ;
}
else if ( vInters[i].first == ILBT_OUT || vInters[i].first == ILBT_TG_FIN)
+7 -3
View File
@@ -629,19 +629,23 @@ LuaSurfTmFacetMinAreaRectangle( lua_State* L)
static int
LuaSurfTmFacetElevationInBBox( lua_State* L)
{
// 3 o 4 parametri : Id, nFacet, b3Box [, nRefId]
// 3 o 4 o 5 parametri : Id, nFacet, b3Box [, bAcceptOutFacet] [, nRefId]
int nId ;
LuaCheckParam( L, 1, nId)
int nFacet ;
LuaCheckParam( L, 2, nFacet)
BBox3d b3Box ;
LuaCheckParam( L, 3, b3Box)
bool bAcceptOutFacet = false ;
int nRefId = nId ;
LuaGetParam( L, 4, nRefId) ;
if ( ! LuaGetParam( L, 4, nRefId)) {
LuaGetParam( L, 4, bAcceptOutFacet) ;
LuaGetParam( L, 5, nRefId) ;
}
LuaClearStack( L) ;
// calcolo elevazione
double dElev ;
bool bOk = ExeSurfTmFacetElevationInBBox( nId, nFacet, b3Box, nRefId, dElev) ;
bool bOk = ExeSurfTmFacetElevationInBBox( nId, nFacet, b3Box, bAcceptOutFacet, nRefId, dElev) ;
if ( bOk)
LuaSetParam( L, dElev) ;
else