EgtExecutor (Nst_SurfFr) :
- aggiunti controlli aggiuntivi per collisioni.
This commit is contained in:
+33
-79
@@ -47,21 +47,6 @@ struct SCollInfoEx : public SCollInfo
|
||||
nIdF( GDB_ID_NULL), bIsCutF( false) {}
|
||||
} ;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// collisioni
|
||||
struct CollInfoEx : public CollInfo
|
||||
{
|
||||
int nIdM ; // identificativo della regione mobile
|
||||
bool bIsCutM ; // flag di regione o pezzo di taglio
|
||||
int nIdF ; // identificativo della regione fissa
|
||||
bool bIsCutF ; // flag di regione di pezzo o di taglio
|
||||
// costruttori
|
||||
CollInfoEx() : CollInfo(), nIdM( GDB_ID_NULL), bIsCutM( false),
|
||||
nIdF( GDB_ID_NULL), bIsCutF( false) {}
|
||||
CollInfoEx( const CollInfo& Sou) : CollInfo( Sou), nIdM( GDB_ID_NULL), bIsCutM( false),
|
||||
nIdF( GDB_ID_NULL), bIsCutF( false) {}
|
||||
} ;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
static const double SPESS = 100 ;
|
||||
static const int BBF_PART_MY_FLAG = BBF_ONLY_VISIBLE | BBF_IGNORE_TEXT | BBF_IGNORE_DIM ;
|
||||
@@ -1155,8 +1140,6 @@ ExePackPartCluster( const INTVECTOR& vIds, bool bReducedCut, bool bBottomUp)
|
||||
//----------------------------------------------------------------------------
|
||||
static SCollInfoEx s_scInfo ;
|
||||
static SCollInfoEx s_scInfoSaved ;
|
||||
static CollInfoEx s_cInfo ;
|
||||
static CollInfoEx s_cInfoSaved ;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
static double
|
||||
@@ -1184,32 +1167,6 @@ UpdateCollId( double dLen, double dPrevLen, int nId1, int nId2, bool bIsCut1, bo
|
||||
return dPrevLen ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
static double
|
||||
UpdateCollId( double dLen, double dPrevLen, int nId1, int nId2, bool bIsCut1, bool bIsCut2, const CollInfo& cInfoCurr)
|
||||
{
|
||||
if ( abs( dLen - dPrevLen) < EPS_SMALL) {
|
||||
if ( cInfoCurr.nType == CI_PNT_LINE || cInfoCurr.nType == CI_LINE_LINE) {
|
||||
s_cInfo = cInfoCurr ;
|
||||
s_cInfo.nIdM = nId1 ;
|
||||
s_cInfo.nIdF = nId2 ;
|
||||
s_cInfo.bIsCutM = bIsCut1 ;
|
||||
s_cInfo.bIsCutF = bIsCut2 ;
|
||||
}
|
||||
return dPrevLen ;
|
||||
}
|
||||
else if ( dLen < dPrevLen) {
|
||||
s_cInfo = cInfoCurr ;
|
||||
s_cInfo.nIdM = nId1 ;
|
||||
s_cInfo.nIdF = nId2 ;
|
||||
s_cInfo.bIsCutM = bIsCut1 ;
|
||||
s_cInfo.bIsCutF = bIsCut2 ;
|
||||
return dLen ;
|
||||
}
|
||||
else
|
||||
return dPrevLen ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// Collisione semplice
|
||||
static bool
|
||||
@@ -1263,7 +1220,7 @@ MySurfFrMoveSimpleNoCollision( int nId1, int nId2, const Vector3d& vtDir, double
|
||||
//----------------------------------------------------------------------------
|
||||
// Collisione completa
|
||||
static bool
|
||||
MySurfFrMoveNoCollision( int nId1, int nId2, const Vector3d& vtDir, double& dLen, CollInfo& cInfo)
|
||||
MySurfFrMoveNoCollision( int nId1, int nId2, const Vector3d& vtDir, double& dLen, SCollInfo& cInfo)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
|
||||
@@ -1300,12 +1257,12 @@ MySurfFrMoveNoCollision( int nId1, int nId2, const Vector3d& vtDir, double& dLen
|
||||
if ( ! cdSfrMove.Translate( vtDirL, dLen))
|
||||
return false ;
|
||||
cInfo = cdSfrMove.GetCollInfo() ;
|
||||
if ( cInfo.nType != CI_NONE) {
|
||||
if ( cInfo.nType != SCI_NONE) {
|
||||
cInfo.ptP1.ToGlob( frSurf1) ;
|
||||
cInfo.vtDirM.ToGlob( frSurf1) ;
|
||||
cInfo.vtDirF.ToGlob( frSurf1) ;
|
||||
}
|
||||
if ( cInfo.nType == CI_LINE_LINE)
|
||||
if ( cInfo.nType == SCI_LINE_LINE)
|
||||
cInfo.ptP2.ToGlob( frSurf1) ;
|
||||
return true ;
|
||||
}
|
||||
@@ -1316,8 +1273,7 @@ static bool
|
||||
MyMovePartCluster( IGeomDB* pGeomDB, const INTVECTOR& vTrueIds, BBox3d b3Cluster, bool bReducedCut, Vector3d& vtMove)
|
||||
{
|
||||
// Reset info di collisione
|
||||
s_scInfo.nType = SCI_NONE ; // semplice
|
||||
s_cInfo.nType = CI_NONE ; // completa
|
||||
s_scInfo.nType = SCI_NONE ;
|
||||
|
||||
// Vettore movimento nel piano XY globale
|
||||
Vector3d vtMoveXY( vtMove.x, vtMove.y, 0) ;
|
||||
@@ -1389,8 +1345,7 @@ MyMovePartCluster( IGeomDB* pGeomDB, const INTVECTOR& vTrueIds, BBox3d b3Cluster
|
||||
Vector3d vtDir = ( dLen > EPS_SMALL ? vtMoveXY / dLen : V_NULL) ;
|
||||
for ( auto nTrueId : vTrueIds) {
|
||||
// info di collisione correnti
|
||||
SCollInfo scInfoCurr ; // semplice
|
||||
CollInfo cInfoCurr ; // completa
|
||||
SCollInfo scInfoCurr ;
|
||||
// -----------------------------------------
|
||||
// recupero regione del pezzo
|
||||
int nRegId = GetFlatPartRegion( pGeomDB, nTrueId) ;
|
||||
@@ -1408,21 +1363,21 @@ MyMovePartCluster( IGeomDB* pGeomDB, const INTVECTOR& vTrueIds, BBox3d b3Cluster
|
||||
}
|
||||
// la confronto con le aree danneggiate (collisione completa)
|
||||
for ( int nDmgRegId : vDmgReg) {
|
||||
MySurfFrMoveNoCollision( nRegId, nDmgRegId, vtDir, dLen, cInfoCurr) ;
|
||||
MySurfFrMoveNoCollision( nRegId, nDmgRegId, vtDir, dLen, scInfoCurr) ;
|
||||
dPrevLen = UpdateCollId( dLen, dPrevLen, nRegId, nDmgRegId, false, false, scInfoCurr) ;
|
||||
}
|
||||
// la confronto con le regioni degli altri pezzi (collisione completa)
|
||||
for ( int nOthRegId : vOthReg) {
|
||||
MySurfFrMoveNoCollision( nRegId, nOthRegId, vtDir, dLen, cInfoCurr) ;
|
||||
dPrevLen = UpdateCollId( dLen, dPrevLen, nRegId, nOthRegId, false, false, cInfoCurr) ;
|
||||
MySurfFrMoveNoCollision( nRegId, nOthRegId, vtDir, dLen, scInfoCurr) ;
|
||||
dPrevLen = UpdateCollId( dLen, dPrevLen, nRegId, nOthRegId, false, false, scInfoCurr) ;
|
||||
}
|
||||
// e con le regioni dei tagli degli altri pezzi
|
||||
// recupero regione in alto del pezzo (collisione completa)
|
||||
int nUpRegId = GetFlatPartUpRegion( pGeomDB, nTrueId) ;
|
||||
int nTestRegId = (( nUpRegId == GDB_ID_NULL) ? nRegId : nUpRegId) ;
|
||||
for ( int nOthCutRegId : vOthCutReg) {
|
||||
MySurfFrMoveNoCollision( nTestRegId, nOthCutRegId, vtDir, dLen, cInfoCurr) ;
|
||||
dPrevLen = UpdateCollId( dLen, dPrevLen, nTestRegId, nOthCutRegId, false, true, cInfoCurr) ;
|
||||
MySurfFrMoveNoCollision( nTestRegId, nOthCutRegId, vtDir, dLen, scInfoCurr) ;
|
||||
dPrevLen = UpdateCollId( dLen, dPrevLen, nTestRegId, nOthCutRegId, false, true, scInfoCurr) ;
|
||||
}
|
||||
// -----------------------------------------
|
||||
// recupero regione in basso del pezzo
|
||||
@@ -1434,14 +1389,14 @@ MyMovePartCluster( IGeomDB* pGeomDB, const INTVECTOR& vTrueIds, BBox3d b3Cluster
|
||||
}
|
||||
// la confronto con la regione di riferimento (collisione completa)
|
||||
if ( nDwnRegId != GDB_ID_NULL && nRefReg != GDB_ID_NULL) {
|
||||
MySurfFrMoveNoCollision( nDwnRegId, nRefReg, vtDir, dLen, cInfoCurr) ;
|
||||
dPrevLen = UpdateCollId( dLen, dPrevLen, nDwnRegId, nRefReg, false, false, cInfoCurr) ;
|
||||
MySurfFrMoveNoCollision( nDwnRegId, nRefReg, vtDir, dLen, scInfoCurr) ;
|
||||
dPrevLen = UpdateCollId( dLen, dPrevLen, nDwnRegId, nRefReg, false, false, scInfoCurr) ;
|
||||
}
|
||||
// la confronto con le aree danneggiate (collisione completa)
|
||||
if ( nDwnRegId != GDB_ID_NULL) {
|
||||
for ( int nDmgRegId : vDmgReg) {
|
||||
MySurfFrMoveNoCollision( nDwnRegId, nDmgRegId, vtDir, dLen, cInfoCurr) ;
|
||||
dPrevLen = UpdateCollId( dLen, dPrevLen, nDwnRegId, nDmgRegId, false, false, cInfoCurr) ;
|
||||
MySurfFrMoveNoCollision( nDwnRegId, nDmgRegId, vtDir, dLen, scInfoCurr) ;
|
||||
dPrevLen = UpdateCollId( dLen, dPrevLen, nDwnRegId, nDmgRegId, false, false, scInfoCurr) ;
|
||||
}
|
||||
}
|
||||
// la confronto con le regioni in basso degli altri pezzi (collisione completa)
|
||||
@@ -1449,8 +1404,8 @@ MyMovePartCluster( IGeomDB* pGeomDB, const INTVECTOR& vTrueIds, BBox3d b3Cluster
|
||||
if ( nDwnRegId != GDB_ID_NULL || vOthDwnReg[j] != GDB_ID_NULL) {
|
||||
int nTmpDwnRegId = ( nDwnRegId != GDB_ID_NULL ? nDwnRegId : nRegId) ;
|
||||
int nOthDwnRegId = ( vOthDwnReg[j] != GDB_ID_NULL ? vOthDwnReg[j] : vOthReg[j]) ;
|
||||
MySurfFrMoveNoCollision( nTmpDwnRegId, nOthDwnRegId, vtDir, dLen, cInfoCurr) ;
|
||||
dPrevLen = UpdateCollId( dLen, dPrevLen, nTmpDwnRegId, nOthDwnRegId, false, false, cInfoCurr) ;
|
||||
MySurfFrMoveNoCollision( nTmpDwnRegId, nOthDwnRegId, vtDir, dLen, scInfoCurr) ;
|
||||
dPrevLen = UpdateCollId( dLen, dPrevLen, nTmpDwnRegId, nOthDwnRegId, false, false, scInfoCurr) ;
|
||||
}
|
||||
}
|
||||
// e con le regioni in basso dei tagli degli altri pezzi (collisione completa)
|
||||
@@ -1458,8 +1413,8 @@ MyMovePartCluster( IGeomDB* pGeomDB, const INTVECTOR& vTrueIds, BBox3d b3Cluster
|
||||
if ( nDwnRegId != GDB_ID_NULL || vOthDwnCutReg[j] != GDB_ID_NULL) {
|
||||
int nTmpDwnRegId = ( nDwnRegId != GDB_ID_NULL ? nDwnRegId : nRegId) ;
|
||||
int nOthDwnCutRegId = ( vOthDwnCutReg[j] != GDB_ID_NULL ? vOthDwnCutReg[j] : vOthCutReg[j]) ;
|
||||
MySurfFrMoveNoCollision( nTmpDwnRegId, nOthDwnCutRegId, vtDir, dLen, cInfoCurr) ;
|
||||
dPrevLen = UpdateCollId( dLen, dPrevLen, nTmpDwnRegId, nOthDwnCutRegId, false, true, cInfoCurr) ;
|
||||
MySurfFrMoveNoCollision( nTmpDwnRegId, nOthDwnCutRegId, vtDir, dLen, scInfoCurr) ;
|
||||
dPrevLen = UpdateCollId( dLen, dPrevLen, nTmpDwnRegId, nOthDwnCutRegId, false, true, scInfoCurr) ;
|
||||
}
|
||||
}
|
||||
// -----------------------------------------
|
||||
@@ -1473,8 +1428,8 @@ MyMovePartCluster( IGeomDB* pGeomDB, const INTVECTOR& vTrueIds, BBox3d b3Cluster
|
||||
for ( int nCrId : vCrId) {
|
||||
for ( int k = 0 ; k < ssize( vOthReg) ; ++ k) {
|
||||
int nOthRegId = ( vOthUpReg[k] == GDB_ID_NULL ? vOthReg[k] : vOthUpReg[k]) ;
|
||||
MySurfFrMoveNoCollision( nCrId, nOthRegId, vtDir, dLen, cInfoCurr) ;
|
||||
dPrevLen = UpdateCollId( dLen, dPrevLen, nCrId, nOthRegId, true, false, cInfoCurr) ;
|
||||
MySurfFrMoveNoCollision( nCrId, nOthRegId, vtDir, dLen, scInfoCurr) ;
|
||||
dPrevLen = UpdateCollId( dLen, dPrevLen, nCrId, nOthRegId, true, false, scInfoCurr) ;
|
||||
}
|
||||
}
|
||||
// -----------------------------------------
|
||||
@@ -1490,8 +1445,8 @@ MyMovePartCluster( IGeomDB* pGeomDB, const INTVECTOR& vTrueIds, BBox3d b3Cluster
|
||||
if ( vDwnCrId[j] != GDB_ID_NULL || vOthDwnReg[k] != GDB_ID_NULL) {
|
||||
int nTmpDwnCrId = ( vDwnCrId[j] != GDB_ID_NULL ? vDwnCrId[j] : vCrId[j]) ;
|
||||
int nOthDwnRegId = ( vOthDwnReg[k] != GDB_ID_NULL ? vOthDwnReg[k] : vOthReg[k]) ;
|
||||
MySurfFrMoveNoCollision( nTmpDwnCrId, nOthDwnRegId, vtDir, dLen, cInfoCurr) ;
|
||||
dPrevLen = UpdateCollId( dLen, dPrevLen, nTmpDwnCrId, nOthDwnRegId, true, false, cInfoCurr) ;
|
||||
MySurfFrMoveNoCollision( nTmpDwnCrId, nOthDwnRegId, vtDir, dLen, scInfoCurr) ;
|
||||
dPrevLen = UpdateCollId( dLen, dPrevLen, nTmpDwnCrId, nOthDwnRegId, true, false, scInfoCurr) ;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1583,7 +1538,7 @@ ExeMovePartCluster( const INTVECTOR& vIds, bool bReducedCut, Vector3d& vtMove)
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
static bool
|
||||
MySurfFrRotateNoCollision( int nId1, int nId2, const Point3d& ptCen, double& dAngDeg, CollInfo& cInfo)
|
||||
MySurfFrRotateNoCollision( int nId1, int nId2, const Point3d& ptCen, double& dAngDeg, SCollInfo& cInfo)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
|
||||
@@ -1629,8 +1584,7 @@ MyRotatePartCluster( IGeomDB* pGeomDB, const INTVECTOR& vTrueIds, BBox3d& b3Clus
|
||||
const Point3d& ptCen, double& dRotAngDeg)
|
||||
{
|
||||
// Reset info di collisione
|
||||
s_scInfo.nType = SCI_NONE ; // semplice
|
||||
s_cInfo.nType = CI_NONE ; // completa
|
||||
s_scInfo.nType = SCI_NONE ;
|
||||
|
||||
// Rotazione nel piano XY globale
|
||||
|
||||
@@ -1710,11 +1664,11 @@ MyRotatePartCluster( IGeomDB* pGeomDB, const INTVECTOR& vTrueIds, BBox3d& b3Clus
|
||||
}
|
||||
// la confronto con le aree danneggiate (collisione completa)
|
||||
for ( int nDmgRegId : vDmgReg) {
|
||||
MySurfFrRotateNoCollision( nRegId, nDmgRegId, ptCen, dAng, s_cInfo) ;
|
||||
MySurfFrRotateNoCollision( nRegId, nDmgRegId, ptCen, dAng, s_scInfo) ;
|
||||
}
|
||||
// la confronto con le regioni degli altri pezzi (collisione completa)
|
||||
for ( int nOthRegId : vOthReg) {
|
||||
MySurfFrRotateNoCollision( nRegId, nOthRegId, ptCen, dAng, s_cInfo) ;
|
||||
MySurfFrRotateNoCollision( nRegId, nOthRegId, ptCen, dAng, s_scInfo) ;
|
||||
}
|
||||
// e con le regioni dei tagli degli altri pezzi (collisione completa)
|
||||
// recupero regione in alto del pezzo
|
||||
@@ -1736,7 +1690,7 @@ MyRotatePartCluster( IGeomDB* pGeomDB, const INTVECTOR& vTrueIds, BBox3d& b3Clus
|
||||
// la confronto con le aree danneggiate (collisione completa)
|
||||
if ( nDwnRegId != GDB_ID_NULL) {
|
||||
for ( int nDmgRegId : vDmgReg) {
|
||||
MySurfFrRotateNoCollision( nDwnRegId, nDmgRegId, ptCen, dAng, s_cInfo) ;
|
||||
MySurfFrRotateNoCollision( nDwnRegId, nDmgRegId, ptCen, dAng, s_scInfo) ;
|
||||
}
|
||||
}
|
||||
// la confronto con le regioni in basso degli altri pezzi (collisione completa)
|
||||
@@ -1744,7 +1698,7 @@ MyRotatePartCluster( IGeomDB* pGeomDB, const INTVECTOR& vTrueIds, BBox3d& b3Clus
|
||||
if ( nDwnRegId != GDB_ID_NULL || vOthDwnReg[j] != GDB_ID_NULL) {
|
||||
int nTmpDwnRegId = ( nDwnRegId != GDB_ID_NULL ? nDwnRegId : nRegId) ;
|
||||
int nOthDwnRegId = ( vOthDwnReg[j] != GDB_ID_NULL ? vOthDwnReg[j] : vOthReg[j]) ;
|
||||
MySurfFrRotateNoCollision( nTmpDwnRegId, nOthDwnRegId, ptCen, dAng, s_cInfo) ;
|
||||
MySurfFrRotateNoCollision( nTmpDwnRegId, nOthDwnRegId, ptCen, dAng, s_scInfo) ;
|
||||
}
|
||||
}
|
||||
// e con le regioni in basso dei tagli degli altri pezzi (collisione completa)
|
||||
@@ -1752,7 +1706,7 @@ MyRotatePartCluster( IGeomDB* pGeomDB, const INTVECTOR& vTrueIds, BBox3d& b3Clus
|
||||
if ( nDwnRegId != GDB_ID_NULL || vOthDwnCutReg[j] != GDB_ID_NULL) {
|
||||
int nTmpDwnRegId = ( nDwnRegId != GDB_ID_NULL ? nDwnRegId : nRegId) ;
|
||||
int nOthDwnCutRegId = ( vOthDwnCutReg[j] != GDB_ID_NULL ? vOthDwnCutReg[j] : vOthCutReg[j]) ;
|
||||
MySurfFrRotateNoCollision( nTmpDwnRegId, nOthDwnCutRegId, ptCen, dAng, s_cInfo) ;
|
||||
MySurfFrRotateNoCollision( nTmpDwnRegId, nOthDwnCutRegId, ptCen, dAng, s_scInfo) ;
|
||||
}
|
||||
}
|
||||
// -----------------------------------------
|
||||
@@ -1766,7 +1720,7 @@ MyRotatePartCluster( IGeomDB* pGeomDB, const INTVECTOR& vTrueIds, BBox3d& b3Clus
|
||||
for ( int nCrId : vCrId) {
|
||||
for ( int k = 0 ; k < ssize( vOthReg) ; ++ k) {
|
||||
int nOthRegId = ( vOthUpReg[k] == GDB_ID_NULL ? vOthReg[k] : vOthUpReg[k]) ;
|
||||
MySurfFrRotateNoCollision( nCrId, nOthRegId, ptCen, dAng, s_cInfo) ;
|
||||
MySurfFrRotateNoCollision( nCrId, nOthRegId, ptCen, dAng, s_scInfo) ;
|
||||
}
|
||||
}
|
||||
// -----------------------------------------
|
||||
@@ -1782,7 +1736,7 @@ MyRotatePartCluster( IGeomDB* pGeomDB, const INTVECTOR& vTrueIds, BBox3d& b3Clus
|
||||
if ( vDwnCrId[j] != GDB_ID_NULL || vOthDwnReg[k] != GDB_ID_NULL) {
|
||||
int nTmpDwnCrId = ( vDwnCrId[j] != GDB_ID_NULL ? vDwnCrId[j] : vCrId[j]) ;
|
||||
int nOthDwnRegId = ( vOthDwnReg[k] != GDB_ID_NULL ? vOthDwnReg[k] : vOthReg[k]) ;
|
||||
MySurfFrRotateNoCollision( nTmpDwnCrId, nOthDwnRegId, ptCen, dAng, s_cInfo) ;
|
||||
MySurfFrRotateNoCollision( nTmpDwnCrId, nOthDwnRegId, ptCen, dAng, s_scInfo) ;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1835,7 +1789,7 @@ GetObstacleTangent( Vector3d& vtTang)
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
static bool
|
||||
GetMovingTangent( Vector3d& vtTang)
|
||||
GetMovingTangent( Vector3d& vtTang)
|
||||
{
|
||||
if ( s_scInfo.nType != SCI_LINE_PNT && s_scInfo.nType != SCI_LINE_LINE)
|
||||
return false ;
|
||||
@@ -1882,7 +1836,7 @@ ExeAlignPartClusterOnCollision( const INTVECTOR& vIds, bool bReducedCut, bool& b
|
||||
Point3d ptCntL = s_scInfo.ptP1 ;
|
||||
ptCntL.ToLoc( frSfr) ;
|
||||
// cerco le direzioni tangenti prima e dopo il punto di contatto sulle parti mobili
|
||||
PtrOwner<ICurve> pCrv( pSfr->GetLoop( s_scInfo.nChunkM, 0)) ;
|
||||
PtrOwner<ICurve> pCrv( pSfr->GetLoop( s_scInfo.nChunkM, s_scInfo.nLoopM)) ;
|
||||
if ( IsNull( pCrv))
|
||||
return false ;
|
||||
double dU ;
|
||||
|
||||
Reference in New Issue
Block a user