EgtGeomKernel 2.5e4 :

- modifiche per verifica collisione con TriMesh chiuse
- aggiunta gestione Capsule.
This commit is contained in:
DarioS
2023-05-22 14:34:10 +02:00
parent b78212c3a1
commit 0a63a4c9a2
10 changed files with 217 additions and 130 deletions
+43
View File
@@ -14,6 +14,7 @@
//--------------------------- Include ----------------------------------------
#include "stdafx.h"
#include "IntersLineCyl.h"
#include "/EgtDev/Include/EGkFrame3d.h"
#include "/EgtDev/Include/ENkPolynomialRoots.h"
using namespace std ;
@@ -116,3 +117,45 @@ IntersLineCyl( const Point3d& ptL, const Vector3d& vtL,
else
return false ;
}
//----------------------------------------------------------------------------
// Linea e cilindro sono nel medesimo riferimento.
// Il cilindro è definito con centro della base, asse, raggio e altezza.
// In caso di intersezione viene restituito true e i parametri in dU1 e dU2.
//----------------------------------------------------------------------------
bool
IntersLineCyl( const Point3d& ptL, const Vector3d& vtL,
const Point3d& ptCyl, const Vector3d& vtCyl, double dRad, double dHeight,
double& dU1, double& dU2)
{
// Riferimento intrinseco del cilindro
Frame3d frCyl ;
if ( ! frCyl.Set( ptCyl, vtCyl))
return false ;
// Ora eseguo i conti nel riferimento intrinseco
return IntersLineCyl( GetToLoc( ptL, frCyl), GetToLoc( vtL, frCyl), dRad, dHeight, dU1, dU2) ;
}
//----------------------------------------------------------------------------
// Linea e cilindro sono nel medesimo riferimento.
// Il cilindro è definito con centri delle due basi, e raggio.
// In caso di intersezione viene restituito true e i parametri in dU1 e dU2.
//----------------------------------------------------------------------------
bool
IntersLineCyl( const Point3d& ptL, const Vector3d& vtL,
const Point3d& ptCyl1, const Point3d& ptCyl2, double dRad,
double& dU1, double& dU2)
{
// Determino asse ed altezza del cilindro
Vector3d vtCyl = ptCyl2 - ptCyl1 ;
double dHeight = vtCyl.Len() ;
if ( dHeight < EPS_SMALL)
return false ;
vtCyl /= dHeight ;
// Riferimento intrinseco del cilindro
Frame3d frCyl ;
if ( ! frCyl.Set( ptCyl1, vtCyl))
return false ;
// Ora eseguo i conti nel riferimento intrinseco
return IntersLineCyl( GetToLoc( ptL, frCyl), GetToLoc( vtL, frCyl), dRad, dHeight, dU1, dU2) ;
}