EgtGeomKernel 2.1e2 :
- correzione a GetSurfTriMeshSwept per controllo estremi piatti quando richiesti tappi.
This commit is contained in:
Binary file not shown.
+30
-27
@@ -328,22 +328,13 @@ GetSurfTriMeshSwept( const ICurve* pSect, const ICurve* pGuide, bool bCapEnds, d
|
||||
frStart.Set( ptStart, -vtStart, vtStart ^ vtExtr) ;
|
||||
// porto la sezione in questo riferimento
|
||||
if ( ! PL.ToLoc( frStart))
|
||||
return false ;
|
||||
return nullptr ;
|
||||
// calcolo la superficie
|
||||
PtrOwner<ISurfTriMesh> pSTM( CreateSurfTriMesh()) ;
|
||||
if ( IsNull( pSTM))
|
||||
return false ;
|
||||
// se richiesti caps, sezione chiusa e guida aperta, creo cap iniziale
|
||||
if ( bCapEnds && bSectClosed && ! bGuideClosed) {
|
||||
// creo e setto la superficie trimesh
|
||||
PtrOwner<ISurfTriMesh> pSc( CreateSurfTriMesh()) ;
|
||||
if ( IsNull( pSc) || ! pSc->CreateByFlatContour( PL))
|
||||
return nullptr ;
|
||||
// la porto in globale
|
||||
pSc->ToGlob( frStart) ;
|
||||
// aggiungo alla superficie complessiva
|
||||
pSTM->DoSewing( *pSc) ;
|
||||
}
|
||||
// salvo tolleranza lineare usata
|
||||
pSTM->SetLinearTolerance( dLinTol) ;
|
||||
// superficie swept
|
||||
PtrOwner<ICurve> pPrevCrv ;
|
||||
Point3d ptP ;
|
||||
@@ -352,16 +343,16 @@ GetSurfTriMeshSwept( const ICurve* pSect, const ICurve* pGuide, bool bCapEnds, d
|
||||
// nuova curva
|
||||
OffsetCurve OffsCrv ;
|
||||
if ( ! OffsCrv.Make( pGuide, ptP.x, ICurve::OFF_FILLET) || OffsCrv.GetCurveCount() > 1)
|
||||
return false ;
|
||||
return nullptr ;
|
||||
PtrOwner<ICurve> pCurrCrv( OffsCrv.GetLongerCurve()) ;
|
||||
if ( IsNull( pCurrCrv))
|
||||
return false ;
|
||||
return nullptr ;
|
||||
pCurrCrv->Translate( ptP.y * frStart.VersY() + ptP.z * frStart.VersZ()) ;
|
||||
// se esiste la curva precedente, costruisco la rigata (di tipo minima distanza)
|
||||
if ( ! IsNull( pPrevCrv)) {
|
||||
PtrOwner<ISurfTriMesh> pSr( GetSurfTriMeshRuled( pPrevCrv, pCurrCrv, ISurfTriMesh::RLT_MINDIST, dLinTol)) ;
|
||||
if ( IsNull( pSr))
|
||||
return false ;
|
||||
return nullptr ;
|
||||
pSTM->DoSewing( *pSr) ;
|
||||
}
|
||||
// salvo la curva come prossima precedente
|
||||
@@ -369,8 +360,25 @@ GetSurfTriMeshSwept( const ICurve* pSect, const ICurve* pGuide, bool bCapEnds, d
|
||||
// prossimo punto
|
||||
bPoint = PL.GetNextPoint( ptP) ;
|
||||
}
|
||||
// se richiesti caps, sezione chiusa e guida aperta, creo cap finale
|
||||
// se richiesti caps e sezione chiusa e guida aperta
|
||||
if ( bCapEnds && bSectClosed && ! bGuideClosed) {
|
||||
// verifico che le due estremità siano piatte
|
||||
POLYLINEVECTOR vPL ;
|
||||
if ( ! pSTM->GetLoops( vPL) || vPL.size() != 2)
|
||||
return nullptr ;
|
||||
int nRank ;
|
||||
Point3d ptCen ;
|
||||
Vector3d vtDir ;
|
||||
if ( ! vPL[0].IsFlat( nRank, ptCen, vtDir, 100 * EPS_SMALL))
|
||||
return nullptr ;
|
||||
if ( ! vPL[1].IsFlat( nRank, ptCen, vtDir, 100 * EPS_SMALL))
|
||||
return nullptr ;
|
||||
// aggiungo il cap sull'inizio
|
||||
PtrOwner<ISurfTriMesh> pSci( CreateSurfTriMesh()) ;
|
||||
if ( IsNull( pSci) || ! pSci->CreateByFlatContour( PL))
|
||||
return nullptr ;
|
||||
pSci->ToGlob( frStart) ;
|
||||
pSTM->DoSewing( *pSci) ;
|
||||
// riferimento alla fine della linea guida
|
||||
Frame3d frEnd ;
|
||||
Point3d ptEnd ;
|
||||
@@ -378,23 +386,18 @@ GetSurfTriMeshSwept( const ICurve* pSect, const ICurve* pGuide, bool bCapEnds, d
|
||||
Vector3d vtEnd ;
|
||||
pGuide->GetEndDir( vtEnd) ;
|
||||
frEnd.Set( ptEnd, -vtEnd, vtEnd ^ vtExtr) ;
|
||||
// creo e setto la superficie trimesh
|
||||
PtrOwner<ISurfTriMesh> pSc( CreateSurfTriMesh()) ;
|
||||
if ( IsNull( pSc) || ! pSc->CreateByFlatContour( PL))
|
||||
// aggiungo il cap sulla fine
|
||||
PtrOwner<ISurfTriMesh> pSce( CreateSurfTriMesh()) ;
|
||||
if ( IsNull( pSce) || ! pSce->CreateByFlatContour( PL))
|
||||
return nullptr ;
|
||||
// ne inverto la normale
|
||||
pSc->Invert() ;
|
||||
// la porto in globale
|
||||
pSc->ToGlob( frEnd) ;
|
||||
// aggiungo alla superficie complessiva
|
||||
pSTM->DoSewing( *pSc) ;
|
||||
pSce->Invert() ;
|
||||
pSce->ToGlob( frEnd) ;
|
||||
pSTM->DoSewing( *pSce) ;
|
||||
}
|
||||
// se superficie risultante chiusa, verifico che la normale sia verso l'esterno
|
||||
double dVol ;
|
||||
if ( pSTM->GetVolume( dVol) && dVol < 0)
|
||||
pSTM->Invert() ;
|
||||
// salvo tolleranza lineare usata
|
||||
pSTM->SetLinearTolerance( dLinTol) ;
|
||||
// restituisco la superficie
|
||||
return Release( pSTM) ;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user