EgtGeomKernel 2.2h1 :

- richiesta licenza livello 22
- aggiunta distanza tra linee
- migliorato calcolo intersezione tra linea e TriMesh nel caso di linea appena esterna ad un bordo
- migliorata creazione Zmap da TriMesh.
This commit is contained in:
Dario Sassi
2020-08-04 09:30:04 +00:00
parent adecabf4c8
commit 3020d9579e
7 changed files with 355 additions and 8 deletions
+54 -8
View File
@@ -17,6 +17,8 @@
#include "CurveLine.h"
#include "IntersLineLine.h"
#include "IntersLineTria.h"
#include "DistPointLine.h"
#include "DistLineLine.h"
#include "/EgtDev/Include/EGkIntersLinePlane.h"
#include "/EgtDev/Include/EGkFrame3d.h"
#include <array>
@@ -53,15 +55,59 @@ IntersLineTria( const Point3d& ptL, const Vector3d& vtL, double dLen, const Tria
// se c'è una intersezione
else if ( nRes == ILPT_START || nRes == ILPT_END || nRes == ILPT_YES) {
int nPTT = PointInTria( ptInt, trTria) ;
switch ( nPTT) {
case PTT_OUT :
return ILTT_NO ;
case PTT_VERT :
return ILTT_VERT ;
case PTT_EDGE :
return ILTT_EDGE ;
default :
if ( nPTT == PTT_IN)
return ILTT_IN ;
else if ( nPTT == PTT_OUT)
return ILTT_NO ;
else if ( nPTT == PTT_VERT) {
for ( int nV = 0 ; nV < 3 ; ++ nV) {
int nW = ( nV + 1) % 3 ;
int nX = ( nW + 1) % 3 ;
Point3d ptPrev = trTria.GetP( nV) ;
Point3d ptCent = trTria.GetP( nW) ;
Point3d ptNext = trTria.GetP( nX) ;
Vector3d vtPrevCent = ptCent - ptPrev ;
vtPrevCent.Normalize() ;
Vector3d vtCentNext = ptNext - ptCent ;
vtCentNext.Normalize() ;
Vector3d vtPrevP = ptInt - ptPrev ;
vtPrevP.Normalize() ;
Vector3d vtCentP = ptInt - ptCent ;
vtCentP.Normalize() ;
if ( ( vtPrevCent ^ vtPrevP) * trTria.GetN() < 0 || ( vtCentNext ^ vtCentP) * trTria.GetN() < 0) {
DistPointLine DistCalc( ptCent, ptL, vtL, dLen, bFinite) ;
double dSqDist ;
DistCalc.GetSqDist( dSqDist) ;
if ( dSqDist < EPS_SMALL * EPS_SMALL) {
DistCalc.GetMinDistPoint( ptInt) ;
break ;
}
}
}
return ILTT_VERT ;
}
else {
for ( int nV = 0 ; nV < 3 ; ++ nV) {
int nW = ( nV + 1) % 3 ;
Point3d ptVertSt = trTria.GetP( nV) ;
Point3d ptVertEn = trTria.GetP( nW) ;
Vector3d vtSeg = ptVertEn - ptVertSt ;
double dSegLen = vtSeg.Len() ;
vtSeg /= dSegLen ;
Vector3d vtIntP = ptInt - ptVertSt ;
vtIntP.Normalize() ;
if ( ( vtSeg ^ vtIntP) * trTria.GetN() < 0) {
DistLineLine DistCalc( ptL, vtL, dLen, ptVertSt, vtSeg, dSegLen, bFinite, true) ;
double dSqDist ;
DistCalc.GetSqDist( dSqDist) ;
if ( dSqDist < EPS_SMALL * EPS_SMALL) {
Point3d ptMinDistOnSeg ;
DistCalc.GetMinDistPoints( ptInt, ptMinDistOnSeg) ;
break ;
}
}
}
return ILTT_EDGE ;
}
}
// se la linea giace nel piano del triangolo