logoalt Hacker News

vintagedavetoday at 10:33 AM4 repliesview on HN

The math for Bezier curves is usually a bit beyond me, but this seems to use a simple lerp (linear interpolation) to split. Why is that valid? I had expected something like moving along the curve and calculating new points and control points (weights?) to get a curve that is a subset of the curve but matching exactly? My possibly incorrect thought was that these are non-linear, therefore, how is lerp suitable?

Or does this retain the original curves but only evaluate a subset, thus, lerp makes complete sense as a simple linear progression along the curve? The curves stay the same, we are evaluating a subset to get the slice?

> It takes the t value between 0 and 1, and returns two bezier curves, one is the half that splitted at t, the other one is other half. Two of them shapes the given bezier curve.

My apologies to the author for finding this unclear -- I am not clear though :D

Also: what an awesome blog post. Interesting topic, straightforward, short, code, diagrams, clearly not AI. Thankyou to the author.


Replies

daharttoday at 2:37 PM

Here’s an interactive picture of how the splitting with lerps works: https://pomax.github.io/bezierinfo/#splitting

Did you ever doodle parabolas on graph paper by drawing straight lines? That’s one way to see why you can form nonlinear curves using only lerps. (For example https://mathcraft.wonderhowto.com/how-to/create-parabolic-cu...)

Your thought is correct - this does (in a sense) move along the curve to produce new control points, and the subset does match the curve exactly. And the new control points are non-linear too! (The inner ones, anyway.) Pay attention to how the new control points are chosen - to split you take one control point from each level of the lerp tree.

show 1 reply
quchentoday at 11:13 AM

Bezier curve are just nested lerps! A bezier curve of degree 1 is lerp, what we usually call "bezier curve" is of degree 3.

It's a mathematical property that bezier curves (degree n) can be split exactly into two bezier curves (degree n), which is known as deCasteljau's algorithm:

https://en.wikipedia.org/wiki/De_Casteljau%27s_algorithm

That page also features some pretty animations on the "lerpy" part - Bezier curves are really simple, it's just that for some reason they are often presented with lots of math jargon that's completely over the top.

This is also used to efficiently draw bezier curves: subdivide them until they're visually straight lines, then plot those.

show 1 reply
WillAdamstoday at 12:15 PM

For a bit more on the lerp aspect see:

https://www.youtube.com/watch?v=jvPPXbo87ds

I am a bit bummed since from the title I was expecting a technique for 3D surfaces w/ multiple Béziers (at least 3, one for each plane) --- if someone knows of a good text on that, I'd be glad to learn of it.

show 1 reply
ginkotoday at 12:36 PM

>The math for Bezier curves is usually a bit beyond me, but this seems to use a simple lerp (linear interpolation) to split. Why is that valid?

This can be explained through the bezier's polar form (aka blossom). There's plenty of literature on this. (For instance see slide 40 here[0])

I generally find it interesting that articles on Bezier curves/surfaces usually get upvoted on HN even though they tend to be extremely surface level. Any introductory applied geometry course or textbook will go much deeper within the first chapter or two.

[0] https://resources.mpi-inf.mpg.de/departments/d4/teaching/ss2...

show 1 reply