<p>IIRC, Watt and Watt's &quot;Advanced Animation and Rendering Techniques&quot; (Chapter 3) has an interesting discussion on this (which I think is summarising the work of Clark <a href="https://dl.acm.org/doi/10.1145/965103.807440" rel="nofollow noreferrer">https://dl.acm.org/doi/10.1145/965103.807440</a> ... but only the first page seems to be there :-(  )</p>
<p><strong>UPDATE</strong>: There is some text from Watt and Watt describing Clark's method <a href="https://archive.org/details/advanced-animation-and-rendering-techniques-1992/page/85/mode/2up" rel="nofollow noreferrer">available here</a>:</p>
<p>If that's not to your taste, you could try the following: Take the Cubic Bezier cage - shown in green  - with the curve in purple:</p>
<p><a href="https://i.sstatic.net/Nxyy4.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/Nxyy4.png" alt="Bezier (Possibly not 100% accurate)" /></a></p>
<p>If you do a do a mid-point subdivision of the curve, you can measure the (squared) distance (red) from the centre of the straight line (blue) joining the original end points to the mid point of your curve. If this exceeds a threshold (some number of pixels), recurse, else stop.</p>
<p>I seem to recall that the difference between the straight-line approx and the curve drops by a factor of 4 (or was it 8??) with each subdivision, so it converges quite rapidly.</p>
<p>The maths to subdivide the 4 control points of any Cubic Bezier into 2 smaller Beziers is quite simple .. but I'd need to go and look it up ...</p>
<p><strong>Update 2</strong>: <a href="https://archive.org/details/advanced-animation-and-rendering-techniques-1992/page/79/mode/2up" rel="nofollow noreferrer">See here for splitting a Bezier in 'twain'</a></p>
<p>Though, thinking about it, I'd say you might need to go one more step to account for this type of starting case:</p>
<p><a href="https://i.sstatic.net/T5QI5.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/T5QI5.png" alt="enter image description here" /></a></p>

