EgtGeomKernel 1.9c2 :

- a BBox3d aggiunti metodi SqMaxDistFromPoint, SqMaxDistFromPointXY, MaxDistFromPoint e MaxDistFromPointXY
- a IntersLineSurfTm e IntersParLine aggiunto parametro bFinite per indicare se linea finita o infinita.
This commit is contained in:
Dario Sassi
2018-03-22 19:53:38 +00:00
parent 85d6365fac
commit 3b6de06fd9
4 changed files with 34 additions and 8 deletions
+10 -7
View File
@@ -23,10 +23,10 @@ using namespace std ;
//----------------------------------------------------------------------------
void
UpdateInfoIntersLineSurfTm( const Point3d& ptL, const Vector3d& vtDir, double dLen,
int nT, const Triangle3d& Tria, ILSIVECTOR& vInfo)
int nT, const Triangle3d& Tria, ILSIVECTOR& vInfo, bool bFinite)
{
Point3d ptInt, ptInt2 ;
int nRes = IntersLineTria( ptL, vtDir, dLen, Tria, ptInt, ptInt2) ;
int nRes = IntersLineTria( ptL, vtDir, dLen, Tria, ptInt, ptInt2, bFinite) ;
if ( nRes == ILTT_IN || nRes == ILTT_EDGE || nRes == ILTT_VERT) {
double dU = ( ptInt - ptL) * vtDir ;
double dCosDN = vtDir * Tria.GetN() ;
@@ -49,7 +49,10 @@ OrderInfoIntersLineSurfTm( ILSIVECTOR& vInfo)
return ;
// ordino il vettore delle intersezioni secondo il senso crescente del parametro di linea
sort( vInfo.begin(), vInfo.end(),
[]( const IntLinStmInfo& a, const IntLinStmInfo& b) { return ( a.dU < b.dU) ; }) ;
[]( const IntLinStmInfo& a, const IntLinStmInfo& b)
{ double dUa = ( ( a.nILTT == ILTT_SEGM || a.nILTT == ILTT_SEGM_ON_EDGE) ? ( a.dU + a.dU2) / 2 : a.dU) ;
double dUb = ( ( b.nILTT == ILTT_SEGM || b.nILTT == ILTT_SEGM_ON_EDGE) ? ( b.dU + b.dU2) / 2 : b.dU) ;
return ( dUa < dUb) ; }) ;
}
//----------------------------------------------------------------------------
@@ -57,7 +60,7 @@ OrderInfoIntersLineSurfTm( ILSIVECTOR& vInfo)
//----------------------------------------------------------------------------
bool
IntersLineSurfTm( const Point3d& ptL, const Vector3d& vtL, double dLen, const ISurfTriMesh& Stm,
ILSIVECTOR& vInfo)
ILSIVECTOR& vInfo, bool bFinite)
{
// verifico linea
Vector3d vtDir = vtL ;
@@ -76,7 +79,7 @@ IntersLineSurfTm( const Point3d& ptL, const Vector3d& vtL, double dLen, const IS
int nT = Stm.GetFirstTriangle( Tria) ;
while ( nT != SVT_NULL) {
// aggiorno info con intersezione
UpdateInfoIntersLineSurfTm( ptL, vtDir, dLen, nT, Tria, vInfo) ;
UpdateInfoIntersLineSurfTm( ptL, vtDir, dLen, nT, Tria, vInfo, bFinite) ;
// passo al prossimo triangolo
nT = Stm.GetNextTriangle( nT, Tria) ;
}
@@ -123,7 +126,7 @@ IntersParLinesSurfTm::IntersParLinesSurfTm( const Frame3d& frLines, const ISurfT
//----------------------------------------------------------------------------
bool
IntersParLinesSurfTm::GetInters( const Point3d& ptL, double dLen, ILSIVECTOR& vInfo)
IntersParLinesSurfTm::GetInters( const Point3d& ptL, double dLen, ILSIVECTOR& vInfo, bool bFinite)
{
// verifico validità
if ( ! m_bOk)
@@ -149,7 +152,7 @@ IntersParLinesSurfTm::GetInters( const Point3d& ptL, double dLen, ILSIVECTOR& vI
Triangle3d Tria ;
m_pSTm->GetTriangle( nT, Tria) ;
// aggiorno info con intersezione
UpdateInfoIntersLineSurfTm( ptLL, m_frLines.VersZ(), dLen, nT, Tria, vInfo) ;
UpdateInfoIntersLineSurfTm( ptLL, m_frLines.VersZ(), dLen, nT, Tria, vInfo, bFinite) ;
}
}