OSVR-Core
SpaceTransformations.h
Go to the documentation of this file.
1 
11 // Copyright 2016 Sensics, Inc.
12 //
13 // Licensed under the Apache License, Version 2.0 (the "License");
14 // you may not use this file except in compliance with the License.
15 // You may obtain a copy of the License at
16 //
17 // http://www.apache.org/licenses/LICENSE-2.0
18 //
19 // Unless required by applicable law or agreed to in writing, software
20 // distributed under the License is distributed on an "AS IS" BASIS,
21 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
22 // See the License for the specific language governing permissions and
23 // limitations under the License.
24 
25 #ifndef INCLUDED_SpaceTransformations_h_GUID_C1F96E04_2D97_428B_047B_0C620A82C10C
26 #define INCLUDED_SpaceTransformations_h_GUID_C1F96E04_2D97_428B_047B_0C620A82C10C
27 
28 // Internal Includes
29 #include "TrackingSystem.h"
30 
31 // Library/third-party includes
32 // - none
33 
34 // Standard includes
35 // - none
36 
37 namespace osvr {
38 namespace vbtracker {
39  inline Eigen::Quaterniond getCameraRotation(TrackingSystem const &sys) {
40  return Eigen::Quaterniond(sys.getCameraPose().rotation());
41  }
42 
43  inline Eigen::Quaterniond getQuatToCameraSpace(TrackingSystem const &sys) {
44  return getCameraRotation(sys).inverse();
45  }
46 
47  inline Eigen::Matrix3d
48  getRotationMatrixToCameraSpace(TrackingSystem const &sys) {
49  return getQuatToCameraSpace(sys).matrix();
50  }
51 
52 } // namespace vbtracker
53 } // namespace osvr
54 
55 #endif // INCLUDED_SpaceTransformations_h_GUID_C1F96E04_2D97_428B_047B_0C620A82C10C
The main namespace for all C++ elements of the framework, internal and external.
Definition: namespace_osvr.dox:3
Definition: Quaternion.h:47
Quaternion< double > Quaterniond
double precision quaternion type
Definition: Quaternion.h:211
RotationMatrixType matrix() const
Definition: RotationBase.h:50
Quaternion inverse(void) const
Definition: Quaternion.h:375