Marcos Duarte, Renato Naville Watanabe

Laboratory of Biomechanics and Motor Control

Federal University of ABC, Brazil

Motion (a change of position in space with respect to time) is not an absolute concept; a reference is needed to describe the motion of the object in relation to this reference. Likewise, the state of such reference cannot be absolute in space and so motion is relative.

A frame of reference is the place with respect to we choose to describe the motion of an object. In this reference frame, we define a coordinate system (a set of axes) within which we measure the motion of an object (but frame of reference and coordinate system are often used interchangeably).

Often, the choice of reference frame and coordinate system is made by convenience. However, there is an important distinction between reference frames when we deal with the dynamics of motion, where we are interested to understand the forces related to the motion of the object. In dynamics, we refer to inertial frame of reference (a.k.a., Galilean reference frame) when the Newton's laws of motion in their simple form are valid in this frame and to non-inertial frame of reference when the Newton's laws in their simple form are not valid (in such reference frame, fictitious accelerations/forces appear). An inertial reference frame is at rest or moves at constant speed (because there is no absolute rest!), whereas a non-inertial reference frame is under acceleration (with respect to an inertial reference frame).

The concept of frame of reference has changed drastically since Aristotle, Galileo, Newton, and Einstein. To read more about that and its philosophical implications, see Space and Time: Inertial Frames.

In anatomy, we use a simplified reference frame composed by perpendicular planes to provide a standard reference for qualitatively describing the structures and movements of the human body, as shown in the next figure.

As we perceive the surrounding space as three-dimensional, a convenient coordinate system is the Cartesian coordinate system in the Euclidean space with three orthogonal axes as shown below. The axes directions are commonly defined by the right-hand rule and attributed the letters X, Y, Z. The orthogonality of the Cartesian coordinate system is convenient for its use in classical mechanics, most of the times the structure of space is assumed having the Euclidean geometry and as consequence, the motion in different directions are independent of each other.

The concept of reference frame in Biomechanics and motor control is very important and central to the understanding of human motion. For example, do we see, plan and control the movement of our hand with respect to reference frames within our body or in the environment we move? Or a combination of both?

The figure below, although derived for a robotic system, illustrates well the concept that we might have to deal with multiple coordinate systems.

For three-dimensional motion analysis in Biomechanics, we may use several different references frames for convenience and refer to them as global, laboratory, local, anatomical, or technical reference frames or coordinate systems (we will study this later).

There has been proposed different standardizations on how to define frame of references for the main segments and joints of the human body. For instance, the International Society of Biomechanics has a page listing standardization proposals by its standardization committee and subcommittees:

In [2]:

```
from IPython.display import IFrame
IFrame('https://isbweb.org/activities/standards', width='100%', height=400)
```

Out[2]:

Another initiative for the standardization of references frames is from the Virtual Animation of the Kinematics of the Human for Industrial, Educational and Research Purposes (VAKHUM) project.

In Biomechanics, we may use different coordinate systems for convenience and refer to them as global, laboratory, local, anatomical, or technical reference frames or coordinate systems. For example, in a standard gait analysis, we define a global or laboratory coordinate system and a different coordinate system for each segment of the body to be able to describe the motion of a segment in relation to anatomical axes of another segment. To define this anatomical coordinate system, we need to place markers on anatomical landmarks on each segment. We also may use other markers (technical markers) on the segment to improve the motion analysis and then we will also have to define a technical coordinate system for each segment.

As we perceive the surrounding space as three-dimensional, a convenient coordinate system to use is the Cartesian coordinate system with three orthogonal axes in the Euclidean space. From linear algebra, a set of unit linearly independent vectors (orthogonal in the Euclidean space and each with norm (length) equals to one) that can represent any vector via linear combination is called a basis (or orthonormal basis). The figure below shows a point and its position vector in the Cartesian coordinate system and the corresponding versors (unit vectors) of the basis for this coordinate system. See the notebook Scalar and vector for a description on vectors.

One can see that the versors of the basis shown in the figure above have the following coordinates in the Cartesian coordinate system:

