@ -513,17 +513,17 @@ void AnnotatedCameraWidget::drawLaneLines(QPainter &painter, const UIState *s) {
// paint path
QLinearGradient bg ( 0 , height ( ) , 0 , 0 ) ;
if ( sm [ " controlsState " ] . getControlsState ( ) . getExperimentalMode ( ) ) {
const QVector < QPointF > right_points = scene . track_vertices . mid ( 0 , scene . track_vertices . length ( ) / 2 ) ;
for ( int i = 0 ; i < right_points . length ( ) ; i + + ) {
const auto & acceleration = sm [ " uiPlan " ] . getUiPlan ( ) . getAccel ( ) ;
if ( i > = acceleration . size ( ) ) break ;
// The first half of track_vertices are the points for the right side of the path
// and the indices match the positions of accel from uiPlan
const auto & acceleration = sm [ " uiPlan " ] . getUiPlan ( ) . getAccel ( ) ;
const int max_len = std : : min < int > ( scene . track_vertices . length ( ) / 2 , acceleration . size ( ) ) ;
for ( int i = 0 ; i < max_len ; + + i ) {
// Some points are out of frame
if ( right_point s[ i ] . y ( ) < 0 | | right_point s[ i ] . y ( ) > height ( ) ) continue ;
if ( scene . track_vertice s[ i ] . y ( ) < 0 | | scene . track_vertice s[ i ] . y ( ) > height ( ) ) continue ;
// Flip so 0 is bottom of frame
float lin_grad_point = ( height ( ) - right_point s[ i ] . y ( ) ) / height ( ) ;
float lin_grad_point = ( height ( ) - scene . track_vertice s[ i ] . y ( ) ) / height ( ) ;
// speed up: 120, slow down: 0
float path_hue = fmax ( fmin ( 60 + acceleration [ i ] * 35 , 120 ) , 0 ) ;
@ -536,7 +536,7 @@ void AnnotatedCameraWidget::drawLaneLines(QPainter &painter, const UIState *s) {
bg . setColorAt ( lin_grad_point , QColor : : fromHslF ( path_hue / 360. , saturation , lightness , alpha ) ) ;
// Skip a point, unless next is last
i + = ( i + 2 ) < right_points . length ( ) ? 1 : 0 ;
i + = ( i + 2 ) < max_len ? 1 : 0 ;
}
} else {