@@ -66,6 +66,7 @@ using Eigen::Matrix3d;
6666using Eigen::Index;
6767using Eigen::SparseMatrix;
6868using Eigen::ColMajor;
69+ using Eigen::indexing::last;
6970
7071using Constraint::ConstraintBase;
7172using Constraint::Parallel;
@@ -459,28 +460,28 @@ void impl::find_adjacencies_of_latest_segment(const Quantiles::Snapping &snap)
459460 if ( m_segm.last ()->touchedBy ( m_segm.at (i)->ux (),
460461 snap.quantile_stdNormDistr (),
461462 snap.quantile_chi2_1dof ()) ) {
462- x_touches_l.set ( i, N- 1 );
463+ x_touches_l.set (i,last );
463464 are_adjacent = true ;
464465 }
465466
466467 if ( m_segm.last ()->touchedBy ( m_segm.at (i)->uy (),
467468 snap.quantile_stdNormDistr (),
468469 snap.quantile_chi2_1dof ()) ) {
469- y_touches_l.set (i,N- 1 );
470+ y_touches_l.set (i,last );
470471 are_adjacent = true ;
471472 }
472473
473474 if ( m_segm.at (i)->touchedBy ( m_segm.last ()->ux () ,
474475 snap.quantile_stdNormDistr (),
475476 snap.quantile_chi2_1dof () ) ) {
476- x_touches_l.set (N- 1 ,i);
477+ x_touches_l.set (last ,i);
477478 are_adjacent = true ;
478479 }
479480
480481 if ( m_segm.at (i)->touchedBy ( m_segm.last ()->uy (),
481482 snap.quantile_stdNormDistr (),
482483 snap.quantile_chi2_1dof () ) ) {
483- y_touches_l.set (N- 1 ,i);
484+ y_touches_l.set (last ,i);
484485 are_adjacent = true ;
485486 }
486487
@@ -490,8 +491,8 @@ void impl::find_adjacencies_of_latest_segment(const Quantiles::Snapping &snap)
490491 }
491492
492493 if ( are_adjacent ) {
493- Adj.set (i, N- 1 );
494- Adj.set (N- 1 , i);
494+ Adj.set (i, last );
495+ Adj.set (last , i);
495496 }
496497 }
497498}
@@ -912,10 +913,9 @@ void impl::establish_parallel( const Index a,
912913 m_qConstraint.append ( QConstraint::QParallel::create () );
913914 m_constr.append ( std::make_shared<Parallel>() );
914915
915- Rel.conservativeResize ( Rel.rows (),
916- Rel.cols ()+1 ); // append a column
917- Rel.set ( a, Rel.cols ()-1 ); // B(a,end) = 1;
918- Rel.set ( b, Rel.cols ()-1 ); // B(b,end) = 1;
916+ Rel.conservativeResize ( Rel.rows (), Rel.cols ()+1 ); // append a column
917+ Rel.set ( a, last );
918+ Rel.set ( b, last );
919919}
920920
921921void impl::establish_vertical ( const Index a)
@@ -924,7 +924,7 @@ void impl::establish_vertical( const Index a)
924924 m_constr.append ( std::make_shared<Vertical>() );
925925
926926 Rel.conservativeResize ( Rel.rows (), Rel.cols ()+1 ); // append a column
927- Rel.set ( a, Rel. cols ()- 1 ); // B(a,end) = 1 ;
927+ Rel.set ( a, last ) ;
928928}
929929
930930void impl::establish_horizontal ( const Index a)
@@ -933,7 +933,7 @@ void impl::establish_horizontal( const Index a)
933933 m_constr.append ( std::make_shared<Horizontal>() );
934934
935935 Rel.conservativeResize ( Rel.rows (), Rel.cols ()+1 ); // append a column
936- Rel.set ( a, Rel. cols ()- 1 ); // B(a,end) = 1 ;
936+ Rel.set ( a, last ) ;
937937}
938938
939939void impl::establish_diagonal ( const Index a)
@@ -942,7 +942,7 @@ void impl::establish_diagonal( const Index a)
942942 m_constr.append ( std::make_shared<Diagonal>() );
943943
944944 Rel.conservativeResize ( Rel.rows (), Rel.cols ()+1 ); // append a column
945- Rel.set ( a, Rel. cols ()- 1 ); // B(a,end) = 1 ;
945+ Rel.set ( a, last ) ;
946946}
947947
948948void impl::establish_orthogonal ( const Index a,
@@ -953,8 +953,8 @@ void impl::establish_orthogonal( const Index a,
953953
954954 Rel.conservativeResize ( Rel.rows (),
955955 Rel.cols ()+1 ); // append a column
956- Rel.set ( a, Rel. cols ()- 1 ); // B(a,end) = 1 ;
957- Rel.set ( b, Rel. cols ()- 1 ); // B(b,end) = 1 ;
956+ Rel.set ( a, last ) ;
957+ Rel.set ( b, last ) ;
958958}
959959
960960
@@ -966,9 +966,9 @@ void impl::establish_copunctual( const Index a,
966966 m_constr.append ( std::make_shared<Copunctual>() );
967967
968968 Rel.conservativeResize ( Rel.rows (), Rel.cols ()+1 ) ; // append a column
969- Rel.set ( a, Rel. cols ()- 1 ); // B(a,end) = 1 ;
970- Rel.set ( b, Rel. cols ()- 1 ); // B(b,end) = 1 ;
971- Rel.set ( c, Rel. cols ()- 1 ); // B(c,end) = 1 ;
969+ Rel.set ( a, last ) ;
970+ Rel.set ( b, last ) ;
971+ Rel.set ( c, last ) ;
972972}
973973
974974
@@ -1082,36 +1082,36 @@ void impl::merge_segment( const Index a)
10821082{
10831083 // qDebug() << Q_FUNC_INFO << a;
10841084
1085- const Index last = m_segm.size ()-1 ; // zero-based
1085+ const Index last1 = m_segm.size ()-1 ; // zero-based
10861086
10871087 const QPolygonF merged_track
10881088 = m_qStroke.at (a)->polygon ()
10891089 + m_qStroke.last ()->polygon ();
10901090
10911091
1092- m_qStroke.replace ( last , std::make_shared<QEntity::QStroke>( merged_track ) );
1092+ m_qStroke.replace ( last1 , std::make_shared<QEntity::QStroke>( merged_track ) );
10931093
10941094 const std::pair<VectorXd, VectorXd> xiyi = trackCoords (merged_track); // {x_i, y_i}
10951095 const std::pair<uPoint, uPoint> uxuy = uEndPoints (xiyi.first , xiyi.second ); // ux, uy
10961096
10971097 auto um = std::make_shared<uStraightLineSegment>( uxuy.first , uxuy.second );
1098- m_segm.replace ( last , um );
1098+ m_segm.replace ( last1 , um );
10991099
1100- m_qUnconstrained.replace ( last ,
1100+ m_qUnconstrained.replace ( last1 ,
11011101 std::make_shared<QEntity::QUnconstrained>(
11021102 m_segm.last ()->ux (),
11031103 m_segm.last ()->uy () ));
11041104
1105- m_qConstrained.replace ( last ,
1105+ m_qConstrained.replace ( last1 ,
11061106 std::make_shared<QEntity::QConstrained>(
11071107 m_segm.last ()->ux (),
11081108 m_segm.last ()->uy () ));
11091109
11101110 // inherit adjacencies of [a]
11111111 for ( Index i=0 ; i<Adj.cols ()-1 ; i++) {
11121112 if ( Adj.isSet (i,a) ) { // column "a" fix
1113- Adj.set ( i, Adj. cols ()- 1 );
1114- Adj.set ( Adj. rows ()- 1 , i );
1113+ Adj.set ( i, last );
1114+ Adj.set ( last , i );
11151115 }
11161116 }
11171117
@@ -1123,17 +1123,17 @@ void impl::merge_segment( const Index a)
11231123 }
11241124
11251125 for ( Index ii=0 ; ii<x_touches_l.cols (); ii++ ) { // but *ColMajor*...
1126- if ( x_touches_l.isSet ( x_touches_l. rows ()- 1 ,ii) ) {
1127- x_touches_l.unset ( x_touches_l. rows ()- 1 ,ii ); // explicit zero !
1126+ if ( x_touches_l.isSet ( last ,ii) ) {
1127+ x_touches_l.unset ( last ,ii ); // explicit zero !
11281128 }
1129- if ( y_touches_l.isSet ( y_touches_l. rows ()- 1 ,ii) ) {
1130- y_touches_l.unset ( y_touches_l. rows ()- 1 ,ii );
1129+ if ( y_touches_l.isSet ( last ,ii) ) {
1130+ y_touches_l.unset ( last ,ii );
11311131 }
1132- if ( x_touches_l.isSet ( ii,x_touches_l. cols ()- 1 ) ) {
1133- x_touches_l.unset ( ii,x_touches_l. cols ()- 1 );
1132+ if ( x_touches_l.isSet ( ii,last ) ) {
1133+ x_touches_l.unset ( ii,last );
11341134 }
1135- if ( y_touches_l.isSet ( ii,y_touches_l. cols ()- 1 ) ) {
1136- y_touches_l.unset ( ii,y_touches_l. cols ()- 1 );
1135+ if ( y_touches_l.isSet ( ii,last ) ) {
1136+ y_touches_l.unset ( ii,last );
11371137 }
11381138 }
11391139
0 commit comments