Navigation:  Language Reference > Functions > Arithmetic >


Previous pageReturn to chapter overviewNext page


y = constraint(x);


This function iteratively assigns a value to y such that x approaches zero within a given error margin. It only works in combination with the MBDF simulation method! The function is very useful for entering constraints in physical systems and inverse dynamics.


This example makes a velocity vm equal to a reference velocity vs:


vs = sin(time);                        // reference velocity

v = vm - vs;                                // If v = 0 then the mass follows the reference velocity

F = constraint(v);                // Make F have a value that yields a zero velocity v

vm = (1/m)*int(F);                // mass