10.2. Interconnecting points#
In the previous section, we learned how to show markers in the Player:
import kineticstoolkit.lab as ktk
# Download and read markers from a sample C3D file
filename = ktk.doc.download("kinematics_tennis_serve_2players.c3d")
markers = ktk.read_c3d(filename)["Points"]
p = ktk.Player(markers, up="z", anterior="-y")
To interconnect points, we use the interconnections
property of the Player, which is a dict that follows this form:

Fig. 10.2 Interconnection dictionary.#
For example, to interconnect Derrick’s right lower limb, we would do:
# Name "RLowerLimb" is arbitrary, anything would do.
p.interconnections["RLowerLimb"] = {"Links": [
["Derrick:RTOE", "Derrick:RHEE", "Derrick:RANK", "Derrick:RTOE"], # Feet
["Derrick:RANK", "Derrick:RKNE"], # Shank
["Derrick:RKNE", "Derrick:RPSI", "Derrick:RASI", "Derrick:RKNE"] # Thigh
]}
Let’s assign a red colour to this side, and do the same in blue for the left side.
p.interconnections["RLowerLimb"]["Color"] = "r"
p.interconnections["LLowerLimb"] = {"Links": [
["Derrick:LTOE", "Derrick:LHEE", "Derrick:LANK", "Derrick:LTOE"], # Feet
["Derrick:LANK", "Derrick:LKNE"], # Shank
["Derrick:LKNE", "Derrick:LPSI", "Derrick:LASI", "Derrick:LKNE"] # Thigh
], "Color": "b"}
10.2.1. Wildcards#
To draw links for both Viktor and Derrick, we could repeat the same code by replacing every occurrence of “Derrick:” with “Viktor:”. However, we can also use wildcards (*
), which is much more convenient. A wildcard means “assign any name in place of *
”. We may choose to use wildcards as a prefix or as a suffix. Here, we use it as a prefix, for every body segment:
p.interconnections["LLowerLimb"] = {
"Color": "b",
"Links": [ # List of lines that span lists of markers
["*LTOE", "*LHEE", "*LANK", "*LTOE"],
["*LANK", "*LKNE"],
["*LKNE", "*LPSI", "*LASI", "*LKNE"],
],
}
p.interconnections["RLowerLimb"] = {
"Color": "r",
"Links": [
["*RTOE", "*RHEE", "*RANK", "*RTOE"],
["*RANK", "*RKNE"],
["*RKNE", "*RPSI", "*RASI", "*RKNE"],
],
}
p.interconnections["LUpperLimb"] = {
"Color": (0.0, 0.5, 1.0),
"Links": [
["*LSHO", "*LELB", "*LWRA", "*LFIN"],
["*LELB", "*LWRB", "*LFIN"],
["*LWRA", "*LWRB"],
],
}
p.interconnections["RUpperLimb"] = {
"Color": (1.0, 0.5, 0.0),
"Links": [
["*RSHO", "*RELB", "*RWRA", "*RFIN"],
["*RELB", "*RWRB", "*RFIN"],
["*RWRA", "*RWRB"],
],
}
p.interconnections["Head"] = {
"Color": (1.0, 0.5, 1.0),
"Links": [
["*C7", "*LFHD", "*RFHD", "*C7"],
["*C7", "*LBHD", "*RBHD", "*C7"],
["*LBHD", "*LFHD"],
["*RBHD", "*RFHD"],
],
}
p.interconnections["TrunkPelvis"] = {
"Color": (0.5, 1.0, 0.5),
"Links": [
["*LASI", "*STRN", "*RASI"],
["*STRN", "*CLAV"],
["*LPSI", "*T10", "*RPSI"],
["*T10", "*C7"],
["*LASI", "*LSHO", "*LPSI"],
["*RASI", "*RSHO", "*RPSI"],
["*LPSI", "*LASI", "*RASI", "*RPSI", "*LPSI"],
["*LSHO", "*CLAV", "*RSHO", "*C7", "*LSHO"],
],
}