GaitGeneration by Graph Search
読み取り中…
検索中…
一致する文字列を見つけられません
map_state.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_MAP_STATE_H_
9#define DESIGNLAB_MAP_STATE_H_
10
11#include <map>
12#include <vector>
13
14#include "cassert_define.h"
15#include "math_vector3.h"
16
17
18namespace designlab
19{
20
31class MapState final
32{
33public:
34 MapState() : map_point_({}) {}
35 explicit MapState(const std::vector<Vector3>& map_point) : map_point_(map_point) {}
36 MapState(const MapState& other) = default;
37 MapState(MapState&& other) noexcept = default;
38 MapState& operator = (const MapState& other) = default;
39
44 inline Vector3 GetMapPoint(const size_t index) const noexcept
45 {
46 assert(index < map_point_.size());
47
48 return map_point_[index];
49 }
50
53 inline size_t GetMapPointSize() const noexcept
54 {
55 return map_point_.size();
56 }
57
64 inline void SetMapPoint(const size_t index, const Vector3& point) noexcept
65 {
66 assert(index < map_point_.size());
67 map_point_[index] = point;
68 }
69
72 inline void SetMapPointVec(const std::vector<Vector3>& point) noexcept
73 {
74 map_point_ = point;
75 }
76
79 inline void AddMapPoint(const Vector3& point) noexcept
80 {
81 map_point_.push_back(point);
82 }
83
85 inline void ClearMapPoint() noexcept
86 {
87 map_point_.clear();
88 }
89
90
92 static constexpr float kMapPointDistance{ 20.0f };
93 static constexpr float kMapMinZ = { -10000000.0f };
94
95private:
96 std::vector<Vector3> map_point_;
97
98 static_assert(kMapPointDistance > 0.0f, "kMapPointDistanceは正の実数である必要があります.");
99};
100
101} // namespace designlab
102
103
104#endif // DESIGNLAB_MAP_STATE_H_
マップを表すクラス.
Definition map_state.h:32
size_t GetMapPointSize() const noexcept
脚設置可能点の総数を返す.
Definition map_state.h:53
void ClearMapPoint() noexcept
脚設置可能点の座標を消去する.
Definition map_state.h:85
static constexpr float kMapPointDistance
z軸から(上から)みたとき,格子点状に分けられた脚接地可能点の間隔 [mm].
Definition map_state.h:92
void SetMapPoint(const size_t index, const Vector3 &point) noexcept
脚設置可能点の座標を1つ選び上書きする. 一応作ったけど,使うことはないと思う. 内容を書き換えたいならば Clear した後,AddMapPoint を使うこと.
Definition map_state.h:64
MapState(const std::vector< Vector3 > &map_point)
Definition map_state.h:35
void SetMapPointVec(const std::vector< Vector3 > &point) noexcept
脚設置可能点の座標を設定する
Definition map_state.h:72
static constexpr float kMapMinZ
マップの最低のZ座標
Definition map_state.h:93
Vector3 GetMapPoint(const size_t index) const noexcept
脚設置可能点の座標を返す.
Definition map_state.h:44
MapState(MapState &&other) noexcept=default
ムーブコンストラクタ
MapState & operator=(const MapState &other)=default
代入演算子
MapState(const MapState &other)=default
コピーコンストラクタ
void AddMapPoint(const Vector3 &point) noexcept
脚設置可能点の座標を追加する.
Definition map_state.h:79
3次元の位置ベクトルを表す構造体.