Tutorial: Adobe Illustrator’s ‘Round Corners’ Effect and Transit Maps

comments 12
Filed Under:
Tutorials

In my earlier post about drawing a transit map, I made mention of the fact that Adobe Illustrator’s “Round Corners” effect doesn’t work very well with multiple curves around a corner, such as parallel route lines changing direction together on a transit map.

This part of my post elicited a very interesting comment from Chris Helenius in Finland that there are ways to get matching curves around a corner when using the Round Corners effect. However, the method he shows is a workaround – he expands the appearance of the curve, then offsets the path the required distance. In practice, this is very similar to my approach of keeping a “master” library of curves that I insert where needed – both require some cutting and pasting of points and curves to achieve the final result.

What Chris’s method doesn’t recognise is that Adobe’s implementation of Rounded Corners is fundamentally flawed, and it’s a flaw that makes it impossible to achieve consistent nested curves.

As the diagram above shows, the problem comes from Adobe’s poorly implemented definition of “radius” in the Rounded Corner effect’s dialog box.

The dictionary definition of radius is, “a straight line from the centre to the circumference of a circle or sphere.” And that’s what I expect to be implemented when I set a value in the dialog box – make a curve with this radius from the centre point of the inferred circle. If this were true, you’d see curves like those shown in the second column of the diagram: three nicely nested curves at a radius of 10, 20 and 30 points, which look the same regardless of the angle between the lines when you started.

Instead, you get what happens in column three. For reasons known only to itself, Illustrator measures the value that is put into the dialog box from the original corner point (shown as the black lines in column three) that joins the line segments on the intended curve, not the centre point of the circle. In other words, this is not a true radius at all.

When the angle between the line segments is 90 degrees, things work as expected, because the mathematics works out the same regardless of where the “radius” is measured from. But look what happens when there’s a 135-degree angle. Instead of the outer curve having a radius to its centre point of 30 points (as input into the dialog box), it’s actually 72.46 points! Even worse, all three curves end up having completely different centre points (as indicated by the grey intersecting lines), so no amount of fiddling with values is ever going to get them to nest inside each other properly.

As you can see, entering the same set of values into the Round Corners dialog box produces vastly different results depending upon the angle between the line segments – this makes results impossible to predict and the effect totally useless when designing a transit map: what is a nice tight 30 point radius on one part of the map may become a loose 72 point radius in another, even though you asked for a 30 point radius both times. I’ll be sticking to my labour-intensive, but 100% accurate methods.

Note: this part of the tutorial is no longer true for users of Adobe Illustrator CC and above, as Adobe has integrated the excellent “Live Corners” tool into the program. See this post for more information.

12 Comments

  1. I’ve never used Illustrator before, only Inkscape, but does Illustrator create bézier curves when applying the round corners function? If so, that’s why you can’t get the perfect transit map curve as bézier curves are mathematically incapable of exactly reproducing circular curves, even 90 degree ones (zoom in really closely and you’ll see a difference). Spiro splines, on the other hand, are capable of creating curves of constant curvature.

    • I’m not really too concerned about whether the resultant bezier curves are a fraction of a fraction of a point off a true arc when viewed at 1600% in Illustrator (which is pixel-pushing to the ultimate degree!), I just want consistency in the way that Illustrator calculates its radius. At the moment, the same value entered in the “Round Corners” effect dialog box will produce different results when applied to a 90-degree curve and a 135-degree curve, and that makes a workflow using that effect impossible.

      • For a 135 degree curve, the “radius” that illustrator calculates is equal to r*√(2)/2/(1-√(2)/2) where r is the radius you thought you were trying to achieve. To calculate the radius that illustrator needs, 2*r*(1-√(2)/2)/√(2) where r is the radius you want.

        And I know what I said was pixel pushing insanity, but in my experience Inkscape would display the difference at 100% zoom no matter how accurate the smoothed curve was. It was quite infuriating when I discovered what the problem was.

  2. Viteks says

    I was looking for custom scripts for rounded corners because, as you saw on my Riga Transit map, I have a lot of rounded corners.

    I found a script “Round Any Corner” and it works fine on 90° corners. On 135° corners you need to experiment to find the right radius for every next line or you can use the math to find the right numbers.

    From the author’s description.
    ## Radius
    Actually, the specified “radius” is not for a radius of arcs which drawn.
    It is for the line length from each selected corner and is for the base
    to compute the length of handles. The reason calling it “radius” is
    for compatibility with the “Round Corners” filter.

    That’s why you need to find numbers for corners other than 90°.

    http://park12.wakwak.com/~shp/lc/et/en_aics_script.html#roundany

    Select a point, run a script, specify radius in prompt dialog, done. No need to expand strokes.

    • Sounds like it does exactly the same thing as the “Round Corners” effect, but you can apply it on a point-by-point basis? That does sound useful, but working out that maths for 135 degree corners still sounds painful if you want things to be 100% accurate.

  3. Jeff Bridgman says

    Not necessarily a good option, but one I had considered in the past… have you ever considered making a brush that contains multiple “line” within it? That way you only have a single path. But when it comes down to getting stuff done, it’s probably just easiest to do your master-curves-library cut-n-paste approach 😉

    Luckily with the map I’m working on right now (Tokyo), lines are very rarely duplicated next to each other (unlike New York where we might have 5 lines running down the same tunnel/tracks), so this hasn’t really been an issue yet.

  4. Ugh — I’m with you on this. Quite annoying. I figured out different ways to deal with it but your explanation is a more accurate and concise way of overcoming the obstacle.

  5. Goreiilar says

    I understand why I should do it the hard way and have managed to cut circles into 90 Degree units. However, I have not been able to get the 45 Degree unit to fit two lines, made by cutting a circle into eight pieces. Help..?

  6. Jason says

    I can’t get the 45 degree pieces to snap to grid and align with the line as well. Help! Why is there nothing mentioned about this?

    • You’re right: this is almost impossible to do. If you’re using Illustrator, the best thing to do is to use “Snap to Grid” to draw your initial lines, then turn it off to place your curves. If you use “Smart Guides” you can snap the curves to the paths pretty easily. In CS5 and above you get best results if you hold down the Command key on a Mac (or the Control key on a Windows machine) as you drag the curve to the right spot. Do’t try to do both ends at once: align to the horizontal or vertical line first, then hold down the Shift key (to constrain the direction the path can move in the 45-degree angles) as you align the the other end with the 45-degree line. If this makes no sense, I’ll draw up a step by step diagram (some things are better seen, then read about!)

Leave a Comment