For this project I wanted to simulate the movement of a Walschaerts valve gear in Houdini. I knew, before I started, that it was going to involve a good amount of sine and cosine expressions considering the repetitive movement.
Reference Material
Breakdown
Each part of the system is connected procedurally, not physically. Since they are all moving in unison, it just looks like they are connected. Each part is also based on the same global variable, $FREQ, which represents the frequency of movement.
The wheels are simply rotating on the Z axis based on the frame number, $F, and $FREQ. As for the bar connecting the wheels, since it has no axis, and does not rotate, it must be translated in the X and Y axes. To acheive this we need to use a Cosine and Sine function on the X and Y transformations respectively:
tx = $AMP * cos($F*$FREQ+$p)
ty = $AMP * sin($F*$FREQ+$p)
$AMP controls the maximum and minimim distance the Sine curve can reach from zero, the amplitude. So in this case the radius of the circle the object forms when moving. $p is the period of the Sine curve, a shift of where in time the Sine curve is currently read.
The bar in the left movie has Sine curves applied to both the translation and rotation. It is being translated in the X axis back and forth with a simple Sine curve and also rotated in the Z axis with another Sine curve. The pivot point is on the right end of the bar. This simultaneous movement gives the illusion of it rotating with the wheels while driving the crosshead arm shown in the last movie.
+ Links
Walschaerts Valve Gear - Wikipedia