conversions.cpp
Go to the documentation of this file.
00001 /*
00002  * Copyright 2014 Google Inc. All Rights Reserved.
00003  *
00004  * Licensed under the Apache License, Version 2.0 (the "License");
00005  * you may not use this file except in compliance with the License.
00006  * You may obtain a copy of the License at
00007  *
00008  *      http://www.apache.org/licenses/LICENSE-2.0
00009  *
00010  * Unless required by applicable law or agreed to in writing, software
00011  * distributed under the License is distributed on an "AS IS" BASIS,
00012  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00013  * See the License for the specific language governing permissions and
00014  * limitations under the License.
00015  */
00016 
00017 #include "tango-gl/conversions.h"
00018 
00019 namespace tango_gl {
00020 namespace conversions {
00021 
00022 glm::mat4 opengl_world_T_tango_world() {
00023   // Note glm is column-wise.
00024   return glm::mat4(1.0f, 0.0f,  0.0f, 0.0f,
00025                    0.0f, 0.0f, -1.0f, 0.0f,
00026                    0.0f, 1.0f,  0.0f, 0.0f,
00027                    0.0f, 0.0f,  0.0f, 1.0f);
00028 }
00029 
00030 glm::mat4 color_camera_T_opengl_camera() {
00031   // Note glm is column-wise.
00032   return glm::mat4(1.0f,  0.0f,  0.0f, 0.0f,
00033                    0.0f, -1.0f,  0.0f, 0.0f,
00034                    0.0f,  0.0f, -1.0f, 0.0f,
00035                    0.0f,  0.0f,  0.0f, 1.0f);
00036 }
00037 
00038 glm::mat4 depth_camera_T_opengl_camera() {
00039   // Note glm is column-wise.
00040   return glm::mat4(1.0f, 0.0f, 0.0f, 0.0f, 0.0f, -1.0f, 0.0f, 0.0f, 0.0f, 0.0f,
00041                    -1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f);
00042 }
00043 
00044 glm::quat QuatTangoToGl(const glm::quat& tango_q_frame) {
00045   const float kSqrt2Over2 = std::sqrt(2.0) / 2.0f;
00046   // Tango frame is a -90 degree rotation about +X from the GL frame.
00047   glm::quat gl_q_tango = glm::quat(kSqrt2Over2, -kSqrt2Over2, 0.0f, 0.0f);
00048   return gl_q_tango * tango_q_frame;
00049 }
00050 
00051 }  // namespace gl_tango_conversions
00052 }  // namespace tango_gl


rtabmap
Author(s): Mathieu Labbe
autogenerated on Thu Jun 6 2019 21:59:19