# Frame of reference¶

Marcos Duarte

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 absolut 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.

## Frame of reference for human motion analysis¶

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.

## Cartesian coordinate system¶

As we perceive the surrounding space as three-dimensional, a convenient coordinate system is the Cartesian coordinate system in the Euclidean space with three ortogonal 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.

### Standardizations in movement analysis¶

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? 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.

## Determination of a coordinate system¶

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 improove 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 ortogonal 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:

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

Using the notation described in the figure above, the position vector r (or the point P) can be expressed as:

$$\mathbf{r} = x \mathbf{i} + y \mathbf{j} + z \mathbf{k}$$

### Definition of a basis¶

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). In the three-dimensional space, given the coordinates of three noncollinear points (points that do not all lie on the same line), m1, m2, m3, which would represent the positions of markers captured from a motion analysis session, a basis can be found following these steps:

1. First axis, v1, the vector m2-m1 (or any other vector difference);
2. Second axis, v2, the cross or vector product between the vectors v1 and m3-m1 (or m3-m2);
3. Third axis, v3, the cross product between the vectors v1 and v2.
4. 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 m1 = [1,2,0], m2 = [0,1,3], m3 = [1,0,1], a basis can be found:

In [2]:
# Import the necessary library
import numpy as np

m1 = np.array([1, 2, 5])
m2 = np.array([2, 1, 3])
m3 = np.array([1, 0, 1])

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))

Versors:
e1 = [ 0.40824829 -0.40824829 -0.81649658]
e2 = [ 0.          0.89442719 -0.4472136 ]
e3 = [ 0.91287093  0.18257419  0.36514837]

Test of orthogonality (cross product between versors):
e1 x e2: 1.0
e1 x e3: 1.0
e2 x e3: 1.0

Norm of each versor:
||e1|| = 1.0
||e2|| = 1.0
||e3|| = 1.0


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 pottentially 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)

Origin:  [ 1.33333333  1.          3.        ]


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))


In [6]:
%matplotlib notebook

/Users/marcos/miniconda3/lib/python3.4/site-packages/IPython/kernel/__init__.py:13: ShimWarning: The IPython.kernel package has been deprecated. You should import from ipykernel or jupyter_client instead.
"You should import from ipykernel or jupyter_client instead.", ShimWarning)

In [7]:
markers = np.vstack((m1, m2, m3))
basis = np.vstack((e1, e2, e3))
CCS(xyz='auto', Oijk=origin, ijk=basis, point=markers, vector=True);


### Gram–Schmidt process¶

Another equivalent form to calculate a basis based on vectors is knwon as the Gram–Schmidt process, a method for orthonormalising a set of vectors using the inner product (the inner product is the scalar product in an Euclidean space). This algorithm is not difficult to implement but we will not see it here because for an anatomical-based coordinate system we will have to explicitly handle the vectors in order to obtain the basis in the desired directions. In addition, when we don't want an anatomical-based coordinate system, e.g., if we are calculating a technical basis, it's typical to use more than three markers on the segment to pottentially reduce the effect of the soft tissue artifact and in this case it's used yet another procedure to calculate a basis: the singular value decomposition (SVD) algorithm, which we will study later.

## Polar and spherical coordinate systems¶

When stuyding 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.

### Polar 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}$$

### Spherical coordinate system¶

The spherical coordinate system can be seen as an extension of the polar coodirnate 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}$$

## Generalized coordinates¶

In mechanics, generalized coordinates are a set of coordimates 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.

## Problems¶

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

2. 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.

3. 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.

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

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

6. 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).

7. 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], and LPSIS=[0.29,0.78,0.3].