CC BY-SA 4.0
2022-07-19T03:31:06.753Z
Thanks for the suggestion! Can I ask if this technique you explained is used or documented anywhere?
Lenny White
CC BY-SA 4.0
2022-07-19T13:51:29.197Z
Well, I *think* the description in Watt and Watt (https://archive.org/details/advanced-animation-and-rendering-techniques-1992) of Clark's work  might have a more direct approach in terms of how to compute an estimate of how much displacement there is between a line segment and a (subdivided) curve.
OOH I've found an link. Will update the text above
Simon F
CC BY-SA 4.0
2022-07-18T08:41:28.587Z
2022-07-19T14:03:07.360Z
2022-07-19T14:03:07.360Z
Simon F
<p>If I want to draw a cubic bezier curve, I need to sample points on it and draw the resulting poly lines. One could sample the curve using De Casteljau algorithm and incrementing <span class="math-container">$t$</span> from 0 to 1 with a given interval. However depending on the length of the curve or how far away the control points are from each other, one might want to choose bigger or smaller sampling interval. Is there a good metric to calculate a satisfactory sampling interval? Would the the length of the poly lines formed by the control points of the bezier curve be considered a good metric? Or the length of the curve itself?</p>

CC BY-SA 4.0
2022-07-18T10:48:00.527Z
Consider computing the rate of curvature of the curve. (there are lots of sources for this on the net) Where it is flat use less samples, where it is more curved subdivide and check the curvature again. Another approach is to do arc fitting which is described here: https://pomax.github.io/bezierinfo/#arcapproximation
pmw1234
CC BY-SA 4.0
2022-07-19T03:30:07.630Z
@pmw1234 Thanks I'll have to read through the arc approximation method but computing the rate of the curvature sounds like a great idea! However I wonder would you sample the rate (or I guess the first derivative) at specific intervals for `t` or how would you do it?
Lenny White
CC BY-SA 4.0
2022-07-19T10:34:34.403Z
Here is a video that explains the issues really well, about half way through she covers curvature, and curve length is covered at the end: https://www.youtube.com/watch?v=aVwxzDHniEw
pmw1234
CC BY-SA 4.0
2022-07-19T10:37:12.863Z
Also note how the evenly spaced t values tend to "bunch up" where acceleration is high, this means that a nicely subdivided t interval  might be "good enough" to capture the curve. If anything the areas on the curve that are flat may tend to have too few points.
pmw1234
CC BY-SA 4.0
2022-07-19T10:39:46.633Z
Also note that the curvature rate $\kappa$ formula is slightly different for 2d and 3d.
pmw1234
<bezier-curve><spline>
How to decide granularity for sampling a bezier curve for rendetion
Lenny White
# How to decide granularity for sampling a bezier curve for rendetion

(Asked by: username_0 on 2022-07-16)

If I want to draw a cubic bezier curve, I need to sample points on it and draw the resulting poly lines. One could sample the curve using De Casteljau algorithm and incrementing $t$ from 0 to 1 with a given interval. However depending on the length of the curve or how far away the control points are from each other, one might want to choose bigger or smaller sampling interval. Is there a good metric to calculate a satisfactory sampling interval? Would the the length of the poly lines formed by the control points of the bezier curve be considered a good metric? Or the length of the curve itself?

**Tags:** bezier-curve, spline

> **Comments:**
> **username_1**: Consider computing the rate of curvature of the curve. (there are lots of sources for this on the net) Where it is flat use less samples, where it is more curved subdivide and check the curvature again. Another approach is to do arc fitting which is described here: https://pomax.github.io/bezierinfo/#arcapproximation  
> **username_0**: @username_1 Thanks I'll have to read through the arc approximation method but computing the rate of the curvature sounds like a great idea! However I wonder would you sample the rate (or I guess the first derivative) at specific intervals for `t` or how would you do it?  
> **username_1**: Here is a video that explains the issues really well, about half way through she covers curvature, and curve length is covered at the end: https://www.youtube.com/watch?v=aVwxzDHniEw  
> **username_1**: Also note how the evenly spaced t values tend to "bunch up" where acceleration is high, this means that a nicely subdivided t interval  might be "good enough" to capture the curve. If anything the areas on the curve that are flat may tend to have too few points.  
> **username_1**: Also note that the curvature rate $\kappa$ formula is slightly different for 2d and 3d.  

---

## 1 answers

### Answer by username_2 on 2022-07-18. Score: 2 | Accepted answer

IIRC, Watt and Watt's "Advanced Animation and Rendering Techniques" (Chapter 3) has an interesting discussion on this (which I think is summarising the work of Clark <https://dl.acm.org/doi/10.1145/965103.807440> ... but only the first page seems to be there :-( )

**UPDATE**: There is some text from Watt and Watt describing Clark's method [available here](https://archive.org/details/advanced-animation-and-rendering-techniques-1992/page/85/mode/2up):

If that's not to your taste, you could try the following: Take the Cubic Bezier cage - shown in green - with the curve in purple:

[![Bezier (Possibly not 100% accurate)](https://i.sstatic.net/Nxyy4.png)](https://i.sstatic.net/Nxyy4.png)

If you do a do a mid-point subdivision of the curve, you can measure the (squared) distance (red) from the centre of the straight line (blue) joining the original end points to the mid point of your curve. If this exceeds a threshold (some number of pixels), recurse, else stop.

I seem to recall that the difference between the straight-line approx and the curve drops by a factor of 4 (or was it 8??) with each subdivision, so it converges quite rapidly.

The maths to subdivide the 4 control points of any Cubic Bezier into 2 smaller Beziers is quite simple .. but I'd need to go and look it up ...

**Update 2**: [See here for splitting a Bezier in 'twain'](https://archive.org/details/advanced-animation-and-rendering-techniques-1992/page/79/mode/2up)

Though, thinking about it, I'd say you might need to go one more step to account for this type of starting case:

[![enter image description here](https://i.sstatic.net/T5QI5.png)](https://i.sstatic.net/T5QI5.png)

> **Comments:**
> **username_0**: Thanks for the suggestion! Can I ask if this technique you explained is used or documented anywhere?  
> **username_2**: Well, I *think* the description in Watt and Watt (https://archive.org/details/advanced-animation-and-rendering-techniques-1992) of Clark's work  might have a more direct approach in terms of how to compute an estimate of how much displacement there is between a line segment and a (subdivided) curve. OOH I've found an link. Will update the text above  

---

