GaitGeneration by Graph Search
全て クラス 名前空間 ファイル 関数 変数 型定義 列挙型 列挙値 マクロ定義 ページ Concepts
math_rotation_matrix.h
[詳解]
1
3
4// Copyright(c) 2023-2025 Design Engineering Laboratory, Saitama University
5// Released under the MIT license
6// https://opensource.org/licenses/mit-license.php
7
8#ifndef DESIGNLAB_MATH_ROTATION_MATRIX_H_
9#define DESIGNLAB_MATH_ROTATION_MATRIX_H_
10
11#include <array>
12#include <string>
13
14#include "math_euler.h"
15#include "math_vector3.h"
16
17
18namespace designlab
19{
20
33{
36 element({ {
37 { 1.0f, 0.0f, 0.0f },
38 { 0.0f, 1.0f, 0.0f },
39 { 0.0f, 0.0f, 1.0f }} }) {}
40
43 const float r11, const float r12, const float r13,
44 const float r21, const float r22, const float r23,
45 const float r31, const float r32, const float r33) :
46 element({ {
47 { r11, r12, r13 },
48 { r21, r22, r23 },
49 { r31, r32, r33 }} }) {}
50
51 RotationMatrix3x3(const RotationMatrix3x3& other) = default;
52 RotationMatrix3x3(RotationMatrix3x3&& other) noexcept = default;
54 ~RotationMatrix3x3() = default;
55
57
58
62 [[nodiscard]] static RotationMatrix3x3 CreateRotationMatrixX(float angle);
63
67 [[nodiscard]] static RotationMatrix3x3 CreateRotationMatrixY(float angle);
68
72 [[nodiscard]] static RotationMatrix3x3 CreateRotationMatrixZ(float angle);
73
74
77 [[nodiscard]] std::string ToString() const;
78
79
87 std::array<std::array<float, 3>, 3> element;
88};
89
90
95[[nodiscard]]
96Vector3 RotateVector3(const Vector3& vec, const RotationMatrix3x3& rot);
97
98} // namespace designlab
99
100
101#endif // DESIGNLAB_MATH_ROTATION_MATRIX_H_
Vector3 RotateVector3(const Vector3 &vec, const EulerXYZ &rot)
回転させたベクトルを返す.三角関数の処理が多く重たいので注意.
3次元の回転行列を表す構造体.
RotationMatrix3x3()
単位行列を生成する.
RotationMatrix3x3 operator*(const RotationMatrix3x3 &other) const
static RotationMatrix3x3 CreateRotationMatrixZ(float angle)
z軸周りに回転する回転行列を生成する.
RotationMatrix3x3(const RotationMatrix3x3 &other)=default
std::array< std::array< float, 3 >, 3 > element
static RotationMatrix3x3 CreateRotationMatrixY(float angle)
y軸周りに回転する回転行列を生成する.
static RotationMatrix3x3 CreateRotationMatrixX(float angle)
x軸周りに回転する回転行列を生成する.
RotationMatrix3x3 & operator=(const RotationMatrix3x3 &other)=default
RotationMatrix3x3(RotationMatrix3x3 &&other) noexcept=default
RotationMatrix3x3(const float r11, const float r12, const float r13, const float r21, const float r22, const float r23, const float r31, const float r32, const float r33)
任意の回転行列を生成する.
std::string ToString() const
回転行列を文字列に変換する.
3次元の位置ベクトルを表す構造体.