21 #ifndef SNARK_GRAPHICS_APPLICATIONS_VIEWPOINTS_CAMERAREADER_H_
22 #define SNARK_GRAPHICS_APPLICATIONS_VIEWPOINTS_CAMERAREADER_H_
28 #include <boost/scoped_ptr.hpp>
29 #include <boost/thread.hpp>
30 #include <comma/csv/stream.h>
31 #include <comma/io/stream.h>
32 #include <snark/visiting/eigen.h>
34 namespace snark {
namespace graphics {
namespace View {
36 struct point_with_orientation
38 Eigen::Vector3d point;
39 Eigen::Vector3d orientation;
46 const comma::csv::options options;
48 CameraReader( comma::csv::options& options );
52 bool ready()
const {
return m_stream->ready(); }
55 bool isShutdown()
const;
57 Eigen::Vector3d position()
const;
58 Eigen::Vector3d orientation()
const;
63 comma::io::istream m_istream;
64 Eigen::Vector3d m_position;
65 Eigen::Vector3d m_orientation;
66 boost::scoped_ptr< comma::csv::input_stream< point_with_orientation > > m_stream;
67 mutable boost::recursive_mutex m_mutex;
68 boost::scoped_ptr< boost::thread > m_thread;
74 namespace comma {
namespace visiting {
76 template <>
struct traits< snark::graphics::View::point_with_orientation >
78 template <
typename Key,
class Visitor >
79 static void visit( Key, snark::graphics::View::point_with_orientation& p, Visitor& v )
81 v.apply(
"point", p.point );
82 v.apply(
"roll", p.orientation.x() );
83 v.apply(
"pitch", p.orientation.y() );
84 v.apply(
"yaw", p.orientation.z() );
87 template <
typename Key,
class Visitor >
88 static void visit( Key,
const snark::graphics::View::point_with_orientation& p, Visitor& v )
90 v.apply(
"point", p.point );
91 v.apply(
"roll", p.orientation.x() );
92 v.apply(
"pitch", p.orientation.y() );
93 v.apply(
"yaw", p.orientation.z() );