# Constraining a Polyline to Look Smooth

What are the mathematical constraints required for a polyline, i.e., a piecewise linear curve, to appear as a smooth curve to human vision? I've discovered one document that specifies only that the change of direction at each vertex must be less than 3°. It seems to me that there also needs to be a limit on degrees turned per curve length, but that's a simple enhancement.

My main question is about how the maximum direction change angle is affected by segment length. If you have two long segments connected at 3° then the change will be (to my eye anyway) much more visible than a 3° angle between short segments. Is anyone aware of any studies in this area?

In case it matters, my application is in polyline generalization for GIS.

• A piecewise linear curve is not smooth by standard definitions. Smoothness usually implies $C^k$ or $G^k$, $k>0$. It may look smooth, when seen at a specific scale, but you can always fund a scale such that it is not. If you want true smoothness use a spline for example. – lightxbulb Feb 28 at 8:32
• @lightxbulb For drawing your spline will, at the end of the day, be discretized into linear pieces too, the amount of which is again a difficult decision to make. What the asker is after, though, is some kind of quality measurement for determining how linear is too linear based on human perception of the result. That sure is dependent on a lot of things, but saying "use a smooth curve" is only shifting away the problem. – Christian Rau Mar 1 at 0:51
• @ChristianRau There's a very big difference between a piecewise linear curve and a smooth curve even if you discretize the smooth one. The point is that at a specific scale your piecewise linear curve will not be smooth, whereas the same does not hold for the smooth curve as long as you discretize correctly, thus his requirement is not achievable unless he specifies that he cares only about a specific scale. Considering the fact that he mentioned GIS, I assumed he cares about things like the curve remaining smooth under different scales, I just wanted to point out that it is infeasible then. – lightxbulb Mar 1 at 1:06
• Yes, I'm trying to come up with a definition of smooth for a line generalisation algorithm in GIS. Beziers are drawn in Postscript and PDF renderers by repeatedly dividing them up into straight line segments (using the flattenpath operator) until the maximum distance error of the approximation is small enough. The problem with this distance-based approach is that curves with jagged fine detail can remain jagged after flattening. Splines are more complex and GIS software tends to handle only polylines. And splines are converted back to polyines for rendering anyway. – James Ashton Mar 1 at 10:07
• @lightxbulb I'm still using polylines. This is printed graphics, so very high res, up to 2540ppi. Think printing coasts, roads, or contours with curves that are smooth to human vision. Often the source polyline is very detailed, but GIS "generalization" means removing unnecessary detail with minimum inaccuracy. – James Ashton Mar 2 at 8:04