EgtGeomKernel 1.8j4 :
- aggiunta classe Polygon3d (da EgtExchange) - razionalizzata classe Plane3d - corretta funzione IntersLineTria.
This commit is contained in:
+8
-5
@@ -17,7 +17,7 @@
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
int
|
||||
IntersLinePlane( const Point3d& ptL1, const Point3d& ptL2, const Plane3d& plPlane, Point3d& ptInt)
|
||||
IntersLinePlane( const Point3d& ptL1, const Point3d& ptL2, const Plane3d& plPlane, Point3d& ptInt, bool bFinite)
|
||||
{
|
||||
Vector3d vtL = ptL2 - ptL1 ;
|
||||
double dLen = vtL.Len() ;
|
||||
@@ -25,20 +25,20 @@ IntersLinePlane( const Point3d& ptL1, const Point3d& ptL2, const Plane3d& plPlan
|
||||
vtL /= dLen ;
|
||||
else
|
||||
vtL = V_NULL ;
|
||||
return IntersLinePlane( ptL1, vtL, dLen, plPlane, ptInt) ;
|
||||
return IntersLinePlane( ptL1, vtL, dLen, plPlane, ptInt, bFinite) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
int
|
||||
IntersLinePlane( const Point3d& ptL, const Vector3d& vtL, double dLen, const Plane3d& plPlane, Point3d& ptInt)
|
||||
IntersLinePlane( const Point3d& ptL, const Vector3d& vtL, double dLen, const Plane3d& plPlane, Point3d& ptInt, bool bFinite)
|
||||
{
|
||||
Vector3d vtDir = vtL ;
|
||||
if ( dLen > EPS_SMALL && ! vtDir.Normalize( EPS_ZERO))
|
||||
return ILPT_NO ;
|
||||
// coseno dell'angolo tra direzione linea e normale al piano
|
||||
double dCosAng = vtDir * plPlane.vtN ;
|
||||
double dCosAng = vtDir * plPlane.GetVersN() ;
|
||||
// posizione del punto rispetto al piano
|
||||
double dPosL = ( ptL - ORIG) * plPlane.vtN - plPlane.dDist ;
|
||||
double dPosL = ( ptL - ORIG) * plPlane.GetVersN() - plPlane.GetDist() ;
|
||||
// verifico se linea parallela al piano (ovvero ortogonale alla normale)
|
||||
if ( fabs( dCosAng) < COS_ORTO_ANG_ZERO) {
|
||||
// se il punto giace nel piano, vi giace anche la linea
|
||||
@@ -51,6 +51,9 @@ IntersLinePlane( const Point3d& ptL, const Vector3d& vtL, double dLen, const Pla
|
||||
// determino il punto di intersezione
|
||||
double dDistI = - dPosL / dCosAng ;
|
||||
ptInt = ptL + vtDir * dDistI ;
|
||||
// se linea infinita, ho trovato l'intersezione
|
||||
if ( ! bFinite)
|
||||
return ILPT_YES ;
|
||||
// intersezione sul primo estremo
|
||||
if ( fabs( dDistI) < EPS_SMALL)
|
||||
return ILPT_START ;
|
||||
|
||||
Reference in New Issue
Block a user