2.1.3. Body Orientation Offset

Calculation of bone vectors for both trainee's motion and trainer's motion based on the world coordinate system could be problematic if the trainee is not oriented as exactly as the trainer. The difference (error) in body orientation would be directly transferred to all eight bone vectors. In order to solve this problem, instead of using the joint position based on the world coordinate system, we calculate the joint position data based on a local coordinate system of the human model, which would be updated in real time. Establishment of the local coordinate system was adopted from Unity3D Mecanim system [35]. The up vector is defined as middle of left/right upper arm and middle of left/right upper leg. The left vector is an average upper body left (a vector defined by the left upper arm and the right upper arm) and lower body left (a vector defined by the left upper leg and the right upper leg). The forward vector is the cross product of the up vector and the left vector. In order to make these three vectors orthogonal to each other, the final left vector is the cross product of the forward vector and the up vector. Then the up vector is aligned to a normal vector of a ground plane as the y-axis. Hence, the final left vector and forward vector would be finalized as the x-axis and z-axis, respectively, based on the rotation matrix. The main purpose of this step is to guarantee that the x-axis and the z-axis would always be in the ground plane. The origin of this local coordinate system is the projection of center of mass on the ground.

As shown in Figure 2, the only difference between motions of two avatars is the body orientation (see z-axis). Under the local coordinate system, all the bone vectors between two avatars are exactly the same. While under the world coordinate system, there are clear angle differences among all corresponding bone vectors of two avatars, which are caused by the different body orientations.

Calculation of angular differences based on the local coordinate system of the human model can remove the accumulative errors on eight bone vectors caused by different body orientations. However, the difference in body orientation between trainee and trainer should also be considered in this case. Hence, we added one more dimension-body orientation into the evaluation of motion similarity. Lastly, we used nine dimensions to calculate the motion similarity: eight bone vectors under the local coordinate system of the human model and the forward vector of the body, which reflects the body (mainly trunk) orientation (z-axis in Figure 2). Then the final performance score can be updated by Equation (5).

$$\text{Final performance score} = \frac{\sum\_{k=-1}^{s} \left| 1 - \frac{\mathcal{C}\left(\varsigma\_k, t\_{jk}\right)}{90 \times 9} \right|}{s} = 1 - \frac{DTW(S, T)}{90 \times 9 \times s},\tag{5}$$

where all the notations are the same as in Equation (4) and where 9 stands for nine dimensions.

**Figure 2.** Illustration of motion similarity evaluation under the local coordinate system of the human model (bottom) and the world coordinate system (at the top right corner).
