Exercise: A fixed point in a moving coordinate system

9.3.3.5. Exercise: A fixed point in a moving coordinate system#

In Fig. 9.6, the position of the elbow in the arm coordinate system is \((0, -0.5, 0)\).

Using Kinetics Toolkit’s geometry module, express the position of the elbow in global coordinates for shoulder flexion movements of 0°, 5°, 10°, and 15°.

a) Do this exercise by creating the corresponding homogeneous transform using ktk.geometry.create_transform_series, then by multiplying this transform by the point coordinates using ktk.geometry.matmul.

Hide code cell content
import numpy as np

import kineticstoolkit.lab as ktk

p_elbow_ref_arm = np.array([[0.0, -0.5, 0.0, 1.0]])

T_arm = ktk.geometry.create_transform_series(
    angles=[0, 5, 10, 15],
    degrees=True,
    seq="z",
)

ktk.geometry.matmul(T_arm, p_elbow_ref_arm)
array([[ 0.        , -0.5       ,  0.        ,  1.        ],
       [ 0.04357787, -0.49809735,  0.        ,  1.        ],
       [ 0.08682409, -0.49240388,  0.        ,  1.        ],
       [ 0.12940952, -0.48296291,  0.        ,  1.        ]])

b) Do this exercise using the ktk.geometry.rotate and ktk.geometry.translate functions.

Hide code cell content
p_elbow_ref_arm = np.array([[0.0, -0.5, 0.0, 1.0]])

ktk.geometry.rotate(
    p_elbow_ref_arm,
    angles=[0, 5, 10, 15],
    seq="z",
)
array([[ 0.        , -0.5       ,  0.        ,  1.        ],
       [-0.47946214, -0.14183109,  0.        ,  1.        ],
       [-0.27201056,  0.41953576,  0.        ,  1.        ],
       [ 0.32514392,  0.37984396,  0.        ,  1.        ]])