iridescence
Loading...
Searching...
No Matches
sensor_view_camera_control.hpp
Go to the documentation of this file.
1#ifndef GUIK_SENSOR_VIEW_CAMERA_CONTROL_HPP
2#define GUIK_SENSOR_VIEW_CAMERA_CONTROL_HPP
3
5
6namespace guik {
7
10public:
11 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
12
17 const Eigen::Isometry3f& T_sensor_camera = Eigen::Translation3f(-5.0f, 0.0f, 0.1f) * Eigen::Isometry3f::Identity(),
18 double smoothing_factor_trans = 0.75,
19 double smoothing_factor_rot = 0.9);
20 virtual ~SensorViewCameraControl() override;
21
23 void set_smoothing_factor(double trans, double rot);
24
26 void set_smoothing_factor_trans(double factor);
27
29 void set_smoothing_factor_rot(double factor);
30
32 void set_z_axis_alignment(bool enabled);
33
35 void set_sensor_pose(const Eigen::Isometry3f& T_world_sensor);
36
38 template <typename Transform>
39 void set_sensor_pose(const Transform& T_world_sensor) {
40 Eigen::Isometry3f T(T_world_sensor.template cast<float>().matrix());
42 }
43
46 virtual void lookat(const Eigen::Isometry3f& T_world_sensor) override { set_sensor_pose(T_world_sensor); }
47
49 void set_sensor_camera_transform(const Eigen::Isometry3f& T_sensor_camera);
50
52 template <typename Transform>
53 void set_sensor_camera_transform(const Transform& T_sensor_camera) {
54 Eigen::Isometry3f T(T_sensor_camera.template cast<float>().matrix());
56 }
57
58 virtual void mouse(const Eigen::Vector2f& p, int button, bool down) override;
59 virtual void drag(const Eigen::Vector2f& p, int button) override;
60 virtual void scroll(const Eigen::Vector2f& rel) override;
61
62 virtual Eigen::Vector2f depth_range() const override;
63 virtual Eigen::Matrix4f view_matrix() const override;
64
65 virtual std::string name() const override { return "SensorViewCameraControl"; }
66
67private:
68 Eigen::Isometry3f T_sensor_camera;
69 Eigen::Isometry3f T_world_sensor;
70 Eigen::Isometry3f T_world_sensor_smoothed;
71 double smoothing_factor_trans;
72 double smoothing_factor_rot;
73 bool first_pose;
74 bool z_axis_alignment;
75
76 double init_distance;
77 double distance_scale;
78 double theta;
79 double phi;
80
81 bool left_button_down;
82 Eigen::Vector2f drag_last_pos;
83};
84
85} // namespace guik
86
87#endif
Base class for camera control. This class defines the interface for controlling the camera in the vie...
Definition camera_control.hpp:19
void set_sensor_camera_transform(const Eigen::Isometry3f &T_sensor_camera)
Set the transform from sensor frame to camera frame (T_sensor_camera).
virtual void lookat(const Eigen::Isometry3f &T_world_sensor) override
Same as set_sensor_pose.
Definition sensor_view_camera_control.hpp:46
virtual void scroll(const Eigen::Vector2f &rel) override
Scroll event callback. This method is called when the mouse wheel is scrolled.
void set_smoothing_factor_trans(double factor)
Set the translation smoothing factor.
virtual ~SensorViewCameraControl() override
void set_sensor_camera_transform(const Transform &T_sensor_camera)
Set the transform from sensor frame to camera frame using a generic transform.
Definition sensor_view_camera_control.hpp:53
virtual void mouse(const Eigen::Vector2f &p, int button, bool down) override
Mouse event callback. This method is called when a mouse button is pressed or released.
void set_sensor_pose(const Eigen::Isometry3f &T_world_sensor)
Set the raw sensor pose (T_world_sensor).
void set_smoothing_factor_rot(double factor)
Set the rotation smoothing factor.
void set_smoothing_factor(double trans, double rot)
Set both smoothing factors. 0 = no smoothing (instant snap), 1 = maximum smoothing (very slow follow)...
EIGEN_MAKE_ALIGNED_OPERATOR_NEW SensorViewCameraControl(const Eigen::Isometry3f &T_sensor_camera=Eigen::Translation3f(-5.0f, 0.0f, 0.1f) *Eigen::Isometry3f::Identity(), double smoothing_factor_trans=0.75, double smoothing_factor_rot=0.9)
virtual Eigen::Vector2f depth_range() const override
Get the depth range of the camera. This method can be overridden by derived classes to specify a cust...
virtual void drag(const Eigen::Vector2f &p, int button) override
Mouse drag event callback. This method is called when the mouse is moved while a button is pressed.
void set_z_axis_alignment(bool enabled)
Enable or disable z-axis alignment. When enabled (default), the camera up direction is locked to the ...
virtual std::string name() const override
Definition sensor_view_camera_control.hpp:65
void set_sensor_pose(const Transform &T_world_sensor)
Set the raw sensor pose using a generic transform.
Definition sensor_view_camera_control.hpp:39
virtual Eigen::Matrix4f view_matrix() const override
Get the view matrix of the camera. This method must be implemented by derived classes to return the c...
Definition drawable_container.hpp:9