EgtExecutor :

- modifiche su nesting di cluster per pezzi in grezzo.
This commit is contained in:
Dario Sassi
2015-09-21 08:34:50 +00:00
parent 6f2de64ae6
commit fda3f6aa19
+10 -4
View File
@@ -633,9 +633,12 @@ ExePackCluster( const INTVECTOR& vIds, double dXmin, double dYmin, double dXmax,
b3Cluster.Expand( dOffs - 2 * EPS_SMALL, dOffs - 2 * EPS_SMALL, 0) ;
// Box della regione di interesse
BBox3d b3Region( dXmin, dYmin, 0, dXmax, dYmax, 0) ;
// Verifico se pezzi sotto la radice o pezzi in altro gruppo
int nGroupId = pGeomDB->GetParentId( vTrueIds[0]) ;
bool bInRoot = ( nGroupId == GDB_ID_ROOT) ;
// Determino il box di tutti gli altri pezzi compresi nella regione di interesse
BOXVECTOR vBox ;
int nId2 = ExeGetFirstPart( true) ;
int nId2 = ( bInRoot ? ExeGetFirstPart( true) : ExeGetFirstGroupInGroup( nGroupId)) ;
while ( nId2 != GDB_ID_NULL) {
if ( find( vTrueIds.begin(), vTrueIds.end(), nId2) == vTrueIds.end()) {
BBox3d b3Part2 ;
@@ -643,7 +646,7 @@ ExePackCluster( const INTVECTOR& vIds, double dXmin, double dYmin, double dXmax,
b3Region.OverlapsXY( b3Part2))
vBox.emplace_back( b3Part2) ;
}
nId2 = ExeGetNextPart( nId2, true) ;
nId2 = ( bInRoot ? ExeGetNextPart( nId2, true) : ExeGetNextGroup( nId2)) ;
}
// Ordino i box dei pezzi secondo la X crescente
sort( vBox.begin(), vBox.end(), []( const BBox3d& a, const BBox3d& b)
@@ -867,9 +870,12 @@ ExeMoveCluster( const INTVECTOR& vIds, Vector3d& vtMove,
if ( vTrueIds.empty())
return true ;
// Verifico se pezzi sotto la radice o pezzi in altro gruppo
int nGroupId = pGeomDB->GetParentId( vTrueIds[0]) ;
bool bInRoot = ( nGroupId == GDB_ID_ROOT) ;
// Determino i box di tutti gli altri pezzi compresi nella regione di interesse
BOXVECTOR vBox ;
int nId2 = ExeGetFirstPart( true) ;
int nId2 = ( bInRoot ? ExeGetFirstPart( true) : ExeGetFirstGroupInGroup( nGroupId)) ;
while ( nId2 != GDB_ID_NULL) {
if ( find( vTrueIds.begin(), vTrueIds.end(), nId2) == vTrueIds.end()) {
BBox3d b3Part2 ;
@@ -877,7 +883,7 @@ ExeMoveCluster( const INTVECTOR& vIds, Vector3d& vtMove,
b3Region.OverlapsXY( b3Part2))
vBox.emplace_back( b3Part2) ;
}
nId2 = ExeGetNextPart( nId2, true) ;
nId2 = ( bInRoot ? ExeGetNextPart( nId2, true) : ExeGetNextGroup( nId2)) ;
}
// Ordino questi box in senso contrario al movimento
if ( fabs( vtMoveXY.x) >= fabs( vtMoveXY.y)) {