        px = lerp(mpx+1.0, mpx, i/100.0);
        py = mpc_y_coords[i] - off;
      } else {
        px = lerp(i+1.0, i, i/100.0);
        py = path.points[i] - off;
      }
  
      vec4 p_car_space = (vec4){{px, py, 0., 1.}};
      vec3 p_full_frame = car_space_to_full_frame(s, p_car_space);
      if (p_full_frame.v[0] < 0. || p_full_frame.v[1] < 0.) {
 
</s> remove       py = path.points[i] + off;
 </s> add       py = points[i] + off; </s> remove static void read_path(PathData& p, const cereal::ModelData::PathData::Reader &pathp) {
  p = {};

  p.prob = pathp.getProb();
  p.std = pathp.getStd();

  auto polyp = pathp.getPoly();
  for (int i = 0; i < POLYFIT_DEGREE; i++) {
    p.poly[i] = polyp[i];
  }

  // Compute points locations
  for (int i = 0; i < MODEL_PATH_DISTANCE; i++) {
    p.points[i] = p.poly[0] * (i*i*i) + p.poly[1] * (i*i)+ p.poly[2] * i + p.poly[3];
  }

  p.validLen = pathp.getValidLen();
}

static void read_model(ModelData &d, const cereal::ModelData::Reader &model) {
  d = {};
  read_path(d.path, model.getPath());
  read_path(d.left_lane, model.getLeftLane());
  read_path(d.right_lane, model.getRightLane());
  auto leadd = model.getLead();
  d.lead = (LeadData){
      .dist = leadd.getDist(), .prob = leadd.getProb(), .std = leadd.getStd(),
  };
}

 </s> add  </s> remove     read_model(scene.model, sm["model"].getModel());
 </s> add     scene.model = sm["model"].getModel();
    fill_path_points(scene.model.getPath(), scene.path_points);
    fill_path_points(scene.model.getLeftLane(), scene.left_lane_points);
    fill_path_points(scene.model.getRightLane(), scene.right_lane_points); </s> remove   // clamp to 5 and 192
  valid_len = fmin(192, fmax(5, data[MODEL_PATH_DISTANCE*2]));
 </s> add   // clamp to 5 and MODEL_PATH_DISTANCE
  valid_len = fmin(MODEL_PATH_DISTANCE, fmax(5, data[MODEL_PATH_DISTANCE*2]));
      py = points[i] - off;
        px = lerp(mpx+1.0, mpx, i/100.0);
        py = mpc_y_coords[i] - off;
      } else {
        px = lerp(i+1.0, i, i/100.0);
      py = points[i] - off;
      }
  
      vec4 p_car_space = (vec4){{px, py, 0., 1.}};
      vec3 p_full_frame = car_space_to_full_frame(s, p_car_space);
      if (p_full_frame.v[0] < 0. || p_full_frame.v[1] < 0.) {
keep keep keep keep replace keep keep keep keep keep
 ui: refactor model related functions (#2026)

* remove read_model

* remove structs for c-capnp

* remove duplicate #define from modeld

* add function fill_path_points

* fix Indentation

* use MODEL_PATH_DISTANCE instead of 192

* fix type

use validLen

* rename left_path_points&right_path_points to xxx_lane_points 
selfdrive/ui/paint.cc