Bézier OCD Or Why You Should Know About Point Placement

0. Introduction

If you’ve been visiting this blog, you might be wondering why I’m writing another article about this subject.

You’ve probably read Bézier Curves And Type Design: A Tutorial and Bézier Curve Quick Tips: Two Methods For Smooth Curves, along with AGSC’s article So What’s the Big Deal with Horizontal & Vertical Bezier Handles Anyway?, and you might think that, for graphic designers and related métiers, things are pretty much covered.

Well, they’re not. The suggestions to keep nodes at extrema, handles vertical or horizontal, use explicit inflection points, balance the handles and so on aren’t just workflow optimizations: they’re methods to overcome technical problems.

So, today, I want to give you the reasons why these point-placement methods should be used extensively, in a more in-depth way than in the previous two articles (and again, here and here, because I strongly suggest you to read them before reading this one).

Ready? Go!

1. It Reduces Point Placement

This one is a no-brainer. As discussed before, in cubic Bézier curves, the most simple way to describe a curve is with two nodes and two handles, and if we keep angles smaller than 90º, we can easily draw any curve. So, working with extra points doesn’t seem much of an advantage, since it ends up with you having more stuff to deal with.

1.1 And Thus, It Reduces File Size

Less points, less coordinates. Less coordinates, smaller file size. Done.

2. Rasterizers Are Dumb

This section and §3 are this article’s gem: the stuff that you don’t usually see being talked about.

In Bézier Curves And Type Design we barely scratched the surface on this. Remember how a cubic Bézier curve is constructed? The animations there show how a Bézier curve rasterizer builds a curve through a method called linear interpolation. Let’s start there.

2.1 Linear Interpolation

Linear interpolation is a method of curve fitting that uses linear polynomials (read line segments joined together to fit a curve), and this is how computers draw Bézier curves, because De Casteljau’s algorithm (the one used in Bézier curves) was made to do precisely this.

So, as we know the Bézier Curves And Type Design‘s animations, the curve is broke into several linear steps. Have a look:

interpol01

Fibonacci FTW!

Be aware that the subdivisions are per segment: from anchor point to anchor point.

So, with this said, how would the previous animation look with odd point placement? Here you go:

interpol02

As you might have guessed, the perceptual smoothing of each segment through the various iterations differ quite a bit:

Ever worked with splines in 3D software? If you have, you know the pain it is (or used to be, rasterizers did get better) to convert it to a mesh, with steps unequally distributed along the spline. Or Flash, that converts the curves to line segments for processing and file size’s sake. Now you know why.

How to solve this? Same recomendations:

2.2 And Rasterizers Should Be Dumb; You’re The One Who Should Be Smart

Why? Because linear interpolation isn’t the only thing to worry about, when it comes to rasterizers.

We want our vector drawings to be cross-compatible between formats, rasterizers, hinters, printers, parsers, and the list goes on. So it’s our job to know a little bit more and try to minize conversion errors. Just because something looks good in Illustrator, it doesn’t mean that it will look good in an old printer.

And if you convert your drawing from cubic to quadratic and back to cubic and then interpolate it, welcome to hell.

3. Hinting

Though this part is somewhat related to §2, it deserves a different section.

Let’s get this straight: hinting is not exclusive to type design; in truth, every printer, for example, only prints bitmaps, i.e., it hints the vector artwork first. And printers may have their own rasterizers and hinters, and the way you draw can make a difference.

The reason why it’s an obvious type concern is that we (type designers) deal with a finer degree of detail in way smaller sizes.

But, in spite of rasterizers becoming better and better, it doesn’t mean that graphic designers shouldn’t be concerned about it too.

And with this I don’t mean that we should rasterize vector work and start editing pixels: you should, however, try to draw vector art as fool-proof as you can.

Can the way you draw influence hinting? Yes, very slightly, but yes. And the smaller you get, the more crucial it becomes.

4. Conclusion

I hope you’ve enjoyed reading this! Happy drawing!

Cheers!

Bézier Curve Quick Tips: Two Methods For Smooth Curves

