21 #ifndef B3_VISUALIZER_H
22 #define B3_VISUALIZER_H
36 #include <boost/optional.hpp>
48 return *std::min_element(v.
begin(), v.
end());
56 return *std::max_element(v.
begin(), v.
end());
64 return *std::min_element(v.
begin(), v.
end());
72 return *std::max_element(v.
begin(), v.
end());
90 #ifdef KJB_HAVE_OPENGL
91 glwin_(DEFAULT_WIDTH, DEFAULT_HEIGHT,
"Visualize description"),
93 desc_p_(&description),
113 #ifdef KJB_HAVE_OPENGL
114 glwin_(DEFAULT_WIDTH, DEFAULT_HEIGHT,
"Visualize description"),
116 desc_p_(&description),
129 template <
class InputIterator>
132 IFT(std::distance(first, last) >= desc_p_->
end(),
154 #ifdef KJB_HAVE_OPENGL
155 glwin_.set_size(width, height);
164 IFT(f >= 1 && f <= desc_p_->end(),
175 if(frame_ > desc_p_->
end())
177 size_t ndf = frame_ - desc_p_->
end() - 1;
188 size_t ndf = df - frame_;
189 frame_ = desc_p_->
end();
202 #ifdef KJB_HAVE_OPENGL
203 glwin_.set_keyboard_callback(cb);
216 #ifdef KJB_HAVE_OPENGL
217 return glwin_.get_width();
225 #ifdef KJB_HAVE_OPENGL
226 return glwin_.get_height();
237 void render_scene()
const;
240 void render_trajectory(
const Trajectory& traj)
const;
243 Vector random_color()
const
250 #ifdef KJB_HAVE_OPENGL
251 opengl::Glut_window glwin_;
253 const Description* desc_p_;
256 const Activity_library* lib_p_;
259 boost::optional<Perspective_camera> alt_camera_;
262 typedef std::map<const Physical_activity*, Vector> Color_map;
263 mutable Color_map cur_colors_;
267 static const size_t DEFAULT_WIDTH = 800;
268 static const size_t DEFAULT_HEIGHT = 800;
Activity_sequence sample(const As_prior &prior)
Sample an activity sequence from the given prior.
Definition: bbb_activity_sequence_prior.cpp:90
void set_frame_images(InputIterator first, InputIterator last)
Set frame images from files.
Definition: bbb_visualizer.h:130
Definition of various standard probability distributions.
double trajectory_max_z(const Trajectory &traj)
Compute the max in the Z-direction.
Definition: bbb_visualizer.h:69
double trajectory_min_z(const Trajectory &traj)
Compute the min in the Z-direction.
Definition: bbb_visualizer.h:61
This class implements vectors, in the linear-algebra sense, with real-valued elements.
Definition: m_vector.h:87
void set_overhead_view()
Set an overhead view.
Definition: bbb_visualizer.cpp:68
void load_images(const std::vector< Image > &images, float)
Definition: video.h:274
void clear_alternative_camera()
Return to the scene's camera.
Definition: bbb_visualizer.cpp:43
Definition: bbb_description.h:62
void set_key_callback(const Func &cb)
Set the key handling callback.
Definition: bbb_visualizer.h:200
#define IFT(a, ex, msg)
Definition: l_exception.h:101
St_perspective_camera for modeling a perspective camera using the classic Forsyth and Ponce parametri...
void advance_frame(size_t df=1)
Advance the current frame by the given value.
Definition: bbb_visualizer.h:171
Visualize a description and the corresponding data.
Definition: bbb_visualizer.h:76
void set_frame(size_t f)
Set the current frame to the given value.
Definition: bbb_visualizer.h:162
const vec_t & dim(size_t d) const
Gets the trajectory of this person.
Definition: bbb_trajectory.h:93
void resize(size_t width, size_t height)
Resize this viewer.
Definition: bbb_visualizer.h:152
iterator end()
Definition: m_vector.h:557
iterator begin()
Definition: m_vector.h:537
Definition: bbb_trajectory.h:41
Definition: perspective_camera.h:93
size_t get_height() const
Definition: video.h:336
#define KJB_THROW_2(ex, msg)
Definition: l_exception.h:48
Definition: bbb_data.h:37
size_t get_width() const
Definition: video.h:331
Sampling functionality for the different distributions defined in "prob_distributions.h".
double width() const
Get this viewer's width.
Definition: bbb_visualizer.h:214
double trajectory_min_x(const Trajectory &traj)
Compute the min in the X-direction.
Definition: bbb_visualizer.h:45
double trajectory_max_x(const Trajectory &traj)
Compute the max in the X-direction.
Definition: bbb_visualizer.h:53
Object thrown when an argument to a function is not acceptable.
Definition: l_exception.h:377
Visualizer(const Description &description, const Data &data, const Perspective_camera &camera, const Activity_library &library)
Construct a visualizer with the given description, data, and camera.
Definition: bbb_visualizer.h:84
void draw_images(bool di)
Definition: bbb_visualizer.cpp:55
boost::math::uniform Uniform_distribution
Definition: prob_distribution.h:70
Support for error handling exception classes in libKJB.
Object thrown when a program lacks required resources or libraries.
Definition: l_exception.h:539
double height() const
Get this viewer's height.
Definition: bbb_visualizer.h:224
void set_alternative_camera(const Perspective_camera &cam)
Set an overhead view.
Definition: bbb_visualizer.h:140
Definition: bbb_activity_library.h:38
void rewind_frame(size_t df=1)
Rewind (move backwards) the current frame by the given value.
Definition: bbb_visualizer.h:184
Definition for the Vector class, a thin wrapper on the KJB Vector struct and its related functionalit...
size_t end() const
Get the end time of this description.
Definition: bbb_description.h:133