i'm going to learn data structures. (really i already spent some days looking into the tutorials) in particular i am interested in arrays, since my (first) goal is to realize a multipoint envelope editor/generator.
if you look at the attached patch, i realized a template for array container (arr) and one for array point (node).
now i have some questions:
window) i get the resize handle too.... but i haven't supplied a 'w' field in 'node'. why? my intention was: to connect these x/y points by a fixed width line. 2) after placing the array, i use [setsize] to set num. of elements in it. but the container doesn't grows horizontally, so it is painful have 10 points, all in the same x/y coordinate. 3) it is possible to set a constraint on a specific field? (i.e.: i do not want the x value of a point to be negative.)
bye
Hallo, federico hat gesagt: // federico wrote:
if you look at the attached patch, i realized a template for array container (arr) and one for array point (node).
now i have some questions:
- although the template for node has only x/y vars, (in the data
window) i get the resize handle too.... but i haven't supplied a 'w' field in 'node'. why? my intention was: to connect these x/y points by a fixed width line.
You have some error in your use of [filledpolygon]: The argument count is wrong. I replaced them both with [drawpolygon] and then the width error went away. It's strange, that Pd reacts like this to a wrong usage of [filledpolygon], though.
- after placing the array, i use [setsize] to set num. of elements in
it. but the container doesn't grows horizontally, so it is painful have 10 points, all in the same x/y coordinate.
That's because you are using array elements that have a field "float x", so [plot] will take the x-spacing from the "node.x" value. This equals 0 after creation so all elements will be at x=0 (or rather at the point, where you start to [plot] which is not 0 in your example but 100). Attached patch shows one possible way to set the array element's x-values after creation.
- it is possible to set a constraint on a specific field? (i.e.: i do
not want the x value of a point to be negative.)
Not that I know. One neat trick could be to use the [mousefilter] external to catch mouse-up events and then check all values and reset them if needed.
Frank Barknecht _ ______footils.org__
_ __latest track: "scans" _ http://footils.org/cms/show/41
Frank Barknecht ha scritto:
You have some error in your use of [filledpolygon]: The argument count is wrong. I replaced them both with [drawpolygon] and then the width error went away. It's strange, that Pd reacts like this to a wrong usage of [filledpolygon], though.
uh?!? however it was a luky strike! generally, pd likes to crash when i make some error with template/data-structures ;-)
- after placing the array, i use [setsize] to set num. of elements in
it. but the container doesn't grows horizontally, so it is painful have 10 points, all in the same x/y coordinate.
That's because you are using array elements that have a field "float x", so [plot] will take the x-spacing from the "node.x" value. This equals 0 after creation so all elements will be at x=0 (or rather at the point, where you start to [plot] which is not 0 in your example but 100). Attached patch shows one possible way to set the array element's x-values after creation.
right. i was thinking something like... thanks for showing me a solution :)
- it is possible to set a constraint on a specific field? (i.e.: i do
not want the x value of a point to be negative.)
Not that I know. One neat trick could be to use the [mousefilter] external to catch mouse-up events and then check all values and reset them if needed.
thanks for the trick ;) i used MouseState external, part of Cyclone/miXed (you can see it in the attached patch, how i realized non-negative x clipping, and negative y clipping.)
i was wondering about a funny thing: when you move points with mouse, the array has a linked-list behavior (moving a dot to the right, also moves the other dots on its right in the same direction). on the opposite, using [set <struct> <field>] seems to bypass that behavior and act like a normal vector (you move *a single* dot) (again look at the patch, do_clip routine, i had to increment x clipping by 2 units, to avoid that boring problem of having 2 dots on the same x/y coordinate)
why this difference?
Federico
Hallo, federico hat gesagt: // federico wrote:
i was wondering about a funny thing: when you move points with mouse, the array has a linked-list behavior (moving a dot to the right, also moves the other dots on its right in the same direction). on the opposite, using [set <struct> <field>] seems to bypass that behavior and act like a normal vector (you move *a single* dot)
why this difference?
Very good question: I have no idea! ;)
Frank Barknecht _ ______footils.org__
_ __latest track: "scans" _ http://footils.org/cms/show/41
again, i forgot to attach the patch :) get it here: http://xaero.ath.cx/cms/data/pd/dstruct-fixed-2.pd
Just in case it could be usefull to understand better the data structures. Here is a little patch oy my own.
http://www.quessy.info/pd/mtl/ Download the 3 files and try premiere.pd
aalex Pure Dada rocks...
Join the Echelon Civil Disobedience Campaign! Let's Overload Echelon!
sigint echelon sugar grove virginia sabana seca puerto rico waihopai new zealand comsat intelsat interception wideband extraction aluminium potassium sulphate signal analysis filtering data processing nitroglycerin facsimile analysis nitrogen trichloride traffic analysis phenol keyword recognition text retrieval topic analysis ammonium hydroxide continuous speech recognition distillate diesel naphthalene red nitric acid ammonium nitrate machine-transcribed speech
Le 05-03-30, à 15:38, federico a écrit :
again, i forgot to attach the patch :) get it here: http://xaero.ath.cx/cms/data/pd/dstruct-fixed-2.pd