EgtExecutor :
- aggiunta funzione Exe e Lua SurfTmFacetMinAreaRectangle.
This commit is contained in:
@@ -1154,6 +1154,40 @@ ExeSurfTmFacetNormVersor( int nId, int nFacet, int nRefId, Vector3d& vtNorm)
|
||||
return TransformVector( pGeomDB, nId, nRefId, vtNorm) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeSurfTmFacetMinAreaRectangle( int nId, int nFacet, int nRefId, Frame3d& frRect, double& dDimX, double& dDimY)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, false)
|
||||
// recupero la superficie trimesh
|
||||
const ISurfTriMesh* pStm = GetSurfTriMesh( pGeomDB->GetGeoObj( nId)) ;
|
||||
if ( pStm == nullptr)
|
||||
return false ;
|
||||
// recupero il centro e la normale della faccia
|
||||
Point3d ptCen ; Vector3d vtN ;
|
||||
if ( ! pStm->GetFacetCenter( nFacet, ptCen, vtN))
|
||||
return false ;
|
||||
// calcolo il riferimento OCS della faccia
|
||||
Frame3d frFac ;
|
||||
if ( ! frFac.Set( ptCen, vtN))
|
||||
return false ;
|
||||
// recupero il contorno esterno della faccia e lo porto nel suo riferimento
|
||||
POLYLINEVECTOR vPL ;
|
||||
pStm->GetFacetLoops( nFacet, vPL) ;
|
||||
if ( vPL.empty())
|
||||
return false ;
|
||||
vPL[0].ToLoc( frFac) ;
|
||||
// derivo il rettangolo in XY di area minima di questa
|
||||
Point3d ptOri ;
|
||||
Vector3d vtAx ;
|
||||
if ( ! vPL[0].GetMinAreaRectangleXY( ptOri, vtAx, dDimX, dDimY) && frRect.Set( ptOri, Z_AX, vtAx))
|
||||
return false ;
|
||||
// esprimo il riferimento rispetto a quello richiesto
|
||||
frRect.ToGlob( frFac) ;
|
||||
return TransformFrame( pGeomDB, nId, nRefId, frRect) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeSurfTmFacetOppositeSide( int nId, int nFacet, const Vector3d& vtDir, int nRefId,
|
||||
|
||||
Reference in New Issue
Block a user