Play (Planar Linkage AnalYser) has been my pet project since engineering days. The current version accepts linkage data in text files and shows the schematic linkage in motion.
I should mention that people not familiar with the concepts of loops and linkages (from basic Kinematics courses) will probably find it difficult to understand the program. Making the program user friendly and adding a nice GUI is one of my long term goals in life. ;-)

Here are two screenshots:

Wiper Mechanism picture

Wiper mechanism found in older BEST buses

Hammer Mechanism picture

Automatic forging hammer (inverted)


Download the source and untar it.
In addition to the main program files, there are 3 subdirectories. "houdini/" contains the Windows graphics library being used. "CVCanvas/" contains the Linux classes which emulate the houdini classes. The "linkages/" directory contains the example linkage files.
Before starting, make sure that the correct OS macro is defined in "playos.h".


# cplay linkagefile
The parameter is essential. Crashes otherwise.
For example: Pressing 'a' in the graphics window advances the linkage by one step. Keep it pressed for a continuous animation.


Designing mechanical machines involves study and experimentation with interconnected moving parts. The functionality of the machine is usually derived from shapes of the moving parts. eg. Consider a mechanical forging hammer. It is driven by a motor and some mechanism converts the rotary motion into hammering action. To design such a machine the engineer needs to experiment with variables such as lengths, velocities, accelerations and shapes of various parts at different configurations. This project is intended to simulate mechanisms. Such a collection of interconnected moving parts is called a linkage. In the mathematical analysis of a linkage, the concept of loops and links are introduced. To obtain the various parameters at a particular configuration, the linkage is "solved". The user defines the loop by specifying the following: All the links invloved in the linkage have two properties each (its length and angle). Out of these some are constants and remaining are variable. The user has to give the exact values of these constant attributes to define the linkage and approximate values of the variable attributes which will define the unique configuration of the linkage in a 2D plane. The number of dependent variables in a linkage is always twice the number of loops.

Input files

All input files are text files. The format is specified below in printf format specifier terms. Explanatory comments appear in parantheses (...)

Design (Classes and Relationships)

The Linkage object is a container of Loop objects. The Loop object in turn is a container of Link objects.
Each Link object has a Shape object associated with it. Shape is an abstract class and some of its child classes are Line, Rectangle, Circle, CompositeShape. CompositeShape object is composed of one or more Shape objects. Due to this inheritence and polymorphism, any Shape object can be associated with a Link object at run time.
Taking the input for the Links, Shapes, Loops and Linkage from the user can be done in many ways such as text file input or a GUI based input. An abstract class LinkageCreator is defined which create a Linkage object. Two classes are derived from this, viz. FLinkageCreator - all the user input is through text files. The job of FLinkageCreator is to read and parse the text files and create Links, Loops, Linkages, Shapes. Add Links to Loops, Loops to Linkage, associate Links to Shapes. GUILinkageCreator- provides GUI based user input. (not implemented)
Once the Linkage is created, user should be able to solve the Linkage for any input parameters. For this, an abstract class LinkageSolver is provided, whose job is to take input parameters from the user and solve the Linkage. Again, two classes are derived from it viz.,FLinkageSolver and GUILinkageSolver for taking user input from file and GUI respectively. Outputing all the Linkage parameters in text mode or graphical mode is achieved by TextOutput and LGraphicsOutput (abstract class) respectively. LGraphicsOutput has some methods for drawing basic shapes like Line, Rectangle, Circle. A class LCanvas inherits from LGraphicsOutput and hoCadCanvas(houdini). hoCadCanvas is the platform dependent class providing the actual drawing functionality and the methods in the LGraphicsOutput act as wrappers for these methods.
The Linkage has the responsibility of solving itself for which it requires matrix maipulation. Hence a Matrix class (thanks Amit) is used as a utility for this purpose which takes care of all the required matrix manipulation functions.



First wrote a linkage simulator in 1996 (I think). In DOS, using Turbo C++ 3.0. Based on the algorithm given in "Kinematics of mechanisms" - Shigley. Have lost the code due to hard disk crashes.
Rewrote the entire thing as a C++ project while doing PGDST at NCST. (May 2000). Used the houdini library provided by an instructor at NCST.
In May-June 2002, did the Linux port using qt.


  1. Input links. Should be properly specifiable. Should be multiple. (Reciprocating?)
  2. Scaling. Currently everything is in pixel units.
  3. Output data to file.
  4. GUI input for linkage specification.
  5. Error checking
  6. Rewrite using "good" C++ (remove mallocs, use STL etc)
  7. Invert the co-ordinate system so user can specify in first quadrant.

Back to personal home