For the following exercise I wanted to experiment with idea of linking every joint of the body to another, in a linear fashion.
The idea is perhaps inspired on concept of industrial robot arms where the position of the end effector is a combination of all the previous joints. The first joint having most effect on the final position and orientation.
Forward kinematics calculations consists of finding the end effector position and orientation by computing the joint parameters. We are most interested however in finding the joint parameters based on a desired end effector position and orientation. This is known as inverse kinematics (IK).
Another interesting video showing a similar concept of kinematics is the X125, in particular the series 2.
Kinectron + p5js
The forward kinematics for this sketch are quite simple, based on Mimi's code, I simply did another function and passed all the joint values in my desired order (arms first, legs second, spine third and head last) to achieve the widest range of movement.
To create the single line of joints I only had to simply push and pop the matrix once for the entire set of joints.
I realized that the order of joints is not as relevant in the program above, this because I am only translating position but not adding rotation depending on joint orientation. (Full code)