\begin{equation} \hat{\mathbf{i}} = \begin{bmatrix}1\\0\\0 \end{bmatrix}, \quad \hat{\mathbf{j}} = \begin{bmatrix}0\\1\\0 \end{bmatrix}, \quad \hat{\mathbf{k}} = \begin{bmatrix} 0 \\ 0 \\ 1 \end{bmatrix} \end{equation}

Using the notation described in the figure above, the position vector $\overrightarrow{\mathbf{r}}$ (or the point $\overrightarrow{\mathbf{P}}$) can be expressed as:

\begin{equation} \overrightarrow{\mathbf{r}} = x\hat{\mathbf{i}} + y\hat{\mathbf{j}} + z\hat{\mathbf{k}} \end{equation}

The mathematical problem of determination of a coordinate system is to find a basis and an origin for it (a basis is only a set of vectors, with no origin). There are different methods to calculate a basis given a set of points (coordinates), for example, one can use the scalar product or the cross product for this problem.

Let's now define a basis using a common method in motion analysis (employing the cross product):

Given the coordinates of three noncollinear points in 3D space (points that do not all lie on the same line), $\overrightarrow{\mathbf{m}}_1, \overrightarrow{\mathbf{m}}_2, \overrightarrow{\mathbf{m}}_3$, which would represent the positions of markers captured from a motion analysis session, a basis can be found following these steps:

- First axis, $\overrightarrow{\mathbf{v}}_1$, the vector $\overrightarrow{\mathbf{m}}_2-\overrightarrow{\mathbf{m}}_1$ (or any other vector difference);

- Second axis, $\overrightarrow{\mathbf{v}}_2$, the cross or vector product between the vectors $\overrightarrow{\mathbf{v}}_1$ and $\overrightarrow{\mathbf{m}}_3-\overrightarrow{\mathbf{m}}_1$ (or $\overrightarrow{\mathbf{m}}_3-\overrightarrow{\mathbf{m}}_2$);

- Third axis, $\overrightarrow{\mathbf{v}}_3$, the cross product between the vectors $\overrightarrow{\mathbf{v}}_1$ and $\overrightarrow{\mathbf{v}}_2$.

- Make all vectors to have norm 1 dividing each vector by its norm.

The positions of the points used to construct a coordinate system have, by definition, to be specified in relation to an already existing coordinate system. In motion analysis, this coordinate system is the coordinate system from the motion capture system and it is established in the calibration phase. In this phase, the positions of markers placed on an object with perpendicular axes and known distances between the markers are captured and used as the reference (laboratory) coordinate system.

For example, given the positions $\overrightarrow{\mathbf{m}}_1 = [1,2,5], \overrightarrow{\mathbf{m}}_2 = [2,3,3], \overrightarrow{\mathbf{m}}_3 = [4,0,2]$, a basis can be found with:

In [2]:

```
import numpy as np
m1 = np.array([1, 2, 5])
m2 = np.array([2, 3, 3])
m3 = np.array([4, 0, 2])
v1 = m2 - m1 # first axis
v2 = np.cross(v1, m3 - m1) # second axis
v3 = np.cross(v1, v2) # third axis
# Vector normalization
e1 = v1/np.linalg.norm(v1)
e2 = v2/np.linalg.norm(v2)
e3 = v3/np.linalg.norm(v3)
print('Versors:', '\ne1 =', e1, '\ne2 =', e2, '\ne3 =', e3)
print('\nTest of orthogonality (cross product between versors):',
'\ne1 x e2:', np.linalg.norm(np.cross(e1, e2)),
'\ne1 x e3:', np.linalg.norm(np.cross(e1, e3)),
'\ne2 x e3:', np.linalg.norm(np.cross(e2, e3)))
print('\nNorm of each versor:',
'\n||e1|| =', np.linalg.norm(e1),
'\n||e2|| =', np.linalg.norm(e2),
'\n||e3|| =', np.linalg.norm(e3))
```

To define a coordinate system using the calculated basis, we also need to define an origin. In principle, we could use any point as origin, but if the calculated coordinate system should follow anatomical conventions, e.g., the coordinate system origin should be at a joint center, we will have to calculate the basis and origin according to standards used in motion analysis as discussed before.

If the coordinate system is a technical basis and not anatomic-based, a common procedure in motion analysis is to define the origin for the coordinate system as the centroid (average) position among the markers at the reference frame. Using the average position across markers potentially reduces the effect of noise (for example, from soft tissue artifact) on the calculation.

