From 3D point representation to axis-angle rotation

1k Views Asked by At

I have an ordered collection of 3D joint positions (X,Y,Z) representing a human's skeleton, as can be seen in this image. For every time-step, I have one such skeleton.

For now I am focusing on the arms, so say I have the following points, three per arm: $P_{i}^{t}$, $i \in [1, 2,... 6]$, $t \in [1, 2, ... T]$

I am wondering if it is possible (and how to do it) to obtain an axis-angle representation of this parametric skeleton, such that instead of having points with the absolute position, I have an axis-angle representation of the body.

My objective here is to prepare data for a model described in this paper. The authors specify that the arms are represented by joints, each joint being "represented by a 3D axis-angle representation in a fixed kinematic structure". The "fixed-kinematic structure" part got me wondering too. What could it mean exactly?

The bone length is fixed, which means that you can define the skeleton's pose by the inter-joint angle. The problem is to define a mathematical notation to express it and design an algorithm to obtain this inter-joint angle from the points.

If more clarifications are needed I'll be happy to provide them.

2

There are 2 best solutions below

0
On BEST ANSWER

For each "bone", you have a point $\vec{p}_J$ that acts as its joint, a point $\vec{p}_B$ that acts as its before/basis, an unit rotation axis vector $\hat{a}$, rotation angle $\theta$, and length $L$; and you need to find out the end point of this bone $\vec{p}_E$.

The before/basis point $\vec{p}_B$ and the joint $\vec{p}_J$ are used to calculate direction unit vector $\hat{u}$, from before to joint, thus: $$\hat{u} = \frac{\vec{p}_J - \vec{p}_B}{\left\lVert \vec{p}_J - \vec{p}_B \right\rVert} \tag{1}\label{BtV1}$$

We then use the rotation angle $\theta$ and rotation unit axis $\hat{a}$ via e.g. Rodrigues' rotation formula to calculate the unit vector $\hat{v}$, i.e. $\hat{u}$ rotated by $\theta$ around unit axis vector $\hat{a}$: $$\hat{v} = \hat{u} \cos\theta + (\hat{a} \times \hat{u}) \sin\theta + \hat{a} (\hat{a} \cdot \hat{u})(1 - \cos\theta) \tag{2}\label{BtV2}$$ Note that if $\theta = 0$, $\hat{v} = \hat{u}$.

Finally, we obtain the end of the "bone" point $\vec{p}_E$ via $$\vec{p}_E = \vec{p}_J + L \hat{v} \tag{3}\label{BtV3}$$

Note that whenever a joint is modified, all "bones" extending from it must be updated, then all "bones" extending from those, and so on.

Note that you technically need three points to determine the initial orientation of your figure. These are naturally points 1, 8, and 11 in your figure. (That is, you use these as $\vec{p}_J$ and $\vec{p}_B$, but they stay in their fixed locations.)

I would define the "bones" as an ordered set, a list or an array, sorted so that "bones" in contact to the core points are listed first, then the bones directly depending on them, and so on.

You can also use $\hat{u} = \vec{p}_J - \vec{p}_B$ if $L$ is the ratio of the length of the current "bone" to the distance between $\vec{p}_J$ and $\vec{p}_B$. (This can be computationally desirable, since it avoids three scalar divisions and one scalar square root operation, which tend to be "slow" compared to scalar addition, subtraction, and multiplication operations.)


To obtain the initial rotation axis vectors $\hat{a}$, rotation angles $\theta$, and lengths $L$ for each bone/joint ($\vec{p}_B$, $\vec{p}_J$, $\vec{p}_E$ triplet), you can use the following:

$$\left\lbrace \, \begin{aligned} \vec{u} &= \vec{p}_J - \vec{p}_B \\ \vec{v} &= \vec{p}_E - \vec{p}_J \\ L &= \left\lVert \vec{v} \right\rVert \\ \theta &= \arccos\left(\frac{\vec{u} \cdot \vec{v}}{\left\lVert\vec{u}\right\rVert \, \left\lVert\vec{v} \right\rVert} \right) \\ \hat{a} &= \frac{\vec{u} \times \vec{v}}{\left\lVert \vec{u} \times \vec{v} \right\rVert} \\ \end{aligned} \right. \tag{4}\label{BtV4}$$ noting that if the three vectors $\vec{p}_B$, $\vec{p}_J$, $\vec{p}_E$ are collinear, then $\theta = 0$ and $\hat{a}$ undefined (due to division by zero), and you need to pick the correct $\hat{a}$ otherwise. This should not be a problem for the skeleton at hand, since no three consecutive points seem to be collinear.

1
On

You can do that, yes, so long as you choose one point to be the origin of your skeleton. We could, as per your image, take point $P_1$ as our origin.

From there, we can say that any time a joint is connected to another one, we have a vector between the two joints. Then, we can express this vector (and thus the position of the second joint) as a length $\ell$ (also sometimes noted $r$ or $\rho$) and two angles $\theta$ (called the polar angle or the inclination angle) and $\varphi$ (called the azimuthal angle), in spherical coordinates. In essence, this definition looks like this :

Spherical coordinates (Image courtesy of the Wikipedia page for spherical coordinates, licensed under CC BY-SA 4.0)

In our case, say we want to express the position of $P_2$ relative to $P_1$. We can create the vector $\overrightarrow{P_1P_2}$ of coordinates $(x,y,z)$ from the "absolute" positions of $P_1$ and $P_2$. From there, we can use the following formulas to convert our coordinates from cartesian to spherical :

$$\left\lbrace\begin{align} \ell & = \sqrt{x^2 + y^2 + z^2} \\ \theta & = \arccos \frac{z}{\ell} = \arctan \frac{\sqrt{x^2 + y^2}}{z} \\ \varphi & = \arctan\frac{y}{x} \end{align} \right.$$

From there, we have defined $P_2$ in spherical coordinates relative to $P_1$ and we can iterate from there, defining $P_3$ relative to $P_2$, then $P_4$ relative to $P_3$.

The main caveat of this method is that it requires one point to be the origin of the skeleton (in my example, $P_1$), whose coordinates cannot be expressed relative to another point.

However, you could either still express these coordinates relative to the spatial origin point, $O = (0,0,0)$ or set $P_1$ as the one point with coordinates $(0,0,0)$, depending on what you want to do.