Fixing curves, for me, is an every day activity. Sometimes they look oddly pointy, too steep or too wide, guiding my eyes to awkwardness.

And since I’m an optimization freak (as you could tell on my previous article on Bézier curves), I end up using some procedures to tackle problems.

So, today I want to share with you a couple of techniques I use a lot. Here we go!

1. Method 1

If you’ve read my article on Bézier curves (and you should for the sake of understanding this article), you’ve noticed that I stressed on how important point placement is. Here’s a summary of what I recommended:

  1. Keep nodes at the extrema;
  2. Keep handles vertical or horizontal (with the obvious exception of corners);
  3. Use explicit inflection points.

But this doesn’t mean that you should immediately start drawing this way; these are only requirements for you final work.

With this said, consider the following lowercase n:

bezier2_001

As you can see, those curves are in terrible shape, due to unfortunate point placement, resulting in pointy areas. So, how do we solve this?

Let’s start by fixing the top curve:

bezier2_002

Here’s what happened:

And here’s the same process for the inside curve:

bezier2_003

And a comparison between our original n and our corrected one:

bezier2_004

So, what happened here? Here’s some observations:

  1. Manipulating two handles is way easier than four handles and an anchor;
  2. This method provides us a way to find the optimum position for where the extreme anchor should go;
  3. We let the point addition algorithm find out the best handle position for us;
  4. Even if we need to do some minor adjustments, it’s easier and safer to adjust a respectable curve than a clumsy one (I know I’m personalizing the curves, I know).

1.1 Problems With This Method

This has some limitations, of course:

  1. It’s not adjustment proof: You might still need to do adjustments to the curve. But hey, you’re closer than you were! And prepare yourself for §2, it might come in handy;
  2. It doesn’t work very well with angles above 180º: For the same reason that we can’t use this method with quadratic Bézier curves, we would need 4th or higher-order Bézier curves to use this method with a fair degree of control. And in plain English: this works with parallel handles or with a smaller angle, because otherwise, you’re no able to control the curve’s extension and steepness. And here’s an animated GIF, because you guys love these things:
bezier2_005

2. Method 2

And here we are. *awkard stare*

So, back to business: how do the point-addition algorithms distribute the handle length? Well, they keep the handle length proportionally equal, to keep the curve as smooth as possible.

With this in mind, when we have our handles in a 90º angle, we can fit our 4 points in a square. And with less than 90º, a trapezoid:

bezier2_006

Let’s stick with the rectangle, for simplicity’s sake.

By now, your inquisitive mind might be asking:

What happens to the curve if one handle grows from the minimum to the maximum length, inscribed in the rectangle, while the other does the opposite?

And now you must be thinking how did I read your thoughts, right? Right.

But let’s not deviated from the subject; here’s what happens:

bezier2_007

As you can see, the curve bulges slightly in the extended handle’s side and gets steeper in the retracted one.

Now, what happens if both handles go from minimum to maximum length?

bezier2_008

You probably saw this coming.

Well, first of all, I apologize for the slow build up, but I wanted you to be aware of the two factors, because you’ll be dealing with them with this method.

By the way, I don’t know if you keep the habit of click-and-dragging curves, but if you don’t, start doing it. And in most drawing applications, holding the Shift key down keeps the handles in the same vector.

If we want to keep the handles’ lengths proportionally equal, the rectangle from their maximum length point to their actual position has to be proportional to the anchor’s rectangle. Here’s an image to clear this out:

bezier2_009

The effect that this has on this curve is minimum, but it distributes the curvature evenly.

So, here are the steps to do this:

bezier2_010
  1. Get an unevenly distributed curve;
  2. Extend the handles to their intersection point;
  3. Press the Shift key (to keep handles straight), click on top of the curve and drag it back. Gently tilt to the sides, trying to get both handles proportionally equal until you get the curvature you desire.

With practice, you’ll be able to eyeball the entire process and still get some sweet and smooth curves.

3. Final Thoughts

I hope you’ve found this article helpful, since I find these make me work faster (I struggle less to achieve satisfactory results), while it keeps the overall look of my work consistent.

Thanks for reading this and if you like it, share the knowledge! Cheers!