<p>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 <a href="https://www.stat.auckland.ac.nz/~ihaka/downloads/Curves-handouts.pdf" rel="nofollow noreferrer">document</a> 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.</p>

<p>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?</p>

<p>In case it matters, my application is in polyline generalization for GIS.</p>

CC BY-SA 4.0
2019-02-28T08:32:39.070Z
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
CC BY-SA 4.0
2019-03-01T00:51:56.277Z
@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
CC BY-SA 4.0
2019-03-01T01:06:42.397Z
@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
CC BY-SA 4.0
2019-03-01T03:54:02.453Z
I would just assume they want to know how to determine what will look smooth at a given scale. Presumably when the user zooms in or out, the scale will change and they will want to recalculate the curve.
user1118321
CC BY-SA 4.0
2019-03-01T10:07:40.153Z
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
CC BY-SA 4.0
2019-03-01T12:06:19.023Z
@JamesAshton So I take it you're using splines after all and not piecewise linear curves. In that case smoothness of the discretized curve can be achieved by simply making sure that the discretisation has subpixel precision. If you want to relax that you can use additionally curvature information to decide how densely to discretize, then you can even quantify the error of your approximation.
lightxbulb
CC BY-SA 4.0
2019-03-01T12:15:33.747Z
Having a point on the curve that maps to screen coordinates $(x,y)$ find the closest intersection with the lines $x+1, x-1, y+1, y-1$, thus you will get pixel precision, you can even go as far as subpixel precision, this is obviously unnecessary where the curvature is low enough (curvature = 0 - you can do a straight line). So it's a mix of screen space length and curvature (note that curvature changes at different scales, as does length).
lightxbulb
CC BY-SA 4.0
2019-03-02T08:04:23.190Z
@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
CC BY-SA 4.0
2019-03-02T19:11:54.147Z
@JamesAshton So you simply want to remove vertices/edges such that you minimize the error? Take a look at this: https://www.sciencedirect.com/science/article/pii/S092577210800028X
lightxbulb
<mathematics><2d><2d-graphics><human-vision>
Constraining a Polyline to Look Smooth
James Ashton
# Constraining a Polyline to Look Smooth

(Asked by: username_0 on 2019-02-28)

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](https://www.stat.auckland.ac.nz/~ihaka/downloads/Curves-handouts.pdf) 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.

**Tags:** mathematics, 2d, 2d-graphics, human-vision

> **Comments:**
> **username_1**: 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.  
> **username_2**: @username_1 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.  
> **username_1**: @username_2 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.  
> **username_3**: I would just assume they want to know how to determine what will look smooth at a given scale. Presumably when the user zooms in or out, the scale will change and they will want to recalculate the curve.  
> **username_0**: 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.  
> **username_1**: @username_0 So I take it you're using splines after all and not piecewise linear curves. In that case smoothness of the discretized curve can be achieved by simply making sure that the discretisation has subpixel precision. If you want to relax that you can use additionally curvature information to decide how densely to discretize, then you can even quantify the error of your approximation.  
> **username_1**: Having a point on the curve that maps to screen coordinates $(x,y)$ find the closest intersection with the lines $x+1, x-1, y+1, y-1$, thus you will get pixel precision, you can even go as far as subpixel precision, this is obviously unnecessary where the curvature is low enough (curvature = 0 - you can do a straight line). So it's a mix of screen space length and curvature (note that curvature changes at different scales, as does length).  
> **username_0**: @username_1 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.  
> **username_1**: @username_0 So you simply want to remove vertices/edges such that you minimize the error? Take a look at this: https://www.sciencedirect.com/science/article/pii/S092577210800028X  

---

## 0 answers

