Aggiunta classificazione linea rispetto a un poligono esteso

This commit is contained in:
LorenzoM
2021-05-20 17:49:25 +02:00
parent e5a45021fa
commit 561e444661
3 changed files with 168 additions and 52 deletions
+24 -5
View File
@@ -3301,7 +3301,7 @@ SurfTriMesh::Invert( void)
bool
SurfTriMesh::Cut( const Plane3d& plPlane, bool bSaveOnEq)
{
#define UseTria 1
#define UseTria 0
#if UseTria
// la superficie deve essere validata
if ( m_nStatus != OK)
@@ -3517,7 +3517,7 @@ SurfTriMesh::Cut( const Plane3d& plPlane, bool bSaveOnEq)
return true ;
#else
bool bModif = false ;
// Setto i triangoli come né fuori né dentro.
@@ -3539,6 +3539,21 @@ SurfTriMesh::Cut( const Plane3d& plPlane, bool bSaveOnEq)
PtrOwner<SurfFlatRegion> pReg( GetBasicSurfFlatRegion( GetSurfFlatRegionFromPolyLineVector( vLoopVec))) ;
if ( IsNull( pReg))
return false ;
//////////////////////////////////////////
BBox3d b3Box( Point3d( 653, -97.4, 4), Point3d(654,-97.3,5));
BBox3d b3RegBox;
pReg->GetLocalBBox(b3RegBox);
if (b3Box.Overlaps(b3RegBox))
int mimi = 0;
if (/*nF == 1349 ||*/ nF == 1350) {
/*INTVECTOR vT ;
GetAllTriaInFacet( nF, vT) ;
for ( auto& nT : vT)
m_vTria[nT].nTempPart = - 1 ;
continue;*/
int qq = 0;
}
//////////////////////////////////////////
LineFacetClassVector IntersLinePart ;
int nIntType = IntersFacetPlane( *pReg, vLoopVec[0], plPlane, IntersLinePart) ;
if ( nIntType == FacetPlaneIntersType::FPI_CUT) {
@@ -3551,7 +3566,7 @@ SurfTriMesh::Cut( const Plane3d& plPlane, bool bSaveOnEq)
else {
IntersLineMap.emplace( nF, IntersInnChain( 1, IntersInnSeg( IntersLinePart[nPart].ptSt, IntersLinePart[nPart].ptEn))) ;
}
}
}
}
else if ( nIntType == FacetPlaneIntersType::FPI_ON) {
INTVECTOR vT ;
@@ -3575,12 +3590,16 @@ SurfTriMesh::Cut( const Plane3d& plPlane, bool bSaveOnEq)
;
}
// Divido le facce.
// Divido e ritriangolo le facce.
PieceMap NewFacet ;
SplitFacet( IntersLineMap, NewFacet) ;
INTERSEDGEMAP EdgeInterLineMap, EdgeEdgeLineMap ;
RetriangulateFacetPieces( NewFacet, EdgeInterLineMap, EdgeEdgeLineMap) ;
if ( ! AdjustVertices() || ! DoCompacting())
return false ;
// Identifico le parti
IdentifyParts() ;
// Elimino i triangoli fuori dal semi-spazio d'interesse.
int nNumTria = GetTriangleSize() ;
for ( int nT = 0 ; nT < nNumTria ; ++ nT)
if ( m_vTria[nT].nTempPart == - 1 || m_vTria[nT].nTempPart == - 2 || ( ! bSaveOnEq && m_vTria[nT].nTempPart == 2))