EgtGeomKernel 2.4h1 :

- in BBox3d aggiunti GetDimX, GetDimY e GetDimZ
- corretta DistLineLine con parametri punti estremi
- in creazione Stm da due curve (rigata) aggiunta gestione tipo RLT_ISOPAR_SMOOTH.
This commit is contained in:
DarioS
2022-08-17 19:17:44 +02:00
parent de99955e93
commit 6238ea1095
6 changed files with 113 additions and 24 deletions
+59 -5
View File
@@ -1,7 +1,7 @@
//----------------------------------------------------------------------------
// EgalTech 2014-2019
// EgalTech 2014-2022
//----------------------------------------------------------------------------
// File : SurfTriMesh.cpp Data : 02.01.19 Versione : 1.9l4
// File : SurfTriMesh.cpp Data : 12.08.22 Versione : 2.4h1
// Contenuto : Implementazione della classe Superfici TriMesh.
//
//
@@ -20,6 +20,7 @@
#include "NgeReader.h"
#include "SurfFlatRegion.h"
#include "DistPointLine.h"
#include "DistLineLine.h"
#include "Triangulate.h"
#include "GeoConst.h"
#include "/EgtDev/Include/EGkIntersLinePlane.h"
@@ -2207,7 +2208,7 @@ SurfTriMesh::CreateByTwoCurves( const PolyLine& PL1, const PolyLine& PL2, int nR
}
// ciclo sui punti
while ( bNext1 || bNext2) {
// se c'è nuovo V1s e la diagonale più corta è V2p -> V1s oppure non c'è V2s
// se non c'è V2s oppure c'è nuovo V1s e la diagonale più corta è V2p -> V1s
if ( ! bNext2 || ( bNext1 && ( nP1s == vPnt2[nP2p].second || vPnt1[nP1s].second == nP2p))) {
// inserisco il vertice V1s (se ultimo e curve chiuse, prendo il primo)
if ( nP1s == nTotP1 - 1 && bClosed)
@@ -2275,6 +2276,7 @@ SurfTriMesh::CreateByTwoCurves( const PolyLine& PL1, const PolyLine& PL2, int nR
return false ;
// costruisco la mesh
bool bTwist = false ;
int nVertNbr = PL1.GetPointNbr() + PL2.GetPointNbr() ;
int nTriaNbr = max( PL1.GetPointNbr(), PL2.GetPointNbr()) + 1 ;
if ( ! Init( nVertNbr, nTriaNbr))
@@ -2331,8 +2333,57 @@ SurfTriMesh::CreateByTwoCurves( const PolyLine& PL1, const PolyLine& PL2, int nR
}
// ciclo sui punti
while ( bNext1 || bNext2) {
// se c'è nuovo dA1s e la diagonale più corta è dA2p -> dA1s oppure non c'è dA2s
if ( ( bNext1 && ( dA1s - dA2p) <= ( dA2s - dA1p) + EPS_PARAM) || ! bNext2) {
// se richiesto smoothing, ci sono entrambi i successivi, hanno circa lo stesso parametro e i segmenti sono sghembi oltre il limite
double dDiagDist = 0 ;
if ( nRuledType == RLT_ISOPAR_SMOOTH &&
bNext1 && bNext2 && abs( dA1p + dA1s - dA2p - dA2s) < min( dA1s - dA1p, dA2s - dA2p) &&
DistLineLine( ptP1p, ptP2s, ptP2p, ptP1s).GetDist( dDiagDist) && dDiagDist > STM_TWIST_DIAG_DIST) {
bTwist = true ;
// inserisco il vertice A1s
if ( ( nV1s = AddVertex( ptP1s)) == SVT_NULL)
return false ;
// inserisco il vertice A2s
if ( ( nV2s = AddVertex( ptP2s)) == SVT_NULL)
return false ;
// inserisco un nuovo vertice punto medio della linea tra i punti medi
Point3d ptCen = ( ptP1s + ptP1p + ptP2s + ptP2p) / 4 ;
int nVCen = AddVertex( ptCen) ;
if ( nVCen == SVT_NULL)
return false ;
// creo 4 triangoli dai lati del quadrilatero al vertice
nIdV[0] = nV2p ;
nIdV[1] = nV1p ;
nIdV[2] = nVCen ;
if ( AddTriangle( nIdV) == SVT_NULL)
return false ;
nIdV[0] = nV1p ;
nIdV[1] = nV1s ;
nIdV[2] = nVCen ;
if ( AddTriangle( nIdV) == SVT_NULL)
return false ;
nIdV[0] = nV1s ;
nIdV[1] = nV2s ;
nIdV[2] = nVCen ;
if ( AddTriangle( nIdV) == SVT_NULL)
return false ;
nIdV[0] = nV2s ;
nIdV[1] = nV2p ;
nIdV[2] = nVCen ;
if ( AddTriangle( nIdV) == SVT_NULL)
return false ;
// passo al punto successivo su 1
nV1p = nV1s ; dA1p = dA1s ; dU1p = dU1s ; ptP1p = ptP1s ;
bNext1 = PL1.GetNextUPoint( &dU1s, &ptP1s, bClosed) ;
if ( bNext1)
dA1s = ( dU1s - dU1F) / dDeltaU1 ;
// passo al punto successivo su 2
nV2p = nV2s ; dA2p = dA2s ; dU2p = dU2s ; ptP2p = ptP2s ;
bNext2 = PL2.GetNextUPoint( &dU2s, &ptP2s, bClosed) ;
if ( bNext2)
dA2s = ( dU2s - dU2F) / dDeltaU2 ;
}
// se non c'è dA2s oppure c'è nuovo dA1s e la diagonale più corta è dA2p -> dA1s
else if ( ! bNext2 || ( bNext1 && ( dA1s - dA2p) <= ( dA2s - dA1p) + EPS_PARAM)) {
// inserisco il vertice A1s
if ( ( nV1s = AddVertex( ptP1s)) == SVT_NULL)
return false ;
@@ -2415,6 +2466,9 @@ SurfTriMesh::CreateByTwoCurves( const PolyLine& PL1, const PolyLine& PL2, int nR
return false ;
}
}
// in presenza di twist aumento il limite sulla deviazione angolare
if ( bTwist)
SetSmoothAngle( STM_TWIST_SMOOTH_ANG) ;
}
// sistemo la topologia