Panda3D
 All Classes Functions Variables Enumerations
trackerNode.I
1 // Filename: trackerNode.I
2 // Created by: drose (12Mar02)
3 //
4 ////////////////////////////////////////////////////////////////////
5 //
6 // PANDA 3D SOFTWARE
7 // Copyright (c) Carnegie Mellon University. All rights reserved.
8 //
9 // All use of this software is subject to the terms of the revised BSD
10 // license. You should have received a copy of this license along
11 // with this source code in a file named "LICENSE."
12 //
13 ////////////////////////////////////////////////////////////////////
14 
15 ////////////////////////////////////////////////////////////////////
16 // Function: TrackerNode::is_valid
17 // Access: Public
18 // Description: Returns true if the TrackerNode is valid and
19 // connected to a server, false otherwise.
20 ////////////////////////////////////////////////////////////////////
21 INLINE bool TrackerNode::
22 is_valid() const {
23  return (_tracker != (ClientTrackerDevice *)NULL) && _tracker->is_connected();
24 }
25 
26 
27 ////////////////////////////////////////////////////////////////////
28 // Function: TrackerNode::get_pos
29 // Access: Public
30 // Description: Returns the current position of the tracker, if it is
31 // available.
32 ////////////////////////////////////////////////////////////////////
33 INLINE const LPoint3 &TrackerNode::
34 get_pos() const {
35  return _data.get_pos();
36 }
37 
38 ////////////////////////////////////////////////////////////////////
39 // Function: TrackerNode::get_orient
40 // Access: Public
41 // Description: Returns the current orientation of the tracker, if it
42 // is available.
43 ////////////////////////////////////////////////////////////////////
44 INLINE const LOrientation &TrackerNode::
45 get_orient() const {
46  return _data.get_orient();
47 }
48 
49 ////////////////////////////////////////////////////////////////////
50 // Function: TrackerNode::get_time
51 // Access: Public
52 // Description: Returns the time of the tracker's last update.
53 ////////////////////////////////////////////////////////////////////
54 INLINE double TrackerNode::
55 get_time() const {
56  return _data.get_time();
57 }
58 
59 ////////////////////////////////////////////////////////////////////
60 // Function: TrackerNode::has_time
61 // Access: Public
62 // Description: True if this data comes with timestamps.
63 ////////////////////////////////////////////////////////////////////
64 INLINE bool TrackerNode::
65 has_time() const {
66  return _data.has_time();
67 }
68 
69 ////////////////////////////////////////////////////////////////////
70 // Function: TrackerNode::get_transform
71 // Access: Public
72 // Description: Returns the current position and orientation of the
73 // tracker, as a combined matrix.
74 ////////////////////////////////////////////////////////////////////
75 INLINE const LMatrix4 &TrackerNode::
76 get_transform() const {
77  return _mat;
78 }
79 
80 
81 ////////////////////////////////////////////////////////////////////
82 // Function: TrackerNode::set_tracker_coordinate_system
83 // Access: Published
84 // Description: Specifies the coordinate system that the tracker
85 // associated with this node will operate in. Normally,
86 // this is set from the ClientBase that's used to create
87 // the TrackerNode, so it should not need to be set on
88 // an individual tracker basis.
89 ////////////////////////////////////////////////////////////////////
90 INLINE void TrackerNode::
91 set_tracker_coordinate_system(CoordinateSystem cs) {
92  _tracker_cs = cs;
93  if (_tracker_cs == CS_default) {
94  _tracker_cs = get_default_coordinate_system();
95  }
96 }
97 
98 ////////////////////////////////////////////////////////////////////
99 // Function: TrackerNode::get_tracker_coordinate_system
100 // Access: Published
101 // Description: Returns the coordinate system that the tracker
102 // associated with this node will operate in.
103 ////////////////////////////////////////////////////////////////////
104 INLINE CoordinateSystem TrackerNode::
106  return _tracker_cs;
107 }
108 
109 ////////////////////////////////////////////////////////////////////
110 // Function: TrackerNode::set_graph_coordinate_system
111 // Access: Published
112 // Description: Specifies the coordinate system that the TrackerNode
113 // will convert its transform into for passing down the
114 // data graph. Normally, this is CS_default.
115 ////////////////////////////////////////////////////////////////////
116 INLINE void TrackerNode::
117 set_graph_coordinate_system(CoordinateSystem cs) {
118  _graph_cs = cs;
119  if (_graph_cs == CS_default) {
120  _graph_cs = get_default_coordinate_system();
121  }
122 }
123 
124 ////////////////////////////////////////////////////////////////////
125 // Function: TrackerNode::get_graph_coordinate_system
126 // Access: Published
127 // Description: Returns the coordinate system that the TrackerNode
128 // will convert its transform into for passing down the
129 // data graph. Normally, this is CS_default.
130 ////////////////////////////////////////////////////////////////////
131 INLINE CoordinateSystem TrackerNode::
133  return _graph_cs;
134 }
const LOrientation & get_orient() const
Returns the current orientation of the tracker, if it is available.
Definition: trackerNode.I:45
bool has_time() const
True if this data comes with timestamps.
Definition: trackerNode.I:65
void set_tracker_coordinate_system(CoordinateSystem cs)
Specifies the coordinate system that the tracker associated with this node will operate in...
Definition: trackerNode.I:91
This is a unit quaternion representing an orientation.
Definition: lorientation.h:92
This is a three-component point in space (as opposed to a three-component vector, which represents a ...
Definition: lpoint3.h:99
CoordinateSystem get_graph_coordinate_system() const
Returns the coordinate system that the TrackerNode will convert its transform into for passing down t...
Definition: trackerNode.I:132
double get_time() const
Returns the time of the tracker's last update.
Definition: trackerNode.I:55
const LPoint3 & get_pos() const
Returns the current position of the tracker.
Definition: trackerData.I:118
CoordinateSystem get_tracker_coordinate_system() const
Returns the coordinate system that the tracker associated with this node will operate in...
Definition: trackerNode.I:105
const LPoint3 & get_pos() const
Returns the current position of the tracker, if it is available.
Definition: trackerNode.I:34
This is a 4-by-4 transform matrix.
Definition: lmatrix.h:451
bool is_valid() const
Returns true if the TrackerNode is valid and connected to a server, false otherwise.
Definition: trackerNode.I:22
A device, attached to the ClientBase by a TrackerNode, that records the data from a single tracker de...
double get_time() const
Returns the time at which the position information (pos and orient) are effective.
Definition: trackerData.I:81
const LOrientation & get_orient() const
Returns the current orientation of the tracker.
Definition: trackerData.I:162
void set_graph_coordinate_system(CoordinateSystem cs)
Specifies the coordinate system that the TrackerNode will convert its transform into for passing down...
Definition: trackerNode.I:117
const LMatrix4 & get_transform() const
Returns the current position and orientation of the tracker, as a combined matrix.
Definition: trackerNode.I:76
bool has_time() const
Returns true if the position information time is available.
Definition: trackerData.I:68