For the markers in the example above, the origin of the coordinate system will be:

In [3]:

```
origin = np.mean((m1, m2, m3), axis=0)
print('Origin: ', origin)
```

Let's plot the coordinate system and the basis using the custom Python function `CCS.py`

:

In [4]:

```
import sys
sys.path.insert(1, r'./../functions') # add to pythonpath
from CCS import CCS
```

In [5]:

```
markers = np.vstack((m1, m2, m3))
basis = np.vstack((e1, e2, e3))
```

Create figure in this page (inline):

In [6]:

```
%matplotlib notebook
markers = np.vstack((m1, m2, m3))
basis = np.vstack((e1, e2, e3))
CCS(xyz=[], Oijk=origin, ijk=basis, point=markers, vector=True);
```

Another classical procedure in mathematics, employing the scalar product, is known as the Gram–Schmidt process. See the notebook Scalar and Vector for a demonstration of the Gram–Schmidt process and how to implement it in Python.

The Gram–Schmidt process is a method for orthonormalizing (orthogonal unit versors) a set of vectors using the scalar product. The Gram–Schmidt process works for any number of vectors.

For example, given three vectors, $\overrightarrow{\mathbf{a}}, \overrightarrow{\mathbf{b}}, \overrightarrow{\mathbf{c}}$, in the 3D space, a basis $\{\hat{e}_a, \hat{e}_b, \hat{e}_c\}$ can be found using the Gram–Schmidt process by:

The first versor is in the $\overrightarrow{\mathbf{a}}$ direction (or in the direction of any of the other vectors):

\begin{equation} \hat{e}_a = \frac{\overrightarrow{\mathbf{a}}}{||\overrightarrow{\mathbf{a}}||} \end{equation}

The second versor, orthogonal to $\hat{e}_a$, can be found considering we can express vector $\overrightarrow{\mathbf{b}}$ in terms of the $\hat{e}_a$ direction as:

$$ \overrightarrow{\mathbf{b}} = \overrightarrow{\mathbf{b}}^\| + \overrightarrow{\mathbf{b}}^\bot $$Then:

$$ \overrightarrow{\mathbf{b}}^\bot = \overrightarrow{\mathbf{b}} - \overrightarrow{\mathbf{b}}^\| = \overrightarrow{\mathbf{b}} - (\overrightarrow{\mathbf{b}} \cdot \hat{e}_a ) \hat{e}_a $$Finally:

$$ \hat{e}_b = \frac{\overrightarrow{\mathbf{b}}^\bot}{||\overrightarrow{\mathbf{b}}^\bot||} $$The third versor, orthogonal to $\{\hat{e}_a, \hat{e}_b\}$, can be found expressing the vector $\overrightarrow{\mathbf{C}}$ in terms of $\hat{e}_a$ and $\hat{e}_b$ directions as:

$$ \overrightarrow{\mathbf{c}} = \overrightarrow{\mathbf{c}}^\| + \overrightarrow{\mathbf{c}}^\bot $$Then:

$$ \overrightarrow{\mathbf{c}}^\bot = \overrightarrow{\mathbf{c}} - \overrightarrow{\mathbf{c}}^\| $$Where:

$$ \overrightarrow{\mathbf{c}}^\| = (\overrightarrow{\mathbf{c}} \cdot \hat{e}_a ) \hat{e}_a + (\overrightarrow{\mathbf{c}} \cdot \hat{e}_b ) \hat{e}_b $$Finally:

$$ \hat{e}_c = \frac{\overrightarrow{\mathbf{c}}^\bot}{||\overrightarrow{\mathbf{c}}^\bot||} $$Let's implement the Gram–Schmidt process in Python.

For example, consider the positions (vectors) $\overrightarrow{\mathbf{a}} = [1,2,0], \overrightarrow{\mathbf{b}} = [0,1,3], \overrightarrow{\mathbf{c}} = [1,0,1]$:

In [3]:

```
import numpy as np
a = np.array([1, 2, 0])
b = np.array([0, 1, 3])
c = np.array([1, 0, 1])
```

The first versor is:

In [4]:

```
ea = a/np.linalg.norm(a)
print(ea)
```

The second versor is:

