Hi,
Is there any help patch or documentation about the (%lf:%lf)(%lf:%lf)(%lf) syntax used in variables for template fields?
Syntax (%lf:%lf)(%lf:%lf)(%lf) for fields?
Hi,
Is there any help patch or documentation about the (%lf:%lf)(%lf:%lf)(%lf) syntax used in variables for template fields?
Hi,
I am not sure if your question is about this specific example of about format specifiers in general. In case it's the latter, then Pd uses the same format specifiers as the C programming language, see: https://www.le.ac.uk/users/rjm1/cotter/page_30.htm
%lf
is used for double precision floats if I am not mistaken. So basically if you ask a C program to print the string (%lf:%lf)(%lf:%lf)(%lf)
and give it 5 double precision floats as arguments (let's say 1.0, 2.0, 3.0, 4.0 and 5.0 for our example), the program would output (1.0:2.0)(3.0:4.0)(5.0)
.
Cheers,
Gilberto
I was talking about things like [drawpolygon 0 2 0 0 0 weasel(10:50)(10:50)(10)] ; probably my question was confused.
The two first seems to set the minimum and the maximum values whereas the last is the step.
Oh, I understand you now! But unfortunately I am not familiar at all with these data objects...
They're for re-scaling values. weasel(x1:y1)(x2:y2) will re-scale weasel so that whatever value it was in the x1:y1 ratio will now fit in the x2:y2 ratio. For example, if weasel=50, weasel(0:100)(0:200) will give you 100, as the new ratio is just doubling the initial one. weasel(0:100)(10:110) will give you 60, as that is just an offset of 10. I believe the last single one might be a step, but I can't find examples of that and haven't used it myself.
Thanks for reply.
You are right ; after few more investigations it appears that (a:b)(c:d)(e) are related values to the formulas above.
t_float division = (d - c) / (b - a);
t_float position = (c + ((value - a) * division));
Note that the screen position obtained is clamped by c and d.
Note that e is used to round the value (to a multiple of a quantum) in reverse operation.
value = ((int)((value / e) + 0.5)) * value;
Oops! Looks like something went wrong!