EgtGeomKernel :
- aggiunto controllo validità coordinate di punti e vettori (isfinite).
This commit is contained in:
+22
-26
@@ -1815,6 +1815,7 @@ VolZmap::AvoidRectPrismoid( const Frame3d& frPrismoid, double dLenghtBaseX, doub
|
||||
dLenghtTopX + 2 * dOffsTopX, dLenghtTopY + 2 * dOffsTopY, dHeight + 2 * dSafeDist, bPrecise))
|
||||
return true ;
|
||||
|
||||
// Offset fine
|
||||
// Sfere centrate nei vertici
|
||||
double dHalfBaseX = dLenghtBaseX / 2 ;
|
||||
double dHalfBaseY = dLenghtBaseY / 2 ;
|
||||
@@ -2307,10 +2308,10 @@ bool
|
||||
VolZmap::IntersLineCylinder( const Point3d& ptLineSt, const Vector3d& vtLineDir,
|
||||
const Frame3d& CylFrame, double dH, double dRad, bool bTapLow, bool bTapUp,
|
||||
Point3d& ptInt1, Vector3d& vtN1, Point3d& ptInt2, Vector3d& vtN2) const
|
||||
{
|
||||
{
|
||||
// Porto la linea nel riferimento del cilindro
|
||||
Point3d ptP = ptLineSt ; ptP.ToLoc( CylFrame) ;
|
||||
Vector3d vtV = vtLineDir ; vtV.ToLoc( CylFrame) ;
|
||||
Point3d ptP = GetToLoc( ptLineSt, CylFrame) ;
|
||||
Vector3d vtV = GetToLoc( vtLineDir, CylFrame) ;
|
||||
|
||||
// Determino le eventuali intersezioni con le due basi a quota minima e massima (solo se linea non parallela ad esse)
|
||||
int nBasInt = 0 ;
|
||||
@@ -2341,13 +2342,11 @@ VolZmap::IntersLineCylinder( const Point3d& ptLineSt, const Vector3d& vtLineDir,
|
||||
}
|
||||
|
||||
// Determino le intersezioni con la superficie laterale del cilindro
|
||||
DBLVECTOR vdCoef(3) ;
|
||||
double dSqRad = dRad * dRad ;
|
||||
vdCoef[0] = ptP.x * ptP.x + ptP.y * ptP.y - dSqRad ;
|
||||
vdCoef[1] = 2 * ( ptP.x * vtV.x + ptP.y * vtV.y) ;
|
||||
vdCoef[2] = vtV.x * vtV.x + vtV.y * vtV.y ;
|
||||
DBLVECTOR vdCoeff{ ptP.x * ptP.x + ptP.y * ptP.y - dRad * dRad,
|
||||
2 * ( ptP.x * vtV.x + ptP.y * vtV.y),
|
||||
vtV.x * vtV.x + vtV.y * vtV.y} ;
|
||||
DBLVECTOR vdRoots ;
|
||||
int nRoot = PolynomialRoots( 2, vdCoef, vdRoots) ;
|
||||
int nRoot = PolynomialRoots( 2, vdCoeff, vdRoots) ;
|
||||
|
||||
// Epsilon per piani di tappo
|
||||
double dEpsLow = ( bTapLow ? - EPS_SMALL : EPS_SMALL) ;
|
||||
@@ -2357,7 +2356,7 @@ VolZmap::IntersLineCylinder( const Point3d& ptLineSt, const Vector3d& vtLineDir,
|
||||
if ( nRoot == 2) {
|
||||
double dIntZ2 = ptP.z + vdRoots[1] * vtV.z ;
|
||||
if ( dIntZ2 < 0 + dEpsLow || dIntZ2 > dH + dEpsUp)
|
||||
nRoot = 1 ;
|
||||
-- nRoot ;
|
||||
}
|
||||
if ( nRoot >= 1) {
|
||||
double dIntZ1 = ptP.z + vdRoots[0] * vtV.z ;
|
||||
@@ -2432,8 +2431,8 @@ VolZmap::IntersLineConus( const Point3d& ptLineSt, const Vector3d& vtLineDir,
|
||||
Point3d& ptInt1, Vector3d& vtN1, Point3d& ptInt2, Vector3d& vtN2) const
|
||||
{
|
||||
// Porto la linea nel riferimento del cono
|
||||
Point3d ptP = ptLineSt ; ptP.ToLoc( ConusFrame) ;
|
||||
Vector3d vtV = vtLineDir ; vtV.ToLoc( ConusFrame) ;
|
||||
Point3d ptP = GetToLoc( ptLineSt, ConusFrame) ;
|
||||
Vector3d vtV = GetToLoc( vtLineDir, ConusFrame) ;
|
||||
|
||||
// Raggi delle due basi
|
||||
double dMinRad = dTan * dMinH ;
|
||||
@@ -2470,19 +2469,18 @@ VolZmap::IntersLineConus( const Point3d& ptLineSt, const Vector3d& vtLineDir,
|
||||
}
|
||||
|
||||
// Determino le intersezioni con la superficie laterale del cono
|
||||
DBLVECTOR vdCoef( 3) ;
|
||||
double dSqTan = dTan * dTan ;
|
||||
vdCoef[0] = dSqTan * ptP.z * ptP.z - ptP.x * ptP.x - ptP.y * ptP.y ;
|
||||
vdCoef[1] = 2 * ( dSqTan * ptP.z * vtV.z - ptP.x * vtV.x - ptP.y * vtV.y) ;
|
||||
vdCoef[2] = dSqTan * vtV.z * vtV.z - vtV.x * vtV.x - vtV.y * vtV.y ;
|
||||
DBLVECTOR vdCoeff{ dSqTan * ptP.z * ptP.z - ptP.x * ptP.x - ptP.y * ptP.y,
|
||||
2 * ( dSqTan * ptP.z * vtV.z - ptP.x * vtV.x - ptP.y * vtV.y),
|
||||
dSqTan * vtV.z * vtV.z - vtV.x * vtV.x - vtV.y * vtV.y} ;
|
||||
DBLVECTOR vdRoots ;
|
||||
int nRoot = PolynomialRoots( 2, vdCoef, vdRoots) ;
|
||||
int nRoot = PolynomialRoots( 2, vdCoeff, vdRoots) ;
|
||||
|
||||
// Elimino le soluzioni cha danno intersezioni fuori dai limiti in Z del tronco
|
||||
if ( nRoot == 2) {
|
||||
double dIntZ2 = ptP.z + vdRoots[1] * vtV.z ;
|
||||
if ( dIntZ2 < dMinH + dEpsLow || dIntZ2 > dMaxH + dEpsUp)
|
||||
nRoot = 1 ;
|
||||
-- nRoot ;
|
||||
}
|
||||
if ( nRoot >= 1) {
|
||||
double dIntZ1 = ptP.z + vdRoots[0] * vtV.z ;
|
||||
@@ -2570,8 +2568,8 @@ VolZmap::IntersLineEllipticalCylinder( const Point3d& ptLineSt, const Vector3d&
|
||||
return false ;
|
||||
|
||||
// Porto la linea nel riferimento del cilindro
|
||||
Point3d ptP = ptLineSt ; ptP.ToLoc( CircFrame) ;
|
||||
Vector3d vtV = vtLineDir ; vtV.ToLoc( CircFrame) ;
|
||||
Point3d ptP = GetToLoc( ptLineSt, CircFrame) ;
|
||||
Vector3d vtV = GetToLoc( vtLineDir, CircFrame) ;
|
||||
|
||||
// Quadrato del raggio
|
||||
double dSqRad = dRad * dRad ;
|
||||
@@ -2713,8 +2711,8 @@ VolZmap::IntersLineMyPolyhedron( const Point3d& ptLineSt, const Vector3d& vtLine
|
||||
return false ;
|
||||
|
||||
// Porto la linea nel riferimento del poliedro
|
||||
Point3d ptP = ptLineSt ; ptP.ToLoc( PolyFrame) ;
|
||||
Vector3d vtV = vtLineDir ; vtV.ToLoc( PolyFrame) ;
|
||||
Point3d ptP = GetToLoc( ptLineSt, PolyFrame) ;
|
||||
Vector3d vtV = GetToLoc( vtLineDir, PolyFrame) ;
|
||||
|
||||
// Facce 1 e 2 parallele a XY
|
||||
// Facce 3 e 4 parallele a XZ
|
||||
@@ -2862,10 +2860,8 @@ VolZmap::IntersLineTruncatedPyramid( const Point3d& ptLineSt, const Vector3d& vt
|
||||
return false ;
|
||||
|
||||
// Porto la linea nel riferimento del solido
|
||||
Point3d ptP = ptLineSt ;
|
||||
Vector3d vtV = vtLineDir ;
|
||||
ptP.ToLoc( frTruncPyramFrame) ;
|
||||
vtV.ToLoc( frTruncPyramFrame) ;
|
||||
Point3d ptP = GetToLoc( ptLineSt, frTruncPyramFrame) ;
|
||||
Vector3d vtV = GetToLoc( vtLineDir, frTruncPyramFrame) ;
|
||||
|
||||
// Se la retta sta sopra o sotto il solido non vi può essere intersezione
|
||||
if ( abs( vtV.z) < EPS_ZERO && ( ptP.z < EPS_SMALL || ptP.z > dHeight + EPS_SMALL))
|
||||
|
||||
Reference in New Issue
Block a user