I have some questions, because I cannot figure out how to start my projects best.
First of all, I would like to program a selfbalancing (binary) tree. Daniel Shiffman tried it too, but the solution was not the best ( Video ) . My idea is to give every node, except the root, a specific type of negative electric charge, so the nodes repel each other. What do you think about this idea? (Mmmmmhh…May be I should fix the y-coodinate…, so they can move only horizontaly…)
My second problem: How do I get, let’s say the first two child nodes, move correctly, while they are stiff connected to the root with a fix length. Like a pendulum. So the complete visualisation is some kind of “more than double” pendulum?
This last thought leads to my third question: How would I, in general, animate a multiple connected shape, which i.e. falls an the floor and rebounds from it.
Do I define “one master node” with an array of conneced nodes? How can I guarantee, even when all nodes are falling down, they are having the correct distances to each other. Or do I better use a shape?
I searched a lot on the internet but couldn’t find a solution for the last problem. But I remember to have seen some animations on youtube. They are about generic algorithms and how a “worm” learns to “walk”. It’s less complex, but similar.
Any tip or help would be great,