The image distortion in the editing interface in Mapknitter is one of the complex operations taking place in the tool.
This steps which take place when we are distorting an image are: 1) The image gets unlocked to allow editing on it.
2) The corners of the image(also known as control points) are dragged by the user to allow distortion.
3) When the control points are dragged, the image gets divided into a large number of small triangles and on each of these triangles, affine transformation takes place. As a result of many affine transformations and some end corrections, it appears as if the image as a whole is undergoing non-affine transformation or more specifically projective transformation.
In step 3, since each triangle will have a different plane of transformation, it is not possible to find a simple unique rule common to transforming all the triangles. To overcome this drawback, the Cartesian coordinates of the triangle are converted into homogeneous coordinates which helps to transform the triangles with a common rule.