diff --git a/CAvToolSurfTm.cpp b/CAvToolSurfTm.cpp index 7698de6..c45176c 100644 --- a/CAvToolSurfTm.cpp +++ b/CAvToolSurfTm.cpp @@ -519,7 +519,7 @@ CAvToolSurfTm::PrepareHashGrid( void) // pulisco HashGrid 2d m_HGrids.Clear() ; // verifico esistenza superfici - if ( m_vSTM.size() == 0 || m_vBaseInd.size() < m_vSTM.size() + 1) + if ( m_vSTM.empty() || m_vBaseInd.size() < m_vSTM.size() + 1) return false ; // creo HashGrid 2d const int LIM_HG_TRIA = 256 ; diff --git a/CurveComposite.cpp b/CurveComposite.cpp index fd59aec..a1b68c0 100644 --- a/CurveComposite.cpp +++ b/CurveComposite.cpp @@ -2989,7 +2989,7 @@ CurveComposite::RemoveFirstOrLastCurve( bool bLast) m_CrvSmplS.pop_front() ; } // eseguo mini verifica - m_nStatus = ( m_CrvSmplS.size() > 0 ? OK : TO_VERIFY) ; + m_nStatus = ( ! m_CrvSmplS.empty() ? OK : TO_VERIFY) ; // assegno estrusione e spessore della curva composita pCrv->SetExtrusion( m_VtExtr) ; pCrv->SetThickness( m_dThick) ; diff --git a/FontNfe.cpp b/FontNfe.cpp index 3427a4c..7d8df71 100644 --- a/FontNfe.cpp +++ b/FontNfe.cpp @@ -493,7 +493,7 @@ NfeFont::GetTextLines( const string& sText, int nInsPos, PNTVECTOR& vPt, STRVECT int nLbLen ; if ( IsLineBreak( vCode, i, nLbLen)) { // salvo la linea, se contiene qualcosa - if ( vTmpCode.size() > 0) { + if ( ! vTmpCode.empty()) { string sLine ; SetCodePoints( vTmpCode, sLine) ; vLine.push_back( sLine) ; @@ -523,7 +523,7 @@ NfeFont::GetTextLines( const string& sText, int nInsPos, PNTVECTOR& vPt, STRVECT dMaxW = vtMove.x ; } // salvo eventuale ultima linea - if ( vTmpCode.size() > 0) { + if ( ! vTmpCode.empty()) { string sLine ; SetCodePoints( vTmpCode, sLine) ; vLine.push_back( sLine) ; diff --git a/FontOs.cpp b/FontOs.cpp index 08ae540..6a764f7 100644 --- a/FontOs.cpp +++ b/FontOs.cpp @@ -619,7 +619,7 @@ OsFont::GetTextLines( const string& sText, int nInsPos, PNTVECTOR& vPt, STRVECTO int nLbLen ; if ( IsLineBreak( vCode, i, nLbLen)) { // salvo la linea, se contiene qualcosa - if ( vTmpCode.size() > 0) { + if ( ! vTmpCode.empty()) { string sLine ; SetCodePoints( vTmpCode, sLine) ; vLine.push_back( sLine) ; @@ -646,7 +646,7 @@ OsFont::GetTextLines( const string& sText, int nInsPos, PNTVECTOR& vPt, STRVECTO dMaxW = vtMove.x ; } // salvo eventuale ultima linea - if ( vTmpCode.size() > 0) { + if ( ! vTmpCode.empty()) { string sLine ; SetCodePoints( vTmpCode, sLine) ; vLine.push_back( sLine) ; diff --git a/GdbExecutor.cpp b/GdbExecutor.cpp index 8cd2c19..2578387 100644 --- a/GdbExecutor.cpp +++ b/GdbExecutor.cpp @@ -2267,7 +2267,7 @@ bool GdbExecutor::SurfTriMeshEnd( const STRVECTOR& vsParams) { // nessun parametro - if ( vsParams.size() != 0) + if ( ! vsParams.empty()) return false ; // recupero la superficie ISurfTriMesh* pSTM = GetSurfTriMesh( m_pGeoObj) ; @@ -6632,7 +6632,7 @@ GdbExecutor::ExecuteDeselect( const string& sCmd2, const STRVECTOR& vsParams) // deselezione di tutto else if ( sCmd2 == "ALL") { // nessun parametro - if ( vsParams.size() != 0) + if ( ! vsParams.empty()) return false ; // cancello selezione oggetti if ( ! m_pGDB->ClearSelection()) @@ -7773,7 +7773,7 @@ bool GdbExecutor::ExecuteNew( const string& sCmd2, const STRVECTOR& vsParams) { // nessun parametro - if ( vsParams.size() != 0) + if ( ! vsParams.empty()) return false ; // pulizia e reinizializzazione del DB geometrico m_pGDB->Clear() ; @@ -7946,7 +7946,7 @@ GdbExecutor::ExecuteOutTsc( const string& sCmd2, const STRVECTOR& vsParams) // chiudo il file di uscita Tsc else if ( sCmd2 == "CLOSE") { // nessun parametro - if ( vsParams.size() != 0) + if ( ! vsParams.empty()) return false ; // scrivo terminazioni e chiudo il file return m_OutTsc.Close() ; @@ -7969,7 +7969,7 @@ GdbExecutor::ExecuteOutTsc( const string& sCmd2, const STRVECTOR& vsParams) else if ( sCmd2 == "SETGR") { Frame3d frF ; // nessun parametro - if ( vsParams.size() == 0) + if ( vsParams.empty()) frF.Reset() ; // un parametro ( Id del gruppo) else if ( vsParams.size() == 1) { diff --git a/HashGrids1d.cpp b/HashGrids1d.cpp index 3831d6d..3593836 100644 --- a/HashGrids1d.cpp +++ b/HashGrids1d.cpp @@ -571,7 +571,7 @@ HashGrids1d::Update( void) // Salvo stato di precedente attivazione delle griglie bool bGridActivePrev = m_bGridActive ; // Inseriamo gli oggetti presenti nel vettore m_objsToAdd - if ( m_objsToAdd.size() > 0 ) { + if ( ! m_objsToAdd.empty()) { for ( auto pObj : m_objsToAdd) { if ( m_bGridActive) addGrid( *pObj) ; @@ -636,7 +636,7 @@ HashGrids1d::Find( const BBox3d& b3Test, INTVECTOR& vnIds) const sort( vnIds.begin(), vnIds.end()) ; vnIds.erase( unique( vnIds.begin(), vnIds.end()), vnIds.end()) ; - return ( vnIds.size() > 0) ; + return ( ! vnIds.empty()) ; } //---------------------------------------------------------------------------- diff --git a/HashGrids2d.cpp b/HashGrids2d.cpp index 9aa6985..6d3bd31 100644 --- a/HashGrids2d.cpp +++ b/HashGrids2d.cpp @@ -625,7 +625,7 @@ HashGrids2d::Update( void) // Salvo stato di precedente attivazione delle griglie bool bGridActivePrev = m_bGridActive ; // Inseriamo gli oggetti presenti nel vettore m_objsToAdd - if ( m_objsToAdd.size() > 0 ) { + if ( ! m_objsToAdd.empty()) { for ( auto pObj : m_objsToAdd) { if ( m_bGridActive) addGrid( *pObj) ; @@ -690,7 +690,7 @@ HashGrids2d::Find( const BBox3d& b3Test, INTVECTOR& vnIds) const sort( vnIds.begin(), vnIds.end()) ; vnIds.erase( unique( vnIds.begin(), vnIds.end()), vnIds.end()) ; - return ( vnIds.size() > 0) ; + return ( ! vnIds.empty()) ; } //---------------------------------------------------------------------------- diff --git a/HashGrids3d.cpp b/HashGrids3d.cpp index 199da94..a071487 100644 --- a/HashGrids3d.cpp +++ b/HashGrids3d.cpp @@ -669,7 +669,7 @@ HashGrids3d::Update( void) // Salvo stato di precedente attivazione delle griglie bool bGridActivePrev = m_bGridActive ; // Inseriamo gli oggetti presenti nel vettore m_objsToAdd - if ( m_objsToAdd.size() > 0 ) { + if ( ! m_objsToAdd.empty()) { for ( auto pObj : m_objsToAdd) { if ( m_bGridActive) addGrid( *pObj) ; @@ -733,7 +733,7 @@ HashGrids3d::Find( const BBox3d& b3Test, INTVECTOR& vnIds) const sort( vnIds.begin(), vnIds.end()) ; vnIds.erase( unique( vnIds.begin(), vnIds.end()), vnIds.end()) ; - return ( vnIds.size() > 0) ; + return ( ! vnIds.empty()) ; } diff --git a/IntersCurveCurve.cpp b/IntersCurveCurve.cpp index f076dea..99e3431 100644 --- a/IntersCurveCurve.cpp +++ b/IntersCurveCurve.cpp @@ -253,7 +253,7 @@ bool IntersCurveCurve::AdjustIntersParams( bool bAdjCrvA, bool bAdjCrvB) { // se non ci sono intersezioni, non va fatto alcunché - if ( m_Info.size() == 0) + if ( m_Info.empty()) return true ; // se le curve originali non sono state approssimate, non va fatto alcunché if ( ! bAdjCrvA && ! bAdjCrvB) diff --git a/IntersCurveSurfTm.cpp b/IntersCurveSurfTm.cpp index 0c564c2..9f4c0ff 100644 --- a/IntersCurveSurfTm.cpp +++ b/IntersCurveSurfTm.cpp @@ -44,7 +44,7 @@ static void OrderInfoIntersCurveSurfTm( ICSIVECTOR& vInfo) { // se non trovati, esco - if ( vInfo.size() == 0) + if ( vInfo.empty()) return ; // ordino il vettore delle intersezioni secondo il senso crescente del parametro di linea sort( vInfo.begin(), vInfo.end(), diff --git a/IntersLineSurfBez.cpp b/IntersLineSurfBez.cpp index e8e8018..1cfabe9 100644 --- a/IntersLineSurfBez.cpp +++ b/IntersLineSurfBez.cpp @@ -83,7 +83,7 @@ static void OrderInfoIntersLineSurfBz( ILSBIVECTOR& vInfo) { // se non trovati, esco - if ( vInfo.size() == 0) + if ( vInfo.empty()) return ; // ordino il vettore delle intersezioni secondo il senso crescente del parametro di linea sort( vInfo.begin(), vInfo.end(), diff --git a/IntersLineSurfStd.cpp b/IntersLineSurfStd.cpp index 41a2ae8..8123316 100644 --- a/IntersLineSurfStd.cpp +++ b/IntersLineSurfStd.cpp @@ -1670,7 +1670,7 @@ LineTorus( const Point3d& ptLine, const Vector3d& vtLine, // Studio le soluzioni int nIntType = T_ERROR ; - if ( vdPar.size() == 0) + if ( vdPar.empty()) nIntType = T_NO_INT ; else if ( vdPar.size() == 1) { nIntType = T_ONE_TAN ; diff --git a/IntersLineSurfTm.cpp b/IntersLineSurfTm.cpp index b6dfd54..35f868b 100644 --- a/IntersLineSurfTm.cpp +++ b/IntersLineSurfTm.cpp @@ -45,7 +45,7 @@ static void OrderInfoIntersLineSurfTm( ILSIVECTOR& vInfo) { // se non trovati, esco - if ( vInfo.size() == 0) + if ( vInfo.empty()) return ; // ordino il vettore delle intersezioni secondo il senso crescente del parametro di linea sort( vInfo.begin(), vInfo.end(), diff --git a/OffsetCurve.cpp b/OffsetCurve.cpp index ce81bf7..f6974a2 100644 --- a/OffsetCurve.cpp +++ b/OffsetCurve.cpp @@ -697,7 +697,7 @@ OffsetCurve::Make( const ICurve* pCrv, double dDist, int nType) // calcolo offset con Voronoi ICURVEPOVECTOR vOffs ; voronoiObj->CalcOffset( vOffs, dDist, nType) ; - if ( vOffs.size() == 0) { + if ( vOffs.empty()) { // se non ho ottenuto offset e sono circa al valore limite ritento con valore leggermente diverso per le tolleranze di vroni double dMaxOffs ; if ( ! pCrv->IsClosed() || ( voronoiObj->CalcLimitOffset( 0, dDist < 0, dMaxOffs) && abs( dMaxOffs - abs( dDist)) < EPS_SMALL)) { diff --git a/PointGrid3d.cpp b/PointGrid3d.cpp index a01cde1..1d7f9fa 100644 --- a/PointGrid3d.cpp +++ b/PointGrid3d.cpp @@ -195,7 +195,7 @@ PointGrid3d::Find( const Point3d& ptTest, double dTol, INTVECTOR& vnIds) const } } - return ( vnIds.size() > 0) ; + return ( ! vnIds.empty()) ; } //---------------------------------------------------------------------------- @@ -221,7 +221,7 @@ PointGrid3d::Find( const BBox3d& b3Test, INTVECTOR& vnIds) const } } - return ( vnIds.size() > 0) ; + return ( ! vnIds.empty()) ; } //---------------------------------------------------------------------------- diff --git a/PolyArc.cpp b/PolyArc.cpp index d6f18b8..32e5f57 100644 --- a/PolyArc.cpp +++ b/PolyArc.cpp @@ -62,7 +62,7 @@ bool PolyArc::AddUPoint( double dPar, const Point3d& ptP, double dBulge) { // se il punto è uguale al precedente (ignoro parametro e bulge), non lo inserisco ma ok - if ( m_lUPointBs.size() > 0 && AreSamePointApprox( ptP, m_lUPointBs.back().ptP)) { + if ( ! m_lUPointBs.empty() && AreSamePointApprox( ptP, m_lUPointBs.back().ptP)) { // assegno parametro e bulge m_lUPointBs.back().dU = dPar ; m_lUPointBs.back().dB = dBulge ; @@ -285,10 +285,10 @@ bool PolyArc::Join( PolyArc& PA, double dOffsetPar) { // se l'altro poliarco non contiene alcunchè, esco con ok - if ( PA.m_lUPointBs.size() == 0) + if ( PA.m_lUPointBs.empty()) return true ; // verifico che l'ultimo punto di questo poliarco coincida con il primo dell'altro - if ( m_lUPointBs.size() > 0 && ! AreSamePointApprox( m_lUPointBs.back().ptP, PA.m_lUPointBs.front().ptP)) + if ( ! m_lUPointBs.empty() && ! AreSamePointApprox( m_lUPointBs.back().ptP, PA.m_lUPointBs.front().ptP)) return false ; // cancello l'ultimo di questo EraseLastUPoint() ; diff --git a/PolyLine.cpp b/PolyLine.cpp index c805725..d9cd847 100644 --- a/PolyLine.cpp +++ b/PolyLine.cpp @@ -54,7 +54,7 @@ PolyLine::AddUPoint( double dPar, const Point3d& ptP, bool bEndOrStart) // se da aggiungere in coda if ( bEndOrStart) { // se il punto è uguale all'ultimo (ignoro parametro), non lo inserisco ma ok - if ( m_lUPoints.size() > 0 && AreSamePointApprox( ptP, m_lUPoints.back().first)) { + if ( ! m_lUPoints.empty() && AreSamePointApprox( ptP, m_lUPoints.back().first)) { ++ m_nRejected ; return true ; } @@ -69,7 +69,7 @@ PolyLine::AddUPoint( double dPar, const Point3d& ptP, bool bEndOrStart) // altrimenti si aggiunge in testa else { // se il punto è uguale al primo (ignoro parametro), non lo inserisco ma ok - if ( m_lUPoints.size() > 0 && AreSamePointApprox( ptP, m_lUPoints.front().first)) { + if ( ! m_lUPoints.empty() && AreSamePointApprox( ptP, m_lUPoints.front().first)) { ++ m_nRejected ; return true ; } @@ -234,10 +234,10 @@ bool PolyLine::Join( PolyLine& PL, double dOffsetPar) { // se l'altra polilinea non contiene alcunchè, esco con ok - if ( PL.m_lUPoints.size() == 0) + if ( PL.m_lUPoints.empty()) return true ; // verifico che l'ultimo punto di questa polilinea coincida con il primo dell'altra - if ( m_lUPoints.size() > 0 && ! AreSamePointApprox( m_lUPoints.back().first, PL.m_lUPoints.front().first)) + if ( ! m_lUPoints.empty() && ! AreSamePointApprox( m_lUPoints.back().first, PL.m_lUPoints.front().first)) return false ; // cancello l'ultimo di questa EraseLastUPoint() ; @@ -1326,7 +1326,7 @@ bool PolyLine::Trim( const Plane3d& plPlane, bool bInVsOut) { // se vuota non faccio alcunché - if ( m_lUPoints.size() == 0) + if ( m_lUPoints.empty()) return false ; // determino le intersezioni dei lati con il piano diff --git a/SelfIntersCurve.cpp b/SelfIntersCurve.cpp index 690256d..8eb784c 100644 --- a/SelfIntersCurve.cpp +++ b/SelfIntersCurve.cpp @@ -135,7 +135,7 @@ bool SelfIntersCurve::AdjustIntersParams( bool bAdjCrv, const ICurve* pCalcCrv, const DBLVECTOR& vCalcPar) { // se la curva originale non è stata approssimata o non ci sono auto-intersezioni, non va fatto alcunché - if ( ! bAdjCrv || m_Info.size() == 0) + if ( ! bAdjCrv || m_Info.empty()) return true ; // procedo ad aggiustare for ( auto& aInfo : m_Info) { diff --git a/SurfBezier.cpp b/SurfBezier.cpp index 2d4db16..62f4f17 100644 --- a/SurfBezier.cpp +++ b/SurfBezier.cpp @@ -828,7 +828,7 @@ bool SurfBezier::Validate( void) { if ( m_nStatus == TO_VERIFY) - m_nStatus = ( ( m_nDegU * m_nDegV > 0 && m_vPtCtrl.size() > 0) ? OK : ERR) ; + m_nStatus = ( ( m_nDegU * m_nDegV > 0 && ! m_vPtCtrl.empty()) ? OK : ERR) ; return ( m_nStatus == OK) ; } @@ -2143,38 +2143,38 @@ struct hash { // Compute individual hash values for first, second and third and combine them using XOR and bit shifting: return ((hash()(get<0>(t))) ^ (hash()(get<1>(t)) << 1) >> 1) ^ (hash()(get<2>(t)) << 1) ; } -}; +} ; //---------------------------------------------------------------------------- ISurfFlatRegion* SurfBezier::CreateTrimRegionFromCuts( ICRVCOMPOPOVECTOR& vpCCOpen, ICRVCOMPOPOVECTOR& vpCCClosed) const { - //comincio a creare la superficie aggiungendo i tagli aperti ai bordi attualmente esistenti + // comincio a creare la superficie aggiungendo i tagli aperti ai bordi attualmente esistenti SurfFlatRegionByContours sfrContour ; if ( int(vpCCOpen.size()) != 0 ) { - // recupero la regione attuale + // recupero la regione attuale PtrOwner pNewTrim( CreateBasicSurfFlatRegion()) ; if ( m_bTrimmed) pNewTrim.Set( GetTrimRegion()->Clone()) ; else pNewTrim.Set( GetSurfFlatRegionRectangle( SBZ_TREG_COEFF * m_nSpanU, SBZ_TREG_COEFF * m_nSpanV)) ; - // costruisco la mappa delle intersezioni, trovando tutte le intersezioni tra i trim e i loop dei vari chunk della falr region + // costruisco la mappa delle intersezioni, trovando tutte le intersezioni tra i trim e i loop dei vari chunk della falr region unordered_map mInters ; int nInters = 0 ; bool bStartFound = false ; bool bEndFound = false ; - // trim + // trim for ( int t = 0 ; t < int( vpCCOpen.size()); ++t) { nInters = 0 ; bStartFound = false ; bEndFound = false ; - //chunk + // chunk for ( int c = 0 ; c < pNewTrim->GetChunkCount() ; ++c) { - // loop + // loop for ( int l = 0 ; l < pNewTrim->GetLoopCount( c) ; ++l) { PtrOwner pLoop( pNewTrim->GetLoop( c, l)) ; - // prima curva è il loop, seconda curva è il trim + // prima curva è il loop, seconda curva è il trim IntersCurveCurve icc( *pLoop, *vpCCOpen[t]) ; if ( icc.GetIntersCount() != 0) { ICCIVECTOR vICC ; @@ -2199,7 +2199,7 @@ SurfBezier::CreateTrimRegionFromCuts( ICRVCOMPOPOVECTOR& vpCCOpen, ICRVCOMPOPOVE } } if ( nInters != 2) { - // se un trim non fa 2 intersezioni allora devo estendere la curva allo start e/o all'end per creare le intersezioni + // se un trim non fa 2 intersezioni allora devo estendere la curva allo start e/o all'end per creare le intersezioni Point3d ptStart ; vpCCOpen[t]->GetStartPoint( ptStart) ; Point3d ptEnd ; vpCCOpen[t]->GetEndPoint( ptEnd) ; PtrOwner pCrv( vpCCOpen[t]->Clone()) ; @@ -2210,19 +2210,19 @@ SurfBezier::CreateTrimRegionFromCuts( ICRVCOMPOPOVECTOR& vpCCOpen, ICRVCOMPOPOVE if ( ! bEndFound) pCrv->ExtendEndByLen( dExtension) ; double dDistStart = 1e6, dDistEnd = 1e6 ; - // vettore per l'intersezione di start + // vettore per l'intersezione di start ICCIVECTOR vICCStart ; vICCStart.emplace_back() ; - // vettore per l'intersezione di end + // vettore per l'intersezione di end ICCIVECTOR vICCEnd ; vICCEnd.emplace_back() ; TRINT tStart, tEnd ; - //chunk + // chunk for ( int c = 0 ; c < pNewTrim->GetChunkCount() ; ++c) { - // loop + // loop for ( int l = 0 ; l < pNewTrim->GetLoopCount( c) ; ++l) { PtrOwner pLoop( pNewTrim->GetLoop( c, l)) ; - // prima curva è il loop, seconda curva è il trim + // prima curva è il loop, seconda curva è il trim IntersCurveCurve icc( *pLoop, *pCrv) ; if ( icc.GetIntersCount() != 0) { for ( int i = 0 ; i < int( icc.GetIntersCount()); ++i) { @@ -2242,29 +2242,29 @@ SurfBezier::CreateTrimRegionFromCuts( ICRVCOMPOPOVECTOR& vpCCOpen, ICRVCOMPOPOVE } } - // ricostruisco gli elementi per la mappa mInters + // ricostruisco gli elementi per la mappa mInters if ( ! bStartFound && ! bEndFound) { - // ridefinisco il taglio aperto con la sua versione estesa che arriva a toccare i loop dello spazio parametrico + // ridefinisco il taglio aperto con la sua versione estesa che arriva a toccare i loop dello spazio parametrico vpCCOpen[t].Set( GetCurveComposite(pCrv->CopyParamRange( vICCStart[0].IciB->dU, vICCEnd[0].IciB->dU))) ; - // correggo il parametro dell'intersezione allo start + // correggo il parametro dell'intersezione allo start vICCStart[0].IciB->dU = 0 ; if ( tStart == tEnd) { - // se ho intersezione con un loop solo allora accorpo i due vettori delle intersezioni + // se ho intersezione con un loop solo allora accorpo i due vettori delle intersezioni vICCStart.emplace_back( vICCEnd[0]) ; mInters.insert( pair(tStart, vICCStart)) ; } else{ - // se ho intersezione con due loop diverse due entry diverse le inserisco + // se ho intersezione con due loop diverse due entry diverse le inserisco mInters.insert( pair(tStart, vICCStart)) ; mInters.insert( pair(tEnd, vICCEnd)) ; } } else { - // devo verificare se avevo già trovato una delle due intersezioni e se era sullo stesso loop o no + // devo verificare se avevo già trovato una delle due intersezioni e se era sullo stesso loop o no if ( ! bStartFound) { pCrv->TrimStartAtParam( vICCStart[0].IciB->dU) ; vpCCOpen[t].Set( GetCurveComposite( Release( pCrv))) ; - // correggo il parametro dell'intersezione allo start + // correggo il parametro dell'intersezione allo start vICCStart[0].IciB->dU = 0 ; if ( mInters.count( tStart) == 1) mInters[tStart].emplace_back( vICCStart[0]) ; @@ -2283,21 +2283,21 @@ SurfBezier::CreateTrimRegionFromCuts( ICRVCOMPOPOVECTOR& vpCCOpen, ICRVCOMPOPOVE } } - // vettore di flag che mi indica quali tagli aperti sono stati aggiunti al nuovo bordo + // vettore di flag che mi indica quali tagli aperti sono stati aggiunti al nuovo bordo BOOLVECTOR vbAdded( vpCCOpen.size()) ; fill( vbAdded.begin(), vbAdded.end(), false) ; PtrOwner pCCNewEdge( CreateCurveComposite()) ; PtrOwner pCL( CreateCurveLine()) ; TRINT tiFirstInters ; - // parto aggiungendo il primo taglio + // parto aggiungendo il primo taglio int nNewToAdd = 0 ; bool bFirstCurveOfEdge = true ; while ( nNewToAdd != -1) { - // aggiungo il taglio + // aggiungo il taglio pCCNewEdge->AddCurve( Release( vpCCOpen[nNewToAdd])) ; - // aggiorno la lista degli aggiunti + // aggiorno la lista degli aggiunti vbAdded[nNewToAdd] = true ; - // di questo taglio mi salvo il chunk e loop di start e end + // di questo taglio mi salvo il chunk e loop di start e end TRINT tiStart, tiEnd ; for (const auto& pair : mInters) { if ( get<2>(pair.first) == nNewToAdd ) { @@ -2305,7 +2305,7 @@ SurfBezier::CreateTrimRegionFromCuts( ICRVCOMPOPOVECTOR& vpCCOpen, ICRVCOMPOPOVE if ( pair.second[p].IciB->dU < EPS_SMALL) { tiStart = pair.first ; if ( bFirstCurveOfEdge){ - // salvo l'inizio del taglio che è la prima curva di questa curva compo + // salvo l'inizio del taglio che è la prima curva di questa curva compo tiFirstInters = pair.first ; bFirstCurveOfEdge = false ; } @@ -2316,22 +2316,22 @@ SurfBezier::CreateTrimRegionFromCuts( ICRVCOMPOPOVECTOR& vpCCOpen, ICRVCOMPOPOVE } } - // devo trovare fino a che punto seguire il loop che ho trovato come prosecuzione del taglio corrente - // devo quindi trovare la prossima intersezione con un taglio + // devo trovare fino a che punto seguire il loop che ho trovato come prosecuzione del taglio corrente + // devo quindi trovare la prossima intersezione con un taglio int nInters = -1 ; double dNextCut = INFINITO ; double dEndCurrentCut ; for ( int i = 0 ; i < int( mInters[tiEnd].size()); ++i) { - // se ho trovato l'intersezione con la fine del taglio corrente, salvo il parametro sul loop + // se ho trovato l'intersezione con la fine del taglio corrente, salvo il parametro sul loop if ( mInters[tiEnd][i].IciB->dU > EPS_SMALL) dEndCurrentCut = mInters[tiEnd][i].IciA->dU ; } - // se non trovo nessuna altra intersezione prima della fine del loop allora devo ripetere tutto cercando a partire dall'inizio del loop + // se non trovo nessuna altra intersezione prima della fine del loop allora devo ripetere tutto cercando a partire dall'inizio del loop for ( const auto& pair : mInters) { if ( get<0>(pair.first) == get<0>(tiEnd) && get<1>(pair.first) == get<1>(tiEnd)) { for ( int i = 0 ; i < int(pair.second.size()); ++i ) { - // se trovo una nuova intersezione che incontro prima di quella che mi ero salvato precedentemente allora - // mi salvo questa nuova che ho trovato + // se trovo una nuova intersezione che incontro prima di quella che mi ero salvato precedentemente allora + // mi salvo questa nuova che ho trovato if ( pair.second[i].IciA->dU < dNextCut && pair.second[i].IciA->dU > dEndCurrentCut) { dNextCut = pair.second[i].IciA->dU ; nInters = get<2>(pair.first) ; @@ -2344,8 +2344,8 @@ SurfBezier::CreateTrimRegionFromCuts( ICRVCOMPOPOVECTOR& vpCCOpen, ICRVCOMPOPOVE for ( const auto& pair : mInters) { if ( get<0>(pair.first) == get<0>(tiEnd) && get<1>(pair.first) == get<1>(tiEnd)) { for ( int i = 0 ; i < int(pair.second.size()); ++i ) { - // se trovo una nuova intersezione che incontro prima di quella che mi ero salvato precedentemente allora - // mi salvo questa nuova che ho trovato + // se trovo una nuova intersezione che incontro prima di quella che mi ero salvato precedentemente allora + // mi salvo questa nuova che ho trovato if ( pair.second[i].IciA->dU < dNextCut) { dNextCut = pair.second[i].IciA->dU ; nInters = get<2>(pair.first) ; @@ -2355,19 +2355,19 @@ SurfBezier::CreateTrimRegionFromCuts( ICRVCOMPOPOVECTOR& vpCCOpen, ICRVCOMPOPOVE } } - // se tutto va bene queste due righe sostituiscono tutto il casino qua sotto + // se tutto va bene queste due righe sostituiscono tutto il casino qua sotto PtrOwner pLoopTrimmed( pNewTrim->GetLoop( get<0>(tiEnd), get<1>(tiEnd))) ; pCCNewEdge->AddCurve(pLoopTrimmed->CopyParamRange( dEndCurrentCut, dNextCut)) ; - // se il prossimo taglio identificato è quello da cui sono partito allora aggiungo il bordo ricostruito fino a questo momento - // alla flat region e comincio a costruire un altro bordo - // altrimenti continuo ad aggiungere curve al bordo corrente + // se il prossimo taglio identificato è quello da cui sono partito allora aggiungo il bordo ricostruito fino a questo momento + // alla flat region e comincio a costruire un altro bordo + // altrimenti continuo ad aggiungere curve al bordo corrente if ( nInters == get<2>(tiFirstInters) ) { pCCNewEdge->Close() ; sfrContour.AddCurve( Release( pCCNewEdge)) ; pCCNewEdge.Set( CreateBasicCurveComposite()) ; bFirstCurveOfEdge = true ; - // trovo il prossimo taglio ancora da aggiungere + // trovo il prossimo taglio ancora da aggiungere nNewToAdd = -1 ; for ( int b = 0 ; b < int(vbAdded.size()) ; ++b ) { if ( ! vbAdded[b]) { @@ -2381,9 +2381,9 @@ SurfBezier::CreateTrimRegionFromCuts( ICRVCOMPOPOVECTOR& vpCCOpen, ICRVCOMPOPOVE } } - // devo verificare se devo aggiungere anche il bordo ( basta verificare se il primo loop chiuso è CCW) + // devo verificare se devo aggiungere anche il bordo ( basta verificare se il primo loop chiuso è CCW) double dArea ; - if( vpCCClosed.size() != 0) { + if ( ! vpCCClosed.empty()) { vpCCClosed[0]->GetAreaXY( dArea) ; if ( dArea < EPS_SMALL ) { PolyLine plEdge ; @@ -3005,16 +3005,16 @@ SurfBezier::UnprojectPoint( const Point3d& pt3D, Point3d& ptParam, const Point3d bool SurfBezier::CalcPoles( void) const { - if ( m_vbPole.size() != 0) + if ( ! m_vbPole.empty()) return true ; - // la funzione identifica se degli edge della superficie non trimmata sono in realtà dei poli + // la funzione identifica se degli edge della superficie non trimmata sono in realtà dei poli for ( int i = 0 ; i < 4 ; ++i) m_vbPole.emplace_back( true) ; - // scorro i punti di controllo e vedo subito + // scorro i punti di controllo e vedo subito bool bOk = false ; bool bPole0 = true, bPole1 = true ; Point3d ptU0, ptU1 ; - // controllo l'edge 0 e 2 per vedere se tutti i punti dell'edge sono coincidenti + // controllo l'edge 0 e 2 per vedere se tutti i punti dell'edge sono coincidenti Point3d ptP00 = GetControlPoint( 0, &bOk) ; Point3d ptP10 = GetControlPoint( m_nDegU * m_nSpanU, &bOk) ; for ( int i = 1 ; i < m_nDegV * m_nSpanV + 1 ; ++ i) { @@ -3027,7 +3027,7 @@ SurfBezier::CalcPoles( void) const } m_vbPole[1] = bPole0 ; // u = 0 corrisponde all'edge 1 m_vbPole[3] = bPole1 ; // u = 1 corrisponde all'edge 3 - // controllo l'edge 1 e 3 per vedere se tutti i punti dell'edge sono coincidenti + // controllo l'edge 1 e 3 per vedere se tutti i punti dell'edge sono coincidenti Point3d ptV0, ptV1 ; Point3d ptP01 = GetControlPoint( ( m_nDegU * m_nSpanU + 1) * ( m_nDegV * m_nSpanV), &bOk) ; bPole0 = true ; @@ -3402,7 +3402,7 @@ SurfBezier::GetLoops( ICRVCOMPOPOVECTOR& vCC, bool bLineOrBezier, int nEdge) con ICurveComposite* SurfBezier::GetSingleEdge3D( bool bLineOrBezier, int nEdge) const { - if ( m_mCCEdge.size() == 0 && bLineOrBezier) + if ( m_mCCEdge.empty() && bLineOrBezier) GetAuxSurf() ; // questa funzione dà per scontato che la superficie NON sia trimmata if ( nEdge < 0 || nEdge > 3 || m_bTrimmed) diff --git a/SurfFlatRegion.cpp b/SurfFlatRegion.cpp index 6747bcb..8c6db87 100644 --- a/SurfFlatRegion.cpp +++ b/SurfFlatRegion.cpp @@ -143,7 +143,7 @@ SurfFlatRegion::AddSimpleExtLoop( ICurve* pCrv, bool& bAdded) if ( dArea < SQ_EPS_SMALL) return true ; // se sto costruendo il primo chunk - if ( m_vExtInd.size() == 0) { + if ( m_vExtInd.empty()) { // assegno il riferimento intrinseco if ( ! m_frF.Set( ORIG + plPlane.GetVersN() * plPlane.GetDist(), plPlane.GetVersN())) return false ; diff --git a/SurfFlatRegionBooleans.cpp b/SurfFlatRegionBooleans.cpp index 1d70bc0..cbd5ef9 100644 --- a/SurfFlatRegionBooleans.cpp +++ b/SurfFlatRegionBooleans.cpp @@ -168,7 +168,7 @@ SurfFlatRegion::Subtract( const ISurfFlatRegion& Other) // creo una nuova regione a partire da questi loop PtrOwner pSfr ; - if ( vpLoop.size() == 0) + if ( vpLoop.empty()) pSfr.Set( new( nothrow) SurfFlatRegion) ; else pSfr.Set( MyNewSurfFromLoops( vpLoop)) ; @@ -258,7 +258,7 @@ SurfFlatRegion::Intersect( const ISurfFlatRegion& Other) // creo una nuova regione a partire da questi loop PtrOwner pSfr ; - if ( vpLoop.size() == 0) + if ( vpLoop.empty()) pSfr.Set( new( nothrow) SurfFlatRegion) ; else pSfr.Set( MyNewSurfFromLoops( vpLoop)) ; diff --git a/SurfFlatRegionOffset.cpp b/SurfFlatRegionOffset.cpp index 30e30a5..53435ee 100644 --- a/SurfFlatRegionOffset.cpp +++ b/SurfFlatRegionOffset.cpp @@ -148,7 +148,7 @@ SurfFlatRegion::CreateOffsetSurf( double dDist, int nType) const return nullptr ; // costruisco la superficie - if ( vOffs.size() > 0) { + if ( ! vOffs.empty()) { PCRV_DEQUE vLoops ; for ( int i = 0 ; i < int( vOffs.size()) ; i ++) { vOffs[i]->ToLoc( m_frF) ; @@ -162,7 +162,7 @@ SurfFlatRegion::CreateOffsetSurf( double dDist, int nType) const } // verifico di avere ancora dei loops - if ( vLoops.size() > 0) { + if ( ! vLoops.empty()) { pSfr.Set( MyNewSurfFromLoops( vLoops)) ; if ( IsNull( pSfr)) { MyTestAndDelete( vLoops) ; diff --git a/SurfTriMeshBooleans.cpp b/SurfTriMeshBooleans.cpp index c8a2e8c..ff10d40 100644 --- a/SurfTriMeshBooleans.cpp +++ b/SurfTriMeshBooleans.cpp @@ -56,7 +56,7 @@ SurfTriMesh::DecomposeLoop( CHAINVECTOR& cvOpenChain, INTVECTOR& vnDegVec, PNTMA // Divido il loop di partenza in sotto-loop int nIterationCount = 0 ; - while ( cvOpenChain.size() > 0) { // per ogni catena aperta... + while ( ! cvOpenChain.empty()) { // per ogni catena aperta... bool bLoopSplitted = false ; int nLastOpenLoopN = int( cvOpenChain.size()) - 1 ; if ( vnDegVec[nLastOpenLoopN] == 1) { @@ -287,7 +287,7 @@ SurfTriMesh::RetriangulationForBooleanOperation( CHAINMAP& LoopLines, TRIA3DVECT } // Recupero i concatenamenti INTVECTOR vIds ; - Point3d ptNearStart = ( it->second.size() > 0 ? it->second[0].ptSt : ORIG) ; + Point3d ptNearStart = ( ! it->second.empty() ? it->second[0].ptSt : ORIG) ; CHAINVECTOR vChain ; while ( LoopCreator.GetChainFromNear( ptNearStart, false, vIds)) { Chain chTemp ; @@ -713,7 +713,7 @@ SurfTriMesh::RetriangulationForBooleanOperation( CHAINMAP& LoopLines, TRIA3DVECT } } - if ( vInnerLoop.size() == 0 || bDouble) { + if ( vInnerLoop.empty() || bDouble) { // Eseguo triangolazione PNTVECTOR vPt ; INTVECTOR vTr ; diff --git a/SurfTriMeshCuts.cpp b/SurfTriMeshCuts.cpp index ec8da01..f6bcbec 100644 --- a/SurfTriMeshCuts.cpp +++ b/SurfTriMeshCuts.cpp @@ -613,7 +613,7 @@ SurfTriMesh::GeneralizedCut( const ICurve& cvCurve, bool bSaveOnEq) ++ it ; } // Se più di una catena chiusa oppure catene chiuse e aperte, errore - if ( cvClosedChain.size() > 1 || ( cvClosedChain.size() > 0 && int( cvOpenChain.size()) > 0)) { + if ( cvClosedChain.size() > 1 || ( ! cvClosedChain.empty() && ! cvOpenChain.empty())) { Scale( frScalingRef, 1. / CUT_SCALE, 1. / CUT_SCALE, 1. / CUT_SCALE) ; return false ; } @@ -676,7 +676,7 @@ SurfTriMesh::GeneralizedCut( const ICurve& cvCurve, bool bSaveOnEq) } // Loop aperti, devo chiuderli - else if ( cvOpenChain.size() > 0) { + else if ( ! cvOpenChain.empty()) { // Creo il loop chiuso padre di tutti, il perimetro del triangolo. // Questo viene diviso in sotto-loop chiusi mediante quelli aperti. // I loop chiusi trovati precedentemente sono interni a uno dei sotto-loop @@ -691,7 +691,7 @@ SurfTriMesh::GeneralizedCut( const ICurve& cvCurve, bool bSaveOnEq) BOOLVECTOR vbInOut ; vbInOut.push_back( true) ; // Divido il loop di partenza in sotto-loop - while ( cvOpenChain.size() > 0) { + while ( ! cvOpenChain.empty()) { int nLastOpenLoopN = int( cvOpenChain.size()) - 1 ; for ( int nLoop = 0 ; nLoop < int( cvBoundClosedLoopVec.size()) ; ++ nLoop) { // Estremi del loop aperto diff --git a/SurfTriMeshFaceting.cpp b/SurfTriMeshFaceting.cpp index 2f99525..bbb1529 100644 --- a/SurfTriMeshFaceting.cpp +++ b/SurfTriMeshFaceting.cpp @@ -644,7 +644,7 @@ SurfTriMesh::GetFacetCenter( int nF, Point3d& ptCen, Vector3d& vtN) const { // recupero i loop della faccia POLYLINEVECTOR vPL ; - if ( ! GetFacetLoops( nF, vPL) || vPL.size() == 0) + if ( ! GetFacetLoops( nF, vPL) || vPL.empty()) return false ; // calcolo il centro del loop esterno (è il primo) PolygonPlane PolyPlane ; @@ -682,7 +682,7 @@ SurfTriMesh::GetFacetArea( int nF, double& dArea) const { // recupero i loop della faccia POLYLINEVECTOR vPL ; - if ( ! GetFacetLoops( nF, vPL) || vPL.size() == 0) + if ( ! GetFacetLoops( nF, vPL) || vPL.empty()) return false ; // sommo le aree dei diversi loop (quelli interni hanno area negativa) dArea = 0 ; diff --git a/SurfTriMeshUtilities.cpp b/SurfTriMeshUtilities.cpp index 2f4cb2e..4bbc787 100644 --- a/SurfTriMeshUtilities.cpp +++ b/SurfTriMeshUtilities.cpp @@ -539,10 +539,10 @@ bool SurfTriMesh::AddChainToChain( const Chain& ChainToAdd, PNTVECTOR& OrigChain) { // Se la catena da aggiungere è vuota, non devo fare alcunchè - if ( ChainToAdd.size() == 0) + if ( ChainToAdd.empty()) return true ; // Se la catena originale è vuota, non è possibile aggiungere nulla - if ( OrigChain.size() == 0) + if ( OrigChain.empty()) return false ; // Se la catena originale è chiusa non posso aggiungere nulla int nLastOrig = max( int( OrigChain.size()) - 1, 0) ; diff --git a/Tree.cpp b/Tree.cpp index 733a359..5addbcf 100644 --- a/Tree.cpp +++ b/Tree.cpp @@ -94,7 +94,7 @@ Tree::LimitLoop( PolyLine& pl, POLYLINEVECTOR& vPl, BOOLVECTOR& vbOrientation) c for ( int i = 0 ; i < int( vCrvClass.size()) ; ++i) { if ( vCrvClass[i].nClass != CRVC_OUT) { // se continua la curva precedente allora la giunta - if ( vCC.size() != 0 && vCrvClass[i].dParS == vCrvClass[nLast].dParE) + if ( ! vCC.empty() && vCrvClass[i].dParS == vCrvClass[nLast].dParE) vCC.back()->AddCurve( (*itCrv)->CopyParamRange( vCrvClass[i].dParS, vCrvClass[i].dParE)) ; // sennò creo una nuova curva else @@ -1589,7 +1589,7 @@ Tree::GetPolygons( POLYLINEMATRIX& vvPolygons, POLYLINEMATRIX& vPolygonsBasic3d) bool Tree::GetPolygons( POLYLINEMATRIX& vvPolygons, bool bForTriangulation, POLYLINEMATRIX& vvPolygons3d) { - if ( (int) m_vPolygons.size() == 0) { + if ( m_vPolygons.empty()) { if ( ! m_bTrimmed) { vvPolygons.clear() ; POLYLINEVECTOR vPolygonsBasic ; @@ -1673,17 +1673,17 @@ Tree::GetPolygons( POLYLINEMATRIX& vvPolygons, bool bForTriangulation, POLYLINEM // vettore in cui salvo i loop che non appartengono al poligono che sto cotruendo nel ciclo attuale e da cui ripasserò dopo INTVECTOR vToCheck( (int) m_mTree[nId].m_vInters.size()) ; //generate_n( vToCheck.begin(), (int) m_mTree[nId].m_vInters.size(), generator()) ; - iota (vToCheck.begin(), vToCheck.end(), 0) ; + iota( vToCheck.begin(), vToCheck.end(), 0) ; // numero di poligoni aggiunti int nPoly = 0 ; // scorro sui vettori intersezione della cella nId e sui suoi vertici // in questo for analizzo solo i loop che tagliano la cella - while( (int)vToCheck.size() != 0) { + while ( ! vToCheck.empty()) { int nPolyBefore = nPoly ; PolyLine pl3d ; - if( bForTriangulation) + if ( bForTriangulation) pl3d = vPolygonsBasic3d[i] ; - if( bForTriangulation) + if ( bForTriangulation) CreateCellPolygons( i, vvPolygons, vvPolygons3d, vToCheck, nPoly, vnParentChunk, vPolygonsCorrected[i], pl3d) ; else CreateCellPolygons( i, vvPolygons, vvPolygons3d, vToCheck, nPoly, vnParentChunk, vPolygonsBasic[i], pl3d) ; @@ -1691,7 +1691,7 @@ Tree::GetPolygons( POLYLINEMATRIX& vvPolygons, bool bForTriangulation, POLYLINEM break ; } // ora analizzo anche i loop che sono contenuti nella cella - if( bForTriangulation) + if ( bForTriangulation) CreateIslandAndHoles( i, vvPolygons, vvPolygons3d, nPoly, vnParentChunk, bForTriangulation, vPolygonsCorrected[i], vPolygonsBasic3d[i]) ; else CreateIslandAndHoles( i, vvPolygons, vvPolygons3d, nPoly, vnParentChunk, bForTriangulation, vPolygonsBasic[i], vPolygonsBasic3d[i]) ; @@ -1772,7 +1772,7 @@ Tree::GetPolygonsBasic( POLYLINEVECTOR& vPolygonsBasic, POLYLINEVECTOR& vPolygon vnVert.push_back( int(vVertices.size()) - 1) ; GetBottomNeigh( nId, vNeigh) ; // aggiungo i vertici che sono sul lato bottom, solo se ho più di un vicino bottom - if ( (int) vNeigh.size() != 0 && (int) vNeigh.size() != 1){ + if ( vNeigh.size() > 1){ // se la superficie è chiusa lungo il parametro V e le celle vicine bottom sono sul lato Top // devo aggiungere i vertici tenendo conto della periodicità dello spazio parametrico. if ( m_bClosedV && m_mTree.at(vNeigh[0]).m_bOnTopEdge) { @@ -1796,7 +1796,7 @@ Tree::GetPolygonsBasic( POLYLINEVECTOR& vPolygonsBasic, POLYLINEVECTOR& vPolygon vNeigh.clear() ; GetRightNeigh ( nId, vNeigh) ; // aggiungo i vertici che sono sul lato right, solo se ho più di un vicino right - if ( (int) vNeigh.size() != 0 && (int) vNeigh.size() != 1){ + if ( vNeigh.size() > 1){ // se la superficie è chiusa lungo il parametro U e le celle vicine right sono sul lato Left // devo aggiungere i vertici tenendo conto della periodicità dello spazio parametrico. vnVert.push_back( int(vVertices.size())) ; @@ -1855,7 +1855,7 @@ Tree::GetPolygonsBasic( POLYLINEVECTOR& vPolygonsBasic, POLYLINEVECTOR& vPolygon GetLeftNeigh ( nId, vNeigh) ; std::reverse( vNeigh.begin(), vNeigh.end()) ; // aggiungo i vertici che sono sul lato left, solo se ho più di un vicino left - if ( (int) vNeigh.size() != 0 && (int) vNeigh.size() != 1) { + if ( vNeigh.size() > 1) { // se la superficie è chiusa lungo il parametro U e la cella è sul lato left // devo aggiungere i vertici tenendo conto della periodicità dello spazio parametrico. vnVert.push_back( int(vVertices.size())) ; @@ -2182,7 +2182,7 @@ Tree::FindCell( const Point3d& ptToAssign, const CurveLine& cl, INTVECTOR vCells } } // se non ho trovato nulla vuol dire che sono su un vertice o su un lato - if ( (int)nCells.size() == 0 && ! bRecurs) { + if ( nCells.empty() && ! bRecurs) { int nEdge = -1 ; for ( int nCell : vCells) { OnWhichEdge( nCell,ptToAssign, nEdge) ; @@ -2335,7 +2335,7 @@ Tree::TraceLoopLabelCell( const POLYLINEVECTOR& vplPolygons) // qui devo mettere una tolleranza negativa per poter tener conto anche dei punti che sono SULLA curva while ( ! IsPointInsidePolyLine( ptCurr, vplPolygons[nIdPolygon], dLinTol)) { // sto uscendo dalla cella, quindi cerco l'intersezione - if ( bEraseNextPoint && vptInters.size() != 0) { + if ( bEraseNextPoint && ! vptInters.empty()) { vptInters.pop_back() ; bEraseNextPoint = false ; } @@ -2345,7 +2345,7 @@ Tree::TraceLoopLabelCell( const POLYLINEVECTOR& vplPolygons) // al precedente FindInters avrei dovuto passare di cella if ( ! FindInters( nId, clTrim, vplPolygons[nIdPolygon], vptInters, true)) { // scarterò il punto molto vicino al lato e tengo solo l'intersezione del trim col lato - if( vptInters.size() != 0) + if ( ! vptInters.empty()) vptInters.pop_back() ; plLoop.GetPrevPoint( ptTEnd) ; plLoop.GetPrevPoint( ptTStart) ; @@ -2646,7 +2646,7 @@ Tree::FindInters( int& nId, const CurveLine& clTrim, const PolyLine& plPolygon, else if ( nEdge == 7) ptInters = ptTR ; // aggiungo il nuovo punto al vettore delle intersezioni - if ( (int)vptInters.size() == 0 || ! AreSamePointXYEpsilon( ptInters , vptInters.back(), 10 * EPS_SMALL)) + if ( vptInters.empty() || ! AreSamePointXYEpsilon( ptInters , vptInters.back(), 10 * EPS_SMALL)) vptInters.push_back( ptInters) ; else { // se l'ultimo punto del vettore delle intersezioni è quasi uguale al punto che devo aggiungere allora lo sostituisco con quest'ultimo @@ -4122,7 +4122,7 @@ Tree::CheckIfBetween( const Inters& inA, const Inters& inB) const else if ( nEdgeIn == 7) nEdgeIn = 0 ; // creo la sequenza di Edges da scorrere per trovare i possibili validNextStart - while ( ! AreSameEdge( nEdge, nEdgeIn) || (int) vEdges.size() == 0) { + while ( ! AreSameEdge( nEdge, nEdgeIn) || vEdges.empty()) { vEdges.push_back( nEdge) ; if ( nEdge == 3) nEdge = 0 ; @@ -4524,11 +4524,12 @@ Tree::CreateCellContour( POLYLINEMATRIX& vPolygons) pl3d.Close() ; // ora posso creare il poligono della cella con i tagli POLYLINEMATRIX vPolygons3d ; - while( (int)vToCheck.size() != 0) { + while( ! vToCheck.empty()) { int nPolyBefore = nPoly ; - CreateCellPolygons( 0, vPolygons, vPolygons3d, vToCheck, nPoly, vnParentChunk, pl, pl3d) ; // l'aggiunta di vPolygons3d forse è un problema in questo punto. - // sarà da valutare quando si aggiungerà la funzione per aggiungere tagli aperti - // e se si vuole usare la funzione su uno spazio 2D ideale non collegato ad una sup di Bezier + CreateCellPolygons( 0, vPolygons, vPolygons3d, vToCheck, nPoly, vnParentChunk, pl, pl3d) ; + // l'aggiunta di vPolygons3d forse è un problema in questo punto. + // sarà da valutare quando si aggiungerà la funzione per aggiungere tagli aperti + // e se si vuole usare la funzione su uno spazio 2D ideale non collegato ad una sup di Bezier if ( nPolyBefore == nPoly) break ; } @@ -4674,7 +4675,7 @@ Tree::CloseOpenCuts( void) //// A MANO //// chiudo le curve aperte e se necessario le giunto tra loro - //if ( vInters.size() != 0) { + //if ( ! vInters.empty()) { // ICurveComposite* pCCOpen ( CreateBasicCurveComposite()) ; // pCCOpen->FromPolyLine( get<0>(m_vPlApprox[vInters[0].first])) ; // //sort( vInters.begin(), vInters.end()) ; diff --git a/Triangulate.cpp b/Triangulate.cpp index ee1d5f2..0f60c4e 100644 --- a/Triangulate.cpp +++ b/Triangulate.cpp @@ -236,7 +236,7 @@ Triangulate::MakeAdvanced( const POLYLINEVECTOR& vPLORIG, PNTVECTOR& vPt, INTVEC vPt.clear() ; vTr.clear() ; // se non ho PolyLine, allora non faccio nulla - if ( int( vPLORIG.size()) == 0) + if ( vPLORIG.empty()) return true ; POLYLINEVECTOR vPL ; @@ -244,12 +244,12 @@ Triangulate::MakeAdvanced( const POLYLINEVECTOR& vPLORIG, PNTVECTOR& vPt, INTVEC // se non sono stati passate le info per ordinare le polyline allora le ordino INTMATRIX vnPLIndMat ; BOOLVECTOR vbInvert ; - if( vnPLIndMatPre.size() == 0) { + if ( vnPLIndMatPre.empty()) { if ( ! CalcRegionPolyLines( vPLORIG, vtN, vnPLIndMat, vbInvert)) return false ; vPL = vPLORIG ; for ( int i = 0 ; i < int( vbInvert.size()) ; i++) { - if( vbInvert[i]) + if ( vbInvert[i]) vPL[i].Invert() ; } } @@ -447,7 +447,7 @@ Triangulate::MakeByEC( const PNTVECTOR& vPt, INTVECTOR& vTr) vTr.push_back( vPol[i]) ; vTr.push_back( vPol[vNext[i]]) ; } - // �Delete� vertex v[i] by redirecting next and previous links + // Delete vertex v[i] by redirecting next and previous links // of neighboring verts past it. Decrement vertex count vNext[vPrev[i]] = vNext[i] ; vPrev[vNext[i]] = vPrev[i] ; diff --git a/VolZmap.cpp b/VolZmap.cpp index d2f802c..bdb0987 100644 --- a/VolZmap.cpp +++ b/VolZmap.cpp @@ -497,7 +497,7 @@ VolZmap::GetLocalBBox( BBox3d& b3Loc, int nFlag) const for ( int i = 0 ; i <= m_nNx[0] ; ++ i) { int ic = ( ( i != m_nNx[0]) ? i : m_nNx[0] - 1) ; int nPos = ic + jc * m_nNx[0] ; - if ( m_Values[0][nPos].size() > 0) { + if ( ! m_Values[0][nPos].empty()) { Point3d ptP = m_MapFrame.Orig() + dX * m_MapFrame.VersX() + dY * m_MapFrame.VersY() ; b3Loc.Add( ptP + m_Values[0][nPos][0].dMin * m_MapFrame.VersZ()) ; b3Loc.Add( ptP + m_Values[0][nPos][m_Values[0][nPos].size()-1].dMax * m_MapFrame.VersZ()) ; @@ -541,7 +541,7 @@ VolZmap::GetBBox( const Frame3d& frRef, BBox3d& b3Ref, int nFlag) const for ( int i = 0 ; i <= m_nNx[0] ; ++ i) { int ic = ( ( i != m_nNx[0]) ? i : m_nNx[0] - 1) ; int nPos = ic + jc * m_nNx[0] ; - if ( nPos >= 0 && m_Values[0][nPos].size() > 0) { + if ( nPos >= 0 && ! m_Values[0][nPos].empty()) { Point3d ptP = frUse.Orig() + dX * frUse.VersX() + dY * frUse.VersY() ; b3Ref.Add( ptP + m_Values[0][nPos][0].dMin * frUse.VersZ()) ; b3Ref.Add( ptP + m_Values[0][nPos][m_Values[0][nPos].size()-1].dMax * frUse.VersZ()) ; diff --git a/VolZmapGraphics.cpp b/VolZmapGraphics.cpp index 001a6aa..01fe8ae 100644 --- a/VolZmapGraphics.cpp +++ b/VolZmapGraphics.cpp @@ -4013,7 +4013,7 @@ VolZmap::GetFirstVoxIJK( int& i, int& j, int& k) const bool bNotEmpty = false ; for ( nj = 0 ; nj < 2 ; ++ nj) { int nDex = nj * int( m_nNx[0]) + ni ; - if ( ! m_Values[0].empty() && m_Values[0][nDex].size() > 0) { + if ( ! m_Values[0].empty() && ! m_Values[0][nDex].empty()) { bNotEmpty = true ; break ; } @@ -4026,7 +4026,7 @@ VolZmap::GetFirstVoxIJK( int& i, int& j, int& k) const bool bNotEmpty = false ; for ( mj = 0 ; mj < 2 ; ++ mj) { int nDex = mj * int( m_nNx[1]) + mi ; - if ( ! m_Values[1].empty() && m_Values[1][nDex].size() > 0) { + if ( ! m_Values[1].empty() && ! m_Values[1][nDex].empty()) { bNotEmpty = true ; break ; } @@ -4056,7 +4056,7 @@ VolZmap::GetLastVoxIJK( int& i, int& j, int& k) const bool bNotEmpty = false ; for ( nj = int( m_nNy[0]) - 1 ; nj > int( m_nNy[0]) - 3 ; -- nj) { int nDex = nj * int( m_nNx[0]) + ni ; - if ( ! m_Values[0].empty() && m_Values[0][nDex].size() > 0) { + if ( ! m_Values[0].empty() && ! m_Values[0][nDex].empty()) { bNotEmpty = true ; break ; } @@ -4069,7 +4069,7 @@ VolZmap::GetLastVoxIJK( int& i, int& j, int& k) const bool bNotEmpty = false ; for ( mj = int( m_nNy[1]) - 1 ; mj > int( m_nNy[1]) - 3 ; -- mj) { int nDex = mj * int( m_nNx[1]) + mi ; - if ( ! m_Values[1].empty() && m_Values[1][nDex].size() > 0) { + if ( ! m_Values[1].empty() && ! m_Values[1][nDex].empty()) { bNotEmpty = true ; break ; } diff --git a/Voronoi.cpp b/Voronoi.cpp index 80f29e5..adaea83 100644 --- a/Voronoi.cpp +++ b/Voronoi.cpp @@ -106,7 +106,7 @@ Voronoi::AddCurve( const ICurve* pCrv) return false ; } - if ( m_vpCrvs.size() == 0) { + if ( m_vpCrvs.empty()) { // se prima curva considerata assegno il frame al Voronoi m_Frame.Set( plPlane.GetPoint(), plPlane.GetVersN()) ; } @@ -161,7 +161,7 @@ Voronoi::AddSurfFlatRegion( const ISurfFlatRegion* pSfr) // recupero il piano Point3d ptCen ; pSfr->GetCentroid( ptCen) ; Vector3d vtN = pSfr->GetNormVersor() ; - if ( m_vpCrvs.size() == 0) { + if ( m_vpCrvs.empty()) { // assegno il frame al Voronoi m_Frame.Set( ptCen, vtN) ; }