EgtGeomKernel 1.6f4 :
- ApproxWithLines di curve con nuove opzioni - semplificata CurveComposite - completate IntersLineTria e IntersLineSurfTm - aggiunta MakeConvex a PolyLine.
This commit is contained in:
+99
-182
@@ -35,7 +35,7 @@ GEOOBJ_REGISTER( CRV_COMPO, NGE_C_CMP, CurveComposite) ;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
CurveComposite::CurveComposite( void)
|
||||
: m_nStatus( TO_VERIFY), m_bClosed( false), m_VtExtr(), m_dThick(), m_nTempProp()
|
||||
: m_nStatus( TO_VERIFY), m_VtExtr(), m_dThick(), m_nTempProp()
|
||||
{
|
||||
}
|
||||
|
||||
@@ -57,7 +57,6 @@ CurveComposite::Clear( void)
|
||||
m_CrvSmplS.clear() ;
|
||||
|
||||
m_nStatus = TO_VERIFY ;
|
||||
m_bClosed = false ;
|
||||
m_VtExtr = V_NULL ;
|
||||
m_dThick = 0 ;
|
||||
m_nTempProp = 0 ;
|
||||
@@ -193,10 +192,12 @@ CurveComposite::AddSimpleCurve( ICurve* pSmplCrv, bool bEndOrStart, double dLinT
|
||||
// se inserita alla fine
|
||||
if ( bEndOrStart) {
|
||||
// verifico sia in continuità con il finale attuale
|
||||
if ( ! AreSamePointApprox( ptStart, m_PtEnd)) {
|
||||
Point3d ptEnd ;
|
||||
GetEndPoint( ptEnd) ;
|
||||
if ( ! AreSamePointApprox( ptStart, ptEnd)) {
|
||||
// se in tolleranza, modifico l'inizio dell'entità
|
||||
if ( SqDist( ptStart, m_PtEnd) < ( dLinTol * dLinTol)) {
|
||||
if ( ! pCrv->ModifyStart( m_PtEnd))
|
||||
if ( SqDist( ptStart, ptEnd) < ( dLinTol * dLinTol)) {
|
||||
if ( ! pCrv->ModifyStart( ptEnd))
|
||||
return false ;
|
||||
}
|
||||
else
|
||||
@@ -206,10 +207,12 @@ CurveComposite::AddSimpleCurve( ICurve* pSmplCrv, bool bEndOrStart, double dLinT
|
||||
// altrimenti inserita all'inizio
|
||||
else {
|
||||
// verifico sia in continuità con l'iniziale attuale
|
||||
if ( ! AreSamePointApprox( ptEnd, m_PtStart)) {
|
||||
Point3d ptStart ;
|
||||
GetStartPoint( ptStart) ;
|
||||
if ( ! AreSamePointApprox( ptEnd, ptStart)) {
|
||||
// se in tolleranza, modifico la fine dell'entità
|
||||
if ( SqDist( ptEnd, m_PtStart) < ( dLinTol * dLinTol)) {
|
||||
if ( ! pCrv->ModifyEnd( m_PtStart))
|
||||
if ( SqDist( ptEnd, ptStart) < ( dLinTol * dLinTol)) {
|
||||
if ( ! pCrv->ModifyEnd( ptStart))
|
||||
return false ;
|
||||
}
|
||||
else
|
||||
@@ -218,29 +221,12 @@ CurveComposite::AddSimpleCurve( ICurve* pSmplCrv, bool bEndOrStart, double dLinT
|
||||
}
|
||||
}
|
||||
|
||||
// se prima curva, assegno il punto iniziale o finale
|
||||
if ( m_CrvSmplS.empty()) {
|
||||
if ( bEndOrStart)
|
||||
m_PtStart = ptStart ;
|
||||
else
|
||||
m_PtEnd = ptEnd ;
|
||||
}
|
||||
|
||||
// inserisco la curva nella lista
|
||||
if ( bEndOrStart)
|
||||
m_CrvSmplS.push_back( ::Release( pCrv)) ;
|
||||
else
|
||||
m_CrvSmplS.push_front( ::Release( pCrv)) ;
|
||||
|
||||
// assegno il nuovo punto estremo
|
||||
if ( bEndOrStart)
|
||||
m_PtEnd = ptEnd ;
|
||||
else
|
||||
m_PtStart = ptStart ;
|
||||
|
||||
// aggiorno il flag di curva chiusa
|
||||
m_bClosed = ( AreSamePointApprox( m_PtStart, m_PtEnd)) ;
|
||||
|
||||
// aggiorno lo stato
|
||||
m_nStatus = OK ;
|
||||
|
||||
@@ -255,11 +241,14 @@ CurveComposite::Close( void)
|
||||
if ( m_nStatus != OK)
|
||||
return false ;
|
||||
// se già chiusa, non faccio alcunché
|
||||
if ( m_bClosed)
|
||||
if ( IsClosed())
|
||||
return true ;
|
||||
// aggiungo la linea di chiusura
|
||||
PtrOwner<CurveLine> pLine( CreateBasicCurveLine()) ;
|
||||
if ( ! pLine->Set( m_PtEnd, m_PtStart) ||
|
||||
Point3d ptStart, ptEnd ;
|
||||
if ( ! GetStartPoint( ptStart) ||
|
||||
! GetEndPoint( ptEnd) ||
|
||||
! pLine->Set( ptEnd, ptStart) ||
|
||||
! AddSimpleCurve( Release( pLine)))
|
||||
return false ;
|
||||
// imposto ricalcolo della grafica
|
||||
@@ -795,46 +784,11 @@ CurveComposite::Validate( void)
|
||||
}
|
||||
// aggiorno
|
||||
m_nStatus = ( nCount > 0 ? OK : TO_VERIFY) ;
|
||||
if ( m_nStatus == OK) {
|
||||
m_CrvSmplS.front()->GetStartPoint( m_PtStart) ;
|
||||
m_CrvSmplS.back()->GetEndPoint( m_PtEnd) ;
|
||||
m_bClosed = ( AreSamePointApprox( m_PtStart, m_PtEnd)) ;
|
||||
}
|
||||
else
|
||||
m_bClosed = false ;
|
||||
}
|
||||
|
||||
return ( m_nStatus == OK) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
CurveComposite::ValidateMoveStart( void)
|
||||
{
|
||||
// ci deve essere almeno una curva
|
||||
if ( m_CrvSmplS.empty())
|
||||
return false ;
|
||||
// imposto punto iniziale e verifico curva chiusa
|
||||
if ( ! m_CrvSmplS.front()->GetStartPoint( m_PtStart))
|
||||
return false ;
|
||||
m_bClosed = ( AreSamePointApprox( m_PtStart, m_PtEnd)) ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
CurveComposite::ValidateMoveEnd( void)
|
||||
{
|
||||
// ci deve essere almeno una curva
|
||||
if ( m_CrvSmplS.empty())
|
||||
return false ;
|
||||
// imposto punto finale e verifica curva chiusa
|
||||
if ( ! m_CrvSmplS.back()->GetEndPoint( m_PtEnd))
|
||||
return false ;
|
||||
m_bClosed = ( AreSamePointApprox( m_PtStart, m_PtEnd)) ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
CurveComposite::IsFlat( Plane3d& plPlane, double dToler) const
|
||||
@@ -930,18 +884,31 @@ CurveComposite::IsFlat( Plane3d& plPlane, double dToler) const
|
||||
return bFlat ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
CurveComposite::IsClosed( void) const
|
||||
{
|
||||
// verifico lo stato
|
||||
if ( m_nStatus != OK || m_CrvSmplS.empty())
|
||||
return false ;
|
||||
|
||||
// ricavo punti iniziale e finale e li confronto
|
||||
Point3d ptStart, ptEnd ;
|
||||
return ( m_CrvSmplS.front()->GetStartPoint( ptStart) &&
|
||||
m_CrvSmplS.back()->GetEndPoint( ptEnd) &&
|
||||
AreSamePointApprox( ptStart, ptEnd)) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
CurveComposite::GetStartPoint( Point3d& ptStart) const
|
||||
{
|
||||
// verifico lo stato
|
||||
if ( m_nStatus != OK)
|
||||
if ( m_nStatus != OK || m_CrvSmplS.empty())
|
||||
return false ;
|
||||
|
||||
// assegno il punto
|
||||
ptStart = m_PtStart ;
|
||||
|
||||
return true ;
|
||||
return m_CrvSmplS.front()->GetStartPoint( ptStart) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
@@ -949,13 +916,11 @@ bool
|
||||
CurveComposite::GetEndPoint( Point3d& ptEnd) const
|
||||
{
|
||||
// verifico lo stato
|
||||
if ( m_nStatus != OK)
|
||||
if ( m_nStatus != OK || m_CrvSmplS.empty())
|
||||
return false ;
|
||||
|
||||
// assegno il punto
|
||||
ptEnd = m_PtEnd ;
|
||||
|
||||
return true ;
|
||||
return m_CrvSmplS.back()->GetEndPoint( ptEnd) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
@@ -995,6 +960,30 @@ CurveComposite::GetCentroid( Point3d& ptCen) const
|
||||
return GetMidPoint( ptCen) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
CurveComposite::GetStartDir( Vector3d& vtDir) const
|
||||
{
|
||||
// verifico lo stato
|
||||
if ( m_nStatus != OK || m_CrvSmplS.empty())
|
||||
return false ;
|
||||
|
||||
// assegno il punto
|
||||
return m_CrvSmplS.front()->GetStartDir( vtDir) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
CurveComposite::GetEndDir( Vector3d& vtDir) const
|
||||
{
|
||||
// verifico lo stato
|
||||
if ( m_nStatus != OK || m_CrvSmplS.empty())
|
||||
return false ;
|
||||
|
||||
// assegno il punto
|
||||
return m_CrvSmplS.back()->GetEndDir( vtDir) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
CurveComposite::GetMidDir( Vector3d& vtDir) const
|
||||
@@ -1039,7 +1028,7 @@ CurveComposite::GetIndSCurveAndLocPar( double dU, Side nS, int& nSCrv, double& d
|
||||
// il parametro U deve essere compreso tra 0 e m_nCounter (le curve chiuse sono cicliche)
|
||||
if ( dU < ( 0 + EPS_PARAM)) {
|
||||
// se chiusa e voglio valutare prima dell'inizio devo valutare prima della fine
|
||||
if ( m_bClosed && nS == ICurve::FROM_MINUS)
|
||||
if ( IsClosed() && nS == ICurve::FROM_MINUS)
|
||||
dU = dMaxU ;
|
||||
// altrimenti posso valutare solo dopo l'inizio
|
||||
else {
|
||||
@@ -1049,7 +1038,7 @@ CurveComposite::GetIndSCurveAndLocPar( double dU, Side nS, int& nSCrv, double& d
|
||||
}
|
||||
else if ( dU > ( dMaxU - EPS_PARAM)) {
|
||||
// se chiusa e voglio valutare dopo la fine devo valutare dopo l'inizio
|
||||
if ( m_bClosed && nS == ICurve::FROM_PLUS)
|
||||
if ( IsClosed() && nS == ICurve::FROM_PLUS)
|
||||
dU = 0 ;
|
||||
// altrimenti posso valutare solo prima della fine
|
||||
else {
|
||||
@@ -1268,6 +1257,13 @@ CurveComposite::ApproxWithLines( double dLinTol, double dAngTolDeg, int nType, P
|
||||
dStartPar += 1 ;
|
||||
}
|
||||
|
||||
// se necessario, sistemo per convessità dalla parte ammessa
|
||||
if ( nType == APL_RIGHT_CONVEX || nType == APL_LEFT_CONVEX) {
|
||||
Vector3d vtExtr = ( m_VtExtr.IsSmall() ? Z_AX : m_VtExtr) ;
|
||||
if ( ! PL.MakeConvex( vtExtr, ( nType == APL_LEFT_CONVEX)))
|
||||
return false ;
|
||||
}
|
||||
|
||||
return true ;
|
||||
}
|
||||
|
||||
@@ -1321,7 +1317,7 @@ CurveComposite::CopyParamRange( double dUStart, double dUEnd) const
|
||||
// se il parametro start supera quello di end
|
||||
if ( dUStart > dUEnd - EPS_PARAM) {
|
||||
// se curva aperta, il trim la cancella completamente quindi non resta alcunchè
|
||||
if ( ! m_bClosed)
|
||||
if ( ! IsClosed())
|
||||
return nullptr ;
|
||||
// se curva chiusa, il trim si avvolge attorno al punto di giunzione
|
||||
else
|
||||
@@ -1361,16 +1357,12 @@ CurveComposite::Invert( void)
|
||||
return false ;
|
||||
|
||||
// inverto le singole curve
|
||||
PCSD_ITER Iter ;
|
||||
for ( Iter = m_CrvSmplS.begin() ; Iter != m_CrvSmplS.end() ; ++Iter)
|
||||
for ( auto Iter = m_CrvSmplS.begin() ; Iter != m_CrvSmplS.end() ; ++Iter)
|
||||
(*Iter)->Invert() ;
|
||||
|
||||
// inverto l'ordine della lista
|
||||
reverse( m_CrvSmplS.begin(), m_CrvSmplS.end()) ;
|
||||
|
||||
// scambio punti iniziale e finale
|
||||
swap( m_PtStart, m_PtEnd) ;
|
||||
|
||||
// imposto ricalcolo della grafica
|
||||
m_OGrMgr.Reset() ;
|
||||
|
||||
@@ -1425,9 +1417,6 @@ CurveComposite::ModifyStart( const Point3d& ptNewStart)
|
||||
// modifico l'inizio di questa curva
|
||||
if ( ! pCrv->ModifyStart( ptNewStart))
|
||||
return false ;
|
||||
// aggiorno il punto iniziale e il flag di curva chiusa
|
||||
m_PtStart = ptNewStart ;
|
||||
m_bClosed = ( AreSamePointApprox( m_PtStart, m_PtEnd)) ;
|
||||
|
||||
// imposto ricalcolo della grafica
|
||||
m_OGrMgr.Reset() ;
|
||||
@@ -1449,9 +1438,6 @@ CurveComposite::ModifyEnd( const Point3d& ptNewEnd)
|
||||
// modifico la fine di questa curva
|
||||
if ( ! pCrv->ModifyEnd( ptNewEnd))
|
||||
return false ;
|
||||
// aggiorno il punto finale e il flag di curva chiusa
|
||||
m_PtEnd = ptNewEnd ;
|
||||
m_bClosed = ( AreSamePointApprox( m_PtStart, m_PtEnd)) ;
|
||||
|
||||
// imposto ricalcolo della grafica
|
||||
m_OGrMgr.Reset() ;
|
||||
@@ -1465,8 +1451,7 @@ CurveComposite::TrimStartAtParam( double dUTrim)
|
||||
{
|
||||
// ciclo sulle diverse curve dall'inizio
|
||||
double dUToTrim = dUTrim ;
|
||||
PCSD_ITER Iter ;
|
||||
for ( Iter = m_CrvSmplS.begin() ; Iter != m_CrvSmplS.end() ;) {
|
||||
for ( auto Iter = m_CrvSmplS.begin() ; Iter != m_CrvSmplS.end() ;) {
|
||||
// dominio parametrico della curva semplice
|
||||
double dParStart, dParEnd ;
|
||||
(*Iter)->GetDomain( dParStart, dParEnd) ;
|
||||
@@ -1486,14 +1471,10 @@ CurveComposite::TrimStartAtParam( double dUTrim)
|
||||
m_CrvSmplS.pop_front() ;
|
||||
if ( m_CrvSmplS.empty())
|
||||
return false ;
|
||||
(*Iter)->GetStartPoint( m_PtStart) ;
|
||||
m_bClosed = ( AreSamePointApprox( m_PtStart, m_PtEnd)) ;
|
||||
break ;
|
||||
}
|
||||
// altrimenti superata lunghezza ancora da tagliare (taglio già fatto al test sopra)
|
||||
else {
|
||||
(*Iter)->GetStartPoint( m_PtStart) ;
|
||||
m_bClosed = ( AreSamePointApprox( m_PtStart, m_PtEnd)) ;
|
||||
break ;
|
||||
}
|
||||
}
|
||||
@@ -1511,8 +1492,7 @@ CurveComposite::TrimEndAtParam( double dUTrim)
|
||||
// ciclo sulle diverse curve dalla fine
|
||||
bool bToErase = false ;
|
||||
double dUToTrim = dUTrim ;
|
||||
PCSD_ITER Iter ;
|
||||
for ( Iter = m_CrvSmplS.begin() ; Iter != m_CrvSmplS.end() ;) {
|
||||
for ( auto Iter = m_CrvSmplS.begin() ; Iter != m_CrvSmplS.end() ;) {
|
||||
// dominio parametrico della curva semplice
|
||||
double dParStart, dParEnd ;
|
||||
(*Iter)->GetDomain( dParStart, dParEnd) ;
|
||||
@@ -1530,9 +1510,6 @@ CurveComposite::TrimEndAtParam( double dUTrim)
|
||||
}
|
||||
// se lunghezza parametrica ancora da tagliare nulla (entro la tolleranza)
|
||||
else if ( dUToTrim > - EPS_PARAM) {
|
||||
// imposto punto finale e verifico curva chiusa
|
||||
(*Iter)->GetEndPoint( m_PtEnd) ;
|
||||
m_bClosed = ( AreSamePointApprox( m_PtStart, m_PtEnd)) ;
|
||||
// passo alla entità successiva
|
||||
++ Iter ;
|
||||
// dichiaro ingresso in zona da cancellare
|
||||
@@ -1546,9 +1523,6 @@ CurveComposite::TrimEndAtParam( double dUTrim)
|
||||
bToErase = true ;
|
||||
continue ;
|
||||
}
|
||||
// imposto punto finale e verifica curva chiusa
|
||||
(*Iter)->GetEndPoint( m_PtEnd) ;
|
||||
m_bClosed = ( AreSamePointApprox( m_PtStart, m_PtEnd)) ;
|
||||
// passo alla entità successiva
|
||||
++ Iter ;
|
||||
// dichiaro ingresso in zona da cancellare
|
||||
@@ -1575,7 +1549,7 @@ CurveComposite::TrimStartEndAtParam( double dUStartTrim, double dUEndTrim)
|
||||
// se il parametro start supera quello di end
|
||||
if ( dUStartTrim > dUEndTrim - EPS_PARAM) {
|
||||
// se curva aperta, il trim la cancella completamente quindi errore
|
||||
if ( ! m_bClosed)
|
||||
if ( ! IsClosed())
|
||||
return false ;
|
||||
// se curva chiusa, il trim interessa il punto di giunzione
|
||||
else {
|
||||
@@ -1619,8 +1593,7 @@ CurveComposite::TrimStartAtLen( double dLenTrim)
|
||||
{
|
||||
// ciclo sulle diverse curve dall'inizio
|
||||
double dLenToTrim = dLenTrim ;
|
||||
PCSD_ITER Iter ;
|
||||
for ( Iter = m_CrvSmplS.begin() ; Iter != m_CrvSmplS.end() ;) {
|
||||
for ( auto Iter = m_CrvSmplS.begin() ; Iter != m_CrvSmplS.end() ;) {
|
||||
// lunghezza della curva
|
||||
double dCrvLen ;
|
||||
if ( ! (*Iter)->GetLength( dCrvLen))
|
||||
@@ -1642,8 +1615,6 @@ CurveComposite::TrimStartAtLen( double dLenTrim)
|
||||
m_CrvSmplS.pop_front() ;
|
||||
if ( m_CrvSmplS.empty())
|
||||
return false ;
|
||||
(*Iter)->GetStartPoint( m_PtStart) ;
|
||||
m_bClosed = ( AreSamePointApprox( m_PtStart, m_PtEnd)) ;
|
||||
break ;
|
||||
}
|
||||
// altrimenti superata lunghezza ancora da tagliare
|
||||
@@ -1652,8 +1623,6 @@ CurveComposite::TrimStartAtLen( double dLenTrim)
|
||||
m_nStatus = ERR ;
|
||||
return false ;
|
||||
}
|
||||
(*Iter)->GetStartPoint( m_PtStart) ;
|
||||
m_bClosed = ( AreSamePointApprox( m_PtStart, m_PtEnd)) ;
|
||||
break ;
|
||||
}
|
||||
}
|
||||
@@ -1671,8 +1640,7 @@ CurveComposite::TrimEndAtLen( double dLenTrim)
|
||||
// ciclo sulle diverse curve dalla fine
|
||||
bool bToErase = false ;
|
||||
double dLenToTrim = dLenTrim ;
|
||||
PCSD_ITER Iter ;
|
||||
for ( Iter = m_CrvSmplS.begin() ; Iter != m_CrvSmplS.end() ;) {
|
||||
for ( auto Iter = m_CrvSmplS.begin() ; Iter != m_CrvSmplS.end() ;) {
|
||||
double dCrvLen ;
|
||||
// se non sono già nella zona da cancellare, aggiorno lunghezze
|
||||
if ( ! bToErase) {
|
||||
@@ -1695,9 +1663,6 @@ CurveComposite::TrimEndAtLen( double dLenTrim)
|
||||
}
|
||||
// se lunghezza ancora da tagliare nulla (entro la tolleranza)
|
||||
else if ( dLenToTrim > - EPS_SMALL) {
|
||||
// imposto punto finale e verifica curva chiusa
|
||||
(*Iter)->GetEndPoint( m_PtEnd) ;
|
||||
m_bClosed = ( AreSamePointApprox( m_PtStart, m_PtEnd)) ;
|
||||
// passo alla entità successiva
|
||||
++ Iter ;
|
||||
// dichiaro ingresso in zona da cancellare
|
||||
@@ -1710,9 +1675,6 @@ CurveComposite::TrimEndAtLen( double dLenTrim)
|
||||
m_nStatus = ERR ;
|
||||
return false ;
|
||||
}
|
||||
// imposto punto finale e verifica curva chiusa
|
||||
(*Iter)->GetEndPoint( m_PtEnd) ;
|
||||
m_bClosed = ( AreSamePointApprox( m_PtStart, m_PtEnd)) ;
|
||||
// passo alla entità successiva
|
||||
++ Iter ;
|
||||
// dichiaro ingresso in zona da cancellare
|
||||
@@ -1743,9 +1705,6 @@ CurveComposite::ExtendStartByLen( double dLenExt)
|
||||
return false ;
|
||||
}
|
||||
|
||||
// imposto punto iniziale e verifica curva chiusa
|
||||
ValidateMoveStart() ;
|
||||
|
||||
// imposto ricalcolo della grafica
|
||||
m_OGrMgr.Reset() ;
|
||||
return true ;
|
||||
@@ -1760,7 +1719,7 @@ CurveComposite::ExtendEndByLen( double dLenExt)
|
||||
return false ;
|
||||
|
||||
// vado sulla fine
|
||||
PCSD_ITER Iter = m_CrvSmplS.end() ;
|
||||
auto Iter = m_CrvSmplS.end() ;
|
||||
if ( Iter == m_CrvSmplS.begin())
|
||||
return false ;
|
||||
-- Iter ;
|
||||
@@ -1773,9 +1732,6 @@ CurveComposite::ExtendEndByLen( double dLenExt)
|
||||
return false ;
|
||||
}
|
||||
|
||||
// imposto punto finale e verifica curva chiusa
|
||||
ValidateMoveEnd() ;
|
||||
|
||||
// imposto ricalcolo della grafica
|
||||
m_OGrMgr.Reset() ;
|
||||
return true ;
|
||||
@@ -1789,13 +1745,8 @@ CurveComposite::Translate( const Vector3d& vtMove)
|
||||
m_OGrMgr.Reset() ;
|
||||
|
||||
// traslo le singole curve
|
||||
PCSD_ITER Iter ;
|
||||
for ( Iter = m_CrvSmplS.begin() ; Iter != m_CrvSmplS.end() ; ++Iter)
|
||||
(*Iter)->Translate( vtMove) ;
|
||||
|
||||
// traslo i punti estremi
|
||||
m_PtStart.Translate( vtMove) ;
|
||||
m_PtEnd.Translate( vtMove) ;
|
||||
for ( auto& pCrv : m_CrvSmplS)
|
||||
pCrv->Translate( vtMove) ;
|
||||
|
||||
return true ;
|
||||
}
|
||||
@@ -1812,13 +1763,9 @@ CurveComposite::Rotate( const Point3d& ptAx, const Vector3d& vtAx, double dCosAn
|
||||
m_OGrMgr.Reset() ;
|
||||
|
||||
// ruoto le singole curve
|
||||
PCSD_ITER Iter ;
|
||||
for ( Iter = m_CrvSmplS.begin() ; Iter != m_CrvSmplS.end() ; ++Iter)
|
||||
(*Iter)->Rotate( ptAx, vtAx, dCosAng, dSinAng) ;
|
||||
for ( auto& pCrv : m_CrvSmplS)
|
||||
pCrv->Rotate( ptAx, vtAx, dCosAng, dSinAng) ;
|
||||
|
||||
// ruoto i punti estremi
|
||||
m_PtStart.Rotate( ptAx, vtAx, dCosAng, dSinAng) ;
|
||||
m_PtEnd.Rotate( ptAx, vtAx, dCosAng, dSinAng) ;
|
||||
// ruoto il vettore estrusione
|
||||
m_VtExtr.Rotate( vtAx, dCosAng, dSinAng) ;
|
||||
|
||||
@@ -1857,7 +1804,7 @@ CurveComposite::Scale( const Frame3d& frRef, double dCoeffX, double dCoeffY, dou
|
||||
}
|
||||
|
||||
// scalo le singole curve
|
||||
for ( PCSD_ITER Iter = m_CrvSmplS.begin() ; Iter != m_CrvSmplS.end() ; ) {
|
||||
for ( auto Iter = m_CrvSmplS.begin() ; Iter != m_CrvSmplS.end() ; ) {
|
||||
// eseguo la scalatura
|
||||
bool bOk = (*Iter)->Scale( frRef, dCoeffX, dCoeffY, dCoeffZ) ;
|
||||
// se tutto bene, passo alla prossima
|
||||
@@ -1871,9 +1818,6 @@ CurveComposite::Scale( const Frame3d& frRef, double dCoeffX, double dCoeffY, dou
|
||||
}
|
||||
}
|
||||
|
||||
// scalo i punti estremi
|
||||
m_PtStart.Scale( frRef, dCoeffX, dCoeffY, dCoeffZ) ;
|
||||
m_PtEnd.Scale( frRef, dCoeffX, dCoeffY, dCoeffZ) ;
|
||||
// scalo vettore estrusione, lo normalizzo e aggiusto spessore
|
||||
m_VtExtr.Scale( frRef, dCoeffX, dCoeffY, dCoeffZ) ;
|
||||
double dLen = m_VtExtr.Len() ;
|
||||
@@ -1898,13 +1842,9 @@ CurveComposite::Mirror( const Point3d& ptOn, const Vector3d& vtNorm)
|
||||
m_OGrMgr.Reset() ;
|
||||
|
||||
// specchio le singole curve
|
||||
PCSD_ITER Iter ;
|
||||
for ( Iter = m_CrvSmplS.begin() ; Iter != m_CrvSmplS.end() ; ++Iter)
|
||||
(*Iter)->Mirror( ptOn, vtNorm) ;
|
||||
for ( auto& pCrv : m_CrvSmplS)
|
||||
pCrv->Mirror( ptOn, vtNorm) ;
|
||||
|
||||
// specchio i punti estremi
|
||||
m_PtStart.Mirror( ptOn, vtNorm) ;
|
||||
m_PtEnd.Mirror( ptOn, vtNorm) ;
|
||||
// specchio il vettore estrusione
|
||||
m_VtExtr.Mirror( vtNorm) ;
|
||||
|
||||
@@ -1927,13 +1867,9 @@ CurveComposite::Shear( const Point3d& ptOn, const Vector3d& vtNorm, const Vector
|
||||
return false ;
|
||||
|
||||
// eseguo scorrimento delle singole curve
|
||||
PCSD_ITER Iter ;
|
||||
for ( Iter = m_CrvSmplS.begin() ; Iter != m_CrvSmplS.end() ; ++Iter)
|
||||
(*Iter)->Shear( ptOn, vtNorm, vtDir, dCoeff) ;
|
||||
for ( auto& pCrv : m_CrvSmplS)
|
||||
pCrv->Shear( ptOn, vtNorm, vtDir, dCoeff) ;
|
||||
|
||||
// eseguo scorrimento dei punti estremi
|
||||
m_PtStart.Shear( ptOn, vtNorm, vtDir, dCoeff) ;
|
||||
m_PtEnd.Shear( ptOn, vtNorm, vtDir, dCoeff) ;
|
||||
// eseguo scorrimento del vettore estrusione, lo normalizzo e aggiusto spessore
|
||||
m_VtExtr.Shear( vtNorm, vtDir, dCoeff) ;
|
||||
double dLen = m_VtExtr.Len() ;
|
||||
@@ -1957,13 +1893,10 @@ CurveComposite::ToGlob( const Frame3d& frRef)
|
||||
m_OGrMgr.Reset() ;
|
||||
|
||||
// trasformo le singole curve
|
||||
PCSD_ITER Iter ;
|
||||
for ( Iter = m_CrvSmplS.begin() ; Iter != m_CrvSmplS.end() ; ++Iter)
|
||||
(*Iter)->ToGlob( frRef) ;
|
||||
for ( auto& pCrv : m_CrvSmplS)
|
||||
pCrv->ToGlob( frRef) ;
|
||||
|
||||
// trasformo i punti estremi e il vettore estrusione
|
||||
m_PtStart.ToGlob( frRef) ;
|
||||
m_PtEnd.ToGlob( frRef) ;
|
||||
// trasformo il vettore estrusione
|
||||
m_VtExtr.ToGlob( frRef) ;
|
||||
|
||||
return true ;
|
||||
@@ -1981,13 +1914,10 @@ CurveComposite::ToLoc( const Frame3d& frRef)
|
||||
m_OGrMgr.Reset() ;
|
||||
|
||||
// trasformo le singole curve
|
||||
PCSD_ITER Iter ;
|
||||
for ( Iter = m_CrvSmplS.begin() ; Iter != m_CrvSmplS.end() ; ++Iter)
|
||||
(*Iter)->ToLoc( frRef) ;
|
||||
for ( auto& pCrv : m_CrvSmplS)
|
||||
pCrv->ToLoc( frRef) ;
|
||||
|
||||
// trasformo i punti estremi e il vettore estrusione
|
||||
m_PtStart.ToLoc( frRef) ;
|
||||
m_PtEnd.ToLoc( frRef) ;
|
||||
// trasformo il vettore estrusione
|
||||
m_VtExtr.ToLoc( frRef) ;
|
||||
|
||||
return true ;
|
||||
@@ -2009,14 +1939,10 @@ CurveComposite::LocToLoc( const Frame3d& frOri, const Frame3d& frDest)
|
||||
m_OGrMgr.Reset() ;
|
||||
|
||||
// trasformo le singole curve
|
||||
PCSD_ITER Iter ;
|
||||
for ( Iter = m_CrvSmplS.begin() ; Iter != m_CrvSmplS.end() ; ++Iter) {
|
||||
(*Iter)->LocToLoc( frOri, frDest) ;
|
||||
}
|
||||
for ( auto& pCrv : m_CrvSmplS)
|
||||
pCrv->LocToLoc( frOri, frDest) ;
|
||||
|
||||
// trasformo i punti estremi e il vettore estrusione
|
||||
m_PtStart.LocToLoc( frOri, frDest) ;
|
||||
m_PtEnd.LocToLoc( frOri, frDest) ;
|
||||
// trasformo il vettore estrusione
|
||||
m_VtExtr.LocToLoc( frOri, frDest) ;
|
||||
|
||||
return true ;
|
||||
@@ -2063,6 +1989,8 @@ CurveComposite::GetNextCurve( void) const
|
||||
return nullptr ;
|
||||
|
||||
// vado al successivo
|
||||
if ( m_Iter == m_CrvSmplS.end())
|
||||
return nullptr ;
|
||||
++ m_Iter ;
|
||||
|
||||
// recupero la curva
|
||||
@@ -2129,23 +2057,15 @@ CurveComposite::RemoveFirstOrLastCurve( bool bLast)
|
||||
pCrv = *(m_CrvSmplS.rbegin()) ;
|
||||
// la tolgo dalla lista
|
||||
m_CrvSmplS.pop_back() ;
|
||||
// aggiorno la curva composita
|
||||
pCrv->GetStartPoint( m_PtEnd) ;
|
||||
}
|
||||
else {
|
||||
// recupero la curva
|
||||
pCrv = *(m_CrvSmplS.begin()) ;
|
||||
// la tolgo dalla lista
|
||||
m_CrvSmplS.pop_front() ;
|
||||
// aggiorno la curva composita
|
||||
pCrv->GetEndPoint( m_PtStart) ;
|
||||
}
|
||||
// eseguo mini verifica
|
||||
m_nStatus = ( m_CrvSmplS.size() > 0 ? OK : TO_VERIFY) ;
|
||||
if ( m_nStatus == OK)
|
||||
m_bClosed = ( AreSamePointApprox( m_PtStart, m_PtEnd)) ;
|
||||
else
|
||||
m_bClosed = false ;
|
||||
// assegno estrusione e spessore della curva composita
|
||||
pCrv->SetExtrusion( m_VtExtr) ;
|
||||
pCrv->SetThickness( m_dThick) ;
|
||||
@@ -2160,8 +2080,9 @@ bool
|
||||
CurveComposite::IsParamAtJoint( double dU) const
|
||||
{
|
||||
// se aperta e all'inizio o alla fine o lontano dagli interi non è giunzione
|
||||
if ( ( ! m_bClosed && fabs( dU) < EPS_ZERO) ||
|
||||
( ! m_bClosed && fabs( dU - double( m_CrvSmplS.size())) < EPS_ZERO) ||
|
||||
bool bClosed = IsClosed() ;
|
||||
if ( ( ! bClosed && fabs( dU) < EPS_ZERO) ||
|
||||
( ! bClosed && fabs( dU - double( m_CrvSmplS.size())) < EPS_ZERO) ||
|
||||
fabs( dU - (int) ( dU + EPS_ZERO)) > EPS_ZERO)
|
||||
return false ;
|
||||
else
|
||||
@@ -2204,11 +2125,9 @@ CurveComposite::ArcsToBezierCurves( void)
|
||||
if ( pCC == nullptr)
|
||||
return false ;
|
||||
// inserisco le curve prima dell'arco
|
||||
int nParts = 0 ;
|
||||
for ( PCSD_ITER Iter2 = pCC->m_CrvSmplS.begin() ; Iter2 != pCC->m_CrvSmplS.end() ; ++ Iter2) {
|
||||
Iter = m_CrvSmplS.insert( Iter, (*Iter2)) ;
|
||||
++ Iter ;
|
||||
++ nParts ;
|
||||
}
|
||||
pCC->m_CrvSmplS.clear() ;
|
||||
// elimino l'arco (e sposto l'iteratore alla curva precedente)
|
||||
@@ -2250,12 +2169,10 @@ CurveComposite::ArcsBezierCurvesToArcsPerpExtr( double dLinTol, double dAngTolDe
|
||||
if ( pCC == nullptr)
|
||||
return false ;
|
||||
// inserisco le curve prima dell'originale
|
||||
int nParts = 0 ;
|
||||
PCSD_ITER Iter2 ;
|
||||
for ( Iter2 = pCC->m_CrvSmplS.begin() ; Iter2 != pCC->m_CrvSmplS.end() ; ++ Iter2) {
|
||||
Iter = m_CrvSmplS.insert( Iter, (*Iter2)) ;
|
||||
++ Iter ;
|
||||
++ nParts ;
|
||||
}
|
||||
pCC->m_CrvSmplS.clear() ;
|
||||
// elimino l'arco (e sposto l'iteratore alla curva precedente)
|
||||
|
||||
Reference in New Issue
Block a user