- AVS Presets
- Bicubic Béziér Patch
Archive: Bicubic Béziér Patch
UnConeD
31st August 2002 03:21 UTC
Bicubic Béziér Patch
(follow up of the bezier-talk in the 'Lamé curve' thread).
I've made a nice bicubic bezier patch scope... it can render at any arbitrary resolution. The patch's control points are limited to vertical movement only, for variable storage reasons (16 control points).
Not very interesting on the visual side and the responsiveness is just something I plugged in quickly. Definitely not finished :).
jheriko
31st August 2002 05:49 UTC
nice... is that just a set of big bicubics or is it generating multiple bicubics for each set of three (or six) control points? i cant sift through your code its too, well, solid.
i assumed bicubics were x6+ax5+bx4+cx3+dx2+ex+f, since biquadratic is another term used for quartic, but it doesn't look like that in the code (i could be wrong of course since i can barely read the code).
also something you might like to look up is the horner method, it is a more efficient way of evaluating a given polynomial. i'm pretty sure it goes like this (you could use it to speed up calculation of x1) if this isn't the horner method this still works (expand the brackets)
ill use a standard cubic as example
ax3+bx2+cx+d = ((ax+b)*x+c)*x+d
this way you use less multiplications and the same number of additions to get the same result. something i learned in alevel further maths, also used it a lot when studying polynomial interpolation in the computing modules of my maths degree course.
dirkdeftly
31st August 2002 11:22 UTC
Umm...yeah....:confused:
I have no idea how this works, so mind an explanation, Stevey? :P
BTW, the animation is uber-spastic, especially the rotation.
UnConeD
31st August 2002 15:59 UTC
It's a 4x4 point patch, where every intersection of the patch along one of its axes results in a cubic bezier curve. That's where bi-cubic comes from (cubic in 2D).
+----+.---+----+
| |. | |
| |. | |
+----+.---+----+
| |. | |
x....x*...x....x
+----+.---+----+
| |. | |
| |. | |
+----+.---+----+
Suppose we want point '*'. You evaluate by first calculating the 4 control points of either the horizontal or the vertical dotted line. Each dashed line is a cubic bezier curve with known control points, so finding them is not a problem. For example, we evaluated the horizontal line and got the 4 x's.
Then, you treat those 4 x's as control points for another bezier, and you're done.
Because of the properties of bezier curves, it doesn't matter if you evaluate it horizontal first or vertical first.
Oh by the way jheriko, biquadratic is not the same as quartic. A bi-quadratic polynomial is a quartic with only even powers:
ax^4 + bx^2 + c
You can solve them by setting y=x^2 and solving it like a regular quadratic. Then you take the roots and find the solution to the quartic.
This bi-cubic has nothing to do with that though.
jheriko
31st August 2002 17:33 UTC
right, now i understand what nurbs mean :P and yeah i forgot you need it 4 control points for a cubic (not 3) so i really should have been able to figure out that it was a 4x4 patch... and on that biquadratic thing, i got that out of one of my algebra books... think it was one on set theory in the back it has a list of terms and in brackets after quartic it has 'or biquadratic'... books can often be wrong tho'. but still, if you are generating a large number of points on a cubic everyframe horner's method should speed it up a bit... wouldn't it be cooler to make a nurbs surface in avs tho? no that you've done this cubic patch making a nurbs surface shouldn't be to difficult right?
(for those who don't know nurbsstands for non-uniform rational bi-cubic spline, and is basically where you split the spline into sets of four control points and make a cubic beizer spline for each set)
i'm gonna go play with some curves now :P
UnConeD
31st August 2002 19:15 UTC
Wasn't nurbs "non-uniform rational b-spline"? B-splines aren't béziérs as far as I know, but they're cubic as well.
jheriko
31st August 2002 20:03 UTC
b-spline means bicubic spline and unless you want to solve a cubic for every control point (exceedingly slow due to large amount of sqrts and couple of cbrts) i'd guess it would use the bezier spline method.. hang-on i have a big fat opengl book lying around somewhere with a huge section on curves...
'b-splines are essentially the same as bezier curves except that b-splines are divided into fragments of four control points per fragment. this division of the entire curve into segments essentially produces a combination of cubic bezier curves that combine to form a single, more complex curve.' - primatech's opengl game programming (hawkings and astle)
thats a pretty nice description, i guess that the fragments would have have to share 'end' control points to ensure that the curves all flowed together seamlessly
jheriko
11th December 2006 13:56 UTC
I'm sure I will get ripped for bumping such an old post... but I must correct my mistakes!!!
Hawkings and Astle were wrong. B-Splines are something totally different...
If you take a a piecewise continuous function x where each range is a constant, (e.g. 0<t<1 ==> x=1; t<0 ==> x=-1 ; t>1 ==> x=0). Call it x and convolve it with itself to get x*x, again and we get x*x*x, again to get x*x*x*x ....
These x*x*x..*x curves are called B-splines. They are piecewise continuous and have continuous (n-1)th derivatives and continuous piecewise (n-2)th derivatives, where n is the number of x's convolved.
Now, if you take two cubic splines and force the together with the right continuity, the curve you get out does happen to obey this definition... but still.
I'm sure everyone will find this very useful. ¬
4 years ago... doesn't seem that long at all.
PAK-9
11th December 2006 19:14 UTC
I AM GLAD YOU ARE NOT BORED AT YOUR WORK
Warrior of the Light
11th December 2006 19:38 UTC
O.o
JaVS_v2.5
12th December 2006 05:25 UTC
I thought this was a new thread..oh well :igor:
Warrior of the Light
12th December 2006 07:23 UTC
you know, if you're bored anyway, you could of course put WA on an USB drive and continue with J10
jheriko
12th December 2006 10:15 UTC
Actually. I was reading something else and I came across a definition of B-splines. Having a stupidly good memory and being bitter about making mistakes because a book misinforms me... I felt duty bound to correct this thread.
WotL: I never seem to finish whatever preset I make to finish J10.
hornet777
13th December 2006 08:58 UTC
Running across something while looking for something else is one of my favourite way of learning. It accentuates the "light-bulb" affect :)
bravo, jheriko
WildJack77
25th December 2006 08:16 UTC
Old thread?