diff --git a/selfdrive/ui/paint.cc b/selfdrive/ui/paint.cc index 28f88d20bf..e0b67336bd 100644 --- a/selfdrive/ui/paint.cc +++ b/selfdrive/ui/paint.cc @@ -1,9 +1,6 @@ #include "ui.hpp" #include -#include -#include -#include #include "common/util.h" #include "common/timing.h" #include @@ -25,23 +22,6 @@ const float y_offset = 0.0; const float zoom = 2.35; #endif -// Projects a point in car to space to the corresponding point in full frame -// image space. -bool calib_frame_to_full_frame(const UIState *s, float in_x, float in_y, float in_z, vertex_data *out) { - const float margin = 500.0f; - const vec3 pt = (vec3){{in_x, in_y, in_z}}; - const vec3 Ep = matvecmul3(s->scene.view_from_calib, pt); - const vec3 KEp = matvecmul3(fcam_intrinsic_matrix, Ep); - - // Project. - float x = KEp.v[0] / KEp.v[2]; - float y = KEp.v[1] / KEp.v[2]; - - nvgTransformPoint(&out->x, &out->y, s->car_space_transform, x, y); - return out->x >= -margin && out->x <= s->fb_w + margin && out->y >= -margin && out->y <= s->fb_h + margin; -} - - static void ui_draw_text(const UIState *s, float x, float y, const char* string, float size, NVGcolor color, const char *font_name){ nvgFontFace(s->vg, font_name); nvgFontSize(s->vg, size); diff --git a/selfdrive/ui/paint.hpp b/selfdrive/ui/paint.hpp index 4f63d3ef4b..bc0927a718 100644 --- a/selfdrive/ui/paint.hpp +++ b/selfdrive/ui/paint.hpp @@ -1,7 +1,6 @@ #pragma once #include "ui.hpp" -bool calib_frame_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 6c262f3dc6..84472401c1 100644 --- a/selfdrive/ui/ui.cc +++ b/selfdrive/ui/ui.cc @@ -1,8 +1,6 @@ #include #include #include -#include -#include #include #include @@ -19,6 +17,21 @@ int write_param_float(float param, const char* param_name, bool persistent_param return Params(persistent_param).write_db_value(param_name, s, size < sizeof(s) ? size : sizeof(s)); } +// Projects a point in car to space to the corresponding point in full frame +// image space. +static bool calib_frame_to_full_frame(const UIState *s, float in_x, float in_y, float in_z, vertex_data *out) { + const float margin = 500.0f; + const vec3 pt = (vec3){{in_x, in_y, in_z}}; + const vec3 Ep = matvecmul3(s->scene.view_from_calib, pt); + const vec3 KEp = matvecmul3(fcam_intrinsic_matrix, Ep); + + // Project. + float x = KEp.v[0] / KEp.v[2]; + float y = KEp.v[1] / KEp.v[2]; + + nvgTransformPoint(&out->x, &out->y, s->car_space_transform, x, y); + return out->x >= -margin && out->x <= s->fb_w + margin && out->y >= -margin && out->y <= s->fb_h + margin; +} static void ui_init_vision(UIState *s) { // Invisible until we receive a calibration message.