conversions.cpp
Go to the documentation of this file.
1 /*
2  * Copyright 2014 Google Inc. All Rights Reserved.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #include "tango-gl/conversions.h"
18 
19 namespace tango_gl {
20 namespace conversions {
21 
23  // Note glm is column-wise.
24  return glm::mat4(1.0f, 0.0f, 0.0f, 0.0f,
25  0.0f, 0.0f, -1.0f, 0.0f,
26  0.0f, 1.0f, 0.0f, 0.0f,
27  0.0f, 0.0f, 0.0f, 1.0f);
28 }
29 
31  // Note glm is column-wise.
32  return glm::mat4(1.0f, 0.0f, 0.0f, 0.0f,
33  0.0f, -1.0f, 0.0f, 0.0f,
34  0.0f, 0.0f, -1.0f, 0.0f,
35  0.0f, 0.0f, 0.0f, 1.0f);
36 }
37 
39  // Note glm is column-wise.
40  return glm::mat4(1.0f, 0.0f, 0.0f, 0.0f, 0.0f, -1.0f, 0.0f, 0.0f, 0.0f, 0.0f,
41  -1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f);
42 }
43 
44 glm::quat QuatTangoToGl(const glm::quat& tango_q_frame) {
45  const float kSqrt2Over2 = std::sqrt(2.0) / 2.0f;
46  // Tango frame is a -90 degree rotation about +X from the GL frame.
47  glm::quat gl_q_tango = glm::quat(kSqrt2Over2, -kSqrt2Over2, 0.0f, 0.0f);
48  return gl_q_tango * tango_q_frame;
49 }
50 
51 } // namespace gl_tango_conversions
52 } // namespace tango_gl
glm::mat4
mat4x4 mat4
Definition: type_mat.hpp:441
glm::quat
highp_quat quat
Quaternion of default single-precision floating-point numbers.
Definition: fwd.hpp:68
glm::detail::tquat
Definition: fwd.hpp:41
glm::detail::tmat4x4
Definition: type_mat.hpp:47
conversions.h
glm::sqrt
GLM_FUNC_DECL vecType< T, P > sqrt(vecType< T, P > const &x)
tango_gl::conversions::depth_camera_T_opengl_camera
glm::mat4 depth_camera_T_opengl_camera()
Definition: conversions.cpp:38
f
Point2(* f)(const Point3 &, OptionalJacobian< 2, 3 >)
tango_gl::conversions::QuatTangoToGl
glm::quat QuatTangoToGl(const glm::quat &tango_q_frame)
Given a quaternion representing the rotation matrix tango_R_any, returns the quaternion representing ...
Definition: conversions.cpp:44
tango_gl::conversions::color_camera_T_opengl_camera
glm::mat4 color_camera_T_opengl_camera()
Definition: conversions.cpp:30
tango_gl::conversions::opengl_world_T_tango_world
glm::mat4 opengl_world_T_tango_world()
Definition: conversions.cpp:22
tango_gl
Definition: axis.cpp:20


rtabmap
Author(s): Mathieu Labbe
autogenerated on Thu Jul 25 2024 02:50:08