[PD] Data structures with $0?
Mathieu Bouchard
matju at artengine.ca
Thu Jun 17 19:47:40 CEST 2010
On Thu, 17 Jun 2010, João Pais wrote:
> yes, but since my math skills aren't much better than basic, all those
> equations and polynomials mean nothing to me. unless I get a clear
> equation (like the cubic one I used, which I found in another site), I
> can't go any further. if anyone wants to translate those funny drawings
> for me into something comprehensible, I'll put it in the patch.
Then this means I'd have to give you one formula per order, or what ?
The general formula goes like this : time goes from 0 to 1. to figure out
the position for a time we call "t", you do this for each point numbered
"i", you multiply the point by t, i times, and you multiply the point by
(1-t), n-i times. It gives a pattern like :
[expr pow(1-$f1,3)*pow($f1,0)*$f2 +
pow(1-$f1,2)*pow($f1,1)*$f3 +
pow(1-$f1,1)*pow($f1,2)*$f4 +
pow(1-$f1,0)*pow($f1,3)*$f5]
I put the pow(,1) and pow(,0) in the formula just to make the pattern
obvious... pow($f1,1) = $f1 and pow($f1,0) = 1, so, they'd be skipped in a
"real" formula.
So, to adapt to 5 points, you'd add a $f6, the exponents in the first
column would be 4,3,2,1,0, and in the second column they'd be 0,1,2,3,4.
You can see that you can add any number of points like that.
It's more difficult, though, to make a patch that supports all possible
orders at once. One way you can do it is with a [until] or [list split] or
[list-drip], to compute the formula for one point at a time, and a [f] [+]
combination to add the results together, for example. All this because you
can't make a single [expr] that supports any number of points.
> my purpose of doing this is basically to "modulate" a [line] (0-1), that
> is, with one direction. I never worked with higher than cubic curves
> (coreldraw etc are cubic), but since the purpose is to have a line that
> follows only one direction, would it become that unpredictable?
CorelDraw curves do the same thing in two dimensions by doing the same
formula twice, once for the x, once for the y. Everything funny that you
can do with those curves in 2 dimensions has a reason that comes from the
1-dimensional case. If you setup your points to bounce back and forth in a
big-order Bézier, you will get an overly jumpy curve. Here's an extreme
example :
http://demonstrations.wolfram.com/RungesPhenomenon/HTMLImages/index.en/popup_3.jpg
this example is a Lagrange curve instead of a Bézier curve, but the
jumpiness is a problem with all methods (some more sensitive than others).
>> So, usually, when they have more than four dots, people chain together
>> pieces made from three or four dots each.
> I know. that's another thing I have to look at in the future, but don't have
> a) the time and concentration b) the necessity for it. although it would be
> better, because then the patch would be "complete".
If I wanted a [vline] that did Bézier, I'd expect it to be chaining
together pieces of Bézier that use three or four points at a time. Sort of
like the difference between [tabread] and [tabread4], but with a better
formula than [tabread4].
_ _ __ ___ _____ ________ _____________ _____________________ ...
| Mathieu Bouchard, Montréal, Québec. téléphone: +1.514.383.3801
More information about the Pd-list
mailing list