transform.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/transform.h"
18 #include "tango-gl/util.h"
19 
20 #define nullptr 0
21 
22 namespace tango_gl {
23 
25  : parent_(nullptr),
26  position_(0.0f, 0.0f, 0.0f),
27  rotation_(1.0f, 0.0f, 0.0f, 0.0f),
28  scale_(1.0f, 1.0f, 1.0f) {
29 }
30 
32  // Objects are not responsible for deleting their parents.
33 }
34 
35 void Transform::SetPosition(const glm::vec3& position) {
37 }
38 
40  return position_;
41 }
42 
45 }
46 
48  return rotation_;
49 }
50 
51 void Transform::SetScale(const glm::vec3& scale) {
52  scale_ = scale;
53 }
54 
56  return scale_;
57 }
58 
59 void Transform::Translate(const glm::vec3& translation) {
61 }
62 
63 void Transform::SetTransformationMatrix(const glm::mat4& transform_mat) {
65 }
66 
69  trans_mat[3][0] = position_.x;
70  trans_mat[3][1] = position_.y;
71  trans_mat[3][2] = position_.z;
72  glm::mat4 parent_mat = glm::mat4(1.0f);
73  if (parent_ != NULL) {
74  parent_mat = parent_->GetTransformationMatrix();
75  trans_mat = parent_mat * trans_mat;
76  }
77  return trans_mat;
78 }
79 
80 void Transform::SetParent(Transform* transform) {
82 }
83 
85  return parent_;
86 }
87 
89  return parent_;
90 }
91 
92 } // namespace tango_gl
nullptr
#define nullptr
Definition: transform.cpp:20
tango_gl::Transform::GetPosition
glm::vec3 GetPosition() const
Definition: transform.cpp:39
tango_gl::util::DecomposeMatrix
void DecomposeMatrix(const glm::mat4 &transform_mat, glm::vec3 &translation, glm::quat &rotation, glm::vec3 &scale)
Definition: util.cpp:115
glm::mat4
mat4x4 mat4
Definition: type_mat.hpp:441
tango_gl::Transform::GetScale
glm::vec3 GetScale() const
Definition: transform.cpp:55
util.h
tango_gl::Transform::SetPosition
void SetPosition(const glm::vec3 &position)
Definition: transform.cpp:35
tango_gl::Transform::position_
glm::vec3 position_
Definition: transform.h:54
glm::detail::tquat
Definition: fwd.hpp:41
glm::detail::tvec3
Definition: type_mat.hpp:37
glm::detail::tmat4x4
Definition: type_mat.hpp:47
tango_gl::Transform::Transform
Transform()
Definition: transform.cpp:24
tango_gl::Transform::~Transform
virtual ~Transform()
Definition: transform.cpp:31
glm::detail::tvec3::z
T z
Definition: type_vec3.hpp:86
tango_gl::Transform::rotation_
glm::quat rotation_
Definition: transform.h:55
translation
translation
glm::scale
GLM_FUNC_DECL detail::tmat4x4< T, P > scale(detail::tmat4x4< T, P > const &m, detail::tvec3< T, P > const &v)
scale
set noclip points set clip one set noclip two set bar set border lt lw set xdata set ydata set zdata set x2data set y2data set boxwidth set dummy y set format x g set format y g set format x2 g set format y2 g set format z g set angles radians set nogrid set key title set key left top Right noreverse box linetype linewidth samplen spacing width set nolabel set noarrow set nologscale set logscale x set set pointsize set encoding default set nopolar set noparametric set set set set surface set nocontour set clabel set mapping cartesian set nohidden3d set cntrparam order set cntrparam linear set cntrparam levels auto set cntrparam points set size set set xzeroaxis lt lw set x2zeroaxis lt lw set yzeroaxis lt lw set y2zeroaxis lt lw set tics in set ticslevel set tics scale
tango_gl::Transform
Definition: transform.h:24
glm::mat4_cast
GLM_FUNC_DECL detail::tmat4x4< T, P > mat4_cast(detail::tquat< T, P > const &x)
glm::detail::tvec3::y
T y
Definition: type_vec3.hpp:85
tango_gl::Transform::GetParent
const Transform * GetParent() const
Definition: transform.cpp:84
glm::detail::tvec3::x
T x
Definition: type_vec3.hpp:84
tango_gl::Transform::SetScale
void SetScale(const glm::vec3 &scale)
Definition: transform.cpp:51
f
Point2(* f)(const Point3 &, OptionalJacobian< 2, 3 >)
glm::rotation
GLM_FUNC_DECL detail::tquat< T, P > rotation(detail::tvec3< T, P > const &orig, detail::tvec3< T, P > const &dest)
tango_gl::Transform::parent_
Transform * parent_
Definition: transform.h:52
tango_gl::Transform::scale_
glm::vec3 scale_
Definition: transform.h:56
position
Point3 position(const NavState &X, OptionalJacobian< 3, 9 > H)
transform.h
tango_gl::Transform::SetRotation
void SetRotation(const glm::quat &rotation)
Definition: transform.cpp:43
NULL
#define NULL
tango_gl
Definition: axis.cpp:20
transform
EIGEN_DONT_INLINE void transform(const Quaternion< Scalar > &t, Data &data)
tango_gl::Transform::Translate
void Translate(const glm::vec3 &translation)
Definition: transform.cpp:59
tango_gl::Transform::GetTransformationMatrix
glm::mat4 GetTransformationMatrix() const
Definition: transform.cpp:67
tango_gl::Transform::GetRotation
glm::quat GetRotation() const
Definition: transform.cpp:47
tango_gl::Transform::SetTransformationMatrix
void SetTransformationMatrix(const glm::mat4 &transform_mat)
Definition: transform.cpp:63
tango_gl::Transform::SetParent
void SetParent(Transform *transform)
Definition: transform.cpp:80


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