EgtGeomKernel 1.8e1 :
- modifiche a visualizzazione Zmap.
This commit is contained in:
+348
-2
@@ -71,6 +71,352 @@ VolZmap::IntersLineBox( const Point3d& ptP, const Vector3d& vtV,
|
||||
|
||||
return ( dU2 >= dU1) ;
|
||||
}
|
||||
/*
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
VolZmap::IntersLineVoxel( const Point3d& ptP, const Vector3d& vtV, int nIndI, int nIndJ, int nIndK,
|
||||
int& nFace1, int& nFace2, double& dU1, double& dU2) const
|
||||
{
|
||||
// Controllo sull'ammissibilità del voxel
|
||||
if ( nIndI < - 1 || nIndI >= int( m_nNx[0]) ||
|
||||
nIndJ < - 1 || nIndJ >= int( m_nNy[0]) ||
|
||||
nIndK < - 1 || nIndK >= int( m_nNy[1]))
|
||||
return false ;
|
||||
|
||||
Point3d ptInt ;
|
||||
int nIntNum = 0 ;
|
||||
double dU ;
|
||||
|
||||
// Intersezione con le facce 1 e 3
|
||||
if ( abs( vtV.y) > EPS_ZERO) {
|
||||
|
||||
// Intersezione con la prima faccia
|
||||
dU1 = ( ( nIndJ + 0.5) * m_dStep - ptP.y) / vtV.y ;
|
||||
ptInt = ptP + dU1 * vtV ;
|
||||
|
||||
if ( ptInt.x > ( nIndI + 0.5) * m_dStep - EPS_SMALL &&
|
||||
ptInt.x < ( nIndI + 1.5) * m_dStep + EPS_SMALL &&
|
||||
ptInt.z > ( nIndK + 0.5) * m_dStep - EPS_SMALL &&
|
||||
ptInt.z < ( nIndK + 1.5) * m_dStep + EPS_SMALL) {
|
||||
|
||||
nFace1 = 1 ;
|
||||
++ nIntNum ;
|
||||
}
|
||||
|
||||
// Intersezione con la terza faccia
|
||||
dU = ( ( nIndJ + 1.5) * m_dStep - ptP.y) / vtV.y ;
|
||||
ptInt = ptP + dU * vtV ;
|
||||
|
||||
if ( ptInt.x > ( nIndI + 0.5) * m_dStep - EPS_SMALL &&
|
||||
ptInt.x < ( nIndI + 1.5) * m_dStep + EPS_SMALL &&
|
||||
ptInt.z > ( nIndK + 0.5) * m_dStep - EPS_SMALL &&
|
||||
ptInt.z < ( nIndK + 1.5) * m_dStep + EPS_SMALL) {
|
||||
|
||||
if ( nIntNum == 0) {
|
||||
|
||||
dU1 = dU ;
|
||||
nFace1 = 3 ;
|
||||
++ nIntNum ;
|
||||
}
|
||||
else if ( nIntNum == 1) {
|
||||
|
||||
dU2 = dU ;
|
||||
nFace2 = 3 ;
|
||||
++ nIntNum ;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Intersezione con le facce 2 e 4
|
||||
if ( abs( vtV.x) > EPS_ZERO) {
|
||||
|
||||
// Intersezione con la seconda faccia
|
||||
dU = ( ( nIndI + 0.5) * m_dStep - ptP.x) / vtV.x ;
|
||||
ptInt = ptP + dU * vtV ;
|
||||
|
||||
if ( ptInt.y > ( nIndJ + 0.5) * m_dStep - EPS_SMALL &&
|
||||
ptInt.y < ( nIndJ + 1.5) * m_dStep + EPS_SMALL &&
|
||||
ptInt.z > ( nIndK + 0.5) * m_dStep - EPS_SMALL &&
|
||||
ptInt.z < ( nIndK + 1.5) * m_dStep + EPS_SMALL) {
|
||||
|
||||
if ( nIntNum == 0) {
|
||||
|
||||
dU1 = dU ;
|
||||
nFace1 = 2 ;
|
||||
++ nIntNum ;
|
||||
}
|
||||
else if ( nIntNum == 1) {
|
||||
|
||||
dU2 = dU ;
|
||||
nFace2 = 2 ;
|
||||
++ nIntNum ;
|
||||
}
|
||||
}
|
||||
|
||||
// Intersezione con la quarta faccia
|
||||
dU = ( ( nIndI + 1.5) * m_dStep - ptP.x) / vtV.x ;
|
||||
ptInt = ptP + dU * vtV ;
|
||||
|
||||
if ( ptInt.y > ( nIndJ + 0.5) * m_dStep - EPS_SMALL &&
|
||||
ptInt.y < ( nIndJ + 1.5) * m_dStep + EPS_SMALL &&
|
||||
ptInt.z > ( nIndK + 0.5) * m_dStep - EPS_SMALL &&
|
||||
ptInt.z < ( nIndK + 1.5) * m_dStep + EPS_SMALL) {
|
||||
|
||||
if ( nIntNum == 0) {
|
||||
|
||||
dU1 = dU ;
|
||||
nFace1 = 4 ;
|
||||
++ nIntNum ;
|
||||
}
|
||||
else if ( nIntNum == 1) {
|
||||
|
||||
dU2 = dU ;
|
||||
nFace2 = 4 ;
|
||||
++ nIntNum ;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Intersezione con le facce 5 e 6
|
||||
if ( abs( vtV.z) > EPS_ZERO) {
|
||||
|
||||
// Intersezione con la quinta faccia
|
||||
dU = ( ( nIndK + 0.5) * m_dStep - ptP.z) / vtV.z ;
|
||||
ptInt = ptP + dU * vtV ;
|
||||
|
||||
if ( ptInt.x > ( nIndI + 0.5) * m_dStep - EPS_SMALL &&
|
||||
ptInt.x < ( nIndI + 1.5) * m_dStep + EPS_SMALL &&
|
||||
ptInt.y > ( nIndJ + 0.5) * m_dStep - EPS_SMALL &&
|
||||
ptInt.y < ( nIndJ + 1.5) * m_dStep + EPS_SMALL) {
|
||||
|
||||
if ( nIntNum == 0) {
|
||||
|
||||
dU1 = dU ;
|
||||
nFace1 = 5 ;
|
||||
++ nIntNum ;
|
||||
}
|
||||
else if ( nIntNum == 1) {
|
||||
|
||||
dU2 = dU ;
|
||||
nFace2 = 5 ;
|
||||
++ nIntNum ;
|
||||
}
|
||||
}
|
||||
|
||||
// Intersezione con la sesta faccia
|
||||
dU = ( ( nIndK + 1.5) * m_dStep - ptP.z) / vtV.z ;
|
||||
ptInt = ptP + dU * vtV ;
|
||||
|
||||
if ( ptInt.x > ( nIndI + 0.5) * m_dStep - EPS_SMALL &&
|
||||
ptInt.x < ( nIndI + 1.5) * m_dStep + EPS_SMALL &&
|
||||
ptInt.y > ( nIndJ + 0.5) * m_dStep - EPS_SMALL &&
|
||||
ptInt.y < ( nIndJ + 1.5) * m_dStep + EPS_SMALL) {
|
||||
|
||||
|
||||
if ( nIntNum == 0) {
|
||||
|
||||
dU1 = dU ;
|
||||
nFace1 = 6 ;
|
||||
++ nIntNum ;
|
||||
}
|
||||
else if ( nIntNum == 1) {
|
||||
|
||||
dU2 = dU ;
|
||||
nFace2 = 6 ;
|
||||
++ nIntNum ;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( dU1 > dU2) {
|
||||
|
||||
swap( dU1, dU2) ;
|
||||
swap( nFace1, nFace2) ;
|
||||
}
|
||||
return ( nIntNum == 2) ;
|
||||
} */
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
VolZmap::IntersLineVoxel( const Point3d& ptP, const Vector3d& vtV, int nIndI, int nIndJ, int nIndK,
|
||||
int& nFaceF, int& nFaceL, double& dUF, double& dUL) const
|
||||
{
|
||||
// Controllo sull'ammissibilità del voxel
|
||||
if ( nIndI < - 1 || nIndI >= int( m_nNx[0]) ||
|
||||
nIndJ < - 1 || nIndJ >= int( m_nNy[0]) ||
|
||||
nIndK < - 1 || nIndK >= int( m_nNy[1]))
|
||||
return false ;
|
||||
|
||||
Point3d ptInt, ptIntF, ptIntL ;
|
||||
double dSqEps = EPS_SMALL * EPS_SMALL ;
|
||||
int nIntNum = 0 ;
|
||||
|
||||
double dU1 = ( ( nIndJ + 0.5) * m_dStep - ptP.y) / vtV.y ;
|
||||
double dU2 = ( ( nIndI + 0.5) * m_dStep - ptP.x) / vtV.x ;
|
||||
double dU3 = ( ( nIndJ + 1.5) * m_dStep - ptP.y) / vtV.y ;
|
||||
double dU4 = ( ( nIndI + 1.5) * m_dStep - ptP.x) / vtV.x ;
|
||||
double dU5 = ( ( nIndK + 0.5) * m_dStep - ptP.z) / vtV.z ;
|
||||
double dU6 = ( ( nIndK + 1.5) * m_dStep - ptP.z) / vtV.z ;
|
||||
|
||||
// Intersezione con le facce 1 e 3
|
||||
if ( abs( vtV.y) > EPS_ZERO) {
|
||||
|
||||
// Intersezione con la prima faccia
|
||||
ptInt = ptP + dU1 * vtV ;
|
||||
|
||||
if ( ptInt.x >= ( nIndI + 0.5) * m_dStep &&
|
||||
ptInt.x <= ( nIndI + 1.5) * m_dStep &&
|
||||
ptInt.z >= ( nIndK + 0.5) * m_dStep &&
|
||||
ptInt.z <= ( nIndK + 1.5) * m_dStep) {
|
||||
|
||||
dUF = dU1 ;
|
||||
nFaceF = 1 ;
|
||||
ptIntF = ptInt ;
|
||||
++ nIntNum ;
|
||||
}
|
||||
|
||||
// Intersezione con la terza faccia
|
||||
ptInt = ptP + dU3 * vtV ;
|
||||
|
||||
if ( ptInt.x >= ( nIndI + 0.5) * m_dStep &&
|
||||
ptInt.x <= ( nIndI + 1.5) * m_dStep &&
|
||||
ptInt.z >= ( nIndK + 0.5) * m_dStep &&
|
||||
ptInt.z <= ( nIndK + 1.5) * m_dStep) {
|
||||
|
||||
if ( nIntNum == 0) {
|
||||
|
||||
dUF = dU3 ;
|
||||
nFaceF = 3 ;
|
||||
ptIntF = ptInt ;
|
||||
++ nIntNum ;
|
||||
}
|
||||
else if ( nIntNum == 1 &&
|
||||
( ptIntF - ptInt).SqLen() > dSqEps) {
|
||||
|
||||
dUL = dU3 ;
|
||||
nFaceL = 3 ;
|
||||
ptIntL = ptInt ;
|
||||
++ nIntNum ;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Intersezione con le facce 2 e 4
|
||||
if ( abs( vtV.x) > EPS_ZERO) {
|
||||
|
||||
// Intersezione con la seconda faccia
|
||||
ptInt = ptP + dU2 * vtV ;
|
||||
|
||||
if ( ptInt.y >= ( nIndJ + 0.5) * m_dStep &&
|
||||
ptInt.y <= ( nIndJ + 1.5) * m_dStep &&
|
||||
ptInt.z >= ( nIndK + 0.5) * m_dStep &&
|
||||
ptInt.z <= ( nIndK + 1.5) * m_dStep) {
|
||||
|
||||
if ( nIntNum == 0) {
|
||||
|
||||
dUF = dU2 ;
|
||||
nFaceF = 2 ;
|
||||
ptIntF = ptInt ;
|
||||
++ nIntNum ;
|
||||
}
|
||||
else if ( nIntNum == 1 &&
|
||||
( ptIntF - ptInt).SqLen() > dSqEps) {
|
||||
|
||||
dUL = dU2 ;
|
||||
nFaceL = 2 ;
|
||||
ptIntL = ptInt ;
|
||||
++ nIntNum ;
|
||||
}
|
||||
}
|
||||
|
||||
// Intersezione con la quarta faccia
|
||||
ptInt = ptP + dU4 * vtV ;
|
||||
|
||||
if ( ptInt.y >= ( nIndJ + 0.5) * m_dStep &&
|
||||
ptInt.y <= ( nIndJ + 1.5) * m_dStep &&
|
||||
ptInt.z >= ( nIndK + 0.5) * m_dStep &&
|
||||
ptInt.z <= ( nIndK + 1.5) * m_dStep) {
|
||||
|
||||
if ( nIntNum == 0) {
|
||||
|
||||
dUF = dU4 ;
|
||||
nFaceF = 4 ;
|
||||
ptIntF = ptInt ;
|
||||
++ nIntNum ;
|
||||
}
|
||||
else if ( nIntNum == 1 &&
|
||||
( ptIntF - ptInt).SqLen() > dSqEps) {
|
||||
|
||||
dUL = dU4 ;
|
||||
nFaceL = 4 ;
|
||||
ptIntL = ptInt ;
|
||||
++ nIntNum ;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Intersezione con le facce 5 e 6
|
||||
if ( abs( vtV.z) > EPS_ZERO) {
|
||||
|
||||
// Intersezione con la quinta faccia
|
||||
ptInt = ptP + dU5 * vtV ;
|
||||
|
||||
if ( ptInt.x >= ( nIndI + 0.5) * m_dStep &&
|
||||
ptInt.x <= ( nIndI + 1.5) * m_dStep &&
|
||||
ptInt.y >= ( nIndJ + 0.5) * m_dStep &&
|
||||
ptInt.y <= ( nIndJ + 1.5) * m_dStep) {
|
||||
|
||||
if ( nIntNum == 0) {
|
||||
|
||||
dUF = dU5 ;
|
||||
nFaceF = 5 ;
|
||||
ptIntF = ptInt ;
|
||||
++ nIntNum ;
|
||||
}
|
||||
else if ( nIntNum == 1 &&
|
||||
( ptIntF - ptInt).SqLen() > dSqEps) {
|
||||
|
||||
dUL = dU5 ;
|
||||
nFaceL = 5 ;
|
||||
ptIntL = ptInt ;
|
||||
++ nIntNum ;
|
||||
}
|
||||
}
|
||||
|
||||
// Intersezione con la sesta faccia
|
||||
ptInt = ptP + dU6 * vtV ;
|
||||
|
||||
if ( ptInt.x >= ( nIndI + 0.5) * m_dStep &&
|
||||
ptInt.x <= ( nIndI + 1.5) * m_dStep &&
|
||||
ptInt.y >= ( nIndJ + 0.5) * m_dStep &&
|
||||
ptInt.y <= ( nIndJ + 1.5) * m_dStep) {
|
||||
|
||||
|
||||
if ( nIntNum == 0) {
|
||||
|
||||
dUF = dU6 ;
|
||||
nFaceF = 6 ;
|
||||
ptIntF = ptInt ;
|
||||
++ nIntNum ;
|
||||
}
|
||||
else if ( nIntNum == 1 &&
|
||||
( ptIntF - ptInt).SqLen() > dSqEps) {
|
||||
|
||||
dUL = dU6 ;
|
||||
nFaceL = 6 ;
|
||||
ptIntL = ptInt ;
|
||||
++ nIntNum ;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( dUF > dUL) {
|
||||
|
||||
swap( dUF, dUL) ;
|
||||
swap( nFaceF, nFaceL) ;
|
||||
}
|
||||
return ( nIntNum == 2) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
@@ -1038,7 +1384,7 @@ VolZmap::IntersLineEllipticalCylinder( const Vector3d& vtLineDir, const Point3d&
|
||||
Vector3d vtTan1( 0, - vtCirc1.z, vtCirc1.y) ;
|
||||
Vector3d vtCross1 = vtTan1 ^ vtMv ;
|
||||
|
||||
vtN1 = ( vtCross1 * vtCirc1 > 0 ? vtCross1 : - vtCross1) ;
|
||||
vtN1 = ( vtCross1 * vtCirc1 > - EPS_ZERO ? vtCross1 : - vtCross1) ;
|
||||
|
||||
if ( vtTest2.y > 0) {
|
||||
|
||||
@@ -1053,7 +1399,7 @@ VolZmap::IntersLineEllipticalCylinder( const Vector3d& vtLineDir, const Point3d&
|
||||
Vector3d vtTan2( 0, - vtCirc2.z, vtCirc2.y) ;
|
||||
Vector3d vtCross2 = vtTan2 ^ vtMv ;
|
||||
|
||||
vtN2 = ( vtCross2 * vtCirc2 > 0 ? vtCross2 : - vtCross2) ;
|
||||
vtN2 = ( vtCross2 * vtCirc2 > - EPS_ZERO ? vtCross2 : - vtCross2) ;
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user