EgtGeomKernel :
- modifiche a Zmap per virtual-additive - modifiche a Frame3d per Set con i tre assi che ora aggiusta errori molto piccoli.
This commit is contained in:
+96
-111
@@ -253,12 +253,12 @@ VolZmap::AddIntervals( int nGrid, int nI, int nJ,
|
||||
double dMin, double dMax, const Vector3d& vtNMin, const Vector3d& vtNMax, int nToolNum)
|
||||
{
|
||||
// Controllo che il numero di griglia sia entro i limiti
|
||||
if ( nGrid < 0 || nGrid > 2)
|
||||
if ( nGrid < 0 || nGrid > 2)
|
||||
return false ;
|
||||
|
||||
// Controllo che indici nI, nJ siano entro i limiti
|
||||
if ( nI < 0 && nI >= m_nNx[nGrid] &&
|
||||
nJ < 0 && nJ >= m_nNy[nGrid])
|
||||
// Controllo che indici nI, nJ siano entro i limiti
|
||||
if ( nI < 0 && nI >= m_nNx[nGrid] &&
|
||||
nJ < 0 && nJ >= m_nNy[nGrid])
|
||||
return false ;
|
||||
|
||||
// Controllo che dMin < dMax
|
||||
@@ -287,7 +287,7 @@ VolZmap::AddIntervals( int nGrid, int nI, int nJ,
|
||||
vtNma = Z_AX ;
|
||||
}
|
||||
|
||||
// Controllo che dMin e dMax non siano quasi coincidenti
|
||||
// Controllo che dMin e dMax non siano quasi coincidenti
|
||||
if ( abs( dMax - dMin) < EPS_SMALL)
|
||||
return true ;
|
||||
|
||||
@@ -306,13 +306,13 @@ VolZmap::AddIntervals( int nGrid, int nI, int nJ,
|
||||
}
|
||||
|
||||
// Calcolo nPos
|
||||
unsigned int nPos = nJ * m_nNx[nGrid] + nI ;
|
||||
int nPos = nJ * m_nNx[nGrid] + nI ;
|
||||
vector<Data>& vDexel = m_Values[nGrid][nPos] ;
|
||||
|
||||
bool bModified = false ;
|
||||
|
||||
// Non esistono segmenti
|
||||
if ( int( vDexel.size()) == 0) {
|
||||
// Non esistono segmenti
|
||||
if ( vDexel.empty()) {
|
||||
|
||||
vDexel.emplace_back() ;
|
||||
vDexel.back().dMin = dMin ;
|
||||
@@ -326,10 +326,10 @@ VolZmap::AddIntervals( int nGrid, int nI, int nJ,
|
||||
|
||||
bModified = true ;
|
||||
}
|
||||
// Esiste almeno un segmento
|
||||
// Esiste almeno un segmento
|
||||
else {
|
||||
// Cerco l'ultimo intervallo a sinistra e l'ultimo intervallo a destra
|
||||
// di quello da aggiungere, che non interferiscono con quest'ultimo.
|
||||
// Cerco l'ultimo intervallo a sinistra e l'ultimo intervallo a destra
|
||||
// di quello da aggiungere, che non interferiscono con quest'ultimo.
|
||||
auto itLastLeft = vDexel.end() ;
|
||||
auto itFirstRight = vDexel.end() ;
|
||||
for ( auto it = vDexel.begin() ; it != vDexel.end() ; ++ it) {
|
||||
@@ -338,12 +338,12 @@ VolZmap::AddIntervals( int nGrid, int nI, int nJ,
|
||||
if ( dMax < it->dMin - EPS_SMALL && itFirstRight == vDexel.end())
|
||||
itFirstRight = it ;
|
||||
}
|
||||
// Esistono intervalli a sinistra.
|
||||
// Esistono intervalli a sinistra.
|
||||
if ( itLastLeft != vDexel.end()) {
|
||||
// Intervallo successivo all'ultimo a sinistra
|
||||
// Intervallo successivo all'ultimo a sinistra
|
||||
auto itNextToLastLeft = itLastLeft ;
|
||||
++ itNextToLastLeft ;
|
||||
// Il successivo non esiste.
|
||||
// Il successivo non esiste.
|
||||
if ( itNextToLastLeft == vDexel.end()) {
|
||||
// Aggiungo il nuovo semgento
|
||||
vDexel.emplace_back() ;
|
||||
@@ -356,11 +356,11 @@ VolZmap::AddIntervals( int nGrid, int nI, int nJ,
|
||||
//m_Values[nGrid][nPos].back().nCompo = ;
|
||||
bModified = true ;
|
||||
}
|
||||
// Il successivo esiste.
|
||||
// Il successivo esiste.
|
||||
else {
|
||||
// Il successivo è il primo a destra.
|
||||
// Il successivo è il primo a destra.
|
||||
if ( itNextToLastLeft == itFirstRight) {
|
||||
// Inserisco nuovo segmento-
|
||||
// Inserisco nuovo segmento-
|
||||
Data NewSegment ;
|
||||
NewSegment.dMin = dMin ;
|
||||
NewSegment.dMax = dMax ;
|
||||
@@ -373,18 +373,18 @@ VolZmap::AddIntervals( int nGrid, int nI, int nJ,
|
||||
bModified = true ;
|
||||
}
|
||||
else {
|
||||
// Il successivo non esce a sinistra da quello da aggiungere.
|
||||
// Il successivo non esce a sinistra da quello da aggiungere.
|
||||
if ( itNextToLastLeft->dMin > dMin + EPS_SMALL) {
|
||||
itNextToLastLeft->dMin = dMin ;
|
||||
itNextToLastLeft->vtMinN = vtNmi ;
|
||||
itNextToLastLeft->nToolMin = nToolNum ;
|
||||
}
|
||||
// Cerco l'ultimo segmento che interferisce con quello da aggiungere.
|
||||
// Cerco l'ultimo segmento che interferisce con quello da aggiungere.
|
||||
auto itPrevToFirstRight = vDexel.end() ;
|
||||
for ( auto it = itNextToLastLeft ; it != itFirstRight ; ++ it) {
|
||||
itPrevToFirstRight = it ;
|
||||
}
|
||||
// L'ultimo che interferisce non esce a destra da quello da aggiungere.
|
||||
// L'ultimo che interferisce non esce a destra da quello da aggiungere.
|
||||
if ( itPrevToFirstRight->dMax < dMax - EPS_SMALL) {
|
||||
itNextToLastLeft->dMax = dMax ;
|
||||
itNextToLastLeft->vtMaxN = vtNma ;
|
||||
@@ -403,18 +403,18 @@ VolZmap::AddIntervals( int nGrid, int nI, int nJ,
|
||||
}
|
||||
}
|
||||
}
|
||||
// Non esistono neanche a destra.
|
||||
// Non esistono neanche a destra.
|
||||
else if ( itFirstRight == m_Values[nGrid][nPos].end()) {
|
||||
// Il primo intervallo non sporge a sinistra
|
||||
// Il primo intervallo non sporge a sinistra
|
||||
if ( vDexel.begin()->dMin > dMin + EPS_SMALL) {
|
||||
vDexel.begin()->dMin = dMin ;
|
||||
vDexel.begin()->vtMinN = vtNmi ;
|
||||
vDexel.begin()->nToolMin = nToolNum ;
|
||||
bModified = true ;
|
||||
}
|
||||
// L'ultimo intervallo sporge a destra.
|
||||
// L'ultimo intervallo sporge a destra.
|
||||
if ( m_Values[nGrid][nPos].back().dMax > dMax + EPS_SMALL) {
|
||||
// Ci sono più segmenti, inglobo tutti nel primo.
|
||||
// Ci sono più segmenti, inglobo tutti nel primo.
|
||||
if ( vDexel.back().dMax > vDexel.begin()->dMax + EPS_SMALL) {
|
||||
vDexel.begin()->dMax = vDexel.back().dMax ;
|
||||
vDexel.begin()->vtMaxN = vDexel.back().vtMaxN ;
|
||||
@@ -422,7 +422,7 @@ VolZmap::AddIntervals( int nGrid, int nI, int nJ,
|
||||
bModified = true ;
|
||||
}
|
||||
}
|
||||
// L'ultimo intervallo non sporge a destra.
|
||||
// L'ultimo intervallo non sporge a destra.
|
||||
else {
|
||||
vDexel.begin()->dMax = dMax ;
|
||||
vDexel.begin()->vtMaxN = vtNma ;
|
||||
@@ -431,11 +431,11 @@ VolZmap::AddIntervals( int nGrid, int nI, int nJ,
|
||||
}
|
||||
vDexel.erase( vDexel.begin() + 1, vDexel.end()) ;
|
||||
}
|
||||
// A destra esistono.
|
||||
// A destra esistono.
|
||||
else {
|
||||
// Tutti i segmenti sono a destra di qullo da aggiungere.
|
||||
// Tutti i segmenti sono a destra di qullo da aggiungere.
|
||||
if ( itFirstRight == vDexel.begin()) {
|
||||
// Inserisco nuovo segmento-
|
||||
// Inserisco nuovo segmento-
|
||||
Data NewSegment ;
|
||||
NewSegment.dMin = dMin ;
|
||||
NewSegment.dMax = dMax ;
|
||||
@@ -447,19 +447,19 @@ VolZmap::AddIntervals( int nGrid, int nI, int nJ,
|
||||
bModified = true ;
|
||||
}
|
||||
else {
|
||||
// Se il primo segmento non esce a sinistra da quello da aggiungere, cambio l'inizio.
|
||||
// Se il primo segmento non esce a sinistra da quello da aggiungere, cambio l'inizio.
|
||||
if ( vDexel.begin()->dMin > dMin + EPS_SMALL) {
|
||||
vDexel.begin()->dMin = dMin ;
|
||||
vDexel.begin()->vtMinN = vtNmi ;
|
||||
vDexel.begin()->nToolMin = nToolNum ;
|
||||
bModified = true ;
|
||||
}
|
||||
// Cerco l'ultimo segmento che interferisce con quello da aggiungere.
|
||||
// Cerco l'ultimo segmento che interferisce con quello da aggiungere.
|
||||
auto itPrevToFirstRight = vDexel.begin() ;
|
||||
for ( auto it = m_Values[nGrid][nPos].begin() ; it != itFirstRight ; ++ it) {
|
||||
itPrevToFirstRight = it ;
|
||||
}
|
||||
// L'ultimo che interferisce non esce a destra da quello da aggiungere.
|
||||
// L'ultimo che interferisce non esce a destra da quello da aggiungere.
|
||||
if ( itPrevToFirstRight->dMax < dMax - EPS_SMALL) {
|
||||
vDexel.begin()->dMax = dMax ;
|
||||
vDexel.begin()->vtMaxN = vtNma ;
|
||||
@@ -479,24 +479,24 @@ VolZmap::AddIntervals( int nGrid, int nI, int nJ,
|
||||
}
|
||||
}
|
||||
|
||||
// Se nessuna modifica, esco
|
||||
// Se nessuna modifica, esco
|
||||
if ( ! bModified)
|
||||
return true ;
|
||||
|
||||
// Imposto ricalcolo della grafica
|
||||
// Imposto ricalcolo della grafica
|
||||
m_OGrMgr.Reset() ;
|
||||
// Imposto forma generica
|
||||
// Imposto forma generica
|
||||
m_nShape = GENERIC ;
|
||||
// Imposto ricalcolo numero di componenti connesse
|
||||
// Imposto ricalcolo numero di componenti connesse
|
||||
m_nConnectedCompoCount = - 1 ;
|
||||
|
||||
// Passo da indici di dexel a indici di voxel
|
||||
// Passo da indici di dexel a indici di voxel
|
||||
nI /= m_nDexVoxRatio ;
|
||||
nJ /= m_nDexVoxRatio ;
|
||||
|
||||
// Determino quali blocchi sono stati modificati
|
||||
// Determino quali blocchi sono stati modificati
|
||||
if ( nGrid == 0) {
|
||||
// Voxel lungo X
|
||||
// Voxel lungo X
|
||||
int nXStop = 1 ;
|
||||
int nXBlock[2] ;
|
||||
nXBlock[0] = min( nI / m_nVoxNumPerBlock, m_nFracLin[0] - 1) ;
|
||||
@@ -504,7 +504,7 @@ VolZmap::AddIntervals( int nGrid, int nI, int nJ,
|
||||
nXBlock[1] = nXBlock[0] - 1 ;
|
||||
++ nXStop ;
|
||||
}
|
||||
// Voxel lungo Y
|
||||
// Voxel lungo Y
|
||||
int nYStop = 1 ;
|
||||
int nYBlock[2] ;
|
||||
nYBlock[0] = min( nJ / m_nVoxNumPerBlock, m_nFracLin[1] - 1) ;
|
||||
@@ -512,13 +512,13 @@ VolZmap::AddIntervals( int nGrid, int nI, int nJ,
|
||||
nYBlock[1] = nYBlock[0] - 1 ;
|
||||
++ nYStop ;
|
||||
}
|
||||
// Voxel lungo Z
|
||||
// Voxel lungo Z
|
||||
int nVoxNumZ = int( m_nNy[1] / m_nDexVoxRatio + ( m_nNy[1] % m_nDexVoxRatio == 0 ? 1 : 2)) ;
|
||||
int nMinK = Clamp( int( floor( ( ( dMin - 0.5 * m_dStep) / ( m_nDexVoxRatio * m_dStep) - EPS_SMALL))), 0, nVoxNumZ - 2) ;
|
||||
int nMaxK = Clamp( int( floor( ( ( dMax + 0.5 * m_dStep) / ( m_nDexVoxRatio * m_dStep) + EPS_SMALL))), 0, nVoxNumZ - 2) ;
|
||||
int nMinZBlock = ( m_nMapNum == 1 ? 0 : Clamp( nMinK / int( m_nVoxNumPerBlock), 0, int( m_nFracLin[2] - 1))) ;
|
||||
int nMaxZBlock = min( int( m_nFracLin[2] - 1), nMaxK / int( m_nVoxNumPerBlock)) ;
|
||||
// Assegno flag ai voxel
|
||||
// Assegno flag ai voxel
|
||||
for ( int tI = 0 ; tI < nXStop ; ++ tI) {
|
||||
for ( int tJ = 0 ; tJ < nYStop ; ++ tJ) {
|
||||
for ( int k = nMinZBlock ; k <= nMaxZBlock ; ++ k) {
|
||||
@@ -530,7 +530,7 @@ VolZmap::AddIntervals( int nGrid, int nI, int nJ,
|
||||
}
|
||||
|
||||
else if ( nGrid == 1) {
|
||||
// Voxel lungo Y
|
||||
// Voxel lungo Y
|
||||
int nYStop = 1 ;
|
||||
int nYBlock[2] ;
|
||||
nYBlock[0] = min( nI / m_nVoxNumPerBlock, m_nFracLin[1] - 1) ;
|
||||
@@ -538,7 +538,7 @@ VolZmap::AddIntervals( int nGrid, int nI, int nJ,
|
||||
nYBlock[1] = nYBlock[0] - 1 ;
|
||||
++ nYStop ;
|
||||
}
|
||||
// Voxel lungo Z
|
||||
// Voxel lungo Z
|
||||
int nZStop = 1 ;
|
||||
int nZBlock[2] ;
|
||||
nZBlock[0] = min( nJ / m_nVoxNumPerBlock, m_nFracLin[2] - 1) ;
|
||||
@@ -546,13 +546,13 @@ VolZmap::AddIntervals( int nGrid, int nI, int nJ,
|
||||
nZBlock[1] = nZBlock[0] - 1 ;
|
||||
++ nZStop ;
|
||||
}
|
||||
// Voxel lungo X
|
||||
// Voxel lungo X
|
||||
int nVoxNumX = int( m_nNx[0] / m_nDexVoxRatio + ( m_nNx[0] % m_nDexVoxRatio == 0 ? 1 : 2)) ;
|
||||
int nMinI = Clamp( int( floor( ( ( dMin - 0.5 * m_dStep) / ( m_nDexVoxRatio * m_dStep) - EPS_SMALL))), 0, nVoxNumX - 2) ;
|
||||
int nMaxI = Clamp( int( floor( ( ( dMax + 0.5 * m_dStep) / ( m_nDexVoxRatio * m_dStep) + EPS_SMALL))), 0, nVoxNumX - 2) ;
|
||||
int nMinXBlock = Clamp( nMinI / int( m_nVoxNumPerBlock), 0, int( m_nFracLin[0] - 1)) ;
|
||||
int nMaxXBlock = min( int( m_nFracLin[0] - 1), nMaxI / int( m_nVoxNumPerBlock)) ;
|
||||
// Assegno flag ai voxel
|
||||
// Assegno flag ai voxel
|
||||
for ( int tI = 0 ; tI < nYStop ; ++ tI) {
|
||||
for ( int tJ = 0 ; tJ < nZStop ; ++ tJ) {
|
||||
for ( int k = nMinXBlock ; k <= nMaxXBlock ; ++ k) {
|
||||
@@ -564,7 +564,7 @@ VolZmap::AddIntervals( int nGrid, int nI, int nJ,
|
||||
}
|
||||
|
||||
else if ( nGrid == 2) {
|
||||
// Voxel lungo X
|
||||
// Voxel lungo X
|
||||
int nXStop = 1 ;
|
||||
int nXBlock[2] ;
|
||||
nXBlock[0] = min( nJ / m_nVoxNumPerBlock, m_nFracLin[0] - 1) ;
|
||||
@@ -572,7 +572,7 @@ VolZmap::AddIntervals( int nGrid, int nI, int nJ,
|
||||
nXBlock[1] = nXBlock[0] - 1 ;
|
||||
++ nXStop ;
|
||||
}
|
||||
// Voxel lungo Z
|
||||
// Voxel lungo Z
|
||||
int nZStop = 1 ;
|
||||
int nZBlock[2] ;
|
||||
nZBlock[0] = min( nI / m_nVoxNumPerBlock, m_nFracLin[2] - 1) ;
|
||||
@@ -580,13 +580,13 @@ VolZmap::AddIntervals( int nGrid, int nI, int nJ,
|
||||
nZBlock[1] = nZBlock[0] - 1 ;
|
||||
++ nZStop ;
|
||||
}
|
||||
// Voxel lungo Y
|
||||
// Voxel lungo Y
|
||||
int nVoxNumY = int( m_nNy[0] / m_nDexVoxRatio + ( m_nNy[0] % m_nDexVoxRatio == 0 ? 1 : 2)) ;
|
||||
int nMinJ = Clamp( int( floor( ( ( dMin - 0.5 * m_dStep) / ( m_nDexVoxRatio * m_dStep) - EPS_SMALL))), 0, nVoxNumY - 2) ;
|
||||
int nMaxJ = Clamp( int( floor( ( ( dMax + 0.5 * m_dStep) / ( m_nDexVoxRatio * m_dStep) + EPS_SMALL))), 0, nVoxNumY - 2) ;
|
||||
int nMinYBlock = Clamp( nMinJ / int( m_nVoxNumPerBlock), 0, int( m_nFracLin[1] - 1)) ;
|
||||
int nMaxYBlock = min( int( m_nFracLin[1] - 1), nMaxJ / int( m_nVoxNumPerBlock)) ;
|
||||
// Assegno flag ai voxel
|
||||
// Assegno flag ai voxel
|
||||
for ( int tI = 0 ; tI < nZStop ; ++ tI) {
|
||||
for ( int tJ = 0 ; tJ < nXStop ; ++ tJ) {
|
||||
for ( int k = nMinYBlock ; k <= nMaxYBlock ; ++ k) {
|
||||
@@ -638,9 +638,6 @@ VolZmap::MillingStep( int nCurrTool,
|
||||
return false ;
|
||||
}
|
||||
|
||||
// Reset numero di parti
|
||||
m_nConnectedCompoCount = - 1 ;
|
||||
|
||||
// Punti e vettori descriventi il moto nel sistema intrinseco dello Zmap
|
||||
Point3d ptPLs = GetToLoc( ptPs, m_MapFrame) ;
|
||||
Point3d ptPLe = GetToLoc( ptPe, m_MapFrame) ;
|
||||
@@ -837,6 +834,8 @@ VolZmap::SelectMotion( int nGrid, const Point3d& ptLs, const Point3d& ptLe, cons
|
||||
return Conus_ZMilling( nGrid, ptLs, ptLe, vtL) ;
|
||||
case Tool::MORTISER :
|
||||
return Mrt_Milling( nGrid, ptLs, ptLe, vtL, vtAL) ;
|
||||
case Tool::ADDITIVE :
|
||||
return AddingMotion( nGrid, ptLs, ptLe, vtL) ;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -899,6 +898,8 @@ VolZmap::SelectMotion( int nGrid, const Point3d& ptLs, const Point3d& ptLe, cons
|
||||
return Conus_XYMilling( nGrid, ptLs, ptLe, vtL) ;
|
||||
case Tool::MORTISER :
|
||||
return Mrt_Milling( nGrid, ptLs, ptLe, vtL, vtAL) ;
|
||||
case Tool::ADDITIVE :
|
||||
return AddingMotion( nGrid, ptLs, ptLe, vtL) ;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -945,6 +946,8 @@ VolZmap::SelectMotion( int nGrid, const Point3d& ptLs, const Point3d& ptLe, cons
|
||||
if ( dSqLLong < EPS_SMALL * EPS_SMALL)
|
||||
return Chs_Milling( nGrid, ptLs, ptLe, vtL, vtAL) ;
|
||||
break ;
|
||||
case Tool::ADDITIVE :
|
||||
return AddingMotion( nGrid, ptLs, ptLe, vtL) ;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4942,29 +4945,27 @@ VolZmap::CompBall_Milling( int nGrid, const Point3d& ptLs, const Point3d& ptLe,
|
||||
bool
|
||||
VolZmap::AddingMotion( int nGrid, const Point3d& ptS, const Point3d& ptE, const Vector3d& vtAx)
|
||||
{
|
||||
// Dimensioni lineari dell'utensile
|
||||
// Dimensioni lineari dell'utensile
|
||||
double dHei = m_vTool[m_nCurrTool].GetHeigth() ;
|
||||
double dRad = m_vTool[m_nCurrTool].GetRadius() ;
|
||||
double dCornerRad = m_vTool[m_nCurrTool].GetCornRadius() ;
|
||||
|
||||
// Utensile sfiancato
|
||||
// Utensile sfiancato
|
||||
if ( dCornerRad * dCornerRad - 0.25 * dHei * dHei > 0) {
|
||||
AddingGeneral( nGrid, ptS, ptE, vtAx) ;
|
||||
return AddingGeneral( nGrid, ptS, ptE, vtAx) ;
|
||||
}
|
||||
// Utensile sferico
|
||||
// Utensile sferico
|
||||
else if ( dRad - dCornerRad < EPS_SMALL) {
|
||||
AddingSphere( nGrid, ptS - dRad * vtAx, ptE - dRad * vtAx, dRad) ;
|
||||
return AddingSphere( nGrid, ptS - dRad * vtAx, ptE - dRad * vtAx, dRad) ;
|
||||
}
|
||||
// Utensile cilindro
|
||||
// Utensile cilindro
|
||||
else if ( dCornerRad < EPS_SMALL) {
|
||||
AddingCylinder( nGrid, ptS, ptE, vtAx, dHei, dRad) ;
|
||||
return AddingCylinder( nGrid, ptS, ptE, vtAx, dHei, dRad) ;
|
||||
}
|
||||
// Utensile naso di toro
|
||||
// Utensile naso di toro
|
||||
else {
|
||||
AddingGeneral( nGrid, ptS, ptE, vtAx) ;
|
||||
return AddingGeneral( nGrid, ptS, ptE, vtAx) ;
|
||||
}
|
||||
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
@@ -5064,57 +5065,37 @@ VolZmap::AddingCylinder( int nGrid, const Point3d& ptS, const Point3d& ptE, cons
|
||||
double dLen1 = vtV1.Len() ;
|
||||
vtV1 /= dLen1 ;
|
||||
|
||||
if ( nGrid == 0) {
|
||||
double dMyTol = 0 ;
|
||||
Frame3d CylFrame, PolyFrame ;
|
||||
if ( ! CylFrame.Set( ptS - dHei * vtAx, vtAx))
|
||||
return false ;
|
||||
if ( ! PolyFrame.Set( ptS - ( dHei + dMyTol) * vtAx, vtAx, vtV1))
|
||||
return false ;
|
||||
for ( int i = nStartI ; i <= nEndI ; ++ i) {
|
||||
for ( int j = nStartJ ; j <= nEndJ ; ++ j) {
|
||||
|
||||
Point3d ptC( ( i + 0.5) * m_dStep, ( j + 0.5) * m_dStep, 0) ;
|
||||
|
||||
Point3d ptInt1, ptInt2 ;
|
||||
Vector3d vtN1, vtN2 ;
|
||||
|
||||
Vector3d vtV2 = Z_AX ^ vtV1 ;
|
||||
if ( IntersLineCylinder( ptC, Z_AX, CylFrame, dHei, dRad, true, true,
|
||||
ptInt1, vtN1, ptInt2, vtN2)) {
|
||||
AddIntervals( nGrid, i, j, ptInt1.z, ptInt2.z, - vtN1, - vtN2, CurrTool.GetToolNum()) ;
|
||||
}
|
||||
|
||||
for ( int i = nStartI ; i <= nEndI ; ++ i) {
|
||||
for ( int j = nStartJ ; j <= nEndJ ; ++ j) {
|
||||
if ( IntersLineCylinder( ptC - dLen1 * vtV1, Z_AX, CylFrame, dHei, dRad, true, true,
|
||||
ptInt1, vtN1, ptInt2, vtN2)) {
|
||||
AddIntervals( nGrid, i, j, ptInt1.z + dLen1 * vtV1.z, ptInt2.z + dLen1 * vtV1.z, - vtN1, - vtN2, CurrTool.GetToolNum()) ;
|
||||
}
|
||||
|
||||
Vector3d vtStC( ( i + 0.5) * m_dStep - ptS.x, ( j + 0.5) * m_dStep - ptS.y, 0) ;
|
||||
Vector3d vtEnC = vtStC - dLen1 * vtV1 ;
|
||||
|
||||
double dX1 = vtStC * vtV1 ;
|
||||
double dX2 = vtStC * vtV2 ;
|
||||
|
||||
if ( ( dX1 > 0 && dX1 < dLen1 && abs( dX2) < dRad + EPS_SMALL) ||
|
||||
vtStC.SqLen() < dRad * dRad + 2 * dRad * EPS_SMALL ||
|
||||
vtEnC.SqLen() < dRad * dRad + 2 * dRad * EPS_SMALL) {
|
||||
AddIntervals( nGrid, i, j, ptS.z - dHei, ptS.z, - Z_AX, Z_AX, CurrTool.GetToolNum()) ;
|
||||
}
|
||||
if ( IntersLineMyPolyhedron( ptC, Z_AX, PolyFrame, dLen1, 2 * ( dRad + dMyTol), dHei + 2 * dMyTol, 0,
|
||||
ptInt1, vtN1, ptInt2, vtN2)) {
|
||||
AddIntervals( nGrid, i, j, ptInt1.z, ptInt2.z, - vtN1, - vtN2, CurrTool.GetToolNum()) ;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
double dMyTol = 0 ;
|
||||
Frame3d CylFrame, PolyFrame ;
|
||||
CylFrame.Set( ptS - dHei * vtAx, vtAx) ;
|
||||
PolyFrame.Set( ptS - ( dHei + dMyTol) * vtAx, vtV1, vtAx ^ vtV1, vtAx) ;
|
||||
for ( int i = nStartI ; i <= nEndI ; ++ i) {
|
||||
for ( int j = nStartJ ; j <= nEndJ ; ++ j) {
|
||||
|
||||
Point3d ptC( ( i + 0.5) * m_dStep, ( j + 0.5) * m_dStep, 0) ;
|
||||
|
||||
Point3d ptInt1, ptInt2 ;
|
||||
Vector3d vtN1, vtN2 ;
|
||||
|
||||
if ( IntersLineCylinder( ptC, Z_AX, CylFrame, dHei, dRad, true, true,
|
||||
ptInt1, vtN1, ptInt2, vtN2)) {
|
||||
AddIntervals( nGrid, i, j, ptInt1.z, ptInt2.z, - vtN1, - vtN2, CurrTool.GetToolNum()) ;
|
||||
}
|
||||
|
||||
if ( IntersLineCylinder( ptC - dLen1 * vtV1, Z_AX, CylFrame, dHei, dRad, true, true,
|
||||
ptInt1, vtN1, ptInt2, vtN2)) {
|
||||
AddIntervals( nGrid, i, j, ptInt1.z + dLen1 * vtV1.z, ptInt2.z + dLen1 * vtV1.z, - vtN1, - vtN2, CurrTool.GetToolNum()) ;
|
||||
}
|
||||
|
||||
if ( IntersLineMyPolyhedron( ptC, Z_AX, PolyFrame, dLen1, 2 * ( dRad + dMyTol), dHei + 2 * dMyTol, 0,
|
||||
ptInt1, vtN1, ptInt2, vtN2)) {
|
||||
AddIntervals( nGrid, i, j, ptInt1.z, ptInt2.z, - vtN1, - vtN2, CurrTool.GetToolNum()) ;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return true ;
|
||||
}
|
||||
|
||||
@@ -5158,7 +5139,9 @@ VolZmap::AddingTruncatedCone( int nGrid, const Point3d& ptS, const Point3d& ptE,
|
||||
Vector3d vtV3 = vtV1 ^ vtV2 ;
|
||||
|
||||
// Sistema di riferimento intrinseco del movimento
|
||||
Frame3d ConusFrame ; ConusFrame.Set( ptV, vtV2, vtV3, vtV1) ;
|
||||
Frame3d ConusFrame ;
|
||||
if ( ! ConusFrame.Set( ptV, vtV1, vtV2, vtV3))
|
||||
return false ;
|
||||
|
||||
// Dimensioni lineari movimento
|
||||
double dLongLen = 0 ;
|
||||
@@ -5183,7 +5166,8 @@ VolZmap::AddingTruncatedCone( int nGrid, const Point3d& ptS, const Point3d& ptE,
|
||||
// Sistema di riferimento poliedro
|
||||
Point3d ptO = ptV + vtV1 * dl + vtV2 * ( dCos * dMinRad) ;
|
||||
Frame3d PolyFrame ;
|
||||
PolyFrame.Set( ptO, vtV1, vtV2, vtV3) ;
|
||||
if ( ! PolyFrame.Set( ptO, vtV1, vtV2, vtV3))
|
||||
return false ;
|
||||
|
||||
// Versori piani nel riferimento poliedro ( riferiti al sistema di riferimento) :
|
||||
// Sx, Dx
|
||||
@@ -5423,7 +5407,7 @@ VolZmap::AddingTruncatedCone( int nGrid, const Point3d& ptS, const Point3d& ptE,
|
||||
}
|
||||
}
|
||||
}
|
||||
// Se il poliedro � attraversato, aggiungo
|
||||
// Se il poliedro è attraversato, aggiungo
|
||||
if ( nIntNum == 2) {
|
||||
|
||||
// Riporto le intersezioni nel sistema griglia
|
||||
@@ -5459,7 +5443,8 @@ VolZmap::AddingSphere( int nGrid, const Point3d& ptS, const Point3d& ptE, double
|
||||
vtV /= dLengthPath ;
|
||||
// Riferimento per cilindro inviluppo della sfera lungo il movimento
|
||||
Frame3d CylFrame ;
|
||||
CylFrame.Set( ptS, vtV) ;
|
||||
if ( ! CylFrame.Set( ptS, vtV))
|
||||
return false ;
|
||||
|
||||
double dSqRad = dRad * dRad ;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user