The Evaluate_Expression command can be used to evaluate arbitrary mathematical expressions. Use the following characters for your mathematical operators.
Arithmetic Operators
Boolean Operators
Comparison Operators
Note: Visual3D parses the mathematical operators before it parses the signal names. If you have a signal name that contains a mathematical operator (e.g. R-Foot1), Visual3D will probably not be able to parse the equation expression properly.
Arithmetic operations can generally be performed using syntax that is similar to that found in a variety of programming and scripting languages.
Addition is accomplished using the + character. An alternative syntax is add(a,b) where a and b are expressions that evaluate to numbers.
NOTE: Pipeline command parameters use the + character as a delimiter. If the user wants to use an expression containing a + in a command parameter that allows multiple signals, then Visual3D will likely interpret this plus sign incorrectly. In this case the add(a,b) syntax should be used.
2 + 3 = 5 add(2,3) = 5
Subtraction is accomplished using the - character.
3 - 2 = 1
Multiplication is accomplished using the * character.
3 * 2 = 6
Division is accomplished using the / character.
6 / 3 = 2
Exponentiation is accomplished using the ^ character.
2^3 = 8
Boolean operators deal with boolean values, such as TRUE and FALSE. These are represented numerically as 1 (TRUE) and 0 (FALSE).
The Logical OR operator is signified by the | character. It takes two boolean values as input and returns TRUE if either of the input values is TRUE.
FALSE | FALSE = FALSE FALSE | TRUE = TRUE TRUE | FALSE = TRUE TRUE | TRUE = FALSE
The Logical AND operator is signified by the & character. It takes two boolean values as input and returns TRUE when both input values are TRUE.
FALSE | FALSE = FALSE FALSE | TRUE = FALSE TRUE | FALSE = FALSE TRUE | TRUE = FALSE
The logical adjective NOT can be used with both the logical AND and logical OR operators. It takes one boolean value as input and negates that boolean value.
NOT(FALSE) = TRUE NOT(TRUE) = FALSE
Given a workspace containing 3 trials (*trial1.c3d, *trial2.c3d, and *trial3.c3d).
Select_Active_File /FILE_NAME=WALK /QUERY=BAD ;
This command results in *trial1.c3d being active
Select_Active_File /FILE_NAME=WALK /QUERY=NOT(BAD) ;
This command results in *trial2.c3d and *trial3.c3d being active.
Comparison operators take two inputs of the same type and return a boolean value.
Equality is tested using either = or ==. It returns TRUE if the two inputs have the same value and FALSE if they do not.
Consider a model metric that is defined as a string and compare it to an explicitly defined string.
Set_Model_Metric ! /CALIBRATION_FILE= /METRIC_NAME=TEST /METRIC_VALUE="TTT" ; Evaluate_Expression** /EXPRESSION=MODEL::METRIC::TEST="TTT" /RESULT_NAME=SCOTT /RESULT_TYPE=METRIC ! /RESULT_FOLDER=PROCESSED ;
The text strings are equal, so the resulting signal contains a 1 (indicating TRUE).
Non-equality is tested using either <> or ><. Its behaviour is opposite that of equality.
If (a==b) is TRUE then (a<>b) is FALSE. Similarly, if (a==b) is FALSE, then (a<>b) is TRUE.
We can test is one value is less than another using the < character.
Given two signals TARGET::ORIGINAL::RFT1 and TARGET::ORIGINAL::LFT1, use the Boolean operator < to identify when the Z component of RFT1 is less than the Z component of LFT1.
Evaluate_Expression /EXPRESSION= TARGET::ORIGINAL::RFT1::Z < TARGET::ORIGINAL::LFT1::Z /RESULT_NAME=RFT1_GREATER /RESULT_TYPE=DERIVED /RESULT_FOLDER=PROCESSED ;
The output signal will be 1 when RFT1::Z is less than LFT1::Z and 0 otherwise
Heel and toe clearance are defined by two paths. It is possible to model “foot clearance” as the lower value of the heel and toe clearance values at each frame.
Here is a simplified test of this. First, make the Global Workspace Active. Then, create 2 toy signals and calculate a third signal containing the lower value of the two toy signals.
Evaluate_Expression /EXPRESSION=LIST(1,2,3,4,5) ! /SIGNAL_TYPES= ! /SIGNAL_FOLDER=ORIGINAL ! /SIGNAL_NAMES= ! /SIGNAL_COMPONENTS= /RESULT_TYPES=DERIVED /RESULT_FOLDERS=PROCESSED /RESULT_NAME=SIGNAL1 ! /APPLY_AS_SUFFIX_TO_SIGNAL_NAME=FALSE ; Evaluate_Expression /EXPRESSION=LIST(5,4,3,2,1) ! /SIGNAL_TYPES= ! /SIGNAL_FOLDER=ORIGINAL ! /SIGNAL_NAMES= ! /SIGNAL_COMPONENTS= /RESULT_TYPES=DERIVED /RESULT_FOLDERS=PROCESSED /RESULT_NAME=SIGNAL2 ! /APPLY_AS_SUFFIX_TO_SIGNAL_NAME=FALSE ; !create a new signal that is the lower value of the two signals Evaluate_Expression /EXPRESSION=(DERIVED::PROCESSED::SIGNAL1<=DERIVED::PROCESSED::SIGNAL2)*DERIVED::PROCESSED::SIGNAL1 +(DERIVED::PROCESSED::SIGNAL2<DERIVED::PROCESSED::SIGNAL1)*DERIVED::PROCESSED::SIGNAL2 ! /SIGNAL_TYPES= ! /SIGNAL_FOLDER=ORIGINAL ! /SIGNAL_NAMES= ! /SIGNAL_COMPONENTS= /RESULT_TYPES=DERIVED /RESULT_FOLDERS=PROCESSED /RESULT_NAME=SIGNAL_LOWER ! /APPLY_AS_SUFFIX_TO_SIGNAL_NAME=FALSE ;
This boolean operator uses one of the following syntaxes: ⇐ or =<.
The expression (a ⇐ b) is equivalent logically to 1).
Given two signals TARGET::ORIGINAL::RFT1 and TARGET::ORIGINAL::LFT1, use the Boolean operator ⇐ or the boolean operative =< to identify when the Z component of RFT1 is less than or equal to the Z component of LFT1.
Evaluate_Expression /EXPRESSION= TARGET::ORIGINAL::RFT1::Z <= TARGET::ORIGINAL::LFT1::Z /RESULT_NAME=RFT1_GREATER /RESULT_TYPE=DERIVED /RESULT_FOLDER=PROCESSED ;
The output signal will be 1 (indicating TRUE) when RFT1::Z is less than or equal to LFT1::Z and 0 (indicating FALSE) otherwise.
We can test is one value is less than another using the > character.
Given two signals TARGET::ORIGINAL::RFT1 and TARGET::ORIGINAL::LFT1, use the Boolean operator > to identify when the Y component of RFT1 is greater than the Y component of LFT1.
Evaluate_Expression /EXPRESSION= TARGET::ORIGINAL::RFT1::Y > TARGET::ORIGINAL::LFT1::Y /RESULT_NAME=RFT1_GREATER /RESULT_TYPE=DERIVED /RESULT_FOLDER=PROCESSED ;
The output signal will be 1 (indicating TRUE) when RFT1::Y is greater than LFT1::Y and 0 (indicating FALSE) otherwise.
This boolean operator uses one of the following syntaxes: >= or ⇒.
The expression (a >= b) is equivalent logically to 2).