Step 3 - Define variables
Points and vectors
- After you have completed Step 2 - Define input parameters, click on the Variables tab at the top left of ProCalc’s main interface.
-
Click the Create button
to create a new Variables scheme and name it, for example,Tutorial
, and then press Enter. -
Below the variable list, click the Add button
to add a new variable.
The display now looks similar to the following:
Variables are time-dependent and are typically calculated for every frame in the motion capture trial you’re working with. Each variable has a Name and a Function, and depending on which Function you have chosen, one or more Input Variables. - For now, define a new Variable called MyPoint. Enter this name, and note the two drop-down menus next to the Function label.
The first one contains the function group, whereas the second one updates dynamically to show the relevant functions belonging to the chosen group. - Select the function group Point.
The second drop-down now contains all possible ways you can define a new point. - Select Halfway between A and B.
Note the interface below – the rows next to the labels A: and B: are active, and the drop-down menus in the Type columns have been set to Point.
This is how ProCalc always works – when you choose a function, the arguments that you can feed into that function dynamically update. The Type drop-down, in this case, contains only a single entry, namely Point, whereas for other function types, it may contain more than one option.
The type Point corresponds to all 3D entities that have an XYZ position in space – either a constant, or one that varies with time (in which case it is also known as a trajectory). - Choose the two points that you want to use as the input for your new point by selecting them from the drop-down menu in the Input Variable column. For this tutorial, select LASI and RASI.
The following things now happen:- Your new point will be valid, in other words it can be calculated. Therefore it is visualized in the workspace as both a new point and as a graph.
Tip: To display the graph, you may need to rotate the view in the workspace (click and drag). - The new point’s value is shown in the Log window.
- Your new point will be valid, in other words it can be calculated. Therefore it is visualized in the workspace as both a new point and as a graph.
- Consider the other columns: XYZ, Factor, Timing and Event. First, try to change the XYZ drop-down for LASI to another value, eg, XY. This corresponds to a projection. In other words, instead of feeding the X, Y and Z values to the function, only LASI’s X and Y values are used, the Z is set to 0, which is the same as projecting the marker into the XY plane, or the lab’s transverse/floor plane. The other options let you project the value to the YZ or XZ planes, or onto the X, Y or Z axis. As you can see, ProCalc immediately updates the 3D workspace and log window to reflect your changes.
- Edit the Factor text box, for example by entering the number
0.5
. This multiplies the input XYZ values with the entered factor. Note that ProCalc updates only when you click outside the box in another active text box.
Timing options
Finally, you need to define the timing options. The default is Continuous. This means that the value is evaluated for the same time as is currently being calculated. The currently calculated time is shown on the time bar in the 3D workspace. The other options in this menu lets you evaluate the input variable at a different time from the one currently being calculated. This can be very useful, for example if you would like to know the walking direction of the subject.
Let’s use this as an example:
- Change the current variable name from MyPoint to PelvisOrigin, noting that naming variables appropriately makes it easier to keep track of them later.
-
Click the Add button
again to add another variable. This time, name the variable WalkingDirectionVector, and from the first Function drop-down menu, select Vector, and from the second drop-down menu, select From point A to point B.This defines a 3D vector, which is a direction, in 3D space, between the points A and B.
- Expand the Input Variable drop-down for both A and B, and choose the previously defined variable PelvisOrigin for both.
This creates a vector of length 0, because it goes from a 3D point to the very same one. However, this is where we can change the timing options mentioned above. - From the Timing drop-down menu for A, select FirstValidFrame, then from the Timing drop-down menu for B, select LastValidFrame.
As you can see in the 3D workspace and the log, you have now created a vector that stars at the PelvisOrigin point’s very first valid 3D point in the trial to its very last valid point, which corresponds to the general direction the subject traveled throughout the trial. This is because the input variable is evaluated at a different time point from the one currently being calculated.
You can further expand this to include events defined in the trial. If your trial includes standard Vicon events such as Foot Contact or Foot Off, you can also evaluate an input variable for the previous, following, first, or last such event. (You choose the event type from the Event column next to the Timing column. We will revisit this later when we define the Step Length parameter.)
Define segments
One of the most powerful concepts in ProCalc is the ability to define segments. A segment can be defined in several ways, as shown in the following example.
To define a segment:
-
Click the Add button
again to add a new variable, and name the variable Pelvis. - From the Function drop-down menu, select Segment and then the option Origin A, Y-Axis=A->B, Z-Axis=(A->B)x(A->C).
This lets you specify a segment using the three points A, B, and C. The origin of the segment is A, the first axis (in this case Y) is the direction from point A to point B, and the second axis of the segment (in this case Z) is found by taking the cross-product of the first axis and the vector from point A to point C.
Tip: Remember, the cross product of two vectors results in a third vector that is perpendicular to both. Another way to look at this is that the segment’s second axis is perpendicular to the plane that contains the two vectors A->B and A→C. - For this example, choose our previously defined PelvisOrigin point as point A. We want the Y-axis of our pelvis segment to point towards the left, so choose the LASI point as point B. We want the Z-axis to point upwards (proximally), so choose the LPSI point as point C.
At this stage, ProCalc displays the XYZ axis of the new segment, again using the color convention XYZ = RGB. As you can see, the third axis, X, points forward according to the right-hand convention.
You have now defined your first segment in ProCalc, and as you can see, a segment is a variable that has both a specific location and orientation in space and time. Segments are commonly used in biomechanical models to represent anatomical segments. - Another segment that we could define in ProCalc is one that corresponds to the subject’s progression frame. The progression frame is often defined as the laboratory axis that corresponds to the general walking direction of the subject, which – depending on how the calibration object is placed to define the laboratory axes – usually is either along X or Y axis, either in the negative or positive direction.
-
To define a progression frame, click the Add button
again and name the new variable ProgressionFrame. - Choose the Segment function group, but this time select the Origin A, X-Axis=lab axis closest to B, Z-Axis up option.
- This option makes it easy to specify the progression frame, and all you need to do is to select the PelvisOrigin as your point A and the previously defined WalkingDirectionVector as the vector B.
You now have another segment anchored in the same origin point, but this time the segment’s axes are aligned with the laboratory axes instead of the pelvis markers. This leads us nicely to the next topic – let’s calculate some angles.
Define angles
Angles in 3D is a rather complicated topic. There are many ways to define them, and the method you choose has a large impact on how the angle graphs look. It is beyond the scope of this guide to discuss this in detail, so if you need more information, please consult the relevant literature.
Our first task is to define the pelvis progression angles. These biomechanically meaningful angles are usually labeled “Pelvic Tilt” for the pelvis’ rotation around the mediolateral axis (sagittal plane), “Pelvic Obliquity” for the rotation around the anterior-posterior axis (coronal plane), and “Pelvic Rotation” for the rotation around the proximal-distal axis (transverse plane). By convention, these angles are calculated as Euler Angles.
-
Click the Add button
again to add another variable, and this time enter PelvicAngles as the variable name, select the Angle function group and then the Euler Angle: XYZ between A and B from the second drop-down.
The Type column below automatically updates to Segment. - Choose the ProgressionFrame segment for A, and Pelvis for B.
The 3D workspace immediately updates to display the Euler angle you’ve just defined. In this case, we have chosen the XYZ rotation order for the Euler angles, which means that the rotation around the X (tilt) axis is done first, followed by Y (obliquity) and Z (rotation).
Define lines and projections
There are times when we want to define variables of other types in 3D. In this section, we look at lines, which are similar to vectors except that lines have a fixed location in 3D. These can be very useful if we are calculating certain parameters, for example, step length in data that contains foot strike events.
However, let’s first look at how we define a line or a plane in ProCalc.
To define a line:
-
Click the Add button
and name the variable LeftStrideLine. - From the function group, select Line and then From point A to point B.
This lets you define a simple line from point A to point B. In this case, we want to create a line that corresponds to a full strike for the left side. - To do this, select the LANK marker for both A and B, and from the Timing menu, choose Previous for A and Following for B.
Note that the drop-downs menus in the Event column are now active – from here, choose the Left Foot Strike for both A and B.
This defines a line that starts at LANK’s 3D point at the previous foot strike event to the LANK’s 3D point at the following foot strike event. This is only defined if the current time is between the two events, so scrub the time bar until you’re there. You should now see a line appear in the 3D workspace.
This is a great time to get to know one of the convenience features of ProCalc: the ability to copy and mirror a variable, as described in the next step. -
Ensure that your selection is still on the LeftStrideLine variable and then click the
button, and then the button. This first creates a copy of the variable, and then mirrors it – changing all references from left to right, and vice versa. If, as is often the case, you would like to define corresponding variables for both the left and right side of the body, this can be a great time saver. -
Now let’s look at a point’s projection onto a line. Click the Add button
to add a new variable again, and call it RANK_LeftStrideLine_Proj. - Choose the function group Point and then Project: A onto B.
- For A, choose RANK and for B our LeftStrideLine.
You will see the projection visualized in the 3D workspace.
We will use this projected point later when we define the step length parameter. -
For now, click the
button, and then the button for this variable as well, to create one called LANK_RightStrideLine_Proj.
Define and compare distances
Another useful feature in ProCalc is the ability to calculate distances. Let’s say we would like to know how far the left foot is ahead or behind the right foot in the direction of walking. We first define a walking direction line by adding a new variable, calling it ProgressionLine, selecting Line and From point A to point B, and specifying A = PelvisOrigin with XYZ = XY, Timing = FirstValidFrame, and B = PelvisOrigin with XYZ = XY, Timing = LastValidFrame. This defines the line of progression in the floor (XY) plane.
We can now define a new variable called LANK_ProgressionLine_Proj and select Point and Project: A onto B, then set A = LANK and B = ProgressionLine. We then copy and mirror this to get RANK_ProgressionLine_Proj. These two new points correspond to the position of each foot along the line of progression.
Our aim is to calculate the distance traveled by these two points as a function of time. The challenge is that we don’t have a common reference point except the lab origin, which we cannot use because the subject typically crosses this point during the walk. Furthermore, the first valid point for the left side is obviously different from the one for the right side.
One solution is to use the first valid point that is furthest from the origin. This is where the comparison operator comes into play.To use this technique:
- Create a new variable called FootDistanceReferencePoint, and select the function type Comparison and then Max: A and B.
- Choose Type = Point and specify A = LANK_ProgressionLine_Proj with Timing = FirstValidFrame and B = RANK_ProgressionLine_Proj, Timing = FirstValidFrame. The variable contains the point that is furthest from the origin, which is also the point from which we will calculate our distances.
- We can now specify our distance variables. To do this, add LeftFootDistance, select Distance and then Distance: A to B, and select A = FootDistanceReferencePoint, B = LANK_ProgressionLine_Proj, copy and mirror.
- Finally, to calculate how far ahead or behind the left foot is in comparison to the right, we simply add another variable called LeftFoot_v_RightFoot, select Arithmetic and Subtract: A – B, choose the type Length for both A and B and select the two variables we defined above.
You should now see a nice curve that alternates between positive and negative values as the subject walks along, as shown in the following illustration.
In summary, we have:
- Defined a progression line along the floor using the pelvis origin’s first and last valid positions.
- Projected the LANK and RANK marker positions onto this line.
- Figured out which of these positions is furthest from the origin.
- Using this point as the reference, calculated the distance to the projected LANK and RANK points.
- Subtracted one of these values from the other to get the difference.
Other variable functions
There are many other functions that you may find useful in ProCalc:
- Calculate the velocity or acceleration of a 3D point or an angle (function groups Velocity and Acceleration).
- Calculate a value as a percentage of another value. For example, you could calculate the distance traveled by the left foot as a percentage of the total distance (function group Normalize).
- Calculate a point’s coordinates in a segment’s local coordinate system, or vice versa (function group Point > Transform: A to B’s local coordinates). You could, for example, calculate an anatomical marker’s position in a coordinate system defined by a marker cluster for a static trial, and then re-calculate the anatomical marker’s position as a virtual marker in the dynamic trials, where the marker is no longer present.
- Calculate a joint center position using the Conventional Gait/Plug-in Gait model’s method of using three markers to define the plane as well as a subject measurement offset value (function group Point > Joint Center).
- Calculate the cross or dot product between two vectors (function group Vector).