Astra SDK  v2.1.3
Matrix3x3.hpp
1 // This file is part of the Orbbec Astra SDK [https://orbbec3d.com]
2 // Copyright (c) 2015-2017 Orbbec 3D
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 // Be excellent to each other.
17 #ifndef ASTRA_MATRIX3X3_HPP
18 #define ASTRA_MATRIX3X3_HPP
19 
20 #include <cmath>
21 #include "Vector3f.hpp"
22 #include "capi/astra_ctypes.h"
23 
24 namespace astra {
25 
30  struct Matrix3x3 : private ::astra_matrix3x3_t
31  {
32  Matrix3x3()
33  {
34  ::astra_matrix3x3_t::m00 = 0.f;
35  ::astra_matrix3x3_t::m10 = 0.f;
36  ::astra_matrix3x3_t::m20 = 0.f;
37 
38  ::astra_matrix3x3_t::m01 = 0.f;
39  ::astra_matrix3x3_t::m11 = 0.f;
40  ::astra_matrix3x3_t::m21 = 0.f;
41 
42  ::astra_matrix3x3_t::m02 = 0.f;
43  ::astra_matrix3x3_t::m12 = 0.f;
44  ::astra_matrix3x3_t::m22 = 0.f;
45  }
46 
48  const Vector3f& x_axis() const
49  {
50  return *static_cast<const Vector3f*>(&(::astra_matrix3x3_t::xAxis));
51  }
53  const Vector3f& y_axis() const
54  {
55  return *static_cast<const Vector3f*>(&(::astra_matrix3x3_t::yAxis));
56  }
58  const Vector3f& z_axis() const
59  {
60  return *static_cast<const Vector3f*>(&(::astra_matrix3x3_t::zAxis));
61  }
62 
63  float m00() const { return ::astra_matrix3x3_t::m00; }
64  float m10() const { return ::astra_matrix3x3_t::m10; }
65  float m20() const { return ::astra_matrix3x3_t::m20; }
66 
67  float m01() const { return ::astra_matrix3x3_t::m01; }
68  float m11() const { return ::astra_matrix3x3_t::m11; }
69  float m21() const { return ::astra_matrix3x3_t::m21; }
70 
71  float m02() const { return ::astra_matrix3x3_t::m02; }
72  float m12() const { return ::astra_matrix3x3_t::m12; }
73  float m22() const { return ::astra_matrix3x3_t::m22; }
74 
75  friend class Joint;
76  };
77 }
78 
79 #endif /* ASTRA_MATRIX3X3_HPP */
Represents a 3x3 rotation matrix
Definition: astra_ctypes.h:50
Represents a 3x3 rotation matrix
Definition: Matrix3x3.hpp:31
const Vector3f & x_axis() const
X axis basis vector, or the first column vector.
Definition: Matrix3x3.hpp:48
const Vector3f & z_axis() const
Z axis basis vector, or the third column vector.
Definition: Matrix3x3.hpp:58
const Vector3f & y_axis() const
Y axis basis vector, or the second column vector.
Definition: Matrix3x3.hpp:53
Represents a float 3d vector
Definition: Vector3f.hpp:30