Here are apps which allow you to define follower motion and derive the cam geometry. They also do nice animations.
Oscillating Flat Face Cam
Oscillating Roller Cam
Reciprocating Flat Face Follower Cam
Reciprocating Roller Cam