In [6]:

```
eb = b - np.dot(b, ea)*ea
eb = eb/np.linalg.norm(eb)
print(eb)
```

And the third version is:

In [8]:

```
ec = c - np.dot(c, ea)*ea - np.dot(c, eb)*eb
ec = ec/np.linalg.norm(ec)
print(ec)
```

Let's check the orthonormality between these versors:

In [13]:

```
print(' Versors:', '\nea =', ea, '\neb =', eb, '\nec =', ec)
print('\n Test of orthogonality (scalar product between versors):',
'\n ea x eb:', np.dot(ea, eb),
'\n eb x ec:', np.dot(eb, ec),
'\n ec x ea:', np.dot(ec, ea))
print('\n Norm of each versor:',
'\n ||ea|| =', np.linalg.norm(ea),
'\n ||eb|| =', np.linalg.norm(eb),
'\n ||ec|| =', np.linalg.norm(ec))
```

When studying circular motion in two or three dimensions, the use of a polar (for 2D) or spherical (for 3D) coordinate system can be more convenient than the Cartesian coordinate system.

In the polar coordinate system, a point in a plane is described by its distance $r$ to the origin (the ray from the origin to this point is the polar axis) and the angle $\theta$ (measured counterclockwise) between the polar axis and an axis of the coordinate system as shown next.

The relation of the coordinates in the Cartesian and polar coordinate systems is:

$$\begin{array}{l l} x = r\cos\theta \\ y = r\sin\theta \\ r = \sqrt{x^2 + y^2} \end{array} $$The spherical coordinate system can be seen as an extension of the polar coordinate system to three dimensions where an orthogonal axis is added and a second angle is used to describe the point with respect to this third axis as shown next.

The relation of the coordinates in the Cartesian and spherical coordinate systems is:

$$\begin{array}{l l} x = r\sin\theta\cos\phi \\ y = r\sin\theta\sin\phi \\ z = r\cos\theta \\ r = \sqrt{x^2 + y^2 + z^2} \end{array} $$In mechanics, generalized coordinates are a set of coordinates that describes the configuration of a system. Generalized coordinates are usually selected for convenience (e.g., simplifies the resolution of the problem) or to provide the minimum number of coordinates to describe the configuration of a system.

For instance, generalized coordinates are used to describe the motion of a system with multiple links where instead of using Cartesian coordinates, it's more convenient to use the angles between links as coordinates.

Right now, how fast are you moving? In your answer, consider your motion in relation to Earth and in relation to Sun.

Go to the website http://www.wisc-online.com/Objects/ViewObject.aspx?ID=AP15305 and complete the interactive lesson to learn about the anatomical terminology to describe relative position in the human body.

To learn more about Cartesian coordinate systems go to the website http://www.mathsisfun.com/data/cartesian-coordinates.html, study the material, and answer the 10 questions at the end.

Given the points in the 3D space, $m1 = [2,2,0], m2 = [0,1,1], m3 = [1,2,0]$, find an orthonormal basis.

Determine if the following points form a basis in the 3D space, $m1 = [2,2,0], m2 = [1,1,1], m3 = [1,1,0]$.

Derive expressions for the three axes of the pelvic basis considering the convention of the Virtual Animation of the Kinematics of the Human for Industrial, Educational and Research Purposes (VAKHUM) project (use RASIS, LASIS, RPSIS, and LPSIS as names for the pelvic anatomical landmarks and indicate the expression for each axis).

Determine the basis for the pelvis following the convention of the Virtual Animation of the Kinematics of the Human for Industrial, Educational and Research Purposes (VAKHUM) project for the following anatomical landmark positions (units in meters): $RASIS=[0.5,0.8,0.4], LASIS=[0.55,0.78,0.1], RPSIS=[0.3,0.85,0.2], LPSIS=[0.29,0.78,0.3]$.

- Corke P (2017) Robotics, Vision and Control: Fundamental Algorithms in MATLAB. 2nd ed. Springer-Verlag Berlin.
- Standards - International Society of Biomechanics.
- Stanford Encyclopedia of Philosophy. Space and Time: Inertial Frames.
- Virtual Animation of the Kinematics of the Human for Industrial, Educational and Research Purposes (VAKHUM).

In [ ]:

```
```