EgtExecutor :
- sistemazioni per proiezione curve su superfici - semplificazione parametri di alcune funzioni MachOpt.
This commit is contained in:
+58
-40
@@ -2319,7 +2319,7 @@ ExeReorderCurvesInGroup( int nGroupId, const Point3d& ptNear, int nRefType)
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static bool
|
||||
MyProjectCurveOnSurf( int nCurveId, int nSurfTmId, const Vector3d& vtProj, int nDestGrpId,
|
||||
MyProjectCurveOnSurf( int nCurveId, const INTVECTOR& vnSurfId, const Vector3d& vtProj, int nDestGrpId,
|
||||
double dLinTol, double dMaxSegmLen, bool bDirFromProj, int nRefType)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
@@ -2331,29 +2331,38 @@ MyProjectCurveOnSurf( int nCurveId, int nSurfTmId, const Vector3d& vtProj, int n
|
||||
Frame3d frCrv ;
|
||||
if ( ! pGeomDB->GetGlobFrame( nCurveId, frCrv))
|
||||
return false ;
|
||||
// recupero la superficie e il suo riferimento
|
||||
const ISurf* pSurf = GetSurf( pGeomDB->GetGeoObj( nSurfTmId)) ;
|
||||
if ( pSurf == nullptr)
|
||||
// deve esserci almeno una superficie
|
||||
if ( vnSurfId.empty())
|
||||
return false ;
|
||||
Frame3d frStm ;
|
||||
if ( ! pGeomDB->GetGlobFrame( nSurfTmId, frStm))
|
||||
// recupero il riferimento della prima superficie
|
||||
Frame3d frSurf ;
|
||||
if ( ! pGeomDB->GetGlobFrame( vnSurfId[0], frSurf))
|
||||
return false ;
|
||||
// recupero le superfici e le porto tutte in locale alla prima
|
||||
SURFLOCALVECTOR vSurfL ; vSurfL.reserve( vnSurfId.size()) ;
|
||||
CISURFPVECTOR vpSurf ; vpSurf.reserve( vnSurfId.size()) ;
|
||||
for ( int i = 0 ; i < int( vnSurfId.size()) ; ++ i) {
|
||||
vSurfL.emplace_back( pGeomDB, vnSurfId[i], frSurf) ;
|
||||
if ( vSurfL[i].Get() == nullptr)
|
||||
return false ;
|
||||
vpSurf.emplace_back( vSurfL[i].Get()) ;
|
||||
}
|
||||
// recupero il riferimento del gruppo di destinazione
|
||||
nDestGrpId = AdjustId( nDestGrpId) ;
|
||||
Frame3d frDest ;
|
||||
if ( ! pGeomDB->GetGroupGlobFrame( nDestGrpId, frDest))
|
||||
return false ;
|
||||
// porto la curva e il vettore nel riferimento della superficie
|
||||
CurveLocal CrvLoc( pCrv, frCrv, frStm) ;
|
||||
CurveLocal CrvLoc( pCrv, frCrv, frSurf) ;
|
||||
if ( CrvLoc.Get() == nullptr)
|
||||
return false ;
|
||||
Vector3d vtProjL = GetVectorLocal( pGeomDB, vtProj, nRefType, frCrv) ;
|
||||
vtProjL.LocToLoc( frCrv, frStm) ;
|
||||
vtProjL.LocToLoc( frCrv, frSurf) ;
|
||||
// vanno affilati gli spigoli solo se direzione non da proiezione
|
||||
bool bSharpEdges = ( ! bDirFromProj) ;
|
||||
// eseguo la proiezione
|
||||
PNT5AXVECTOR vPt5ax ;
|
||||
if ( ! ProjectCurveOnSurf( *CrvLoc.Get(), *pSurf, vtProjL, dLinTol, dMaxSegmLen, bSharpEdges, vPt5ax))
|
||||
if ( ! ProjectCurveOnSurf( *CrvLoc.Get(), vpSurf, vtProjL, dLinTol, dMaxSegmLen, bSharpEdges, vPt5ax))
|
||||
return false ;
|
||||
// inserisco la composita nel gruppo destinazione
|
||||
PtrOwner<ICurveComposite> pCompo ;
|
||||
@@ -2362,10 +2371,10 @@ MyProjectCurveOnSurf( int nCurveId, int nSurfTmId, const Vector3d& vtProj, int n
|
||||
pCompo.Set( CreateCurveComposite()) ;
|
||||
if ( IsNull( pCompo))
|
||||
return false ;
|
||||
pCompo->AddPoint( GetLocToLoc( Pt5ax.ptP, frStm, frDest)) ;
|
||||
pCompo->AddPoint( GetLocToLoc( Pt5ax.ptP, frSurf, frDest)) ;
|
||||
}
|
||||
else
|
||||
pCompo->AddLine( GetLocToLoc( Pt5ax.ptP, frStm, frDest)) ;
|
||||
pCompo->AddLine( GetLocToLoc( Pt5ax.ptP, frSurf, frDest)) ;
|
||||
}
|
||||
int nCompoId = pGeomDB->AddGeoObj( GDB_ID_NULL, nDestGrpId, Release( pCompo)) ;
|
||||
if ( nCompoId == GDB_ID_NULL)
|
||||
@@ -2377,7 +2386,7 @@ MyProjectCurveOnSurf( int nCurveId, int nSurfTmId, const Vector3d& vtProj, int n
|
||||
if ( IsNull( pGeoVct))
|
||||
return false ;
|
||||
Vector3d vtDir = ( bDirFromProj ? Pt5ax.vtDir2 : Pt5ax.vtDir1) ;
|
||||
pGeoVct->Set( 10 * GetLocToLoc( vtDir, frStm, frDest), GetLocToLoc( Pt5ax.ptP, frStm, frDest)) ;
|
||||
pGeoVct->Set( 10 * GetLocToLoc( vtDir, frSurf, frDest), GetLocToLoc( Pt5ax.ptP, frSurf, frDest)) ;
|
||||
int nNewId = pGeomDB->AddGeoObj( GDB_ID_NULL, nDestGrpId, Release( pGeoVct)) ;
|
||||
if ( nNewId == GDB_ID_NULL)
|
||||
return false ;
|
||||
@@ -2391,15 +2400,15 @@ MyProjectCurveOnSurf( int nCurveId, int nSurfTmId, const Vector3d& vtProj, int n
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
bool
|
||||
ExeProjectCurveOnSurf( int nCurveId, int nSurfTmId, const Vector3d& vtProj, int nDestGrpId,
|
||||
ExeProjectCurveOnSurf( int nCurveId, const INTVECTOR& vnSurfId, const Vector3d& vtProj, int nDestGrpId,
|
||||
double dLinTol, double dMaxSegmLen, bool bDirFromProj, int nRefType)
|
||||
{
|
||||
bool bOk = MyProjectCurveOnSurf( nCurveId, nSurfTmId, vtProj, nDestGrpId, dLinTol, dMaxSegmLen, bDirFromProj, nRefType) ;
|
||||
bool bOk = MyProjectCurveOnSurf( nCurveId, vnSurfId, vtProj, nDestGrpId, dLinTol, dMaxSegmLen, bDirFromProj, nRefType) ;
|
||||
ExeSetModified() ;
|
||||
// se richiesto, salvo il comando Lua equivalente
|
||||
if ( IsCmdLog()) {
|
||||
string sLua = "EgtProjectCurveOnSurf(" + ToString( nCurveId) + "," +
|
||||
ToString( nSurfTmId) + ",{" +
|
||||
string sLua = "EgtProjectCurveOnSurf(" + ToString( nCurveId) + ",{" +
|
||||
ToString( vnSurfId) + "},{" +
|
||||
ToString( vtProj) + "}," +
|
||||
ToString( nDestGrpId) + "," +
|
||||
ToString( dLinTol) + "," +
|
||||
@@ -2415,7 +2424,7 @@ ExeProjectCurveOnSurf( int nCurveId, int nSurfTmId, const Vector3d& vtProj, int
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static bool
|
||||
MyProjectCurveOnSurfExt( int nCurveId, int nSurfTmId, int nGuideId, int nDestGrpId,
|
||||
MyProjectCurveOnSurfExt( int nCurveId, const INTVECTOR& vnSurfId, int nGuideId, int nDestGrpId,
|
||||
double dLinTol, double dMaxSegmLen, bool bDirFromGuide)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
@@ -2427,13 +2436,22 @@ MyProjectCurveOnSurfExt( int nCurveId, int nSurfTmId, int nGuideId, int nDestGrp
|
||||
Frame3d frCrv ;
|
||||
if ( ! pGeomDB->GetGlobFrame( nCurveId, frCrv))
|
||||
return false ;
|
||||
// recupero la superficie e il suo riferimento
|
||||
const ISurf* pStm = GetSurf( pGeomDB->GetGeoObj( nSurfTmId)) ;
|
||||
if ( pStm == nullptr)
|
||||
// deve esserci almeno una superficie
|
||||
if ( vnSurfId.empty())
|
||||
return false ;
|
||||
Frame3d frStm ;
|
||||
if ( ! pGeomDB->GetGlobFrame( nSurfTmId, frStm))
|
||||
// recupero il riferimento della prima superficie
|
||||
Frame3d frSurf ;
|
||||
if ( ! pGeomDB->GetGlobFrame( vnSurfId[0], frSurf))
|
||||
return false ;
|
||||
// recupero le superfici e le porto tutte in locale alla prima
|
||||
SURFLOCALVECTOR vSurfL ; vSurfL.reserve( vnSurfId.size()) ;
|
||||
CISURFPVECTOR vpSurf ; vpSurf.reserve( vnSurfId.size()) ;
|
||||
for ( int i = 0 ; i < int( vnSurfId.size()) ; ++ i) {
|
||||
vSurfL.emplace_back( pGeomDB, vnSurfId[i], frSurf) ;
|
||||
if ( vSurfL[i].Get() == nullptr)
|
||||
return false ;
|
||||
vpSurf.emplace_back( vSurfL[i].Get()) ;
|
||||
}
|
||||
// recupero l'entità guida (punto, curva o superficie) e il suo riferimento
|
||||
const IGeoPoint3d* pGdePnt = nullptr ;
|
||||
const ICurve* pGdeCrv = nullptr ;
|
||||
@@ -2456,7 +2474,7 @@ MyProjectCurveOnSurfExt( int nCurveId, int nSurfTmId, int nGuideId, int nDestGrp
|
||||
if ( ! pGeomDB->GetGroupGlobFrame( nDestGrpId, frDest))
|
||||
return false ;
|
||||
// porto la curva nel riferimento della superficie
|
||||
CurveLocal CrvLoc( pCrv, frCrv, frStm) ;
|
||||
CurveLocal CrvLoc( pCrv, frCrv, frSurf) ;
|
||||
if ( CrvLoc.Get() == nullptr)
|
||||
return false ;
|
||||
// vanno affilati gli spigoli solo se direzione non da guida
|
||||
@@ -2467,23 +2485,23 @@ MyProjectCurveOnSurfExt( int nCurveId, int nSurfTmId, int nGuideId, int nDestGrp
|
||||
PtrOwner<IGeoPoint3d> pGdeLoc( pGdePnt->Clone()) ;
|
||||
if ( pGdeLoc == nullptr)
|
||||
return false ;
|
||||
pGdeLoc->LocToLoc( frGde, frStm) ;
|
||||
if ( ! ProjectCurveOnSurf( *CrvLoc.Get(), *pStm, *pGdeLoc, dLinTol, dMaxSegmLen, bSharpEdges, vPt5ax))
|
||||
pGdeLoc->LocToLoc( frGde, frSurf) ;
|
||||
if ( ! ProjectCurveOnSurf( *CrvLoc.Get(), vpSurf, *pGdeLoc, dLinTol, dMaxSegmLen, bSharpEdges, vPt5ax))
|
||||
return false ;
|
||||
}
|
||||
else if ( pGdeCrv != nullptr) {
|
||||
CurveLocal GdeLoc( pGdeCrv, frGde, frStm) ;
|
||||
CurveLocal GdeLoc( pGdeCrv, frGde, frSurf) ;
|
||||
if ( GdeLoc.Get() == nullptr)
|
||||
return false ;
|
||||
if ( ! ProjectCurveOnSurf( *CrvLoc.Get(), *pStm, *GdeLoc.Get(), dLinTol, dMaxSegmLen, bSharpEdges, vPt5ax))
|
||||
if ( ! ProjectCurveOnSurf( *CrvLoc.Get(), vpSurf, *GdeLoc.Get(), dLinTol, dMaxSegmLen, bSharpEdges, vPt5ax))
|
||||
return false ;
|
||||
}
|
||||
else { // pGdeStm != nullptr
|
||||
SurfLocal GdeLoc( pGdeStm, frGde, frStm) ;
|
||||
SurfLocal GdeLoc( pGdeStm, frGde, frSurf) ;
|
||||
const ISurf* pGdeLoc = GetSurf( GdeLoc.Get()) ;
|
||||
if ( pGdeLoc == nullptr)
|
||||
return false ;
|
||||
if ( ! ProjectCurveOnSurf( *CrvLoc.Get(), *pStm, *pGdeLoc, dLinTol, dMaxSegmLen, bSharpEdges, vPt5ax))
|
||||
if ( ! ProjectCurveOnSurf( *CrvLoc.Get(), vpSurf, *pGdeLoc, dLinTol, dMaxSegmLen, bSharpEdges, vPt5ax))
|
||||
return false ;
|
||||
}
|
||||
// inserisco la composita nel gruppo destinazione
|
||||
@@ -2493,10 +2511,10 @@ MyProjectCurveOnSurfExt( int nCurveId, int nSurfTmId, int nGuideId, int nDestGrp
|
||||
pCompo.Set( CreateCurveComposite()) ;
|
||||
if ( IsNull( pCompo))
|
||||
return false ;
|
||||
pCompo->AddPoint( GetLocToLoc( Pt5ax.ptP, frStm, frDest)) ;
|
||||
pCompo->AddPoint( GetLocToLoc( Pt5ax.ptP, frSurf, frDest)) ;
|
||||
}
|
||||
else
|
||||
pCompo->AddLine( GetLocToLoc( Pt5ax.ptP, frStm, frDest)) ;
|
||||
pCompo->AddLine( GetLocToLoc( Pt5ax.ptP, frSurf, frDest)) ;
|
||||
}
|
||||
int nCompoId = pGeomDB->AddGeoObj( GDB_ID_NULL, nDestGrpId, Release( pCompo)) ;
|
||||
if ( nCompoId == GDB_ID_NULL)
|
||||
@@ -2508,7 +2526,7 @@ MyProjectCurveOnSurfExt( int nCurveId, int nSurfTmId, int nGuideId, int nDestGrp
|
||||
if ( IsNull( pGeoVct))
|
||||
return false ;
|
||||
Vector3d vtDir = ( bDirFromGuide ? Pt5ax.vtDir2 : Pt5ax.vtDir1) ;
|
||||
pGeoVct->Set( 10 * GetLocToLoc( vtDir, frStm, frDest), GetLocToLoc( Pt5ax.ptP, frStm, frDest)) ;
|
||||
pGeoVct->Set( 10 * GetLocToLoc( vtDir, frSurf, frDest), GetLocToLoc( Pt5ax.ptP, frSurf, frDest)) ;
|
||||
int nNewId = pGeomDB->AddGeoObj( GDB_ID_NULL, nDestGrpId, Release( pGeoVct)) ;
|
||||
if ( nNewId == GDB_ID_NULL)
|
||||
return false ;
|
||||
@@ -2522,16 +2540,16 @@ MyProjectCurveOnSurfExt( int nCurveId, int nSurfTmId, int nGuideId, int nDestGrp
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
bool
|
||||
ExeProjectCurveOnSurfExt( int nCurveId, int nSurfTmId, int nGuideId, int nDestGrpId,
|
||||
double dLinTol, double dMaxSegmLen, bool bDirFromGuide)
|
||||
ExeProjectCurveOnSurfExt( int nCurveId, const INTVECTOR& vnSurfId, int nGuideId, int nDestGrpId,
|
||||
double dLinTol, double dMaxSegmLen, bool bDirFromGuide)
|
||||
{
|
||||
bool bOk = MyProjectCurveOnSurfExt( nCurveId, nSurfTmId, nGuideId, nDestGrpId, dLinTol, dMaxSegmLen, bDirFromGuide) ;
|
||||
bool bOk = MyProjectCurveOnSurfExt( nCurveId, vnSurfId, nGuideId, nDestGrpId, dLinTol, dMaxSegmLen, bDirFromGuide) ;
|
||||
ExeSetModified() ;
|
||||
// se richiesto, salvo il comando Lua equivalente
|
||||
if ( IsCmdLog()) {
|
||||
string sLua = "EgtProjectCurveOnSurfExt(" + ToString( nCurveId) + "," +
|
||||
ToString( nSurfTmId) + ",{" +
|
||||
ToString( nGuideId) + "}," +
|
||||
string sLua = "EgtProjectCurveOnSurfExt(" + ToString( nCurveId) + ",{" +
|
||||
ToString( vnSurfId) + "}," +
|
||||
ToString( nGuideId) + "," +
|
||||
ToString( nDestGrpId) + "," +
|
||||
ToString( dLinTol) + "," +
|
||||
ToString( dMaxSegmLen) + "," +
|
||||
@@ -2606,8 +2624,8 @@ ExeCurveGetVoronoi( const INTVECTOR& vIds, int nDestGrpId, int nBound, int* pnCo
|
||||
ExeSetModified() ;
|
||||
|
||||
if ( IsCmdLog()) {
|
||||
string sLua = "EgtCurveGetVoronoi(" + ToString( vIds[0]) + "," +
|
||||
ToString( nDestGrpId) + ")" +
|
||||
string sLua = "EgtCurveGetVoronoi({" + ToString( vIds) + "}," +
|
||||
ToString( nDestGrpId) + ")" +
|
||||
" FirstId=" + ToString( nFirstId) + " nCurveCount=" + ToString( nCount) ;
|
||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user