From 40919a6f484042fc486c5da7d30b2fcc1d778e60 Mon Sep 17 00:00:00 2001 From: Dean Lee Date: Mon, 8 Feb 2021 10:00:56 +0800 Subject: [PATCH] removed margin paramater from car_space_to_full_frame (#20017) --- selfdrive/ui/paint.cc | 3 ++- selfdrive/ui/paint.hpp | 2 +- selfdrive/ui/ui.cc | 5 ++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/selfdrive/ui/paint.cc b/selfdrive/ui/paint.cc index 3b1a17e6..350a4124 100644 --- a/selfdrive/ui/paint.cc +++ b/selfdrive/ui/paint.cc @@ -37,7 +37,8 @@ const mat3 intrinsic_matrix = (mat3){{ // Projects a point in car to space to the corresponding point in full frame // image space. -bool car_space_to_full_frame(const UIState *s, float in_x, float in_y, float in_z, vertex_data *out, float margin) { +bool car_space_to_full_frame(const UIState *s, float in_x, float in_y, float in_z, vertex_data *out) { + const float margin = 500.0f; const vec4 car_space_projective = (vec4){{in_x, in_y, in_z, 1.}}; // We'll call the car space point p. // First project into normalized image coordinates with the extrinsics matrix. diff --git a/selfdrive/ui/paint.hpp b/selfdrive/ui/paint.hpp index 7bab393a..08294649 100644 --- a/selfdrive/ui/paint.hpp +++ b/selfdrive/ui/paint.hpp @@ -1,7 +1,7 @@ #pragma once #include "ui.hpp" -bool car_space_to_full_frame(const UIState *s, float in_x, float in_y, float in_z, vertex_data *out, float margin=0.0); +bool car_space_to_full_frame(const UIState *s, float in_x, float in_y, float in_z, vertex_data *out); void ui_draw(UIState *s); void ui_draw_image(const UIState *s, const Rect &r, const char *name, float alpha); void ui_draw_rect(NVGcontext *vg, const Rect &r, NVGcolor color, int width, float radius = 0); diff --git a/selfdrive/ui/ui.cc b/selfdrive/ui/ui.cc index 3946ec4b..4a41113e 100644 --- a/selfdrive/ui/ui.cc +++ b/selfdrive/ui/ui.cc @@ -81,13 +81,12 @@ static void update_line_data(const UIState *s, const cereal::ModelDataV2::XYZTDa const auto line_x = line.getX(), line_y = line.getY(), line_z = line.getZ(); int max_idx = -1; vertex_data *v = &pvd->v[0]; - const float margin = 500.0f; for (int i = 0; ((i < TRAJECTORY_SIZE) and (line_x[i] < fmax(MIN_DRAW_DISTANCE, max_distance))); i++) { - v += car_space_to_full_frame(s, line_x[i], -line_y[i] - y_off, -line_z[i] + z_off, v, margin); + v += car_space_to_full_frame(s, line_x[i], -line_y[i] - y_off, -line_z[i] + z_off, v); max_idx = i; } for (int i = max_idx; i >= 0; i--) { - v += car_space_to_full_frame(s, line_x[i], -line_y[i] + y_off, -line_z[i] + z_off, v, margin); + v += car_space_to_full_frame(s, line_x[i], -line_y[i] + y_off, -line_z[i] + z_off, v); } pvd->cnt = v - pvd->v; assert(pvd->cnt < std::size(pvd->v));