visual3d:documentation:pipeline:expressions:mathematical_operators
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
visual3d:documentation:pipeline:expressions:mathematical_operators [2024/06/19 13:59] – created sgranger | visual3d:documentation:pipeline:expressions:mathematical_operators [2024/11/04 20:30] (current) – wikisysop | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ===== Contents | + | ====== Mathematical Operators |
+ | The [[visual3d: | ||
+ | **Arithmetic Operators** | ||
+ | * [[# | ||
+ | * [[# | ||
+ | * [[# | ||
+ | * [[# | ||
+ | * [[# | ||
- | | + | **Boolean Operators** |
- | | + | * [[# |
- | | + | * [[# |
- | | + | * [[# |
- | * [[#Power|5 Power]] | + | |
- | * [[# | + | |
- | * [[# | + | |
- | * [[#Equals|8 Equals]] | + | |
- | * [[# | + | |
- | * [[# | + | |
- | * [[# | + | |
- | * [[# | + | |
- | * [[# | + | |
- | * [[# | + | |
+ | **Comparison Operators** | ||
+ | * [[# | ||
+ | * [[# | ||
+ | * [[# | ||
+ | * [[# | ||
+ | * [[# | ||
+ | * [[# | ||
- | ===== Plus ===== | + | 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. |
- | NOTE: Pipeline command parameters use + as delimiter | + | ===== Arithmetic Operators ===== |
- | If the user wants to use an expression containing a + in a command parameter that allows multiple signals, Visual3D will likely interpret this plus sign incorrectly. | + | Arithmetic operations can generally be performed using syntax that is similar |
- | The workaround is to use a mathematical function add() to express the addition. | + | ==== Plus ==== |
- | **add(a, | + | Addition is accomplished using the + character. An alternative syntax is **add(a, |
- | ===== Minus ===== | + | |
- | ===== Multiply ===== | + | 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, |
- | ===== Divide ===== | + | < |
+ | 2 + 3 = 5 | ||
+ | add(2, | ||
+ | </ | ||
- | ===== Power ===== | + | ==== Minus ==== |
- | ===== Logical_Or ===== | + | Subtraction is accomplished using the - character. |
- | Logical Or | + | < |
- | ===== Logical_And ===== | + | 3 - 2 = 1 |
+ | </ | ||
- | Logical And | + | ==== Multiply |
- | ===== Equals ===== | + | |
- | **= or ==** - Boolean Operator // | + | Multiplication is accomplished using the * character. |
- | Example: Comparing a model metric with a string | + | |
- | Consider a model metric that is defined as a string. | + | < |
- | **Set_Model_Metric** | + | 3 * 2 = 6 |
- | ! / | + | </code> |
- | /METRIC_NAME=TEST | + | |
- | / | + | |
- | **;** | + | |
- | Now compare it to the text string " | + | |
- | **Evaluate_Expression** | + | |
- | / | + | |
- | / | + | |
- | / | + | |
- | ! / | + | |
- | **;** | + | |
- | The text strings should be equal so the resulting signal contains a 1 | + | |
- | ===== Not_Equals ===== | + | |
- | **<> or ><** - Boolean Operator "Not Equals" | + | ==== Divide |
- | ===== Using the Adjective NOT ===== | + | |
- | NOT can be used with the logical AND and logical OR | + | Division is accomplished using the / character. |
- | Example: Given a workspace containing | + | < |
+ | 6 / 3 = 2 | ||
+ | </ | ||
- | All trials are assigned a TAG labeled WALK | + | ==== Power ==== |
+ | Exponentiation is accomplished using the ^ character. | ||
+ | |||
+ | < | ||
+ | 2^3 = 8 | ||
+ | </ | ||
+ | |||
+ | ===== Boolean Operators ===== | ||
+ | |||
+ | Boolean operators deal with boolean values, such as TRUE and FALSE. These are represented numerically as 1 (TRUE) and 0 (FALSE). | ||
+ | |||
+ | ==== Logical OR ==== | ||
+ | |||
+ | 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 | ||
+ | </ | ||
+ | |||
+ | ==== Logical AND ==== | ||
+ | |||
+ | 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 Adjective NOT ==== | ||
+ | |||
+ | 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 | ||
+ | </ | ||
+ | |||
+ | ===Example=== | ||
+ | |||
+ | Given a workspace containing 3 trials (*trial1.c3d, | ||
+ | * All trials are assigned a TAG labeled WALK | ||
* trial1.c3d is also assigned a TAG labeled BAD | * trial1.c3d is also assigned a TAG labeled BAD | ||
- | [[Visual3D: | + | < |
+ | Select_Active_File | ||
/ | / | ||
/QUERY=BAD | /QUERY=BAD | ||
- | **;** | + | ; |
+ | </ | ||
This command results in *trial1.c3d being active | This command results in *trial1.c3d being active | ||
- | [[Visual3D: | + | < |
+ | Select_Active_File | ||
/ | / | ||
/ | / | ||
- | **;** | + | ; |
+ | </ | ||
This command results in *trial2.c3d and *trial3.c3d being active. | This command results in *trial2.c3d and *trial3.c3d being active. | ||
- | ===== Less_Than | + | ===== Comparison Operators |
+ | |||
+ | Comparison operators take two inputs of the same type and return a boolean value. | ||
+ | |||
+ | ==== Equals ==== | ||
+ | |||
+ | Equality is tested using either = or ==. It returns TRUE if the two inputs have the same value and FALSE if they do not. | ||
+ | |||
+ | ===Example=== | ||
+ | |||
+ | Consider a model metric that is defined as a string and compare it to an explicitly defined string. | ||
+ | |||
+ | < | ||
+ | Set_Model_Metric | ||
+ | ! / | ||
+ | / | ||
+ | / | ||
+ | ; | ||
+ | |||
+ | Evaluate_Expression** | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | ! / | ||
+ | ; | ||
+ | </ | ||
+ | |||
+ | The text strings are equal, so the resulting signal contains a 1 (indicating TRUE). | ||
+ | |||
+ | ==== Not Equals ==== | ||
+ | |||
+ | Non-equality is tested using either <> or ><. Its behaviour is opposite that of equality. | ||
+ | |||
+ | If (a==b) is TRUE then (a<> | ||
+ | |||
+ | ==== Less Than ==== | ||
+ | |||
+ | We can test is one value is less than another using the < character. | ||
- | **<** Boolean Operator //less than// | + | ===Example=== |
- | **Example** | + | Given two signals TARGET:: |
- | Given two signals | + | <code> |
- | TARGET:: | + | Evaluate_Expression |
- | TARGET:: | + | |
- | Use the Boolean operator | + | |
- | **Evaluate_Expression** | + | |
/ | / | ||
/ | / | ||
/ | / | ||
/ | / | ||
- | **;** | + | ; |
+ | </ | ||
The output signal will be 1 when RFT1::Z is less than LFT1::Z and 0 otherwise | The output signal will be 1 when RFT1::Z is less than LFT1::Z and 0 otherwise | ||
- | **Example - Foot Clearance** | ||
- | Given the following situation. | + | ===Example - Foot Clearance=== |
- | One might consider Foot clearance | + | |
- | {{heel_toe_clearance.jpg}} | + | Heel and toe clearance are defined by two paths. |
- | Here is a simplified test of this | + | {{:heel_toe_clearance.jpg}} |
- | Make the Global Workspace Active. | + | |
- | Create | + | Here is a simplified test of this. First, make the Global Workspace Active. |
- | **Evaluate_Expression** | + | |
+ | < | ||
+ | Evaluate_Expression | ||
/ | / | ||
! / | ! / | ||
Line 121: | Line 203: | ||
/ | / | ||
! / | ! / | ||
- | **;** | + | ; |
- | **Evaluate_Expression** | + | |
+ | Evaluate_Expression | ||
/ | / | ||
! / | ! / | ||
Line 132: | Line 215: | ||
/ | / | ||
! / | ! / | ||
- | **;** | + | ; |
- | !create a new signal that is the lower value of the two signals | + | |
- | **Evaluate_Expression** | + | !create a new signal that is the lower value of the two signals |
+ | Evaluate_Expression | ||
/ | / | ||
+(DERIVED:: | +(DERIVED:: | ||
Line 146: | Line 229: | ||
/ | / | ||
! / | ! / | ||
- | **;** | + | ; |
- | {{heel_toe_clearance2.jpg}} | + | </ |
- | ===== Less_Than_Or_Equals ===== | + | |
- | ! style=" | + | {{:heel_toe_clearance2.jpg}} |
- | Example: | + | ==== Less Than Or Equals ==== |
- | Given two signals | + | This boolean operator uses one of the following syntaxes: <= or =<. |
- | TARGET:: | + | |
- | TARGET:: | + | The expression (a <= b) is equivalent logically to ((a < b) | (a == b)). |
- | 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** | + | ===Example=== |
+ | |||
+ | Given two signals TARGET:: | ||
+ | |||
+ | < | ||
+ | Evaluate_Expression | ||
/ | / | ||
/ | / | ||
/ | / | ||
/ | / | ||
- | **;** | + | ; |
- | The output signal will be 1 when RFT1::Z is less than or equal toLFT1::Z and 0 otherwise | + | </ |
- | ===== Greater_Than ===== | + | |
- | **>** Boolean Operator // | + | The output signal will be 1 (indicating TRUE) when RFT1::Z is less than or equal to LFT1::Z and 0 (indicating FALSE) otherwise. |
- | Example: | + | ==== Greater Than ==== |
- | Given two signals | + | We can test is one value is less than another using the > character. |
- | TARGET:: | + | |
- | TARGET:: | + | ===Example=== |
- | Use the Boolean operator > to identify when the Y component of RFT1 is greater than the Y component of LFT1 | + | |
- | **Evaluate_Expression** | + | Given two signals TARGET:: |
+ | |||
+ | < | ||
+ | Evaluate_Expression | ||
/ | / | ||
/ | / | ||
/ | / | ||
/ | / | ||
- | **;** | + | ; |
- | The output signal will be 1 when RFT1::Y is greater than LFT1::Y and 0 otherwise | + | </ |
- | ===== Greater_Than_Or_Equals | + | |
+ | The output signal will be 1 (indicating TRUE) when RFT1::Y is greater than LFT1::Y and 0 (indicating FALSE) | ||
+ | |||
+ | ==== Greater Than Or Equals | ||
+ | |||
+ | This boolean operator uses one of the following syntaxes: >= or =>. | ||
- | **>=** Boolean Operator //greater than or equals// | + | The expression (a >= b) is equivalent logically to ((a > b) | (a == b)). |
visual3d/documentation/pipeline/expressions/mathematical_operators.1718805567.txt.gz · Last modified: 2024/06/19 13:59 by sgranger