@raph I am fascinated, but so clearly out of my depth. I started looking over your thesis (which has lots of introductory background), are there any other resources I should look too covering curves & their related math?
Thanks!

I’ve been stumped by a problem. I kind of got an answer here, but it’s incomplete

My goal is to write out the 2D projection of a 3D bezier curve to a pdf document.

I am told that the 2D perspective (conic) projection of a 3D bezier curve is a rational bezier curve. There are instructions on how to compute the projected control points.

The PDF specification says that bezier curves are described with control and anchor points which are evaluated via the explicit form of the cubic bezier.

What I don’t understand is how to re-cast the rational bezier curve such that it is expressible in the way PDF expects.

What almost everybody does is fit an approximate cubic Bézier to the source curve, compute an error metric, and subdivide the source curve if the error bound is exceeded. If you know the positions, tangent vectors, and arclength of your curve, a really good way to create the cubic is to set the both arm lengths to 1/3 the arclength. An even more sophisticated version measures the arclength of the resulting Bézier, and adjusts the armlengths til the lengths match (using Newton or secant method). All this is a tradeoff between how much time you want to spend optimizing and the size of the resulting curve.

You’ll see a variant of that in the Euler explorer code, in EulerSegment.renderSvg. Here I arbitrarily chose to subdivide it into 5 cubics, because I know that’ll be really precise and I’m not too worried about the cost.

@raph I am fascinated, but so clearly out of my depth. I started looking over your thesis (which has lots of introductory background), are there any other resources I should look too covering curves & their related math? Thanks!

Probably A Primer on Bézier Curves, if you never heard of.

I haven’t, I’ll take a look. Thanks!

I’ve been stumped by a problem. I kind of got an answer here, but it’s incomplete

My goal is to write out the 2D projection of a 3D bezier curve to a pdf document.

I am told that the 2D perspective (conic) projection of a 3D bezier curve is a rational bezier curve. There are instructions on how to compute the projected control points.

The PDF specification says that bezier curves are described with control and anchor points which are evaluated via the explicit form of the cubic bezier.

What I don’t understand is how to re-cast the rational bezier curve such that it is expressible in the way PDF expects.

What almost everybody does is fit an approximate cubic Bézier to the source curve, compute an error metric, and subdivide the source curve if the error bound is exceeded. If you know the positions, tangent vectors, and arclength of your curve, a really good way to create the cubic is to set the both arm lengths to 1/3 the arclength. An even more sophisticated version measures the arclength of the resulting Bézier, and adjusts the armlengths til the lengths match (using Newton or secant method). All this is a tradeoff between how much time you want to spend optimizing and the size of the resulting curve.

You’ll see a variant of that in the Euler explorer code, in EulerSegment.renderSvg. Here I arbitrarily chose to subdivide it into 5 cubics, because I know that’ll be really precise and I’m not too worried about the cost.

Best of luck!

Nice. I’ve been writing a painting software and working with Béziers just this week to smooth strokes. I will have a lot to dig in your thesis.