EgtGeomKernel 1.9a1 :
- aggiunte funzioni per conversione colore RGB in HSV e viceversa - modifiche a VolZmap per gestione Flag utensile.
This commit is contained in:
+57
-69
@@ -12,25 +12,21 @@
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
//--------------------------- Include ----------------------------------------
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "CurveLine.h"
|
||||
#include "VolZmap.h"
|
||||
#include "GeoConst.h"
|
||||
#include "IntersLineSurfTm.h"
|
||||
#include "MC_Tables.h"
|
||||
#include "PolygonPlane.h"
|
||||
#include "/EgtDev/Include/EGkIntervals.h"
|
||||
#include "/EgtDev/Include/EgtNumUtils.h"
|
||||
#include "/EgtDev/Include/EGkStringUtils3d.h"
|
||||
#include "/EgtDev/Extern/Eigen\Core"
|
||||
#include "/EgtDev/Extern/Eigen\SVD"
|
||||
#include "PolygonPlane.h"
|
||||
|
||||
|
||||
using namespace std ;
|
||||
|
||||
|
||||
|
||||
// ------------------------- UNORDERED MAP PER LA GESTIONE DEI TRIANGOLI GRANDI ---------------------------------------------------
|
||||
|
||||
// ------------------------- TABELLA BLOCCHI ADIACENTI ----------------------------------------------------------------------------
|
||||
@@ -186,7 +182,6 @@ VolZmap::GridControl( VectorField VecField[], VectorField CompoVert[][12],
|
||||
( nIndArrey[nCompCount - 1][0] == 5 && nIndArrey[nCompCount - 1][1] == 7 &&
|
||||
nIndArrey[nCompCount - 1][2] == 8 && nIndArrey[nCompCount - 1][3] == 9 )) {
|
||||
|
||||
|
||||
if ( AreSameVectorApprox( VecField[nIndArrey[nCompCount - 1][0]].vtNorm, VecField[nIndArrey[nCompCount - 1][1]].vtNorm) &&
|
||||
abs( VecField[nIndArrey[nCompCount - 1][0]].vtNorm * VecField[nIndArrey[nCompCount - 1][2]].vtNorm) < EPS_SMALL &&
|
||||
abs( VecField[nIndArrey[nCompCount - 1][0]].vtNorm * VecField[nIndArrey[nCompCount - 1][3]].vtNorm) < EPS_SMALL) {
|
||||
@@ -197,16 +192,13 @@ VolZmap::GridControl( VectorField VecField[], VectorField CompoVert[][12],
|
||||
Vector3d vtVecField = VecField[nIndArrey[nCompCount - 1][0]].vtNorm ;
|
||||
|
||||
if ( vtVecField.x * vtVecField.x > 1 - EPS_SMALL * EPS_SMALL) {
|
||||
|
||||
if ( abs( CompoVert[nCompCount - 1][0].ptInt.x - ptBarycenter.x) < EPS_SMALL &&
|
||||
abs( CompoVert[nCompCount - 1][1].ptInt.x - ptBarycenter.x) < EPS_SMALL &&
|
||||
abs( CompoVert[nCompCount - 1][2].ptInt.x - ptBarycenter.x) < EPS_SMALL &&
|
||||
abs( CompoVert[nCompCount - 1][3].ptInt.x - ptBarycenter.x) < EPS_SMALL) {
|
||||
|
||||
double dXBar = ptBarycenter.x / m_dStep - 0.5 ;
|
||||
int nBarLimSup = int( m_nNx[0]) ;
|
||||
int nBarInd = 0 ;
|
||||
|
||||
while ( nBarInd < nBarLimSup) {
|
||||
double dXInd = double( nBarInd) ;
|
||||
if ( abs( dXInd - dXBar) < EPS_SMALL) {
|
||||
@@ -217,17 +209,15 @@ VolZmap::GridControl( VectorField VecField[], VectorField CompoVert[][12],
|
||||
}
|
||||
}
|
||||
}
|
||||
else if ( vtVecField.y * vtVecField.y > 1 - EPS_SMALL * EPS_SMALL) {
|
||||
|
||||
else if ( vtVecField.y * vtVecField.y > 1 - EPS_SMALL * EPS_SMALL) {
|
||||
if ( abs( CompoVert[nCompCount - 1][0].ptInt.y - ptBarycenter.y) < EPS_SMALL &&
|
||||
abs( CompoVert[nCompCount - 1][1].ptInt.y - ptBarycenter.y) < EPS_SMALL &&
|
||||
abs( CompoVert[nCompCount - 1][2].ptInt.y - ptBarycenter.y) < EPS_SMALL &&
|
||||
abs( CompoVert[nCompCount - 1][3].ptInt.y - ptBarycenter.y) < EPS_SMALL) {
|
||||
|
||||
double dYBar = ptBarycenter.y / m_dStep - 0.5 ;
|
||||
int nBarLimSup = int( m_nNy[0]) ;
|
||||
int nBarInd = 0 ;
|
||||
|
||||
while ( nBarInd < nBarLimSup) {
|
||||
double dYInd = double( nBarInd) ;
|
||||
if ( abs( dYInd - dYBar) < EPS_SMALL) {
|
||||
@@ -238,17 +228,15 @@ VolZmap::GridControl( VectorField VecField[], VectorField CompoVert[][12],
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
else if ( vtVecField.z * vtVecField.z > 1 - EPS_SMALL * EPS_SMALL) {
|
||||
|
||||
if ( abs( CompoVert[nCompCount - 1][0].ptInt.z - ptBarycenter.z) < EPS_SMALL &&
|
||||
abs( CompoVert[nCompCount - 1][1].ptInt.z - ptBarycenter.z) < EPS_SMALL &&
|
||||
abs( CompoVert[nCompCount - 1][2].ptInt.z - ptBarycenter.z) < EPS_SMALL &&
|
||||
abs( CompoVert[nCompCount - 1][3].ptInt.z - ptBarycenter.z) < EPS_SMALL) {
|
||||
|
||||
double dZBar = ptBarycenter.z / m_dStep - 0.5 ;
|
||||
int nBarLimSup = int( m_nNy[1]) ;
|
||||
int nBarInd = 0 ;
|
||||
|
||||
while ( nBarInd < nBarLimSup) {
|
||||
double dZInd = double( nBarInd) ;
|
||||
if ( abs( dZInd - dZBar) < EPS_SMALL) {
|
||||
@@ -260,6 +248,7 @@ VolZmap::GridControl( VectorField VecField[], VectorField CompoVert[][12],
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
else if ( AreSameVectorApprox( VecField[nIndArrey[nCompCount - 1][2]].vtNorm, VecField[nIndArrey[nCompCount - 1][3]].vtNorm) &&
|
||||
abs( VecField[nIndArrey[nCompCount - 1][2]].vtNorm * VecField[nIndArrey[nCompCount - 1][0]].vtNorm) < EPS_SMALL &&
|
||||
abs( VecField[nIndArrey[nCompCount - 1][2]].vtNorm * VecField[nIndArrey[nCompCount - 1][1]].vtNorm) < EPS_SMALL) {
|
||||
@@ -270,16 +259,13 @@ VolZmap::GridControl( VectorField VecField[], VectorField CompoVert[][12],
|
||||
Vector3d vtVecField = VecField[nIndArrey[nCompCount - 1][2]].vtNorm ;
|
||||
|
||||
if ( vtVecField.x * vtVecField.x > 1 - EPS_SMALL * EPS_SMALL) {
|
||||
|
||||
if ( abs( CompoVert[nCompCount - 1][0].ptInt.x - ptBarycenter.x) < EPS_SMALL &&
|
||||
abs( CompoVert[nCompCount - 1][1].ptInt.x - ptBarycenter.x) < EPS_SMALL &&
|
||||
abs( CompoVert[nCompCount - 1][2].ptInt.x - ptBarycenter.x) < EPS_SMALL &&
|
||||
abs( CompoVert[nCompCount - 1][3].ptInt.x - ptBarycenter.x) < EPS_SMALL) {
|
||||
|
||||
double dXBar = ptBarycenter.x / m_dStep - 0.5 ;
|
||||
int nBarLimSup = int( m_nNx[0]) ;
|
||||
int nBarInd = 0 ;
|
||||
|
||||
while ( nBarInd < nBarLimSup) {
|
||||
double dXInd = double( nBarInd) ;
|
||||
if ( abs( dXInd - dXBar) < EPS_SMALL) {
|
||||
@@ -290,17 +276,15 @@ VolZmap::GridControl( VectorField VecField[], VectorField CompoVert[][12],
|
||||
}
|
||||
}
|
||||
}
|
||||
else if ( vtVecField.y * vtVecField.y > 1 - EPS_SMALL * EPS_SMALL) {
|
||||
|
||||
else if ( vtVecField.y * vtVecField.y > 1 - EPS_SMALL * EPS_SMALL) {
|
||||
if ( abs( CompoVert[nCompCount - 1][0].ptInt.y - ptBarycenter.y) < EPS_SMALL &&
|
||||
abs( CompoVert[nCompCount - 1][1].ptInt.y - ptBarycenter.y) < EPS_SMALL &&
|
||||
abs( CompoVert[nCompCount - 1][2].ptInt.y - ptBarycenter.y) < EPS_SMALL &&
|
||||
abs( CompoVert[nCompCount - 1][3].ptInt.y - ptBarycenter.y) < EPS_SMALL) {
|
||||
|
||||
double dYBar = ptBarycenter.y / m_dStep - 0.5 ;
|
||||
int nBarLimSup = int( m_nNy[0]) ;
|
||||
int nBarInd = 0 ;
|
||||
|
||||
while ( nBarInd < nBarLimSup) {
|
||||
double dYInd = double( nBarInd) ;
|
||||
if ( abs( dYInd - dYBar) < EPS_SMALL) {
|
||||
@@ -311,17 +295,15 @@ VolZmap::GridControl( VectorField VecField[], VectorField CompoVert[][12],
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
else if ( vtVecField.z * vtVecField.z > 1 - EPS_SMALL * EPS_SMALL) {
|
||||
|
||||
if ( abs( CompoVert[nCompCount - 1][0].ptInt.z - ptBarycenter.z) < EPS_SMALL &&
|
||||
abs( CompoVert[nCompCount - 1][1].ptInt.z - ptBarycenter.z) < EPS_SMALL &&
|
||||
abs( CompoVert[nCompCount - 1][2].ptInt.z - ptBarycenter.z) < EPS_SMALL &&
|
||||
abs( CompoVert[nCompCount - 1][3].ptInt.z - ptBarycenter.z) < EPS_SMALL) {
|
||||
|
||||
double dZBar = ptBarycenter.z / m_dStep - 0.5 ;
|
||||
int nBarLimSup = int( m_nNy[1]) ;
|
||||
int nBarInd = 0 ;
|
||||
|
||||
while ( nBarInd < nBarLimSup) {
|
||||
double dZInd = double( nBarInd) ;
|
||||
if ( abs( dZInd - dZBar) < EPS_SMALL) {
|
||||
@@ -355,16 +337,13 @@ VolZmap::GridControl( VectorField VecField[], VectorField CompoVert[][12],
|
||||
Vector3d vtVecField = VecField[nIndArrey[nCompCount - 1][0]].vtNorm ;
|
||||
|
||||
if ( vtVecField.x * vtVecField.x > 1 - EPS_SMALL * EPS_SMALL) {
|
||||
|
||||
if ( abs( CompoVert[nCompCount - 1][0].ptInt.x - ptBarycenter.x) < EPS_SMALL &&
|
||||
abs( CompoVert[nCompCount - 1][1].ptInt.x - ptBarycenter.x) < EPS_SMALL &&
|
||||
abs( CompoVert[nCompCount - 1][2].ptInt.x - ptBarycenter.x) < EPS_SMALL &&
|
||||
abs( CompoVert[nCompCount - 1][3].ptInt.x - ptBarycenter.x) < EPS_SMALL) {
|
||||
|
||||
double dXBar = ptBarycenter.x / m_dStep - 0.5 ;
|
||||
int nBarLimSup = int( m_nNx[0]) ;
|
||||
int nBarInd = 0 ;
|
||||
|
||||
while ( nBarInd < nBarLimSup) {
|
||||
double dXInd = double( nBarInd) ;
|
||||
if ( abs( dXInd - dXBar) < EPS_SMALL) {
|
||||
@@ -375,17 +354,15 @@ VolZmap::GridControl( VectorField VecField[], VectorField CompoVert[][12],
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
else if ( vtVecField.y * vtVecField.y > 1 - EPS_SMALL * EPS_SMALL) {
|
||||
|
||||
if ( abs( CompoVert[nCompCount - 1][0].ptInt.y - ptBarycenter.y) < EPS_SMALL &&
|
||||
abs( CompoVert[nCompCount - 1][1].ptInt.y - ptBarycenter.y) < EPS_SMALL &&
|
||||
abs( CompoVert[nCompCount - 1][2].ptInt.y - ptBarycenter.y) < EPS_SMALL &&
|
||||
abs( CompoVert[nCompCount - 1][3].ptInt.y - ptBarycenter.y) < EPS_SMALL) {
|
||||
|
||||
double dYBar = ptBarycenter.y / m_dStep - 0.5 ;
|
||||
int nBarLimSup = int( m_nNy[0]) ;
|
||||
int nBarInd = 0 ;
|
||||
|
||||
while ( nBarInd < nBarLimSup) {
|
||||
double dYInd = double( nBarInd) ;
|
||||
if ( abs( dYInd - dYBar) < EPS_SMALL) {
|
||||
@@ -396,17 +373,15 @@ VolZmap::GridControl( VectorField VecField[], VectorField CompoVert[][12],
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
else if ( vtVecField.z * vtVecField.z > 1 - EPS_SMALL * EPS_SMALL) {
|
||||
|
||||
if ( abs( CompoVert[nCompCount - 1][0].ptInt.z - ptBarycenter.z) < EPS_SMALL &&
|
||||
abs( CompoVert[nCompCount - 1][1].ptInt.z - ptBarycenter.z) < EPS_SMALL &&
|
||||
abs( CompoVert[nCompCount - 1][2].ptInt.z - ptBarycenter.z) < EPS_SMALL &&
|
||||
abs( CompoVert[nCompCount - 1][3].ptInt.z - ptBarycenter.z) < EPS_SMALL) {
|
||||
|
||||
double dZBar = ptBarycenter.z / m_dStep - 0.5 ;
|
||||
int nBarLimSup = int( m_nNy[1]) ;
|
||||
int nBarInd = 0 ;
|
||||
|
||||
while ( nBarInd < nBarLimSup) {
|
||||
double dZInd = double( nBarInd) ;
|
||||
if ( abs( dZInd - dZBar) < EPS_SMALL) {
|
||||
@@ -418,6 +393,7 @@ VolZmap::GridControl( VectorField VecField[], VectorField CompoVert[][12],
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
else if ( AreSameVectorApprox( VecField[nIndArrey[nCompCount - 1][1]].vtNorm, VecField[nIndArrey[nCompCount - 1][3]].vtNorm) &&
|
||||
abs( VecField[nIndArrey[nCompCount - 1][1]].vtNorm * VecField[nIndArrey[nCompCount - 1][0]].vtNorm) < EPS_SMALL &&
|
||||
abs( VecField[nIndArrey[nCompCount - 1][1]].vtNorm * VecField[nIndArrey[nCompCount - 1][2]].vtNorm) < EPS_SMALL) {
|
||||
@@ -428,16 +404,13 @@ VolZmap::GridControl( VectorField VecField[], VectorField CompoVert[][12],
|
||||
Vector3d vtVecField = VecField[nIndArrey[nCompCount - 1][0]].vtNorm ;
|
||||
|
||||
if ( vtVecField.x * vtVecField.x > 1 - EPS_SMALL * EPS_SMALL) {
|
||||
|
||||
if ( abs( CompoVert[nCompCount - 1][0].ptInt.x - ptBarycenter.x) < EPS_SMALL &&
|
||||
abs( CompoVert[nCompCount - 1][1].ptInt.x - ptBarycenter.x) < EPS_SMALL &&
|
||||
abs( CompoVert[nCompCount - 1][2].ptInt.x - ptBarycenter.x) < EPS_SMALL &&
|
||||
abs( CompoVert[nCompCount - 1][3].ptInt.x - ptBarycenter.x) < EPS_SMALL) {
|
||||
|
||||
double dXBar = ptBarycenter.x / m_dStep - 0.5 ;
|
||||
int nBarLimSup = int( m_nNx[0]) ;
|
||||
int nBarInd = 0 ;
|
||||
|
||||
while ( nBarInd < nBarLimSup) {
|
||||
double dXInd = double( nBarInd) ;
|
||||
if ( abs( dXInd - dXBar) < EPS_SMALL) {
|
||||
@@ -448,17 +421,15 @@ VolZmap::GridControl( VectorField VecField[], VectorField CompoVert[][12],
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
else if ( vtVecField.y * vtVecField.y > 1 - EPS_SMALL * EPS_SMALL) {
|
||||
|
||||
if ( abs( CompoVert[nCompCount - 1][0].ptInt.y - ptBarycenter.y) < EPS_SMALL &&
|
||||
abs( CompoVert[nCompCount - 1][1].ptInt.y - ptBarycenter.y) < EPS_SMALL &&
|
||||
abs( CompoVert[nCompCount - 1][2].ptInt.y - ptBarycenter.y) < EPS_SMALL &&
|
||||
abs( CompoVert[nCompCount - 1][3].ptInt.y - ptBarycenter.y) < EPS_SMALL) {
|
||||
|
||||
double dYBar = ptBarycenter.y / m_dStep - 0.5 ;
|
||||
int nBarLimSup = int( m_nNy[0]) ;
|
||||
int nBarInd = 0 ;
|
||||
|
||||
while ( nBarInd < nBarLimSup) {
|
||||
double dYInd = double( nBarInd) ;
|
||||
if ( abs( dYInd - dYBar) < EPS_SMALL) {
|
||||
@@ -469,17 +440,15 @@ VolZmap::GridControl( VectorField VecField[], VectorField CompoVert[][12],
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
else if ( vtVecField.z * vtVecField.z > 1 - EPS_SMALL * EPS_SMALL) {
|
||||
|
||||
if ( abs( CompoVert[nCompCount - 1][0].ptInt.z - ptBarycenter.z) < EPS_SMALL &&
|
||||
abs( CompoVert[nCompCount - 1][1].ptInt.z - ptBarycenter.z) < EPS_SMALL &&
|
||||
abs( CompoVert[nCompCount - 1][2].ptInt.z - ptBarycenter.z) < EPS_SMALL &&
|
||||
abs( CompoVert[nCompCount - 1][3].ptInt.z - ptBarycenter.z) < EPS_SMALL) {
|
||||
|
||||
double dZBar = ptBarycenter.z / m_dStep - 0.5 ;
|
||||
int nBarLimSup = int( m_nNy[1]) ;
|
||||
int nBarInd = 0 ;
|
||||
|
||||
while ( nBarInd < nBarLimSup) {
|
||||
double dZInd = double( nBarInd) ;
|
||||
if ( abs( dZInd - dZBar) < EPS_SMALL) {
|
||||
@@ -491,7 +460,8 @@ VolZmap::GridControl( VectorField VecField[], VectorField CompoVert[][12],
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true ;
|
||||
}
|
||||
|
||||
@@ -1028,8 +998,7 @@ VolZmap::ProcessCube( int nVoxI, int nVoxJ, int nVoxK, TRIA3DLIST& lstTria, TriH
|
||||
bool bN1 = ( ( nIndex & ( 1 << n1)) != 0) ;
|
||||
// Determino con precisione il punto di intersezione sullo spigolo,
|
||||
// se i campi scalare e vettoriale non sono regolari bReg diviene falso.
|
||||
if ( ! IntersPos( IndexCorner[n1], IndexCorner[n2], bN1,
|
||||
VecField[EdgeIndex].ptInt, VecField[EdgeIndex].vtNorm))
|
||||
if ( ! IntersPos( IndexCorner[n1], IndexCorner[n2], bN1, VecField[EdgeIndex]))
|
||||
bReg = false ;
|
||||
}
|
||||
|
||||
@@ -1726,8 +1695,7 @@ VolZmap::ExtMarchingCubes( int nBlock, TRIA3DLIST& lstTria, TriHolder& triHold)
|
||||
bool bN1 = ( ( nIndex & ( 1 << n1)) != 0) ;
|
||||
// Determino con precisione il punto di intersezione sullo spigolo,
|
||||
// se i campi scalare e vettoriale non sono regolari bReg diviene falso.
|
||||
if ( ! IntersPos( IndexCorner[n1], IndexCorner[n2], bN1,
|
||||
VecField[EdgeIndex].ptInt, VecField[EdgeIndex].vtNorm))
|
||||
if ( ! IntersPos( IndexCorner[n1], IndexCorner[n2], bN1, VecField[EdgeIndex]))
|
||||
bReg = false ;
|
||||
}
|
||||
|
||||
@@ -2422,6 +2390,13 @@ VolZmap::ExtMarchingCubes( int nBlock, TRIA3DLIST& lstTria, TriHolder& triHold)
|
||||
CurrentTriangle.Set( CompoTriVert[nCompCount - 1][TriIndex].ptInt,
|
||||
CompoTriVert[nCompCount - 1][TriIndex+1].ptInt,
|
||||
CompoTriVert[nCompCount - 1][TriIndex+2].ptInt) ;
|
||||
// Setto il numero di utensile
|
||||
int nTool0 = CompoTriVert[nCompCount - 1][TriIndex].nToolFlag ;
|
||||
int nTool1 = CompoTriVert[nCompCount - 1][TriIndex+1].nToolFlag ;
|
||||
int nTool2 = CompoTriVert[nCompCount - 1][TriIndex+2].nToolFlag ;
|
||||
if ( nTool0 == nTool1 && nTool0 == nTool2)
|
||||
CurrentTriangle.SetFlag( nTool0) ;
|
||||
//
|
||||
bool bV = CurrentTriangle.Validate( true) ;
|
||||
// Riporto le coordinate nel sistema in cui è immerso lo Zmap
|
||||
CurrentTriangle.ToGlob( m_MapFrame) ;
|
||||
@@ -2440,6 +2415,13 @@ VolZmap::ExtMarchingCubes( int nBlock, TRIA3DLIST& lstTria, TriHolder& triHold)
|
||||
CurrentTriangle.Set( CompoTriVert[nCompCount - 1][TriIndex].ptInt,
|
||||
CompoTriVert[nCompCount - 1][TriIndex+1].ptInt,
|
||||
CompoTriVert[nCompCount - 1][TriIndex+2].ptInt) ;
|
||||
// Setto il numero di utensile
|
||||
int nTool0 = CompoTriVert[nCompCount - 1][TriIndex].nToolFlag ;
|
||||
int nTool1 = CompoTriVert[nCompCount - 1][TriIndex+1].nToolFlag ;
|
||||
int nTool2 = CompoTriVert[nCompCount - 1][TriIndex+2].nToolFlag ;
|
||||
if ( nTool0 == nTool1 && nTool0 == nTool2)
|
||||
CurrentTriangle.SetFlag( nTool0) ;
|
||||
//
|
||||
bool bV = CurrentTriangle.Validate( true) ;
|
||||
// Riporto le coordinate nel sistema in cui è immerso lo Zmap
|
||||
CurrentTriangle.ToGlob( m_MapFrame) ;
|
||||
@@ -2927,7 +2909,7 @@ VolZmap::CalcIndex( int nI, int nJ, int nK) const
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
VolZmap::IntersPos( int nVec1[], int nVec2[], bool bFirstCorner, Point3d& ptInt, Vector3d& vtNormal) const
|
||||
VolZmap::IntersPos( int nVec1[], int nVec2[], bool bFirstCorner, VectorField& vfField) const
|
||||
{
|
||||
const double dEps = 2 * EPS_SMALL ;
|
||||
|
||||
@@ -2941,8 +2923,8 @@ VolZmap::IntersPos( int nVec1[], int nVec2[], bool bFirstCorner, Point3d& ptInt,
|
||||
double dMinX = ( nMinI + 0.5) * m_dStep ;
|
||||
double dMaxX = ( nMaxI + 0.5) * m_dStep ;
|
||||
|
||||
ptInt.y = ( nVec1[1] * N_DEXVOXRATIO + 0.5) * m_dStep ;
|
||||
ptInt.z = ( nVec1[2] * N_DEXVOXRATIO + 0.5) * m_dStep ;
|
||||
vfField.ptInt.y = ( nVec1[1] * N_DEXVOXRATIO + 0.5) * m_dStep ;
|
||||
vfField.ptInt.z = ( nVec1[2] * N_DEXVOXRATIO + 0.5) * m_dStep ;
|
||||
|
||||
size_t nDexel = ( nVec1[2] * m_nNx[1] + nVec1[1]) * N_DEXVOXRATIO ;
|
||||
int nSize = int( m_Values[1][nDexel].size()) ;
|
||||
@@ -2952,8 +2934,9 @@ VolZmap::IntersPos( int nVec1[], int nVec2[], bool bFirstCorner, Point3d& ptInt,
|
||||
double dX = m_Values[1][nDexel][n].dMax ;
|
||||
while ( n >= 0 && dX > dMinX - dEps) {
|
||||
if ( dX < dMaxX + dEps) {
|
||||
ptInt.x = dX ;
|
||||
vtNormal = m_Values[1][nDexel][n].vtMaxN ;
|
||||
vfField.ptInt.x = dX ;
|
||||
vfField.vtNorm = m_Values[1][nDexel][n].vtMaxN ;
|
||||
vfField.nToolFlag = m_Values[1][nDexel][n].nToolMax ;
|
||||
bFound = true ;
|
||||
break ;
|
||||
}
|
||||
@@ -2968,8 +2951,9 @@ VolZmap::IntersPos( int nVec1[], int nVec2[], bool bFirstCorner, Point3d& ptInt,
|
||||
double dX = m_Values[1][nDexel][n].dMin ;
|
||||
while ( n < nSize && dX < dMaxX + dEps) {
|
||||
if ( dX > dMinX - dEps) {
|
||||
ptInt.x = dX ;
|
||||
vtNormal = m_Values[1][nDexel][n].vtMinN ;
|
||||
vfField.ptInt.x = dX ;
|
||||
vfField.vtNorm = m_Values[1][nDexel][n].vtMinN ;
|
||||
vfField.nToolFlag = m_Values[1][nDexel][n].nToolMin ;
|
||||
bFound = true ;
|
||||
break ;
|
||||
}
|
||||
@@ -2980,7 +2964,7 @@ VolZmap::IntersPos( int nVec1[], int nVec2[], bool bFirstCorner, Point3d& ptInt,
|
||||
}
|
||||
|
||||
if ( ! bFound)
|
||||
ptInt.x = 0.5 * ( dMinX + dMaxX) ;
|
||||
vfField.ptInt.x = 0.5 * ( dMinX + dMaxX) ;
|
||||
}
|
||||
|
||||
else if ( nVec1[1] != nVec2[1]) {
|
||||
@@ -2991,8 +2975,8 @@ VolZmap::IntersPos( int nVec1[], int nVec2[], bool bFirstCorner, Point3d& ptInt,
|
||||
double dMinY = ( nMinJ + 0.5) * m_dStep ;
|
||||
double dMaxY = ( nMaxJ + 0.5) * m_dStep ;
|
||||
|
||||
ptInt.x = ( nVec1[0] * N_DEXVOXRATIO + 0.5) * m_dStep ;
|
||||
ptInt.z = ( nVec1[2] * N_DEXVOXRATIO + 0.5) * m_dStep ;
|
||||
vfField.ptInt.x = ( nVec1[0] * N_DEXVOXRATIO + 0.5) * m_dStep ;
|
||||
vfField.ptInt.z = ( nVec1[2] * N_DEXVOXRATIO + 0.5) * m_dStep ;
|
||||
|
||||
size_t nDexel = ( nVec1[0] * m_nNx[2] + nVec1[2]) * N_DEXVOXRATIO ;
|
||||
int nSize = int( m_Values[2][nDexel].size()) ;
|
||||
@@ -3002,8 +2986,9 @@ VolZmap::IntersPos( int nVec1[], int nVec2[], bool bFirstCorner, Point3d& ptInt,
|
||||
double dY = m_Values[2][nDexel][n].dMax ;
|
||||
while ( n >= 0 && dY > dMinY - dEps) {
|
||||
if ( dY < dMaxY + dEps) {
|
||||
ptInt.y = dY ;
|
||||
vtNormal = m_Values[2][nDexel][n].vtMaxN ;
|
||||
vfField.ptInt.y = dY ;
|
||||
vfField.vtNorm = m_Values[2][nDexel][n].vtMaxN ;
|
||||
vfField.nToolFlag = m_Values[2][nDexel][n].nToolMax;
|
||||
bFound = true ;
|
||||
break ;
|
||||
}
|
||||
@@ -3018,8 +3003,9 @@ VolZmap::IntersPos( int nVec1[], int nVec2[], bool bFirstCorner, Point3d& ptInt,
|
||||
double dY = m_Values[2][nDexel][n].dMin ;
|
||||
while ( n < nSize && dY < dMaxY + dEps) {
|
||||
if ( dY > dMinY - dEps) {
|
||||
ptInt.y = dY ;
|
||||
vtNormal = m_Values[2][nDexel][n].vtMinN ;
|
||||
vfField.ptInt.y = dY ;
|
||||
vfField.vtNorm = m_Values[2][nDexel][n].vtMinN ;
|
||||
vfField.nToolFlag = m_Values[2][nDexel][n].nToolMin ;
|
||||
bFound = true ;
|
||||
break ;
|
||||
}
|
||||
@@ -3030,7 +3016,7 @@ VolZmap::IntersPos( int nVec1[], int nVec2[], bool bFirstCorner, Point3d& ptInt,
|
||||
}
|
||||
|
||||
if ( ! bFound)
|
||||
ptInt.y = 0.5 * ( dMinY + dMaxY) ;
|
||||
vfField.ptInt.y = 0.5 * ( dMinY + dMaxY) ;
|
||||
}
|
||||
|
||||
else if ( nVec1[2] != nVec2[2]) {
|
||||
@@ -3041,8 +3027,8 @@ VolZmap::IntersPos( int nVec1[], int nVec2[], bool bFirstCorner, Point3d& ptInt,
|
||||
double dMinZ = ( nMinK + 0.5) * m_dStep ;
|
||||
double dMaxZ = ( nMaxK + 0.5) * m_dStep ;
|
||||
|
||||
ptInt.x = ( nVec1[0] * N_DEXVOXRATIO + 0.5) * m_dStep ;
|
||||
ptInt.y = ( nVec1[1] * N_DEXVOXRATIO + 0.5) * m_dStep ;
|
||||
vfField.ptInt.x = ( nVec1[0] * N_DEXVOXRATIO + 0.5) * m_dStep ;
|
||||
vfField.ptInt.y = ( nVec1[1] * N_DEXVOXRATIO + 0.5) * m_dStep ;
|
||||
|
||||
size_t nDexel = ( nVec1[1] * m_nNx[0] + nVec1[0]) * N_DEXVOXRATIO ;
|
||||
int nSize = int( m_Values[0][nDexel].size()) ;
|
||||
@@ -3052,8 +3038,9 @@ VolZmap::IntersPos( int nVec1[], int nVec2[], bool bFirstCorner, Point3d& ptInt,
|
||||
double dZ = m_Values[0][nDexel][n].dMax ;
|
||||
while ( n >= 0 && dZ > dMinZ - dEps) {
|
||||
if ( dZ < dMaxZ + dEps) {
|
||||
ptInt.z = dZ ;
|
||||
vtNormal = m_Values[0][nDexel][n].vtMaxN ;
|
||||
vfField.ptInt.z = dZ ;
|
||||
vfField.vtNorm = m_Values[0][nDexel][n].vtMaxN ;
|
||||
vfField.nToolFlag = m_Values[0][nDexel][n].nToolMax ;
|
||||
bFound = true ;
|
||||
break ;
|
||||
}
|
||||
@@ -3068,8 +3055,9 @@ VolZmap::IntersPos( int nVec1[], int nVec2[], bool bFirstCorner, Point3d& ptInt,
|
||||
double dZ = m_Values[0][nDexel][n].dMin ;
|
||||
while ( n < nSize && dZ < dMaxZ + dEps) {
|
||||
if ( dZ > dMinZ - dEps) {
|
||||
ptInt.z = dZ ;
|
||||
vtNormal = m_Values[0][nDexel][n].vtMinN ;
|
||||
vfField.ptInt.z = dZ ;
|
||||
vfField.vtNorm = m_Values[0][nDexel][n].vtMinN ;
|
||||
vfField.nToolFlag = m_Values[0][nDexel][n].nToolMin ;
|
||||
bFound = true ;
|
||||
break ;
|
||||
}
|
||||
@@ -3080,7 +3068,7 @@ VolZmap::IntersPos( int nVec1[], int nVec2[], bool bFirstCorner, Point3d& ptInt,
|
||||
}
|
||||
|
||||
if ( ! bFound)
|
||||
ptInt.z = 0.5 * ( dMinZ + dMaxZ) ;
|
||||
vfField.ptInt.z = 0.5 * ( dMinZ + dMaxZ) ;
|
||||
}
|
||||
|
||||
return bFound ;
|
||||
|
||||
Reference in New Issue
Block a user