In order to create animations hierarchy of bones and parts of a model needs to be preserved. It can be achived using directed acyclic graphs, but trees have many advantages, one of which is their simplicity. Class enables user to create hierarchical tree, modify its structure and provide iterator which can notify whenever it changes level during iteration. Why is it important? This feature provides a convenient way to concatenate tranformations.
In file named "tree.hpp"
Only one
There is no need of compilation. It is a header only, one class lib.
If you would like to install the library once and for all I suggest using CMake and running the snippet placed below.
$ git clone https://github.com/mateuszstompor/tree.git
$ cd tree
$ mkdir build && cd build
$ cmake ..
$ make install
Yes, whole project is tested and works correctly.
In order to use class you need to use of listed compilers to build your project. If you wish to use the class in Windows please compile with WIN32 flag.
- GCC, version 8.1
- clang, version 6.0
#include <iostream>
int main() {
// declare and init
ms::tree<int> t{};
// insert_sibling - in this case adds root node to the tree
t.insert_s(t.end(), 1);
// insert_child - adds child to root node
t.insert_c(t.begin(), 0, 4);
// iterate through the nodes
for(auto i : t) {
std::cout << *i << '\n';
}
}