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
10
11namespace designlab
12{
13
14const RobotStateNode& GaitPatternGraphTree::GetParentNode(const int index, const int depth) const
15{
16 assert(0 <= index);
17 assert(index < graph_size_);
18 assert(0 <= depth);
19 assert(depth <= nodes_[index].depth);
20
21 int res_index = index;
22
23 while (true)
24 {
25 if (depth == nodes_[res_index].depth)
26 {
27 break;
28 }
29
30 res_index = nodes_[res_index].parent_index;
31 }
32
33 return nodes_[res_index];
34}
35
36const int GaitPatternGraphTree::GetParentNodeIndex(const int index, const int depth) const
37{
38 assert(0 <= depth);
39 assert(depth <= nodes_[index].depth);
40 assert(0 <= index);
41 assert(index < graph_size_);
42
43 int res_index = index;
44
45 while (true)
46 {
47 if (depth == nodes_[res_index].depth)
48 {
49 break;
50 }
51
52 res_index = nodes_[res_index].parent_index;
53 }
54
55 return res_index;
56}
57
58} // namespace designlab
const int GetParentNodeIndex(const int index, const int depth) const
指定したノードの親ノードの参照を返す.depthは親ノードの深さを指定する.
const RobotStateNode & GetParentNode(const int index, const int depth) const
指定したノードの親ノードの参照を返す.depthは親ノードの深さを指定する.
グラフ構造のためのノード(頂点).旧名 LNODE