7

I would like to generate an average stroke from a given compound enclosed path, or fill, in Adobe Illustrator CC or Inkscape.

Depiction of desired result of averaging a compound enclosed path

Sorry I don't know the mathematical function name to achieve this. I've come upon a couple bizarre hacks involving Photoshop, but it stands to reason there is a simpler way to achieve this within a vector program. Unfortunately Illustrator's path averaging collapses my example into a single point, likely because it has both horizontal and vertical aspects.

  • 1
    Sounds like a mathematically highly non-trivial task to me. Even for a human it’s impossible to tell whether the result should be yours or one where there are two non-intersecting paths: one connecting the bottom two endpoints and one connecting the top two endpoints. – Wrzlprmft Feb 20 '15 at 18:07
7

Using Inkscape...

tl;dr Interpolate paths

As a generalized case, this is a very interesting question, for which I have a reasonable answer. However, your specific example is further complicated by the fact that your desired resulting "path" requires multiple disconnected, intersecting sub-paths (one for the horizontal line, and one for the vertical line). So, I'll be answering the more general (and simpler) case of one continuous, non-intersecting path, as summarized below:

Summary

Steps:

  1. To set up the example, begin with a simple path having some substantial stroke width.

enter image description here

  1. Choose "Path" > "Stroke to Path"

enter image description here

  1. Mess with the nodes to create a more interesting example.

enter image description here

  1. Remove fill, and set a thin stroke.

enter image description here

  1. Delete the two endpoint segments. Then choose "Path" > "Break Apart"

enter image description here

  1. Important: Select one of the resulting objects (either one) and choose "Path" > "Reverse".

  2. Select the two objects and choose "Extensions" > "Generate from path" > "Interpolate". (Make sure settings on the Interpolate extension are set as follows.

enter image description here

  1. Delete the two original paths, leaving only the interpolated path. It will be a group. You can choose "Object" > "Ungroup" to remove the group container and just have a plain old path.

enter image description here

  1. Style with thickness to taste. From here, you could simplify or tweak as desired.

enter image description here

  • Upon testing this method, I see what Sean meant by my example not being ideal. The lack of endpoints creates a problem which results in a non-meaningful interpolation. I went back and live-traced the original sketches in Adobe Illustrator in stead and saw there were some options for line art, which does a decent job if I tweak it and does create strokes. I have few enough samples that I can just draw in what I need, so I may just drop an automated solution and hope it doesn't come up again. – Joseph Coco Feb 21 '15 at 5:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.