EgtGeomKernel 2.3e1 :

- inserite modifiche LorenzoM per intersezioni tra triangoli e tra trimesh e piani
- in CurveComposite quando si aggiungono le curve si fa coincidere l'inizio della nuova curva con la fine dell'ultima precedente.
This commit is contained in:
DarioS
2021-05-14 17:17:27 +02:00
parent 0b37e12df9
commit 80070cc608
6 changed files with 136 additions and 201 deletions
+12 -14
View File
@@ -3301,7 +3301,7 @@ SurfTriMesh::Invert( void)
bool
SurfTriMesh::Cut( const Plane3d& plPlane, bool bSaveOnEq)
{
#define UseTria 0
#define UseTria 1
#if UseTria
// la superficie deve essere validata
if ( m_nStatus != OK)
@@ -3515,36 +3515,32 @@ SurfTriMesh::Cut( const Plane3d& plPlane, bool bSaveOnEq)
}
return true ;
#endif
#if ! UseTria
#else
bool bModif = false ;
// Setto il triangolo come né fuori né dentro.
int nTriaNum = GetTriangleSize();
// Setto i triangoli come né fuori né dentro.
int nTriaNum = GetTriangleSize() ;
for ( int nT = 0 ; nT < nTriaNum ; ++ nT) {
m_vTria[nT].nTempPart = 0 ;
}
INTERSCHAINMAP IntersLineMap ;
INTERSEDGEMAP EdgeInterLineMap ;
INTERSEDGEMAP EdgeEdgeLineMap ;
// Ciclo su tutte le facce.
// Ciclo su tutte le facce.
int nFacetNum = GetFacetCount() ;
for ( int nF = 0 ; nF < nFacetNum ; ++ nF) {
// Dati della faccia
// Dati della faccia
POLYLINEVECTOR vLoopVec ;
GetFacetLoops( nF, vLoopVec) ;
if ( vLoopVec.empty())
continue ;
PtrOwner<SurfFlatRegion> pReg( GetBasicSurfFlatRegion( GetSurfFlatRegionFromPolyLineVector( vLoopVec))) ;
if ( pReg == nullptr)
if ( IsNull( pReg))
return false ;
SurfFlatRegion Region = *pReg ;
LineFacetClassVector IntersLinePart ;
int nIntType = IntersFacetPlane( Region, vLoopVec[0], plPlane, IntersLinePart) ;
int nIntType = IntersFacetPlane( *pReg, vLoopVec[0], plPlane, IntersLinePart) ;
if ( nIntType == FacetPlaneIntersType::FPI_CUT) {
for ( int nPart = 0 ; nPart < int( IntersLinePart.size()) ; ++ nPart) {
// Salvo intersezione per la faccia.
@@ -3561,7 +3557,7 @@ SurfTriMesh::Cut( const Plane3d& plPlane, bool bSaveOnEq)
INTVECTOR vT ;
GetAllTriaInFacet( nF, vT) ;
for ( auto& nT : vT)
m_vTria[nT].nTempPart = Region.GetNormVersor() * plPlane.GetVersN() > 0. ? 2 : - 2 ;
m_vTria[nT].nTempPart = pReg->GetNormVersor() * plPlane.GetVersN() > 0. ? 2 : - 2 ;
}
else if ( nIntType == FacetPlaneIntersType::FPI_INN) {
INTVECTOR vT ;
@@ -3578,9 +3574,11 @@ SurfTriMesh::Cut( const Plane3d& plPlane, bool bSaveOnEq)
else
;
}
// Divido le facce.
// Divido le facce.
PieceMap NewFacet ;
SplitFacet( IntersLineMap, NewFacet) ;
INTERSEDGEMAP EdgeInterLineMap, EdgeEdgeLineMap ;
RetriangulateFacetPieces( NewFacet, EdgeInterLineMap, EdgeEdgeLineMap) ;
int nNumTria = GetTriangleSize() ;