Readit News logoReadit News
NinjaKoala commented on Closed form arc length parametrization is impossible for quadratic Bézier curves   ninjakoa.la/curly_curves/... · Posted by u/NinjaKoala
raphlinus · 2 years ago
Numerical solutions are better. Having a closed form solution is overrated. For example, the closed form solution for arc length of a quadratic Bézier becomes numerically unstable for curves that are close to a straight line. In those cases, you definitely want the numerical approach.

I also think Pythagorean Hodograph curves are overrated. Euler spirals, on the other hand, are extremely easy to work with in an arc length parametrization, it's just that you need to compute a "special function" to get back to parametrized land. Fortunately, that's easy enough to compute very accurately using standard numerical techniques.

NinjaKoala · 2 years ago
Numerical solutions are usually much more accurate, yes. However, especially when computing with fragment shaders for example, closed form formulas tend to be faster. But the main reason for looking into it was because i had fun doing it.
NinjaKoala commented on Closed form arc length parametrization is impossible for quadratic Bézier curves   ninjakoa.la/curly_curves/... · Posted by u/NinjaKoala
nvpr · 2 years ago
The linked article says:

> The arc length of quadratic Bézier curves actually can be computed with a closed form expression.

While indeed true, the article doesn't provide the closed form expression. The curious or unsatisfied reader can find the solution for the 2D case at the top of page 7 of this SIGGRAPH paper:

https://developer.download.nvidia.com/devzone/devcenter/game...

The quadratic function Q(t)=(x,y) is of the monomial form At^2 + Bt + C where A, B, and C are 2D coefficients (see page 5) where A is non-zero.

Simply convert your Bezier quadratic form to monomial form to apply this equation.

This equation still doesn't provide an arc length parameterization, the article's actual focus.

But if you did, say, want to move 26% (or N%, more generally) of the arc length along a quadratic Bezier segment, first compute the total (100%) arc length with the paper's formula (take care doing so as the paper suggests). Then split the Bezier at a halfway guess (try t=0.5). Again use the formula to evaluate the split quadratic. Repeating this in a divide and conquer fashion, you narrow in on the t value very close to 26% (or N%) of the arc length.

2D vector graphics standards expect to dash cubic & quadratic Bezier segments so some practical strategy to provide an arc length parameterization -- even if unavailable in closed form.

NinjaKoala · 2 years ago
Yes, the procedure you mention works, but it's a numerical method. I'm not saying such numerical method's are impractical or something, but depending on your general setup, closed form formulas might be faster.
NinjaKoala commented on Closed form arc length parametrization is impossible for quadratic Bézier curves   ninjakoa.la/curly_curves/... · Posted by u/NinjaKoala
magnio · 2 years ago
> It is well known in the computer graphics community that the arc length of cubic Bézier curves has no closed form and has to be computed numerically. Sadly, I’ve not yet seen a proof sketch for that, though.

A cubic Bezier curve B(t) is a cubic polynomial of t in [0, 1], parameterized by the four control points. Since it is continuously differentiable, its length is the integral from 0 to 1 of the square root of (1 + (B')^2), a quartic. Such an integral is well known to be reducible to the elliptic integrals, which have no closed form.

NinjaKoala · 2 years ago
Yes, you're right. I didn't find a proof for the fact that elliptic integrals have no closed form, though.
NinjaKoala commented on What is the Demoscene? An interview   onthearts.com/p/what-is-t... · Posted by u/keiferski
gnramires · 2 years ago
Procedural art has a different quality to it though :)

Edit: That is to say, I don't think the only value of the demoscene is to create something cool under technical limitations. I think it's to create something cool in a computational medium (the spirit lives on as procedural art, shader art, etc. as well).

Every method of producing a work (done under finite time, I guess :P) will give sometimes vastly different results. Hand drawing an animation will give something completely different under similar time constraints as video editing and completely different from procedural drawing.

To give some examples: you can easily render thousands of points, e.g. stars, make them twinkle, draw thousands of trees, and give them all detailed movement. That's very hard to do by hand. By hand you'll have better control of style, and details like paint texture, etc.. Animating characters (with genuine character) is trivial by hand but quite difficult procedurally (you have to resort to essentially manual animation in the end). There's the question of offline vs online rendering... if you're offline rendering you can go bonkers with millions of objects. I personally like being able to run it real time, I find it gives it a more intimate feeling, and is easier to reproduce (but am not against offline rendering if you find it suitable!).

Also very exciting to me is baking randomness, either with a fixed seed or changing seeds every time. You get a different piece every time you watch it! The possibilities are really vast, and mostly unexplored.

NinjaKoala · 2 years ago
There was actually a 4k intro released this year which uses changing seeds: https://www.pouet.net/prod.php?which=94081

u/NinjaKoala

KarmaCake day64October 18, 2023View Original