GaitGeneration by Graph Search
読み取り中…
検索中…
一致する文字列を見つけられません
gait_pattern_graph_tree.cpp
[詳解]
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
9
10namespace designlab {
11
13 const int index, const int depth) const {
14 assert(0 <= index);
15 assert(index < graph_size_);
16 assert(0 <= depth);
17 assert(depth <= nodes_[index].depth);
18
19 int res_index = index;
20
21 while (true) {
22 if (depth == nodes_[res_index].depth) {
23 break;
24 }
25
26 res_index = nodes_[res_index].parent_index;
27 }
28
29 return nodes_[res_index];
30}
31
33 const int depth) const {
34 assert(0 <= depth);
35 assert(depth <= nodes_[index].depth);
36 assert(0 <= index);
37 assert(index < graph_size_);
38
39 int res_index = index;
40
41 while (true) {
42 if (depth == nodes_[res_index].depth) {
43 break;
44 }
45
46 res_index = nodes_[res_index].parent_index;
47 }
48
49 return res_index;
50}
51
52} // namespace designlab
const int GetParentNodeIndex(const int index, const int depth) const
指定したノードの親ノードの参照を返す.depthは親ノードの深さを指定する.
const RobotStateNode & GetParentNode(const int index, const int depth) const
指定したノードの親ノードの参照を返す.depthは親ノードの深さを指定する.
グラフ構造のためのノード(頂点).