Automatically Insert Ink Traps

I think ink traps often look pretty good and I wonder if

• they are really designed to serve an optimal purpose, which can be modelled as given a shape `S`, finding `S'` such that `d(S,I(S'))` is minimized, where `I` is the ink spreading function, which models how ink spreading alters the shape in the transfer to paper, and `d` is some appropriate distance functions, like integral of the symmetric distance, and
• if the answer to this is yes, what computational methods can be used to solve this optimization problem numerically?

My first intuition was that ink spreading could be modeled by looking for a shape whose area is `a` times the area of `S`, for some `a>=1`, which contains all the points in `S` and whose boundary length is minimized (clearly `a=1` reduces to the identity). But I guess the algorithm for ink traps described above would then only insert holes, because closing holes is a very efficient way of reducing boundary length.

Other (simpler) ideas for ink spreading include morphological closing (which I think produces no interesting results) or taking the union of all lines `L` whose endpoints lie in `S` and whose length is smaller or equal to some constant `a` (here `a=0` reduces to the identity).

• Ink is viscous fluid. It spreads in inner corners as well as iside the paper as out of it. There's 4 phenomenas which should be taken into the account: Gravity, surface tension balancing which causes fast filling of concave areas and capillary spreading along paper fibres, diffusion which spreads the ink slowly and drying which slows down the spreading (loss of mass, more viscocity). All these are so complex in math that you cannot expect much help from most of us in this site. We feel much more at home with drawing, editing images, making layouts etc... (continues) – user287001 Nov 1 '19 at 13:21
• (continued) I guess the ink traps can well be designed experimentally with no math. If you want a theory of it, you should search for PhD level research reports. They should exist because graphic industry has been widely supported by the academic education system. – user287001 Nov 1 '19 at 13:24
• Thanks for your comment! I don't want a perfect physical theory of it, more like an aesthetically pleasing algorithm, which in the best case is embedded in some (simplified) model so that playing around with the model can lead to more possibly nice results which don't look exactly like the existing ink traps. – fweth Nov 1 '19 at 13:28
• For related information, see "dot gain" which describes the precise amount of effect for a given combination of ink, paper, and (for offset) fountain solution. – Stan Nov 1 '19 at 14:36
• @Stan Interesting! I guess you can generalize this idea to arbitrary shapes by first constructing a set of discs which generates the given shape (e.g. medial axis transform or just taking all discs contained in the shape) and then enlarge the discs via the formulas found in the dot gain models. – fweth Nov 1 '19 at 15:28

If a resembling look is enough, it surely can be generated easily, if you are a competent programmer.

The next has nothing to do with ink spreading physics, but it generates a pocket at a sharp corner:

Present your edge curve with equally spaced discrete points. In my image those discrete points are the black dots. C is the vertex point of a corner angle.

Let the dots push each other away like there's antigravity or equal electric charge in each dot. Think the dots are in elastic medium which stretches. The caused displacement of each dot is proportional to the resultant force against the dot. The arrows of the image present the displacements.

The distraction force vs distance function probably should have form A/(R^n) where A is a selectable constant, R is the distance of two dots and exponent n is another selectable constant. The same formula can be used to calculate the magnitude of the displacement increment caused by one dot to another. The direction of the increment is opposite than towards the other dot. All increments caused by other dots should be summed as vectors for every dot.

I unfortunately cannot program vector math calculations, so this is not tested.

• Thanks so much, that looks really promising! If you deleted the point directly in the corner (or actually duplicate it, but let both lines extending from the corner be unconnected, and reconnect them after the process, you would even get those corners in the traps, as opposed to something round i guess... – fweth Nov 3 '19 at 13:09
• @fweth If you succeed to program something well working, you can hopefully show the generated result and the basic idea behind it to us. Nothing prevents you to accept your own answer. – user287001 Nov 3 '19 at 16:28