Latice Deformation
The effect is based on a mathematical object from 2geom, called "d2sb2d", in which we store the values necessary for the deformation, and the 2geom function "compose", which computes the mathematical composition of functions. In this case, we compose the original path with the 2dsb2d (which holds the wanted deformation).
The effect needs 16 control points we called "handles" -- they are meant to be positioned by hand -- placed as a rectangular grid over the shape. The four corners are those of the bounding box of the path, and the others divide the rectangle evenly to form their original position. It is the difference between the actual position of the handles (chosen by the user) and their original position that is stored in the d2sb2d structure. This is done with a simple formula, which depends on the numbering of the handles, which is itself quite odd:
Inside the algorithm, two variables, corner and i are used to select the handle. i is the big rectangle ([0 1 2 3], [4 5 6 7], [8 9 10 11], or [12 13 14 15]), and corner is its corner, so that any individual handle is computed corner + 4*i. But it is even more complicated since the algorithm loops on four other variables, ui, vi, iu, iv, each taking either 0 or 1 as a value, in such a way that corner = iu + 2*iv and i = ui + 2*vi. Why so many complications ? Because the formula used to store values in the d2sb2d seems to need, for each handle, the associated value for ui+vi.
And it is not over yet! Apparently, for the effect to work properly, the path has to be translated to (0,0), and resized to be exactly 1 unit wide. Then, it should be translated back to its original position.