function
LieGroups.Util.saturate3
Clamp 3-vector element-wise
Public declarations
Explicit source declarations; dimensions, modifications and defaults are shown as written, without evaluation.
| Role | Name | Type | Dimensions / attributes / default | Description |
|---|---|---|---|---|
| input | x | Real | [3] | |
| input | x_min | Real | [3] | |
| input | x_max | Real | [3] | |
| output | y | Real | [3] |
Modelica declarations and implementation
Show parameters, interfaces and source
Parameters, inputs, outputs, defaults and equations from the source file.
function saturate3 "Clamp 3-vector element-wise"
input Real x[3];
input Real x_min[3];
input Real x_max[3];
output Real y[3];
algorithm
for i in 1:3 loop
y[i] := if x[i] > x_max[i] then x_max[i]
elseif x[i] < x_min[i] then x_min[i]
else x[i];
end for;
end saturate3;