43 #ifndef ILQGAMES_GUI_TOP_DOWN_RENDERER_H 44 #define ILQGAMES_GUI_TOP_DOWN_RENDERER_H 46 #include <ilqgames/gui/control_sliders.h> 47 #include <ilqgames/solver/top_down_renderable_problem.h> 48 #include <ilqgames/utils/operating_point.h> 49 #include <ilqgames/utils/solver_log.h> 50 #include <ilqgames/utils/types.h> 52 #include <glog/logging.h> 53 #include <imgui/imgui.h> 64 const std::shared_ptr<const ControlSliders>& sliders,
65 const std::vector<std::shared_ptr<const TopDownRenderableProblem>>&
69 center_delta_(0.0, 0.0),
70 last_mouse_position_(0.0, 0.0),
71 pixel_to_meter_ratio_(5.0) {
72 CHECK_NOTNULL(sliders_.get());
73 CHECK_EQ(problems_.size(), sliders_->NumProblems());
74 for (
const auto& problem : problems_) CHECK_NOTNULL(problem.get());
83 float CurrentZoomLevel()
const;
84 float LengthToPixels(
float l)
const {
return l * CurrentZoomLevel(); }
85 float PixelsToLength(
float p)
const {
return p / CurrentZoomLevel(); }
86 float HeadingToWindowCoordinates(
float heading)
const {
return -heading; }
87 ImVec2 PositionToWindowCoordinates(
float x,
float y)
const;
88 Point2 WindowCoordinatesToPosition(
const ImVec2& coords)
const;
89 ImVec2 WindowCenter()
const;
92 const std::shared_ptr<const ControlSliders> sliders_;
96 const std::vector<std::shared_ptr<const TopDownRenderableProblem>> problems_;
102 ImVec2 last_mouse_position_;
105 float pixel_to_meter_ratio_;