cgv
Loading...
Searching...
No Matches
pose_event.cxx
1#include "pose_event.h"
2#include "shortcut.h"
3
4namespace cgv {
5 namespace gui {
6
8pose_event::pose_event(const float *_pose, const float *_last_pose, unsigned short _player_index, short _trackable_index, double _time)
9 : event(EID_POSE,0,0,_time), player_index(_player_index), trackable_index(_trackable_index)
10{
11 std::copy(_pose, _pose + 12, pose);
12 std::copy(_last_pose, _last_pose + 12, last_pose);
13}
14
17{
18 return player_index;
19}
22{
23 return trackable_index;
24}
26void pose_event::stream_out(std::ostream& os) const
27{
29 os << "x(" << pose[0] << "," << pose[1] << "," << pose[2] << ");";
30 os << "y(" << pose[3] << "," << pose[4] << "," << pose[5] << ");";
31 os << "z(" << pose[6] << "," << pose[7] << "," << pose[8] << ");";
32 os << "O(" << pose[9] << "," << pose[10] << "," << pose[11] << ");";
33 os << "<" << player_index << ":" << trackable_index << ">";
34}
35
37void pose_event::stream_in(std::istream& is)
38{
39 std::cerr << "not implemented" << std::endl;
40}
41
44{
45 return reinterpret_cast<const mat3&>(pose[0]);
46}
47
50{
51 return reinterpret_cast<const vec3&>(pose[9]);
52}
55{
56 return reinterpret_cast<const mat3x4&>(pose[0]);
57}
65{
66 return reinterpret_cast<const mat3&>(last_pose[0]);
67}
70{
71 return reinterpret_cast<const vec3&>(last_pose[9]);
72}
75{
76 return reinterpret_cast<const mat3x4&>(last_pose[0]);
77}
78
84
100
101 }
102}
virtual void stream_out(std::ostream &os) const
write to stream
Definition event.cxx:139
const mat3 & get_orientation() const
return current orientation matrix
pose_event(const float *_pose, const float *_last_pose, unsigned short _player_index, short _trackable_index=0, double _time=0)
construct a key event from its textual description
Definition pose_event.cxx:8
const vec3 & get_last_position() const
return last position
const mat3x4 & get_last_pose_matrix() const
return last pose matrix
float pose[12]
pose stored as 3x4 matrix in column major format
Definition pose_event.h:21
const vec3 & get_position() const
return current position
mat3 get_rotation_matrix() const
return rotation matrix between from the last to current orientation
const mat3 & get_last_orientation() const
return last orientation matrix
quat get_last_quaternion() const
return last orientation quaternion
vec3 get_different() const
return difference vector from last to current position
unsigned get_player_index() const
return player index
quat get_quaternion() const
return current orientation quaternion
void stream_in(std::istream &is)
read from stream
const mat3x4 & get_pose_matrix() const
return current pose matrix
int get_trackable_index() const
return trackable index
void stream_out(std::ostream &os) const
write to stream
quat get_rotation_quaternion() const
return rotation quaternion between from the last to current orientation
float last_pose[12]
last pose as 3x4 matrix
Definition pose_event.h:23
@ EID_POSE
id for a 6D pose change events
Definition event.h:21
the cgv namespace
Definition print.h:11
cgv::math::quaternion< float > quat
declare type of quaternion
Definition quaternion.h:370