PURE DATA forum~

...that deal with pure data

You are not logged in.

#1 2012-04-28 20:38:03

hugo_s
Member

Circle data structure ?

Hi everyone,

I am starting to use pd's datastructures. But I am very surprised that there is no "drawcircle" object, with argument such as center coordinates and radius.
How do you draw circles ?


By the way, if anyone knows where to find some advanced documentation on data structures, I've used PD's data structures tutorial by MR. Karman, which was very good, but I would like to have more complete information.
Thank you,

Last edited by hugo_s (2012-04-28 20:44:16)

Offline

 

#2 2012-04-28 21:33:53

Maelstorm
Administrator

Re: Circle data structure ?

It's pretty clunky, but you can do it with [drawcurve]. Look at browser -> PureData -> 4.data.structures -> 10.onoff.pd


.mmb   |   My library

Offline

 

#3 2012-05-10 19:09:42

hugo_s
Member

Re: Circle data structure ?

yeah, thank you, actually I was very afraid of this kind of answer ^^.
Anyway datastructures are an awesome feature.
I was planning to move to max, but I don't think there is anything equivalent.

Offline

 

#4 2012-05-10 21:22:49

katjav
Member

Re: Circle data structure ?

Indeed it is not the most comfortable way to draw a circle. I don't understand the procedure at all.

Anyway, there's this nice video of Miller Puckette doing a speech (in French!), where he mentions how graphical composition with data structures were the immediate cause for developing Pure Data:

http://vimeo.com/39432325


Katja

Offline

 

#5 2012-05-10 23:27:21

sinewave
Member

Re: Circle data structure ?

Hi hugo_s,

will you, please, post a link on Mr Karman tutorial? Google didn't help.
Thank you!

Offline

 

#6 2012-05-11 00:06:28

hugo_s
Member

Re: Circle data structure ?

Thanks, Katja (I love this forum).
Here is the link for the tutorial: http://puredata.info/Members/ggkarman/T … en_02/view
It was actually hidden somewhere on the maze that is pd's official website.

Offline

 

#7 2012-05-11 07:48:50

katjav
Member

Re: Circle data structure ?

On Pd-list, Jonathan Wilkes has recently posted a cool patch demonstrating the THX 'Deep Note' accompanied by a visual animation in data structures. The thread starts here:

http://lists.puredata.info/pipermail/pd … 96200.html

And his patch appears a few posts later. It shows the graph on the parent patch, like Maelstorm's waveform display (in 'abstract~' section of this forum) does. I've never managed to properly graph a data struct window on parent, what is the trick?


Katja

Offline

 

#8 2012-05-11 14:32:13

Re: Circle data structure ?

I totally second that katja :) yeah what's the trick ?!

@ hugo_s : I've tried a few things with data structures some time ago. It mainly came from hacking Hans Chritoph Steiner work on his piece solitutde : http://at.or.at/hans/solitude/

http://puredata.hurleur.com/sujet-4300-score-editor

there are also a few of Chris McCormick's s-abstraction that use data struct in GOP that may be worth studying such as : s-varseq, s-varenv,s-nadsr~, s-microenv, s-controlsurface , s-arranger , etc

hope it helps

berenger

Offline

 

#9 2012-05-11 20:31:09

Flipp
Member

Re: Circle data structure ?

Hey,
concerning the circle: The easiest way I found is just drawing a polygon with xy1=[0,0], xy2=[0,0] and using the line-width as the radius.. This will produce a fat point. It's actually not round but works well with 'not so big' graphics.
For a circle just place an other point inside the first one that's slightly smaller while having the backgrounds color..


I've never managed to properly graph a data struct window on parent, what is the trick?

What's the problem? ;) It took me some time and tries and errors but once one gets it, the whole data-structure-thing is actually pretty straight forward..
...although there are some nasty "refreshment bugs" like suddenly things hide below other things when maximizing a window or something like that..anyways..

1. Create a "graphics-subpatch" eg. [pd $0mygraphics] to insert the scalars into..
Don't place objects there!
2. Make the subpatch "graph on parent" (& hide object-name etc...) and select the "X- and Y-range" according to the positions of the scalars inside the subpatch. The "Size" determines the size of the subpatches GOP-frame, and the margin is I guess not doing anything right here.
=>This will make the setted number of pixels from inside the subpatch fit into the "subpatches GOP-frame"
...if you have placed scalars outside the "X- and Y-range" the GOP-frame will be stretched accordingly..
3. ...if you haven't done already, put the scalars into the subpatch
4. Now just make the abstraction "graph on parent" as usual and place the "GOP-graphics-subpatch-object" :) inside the red rectangle ..that appeared because we have objects inside this patch (in contrast to the "graphics-subpatch").
5. ..ehm that's it, I guess.. oh save and use anywhere.. ;)

Bye
Flipp

Last edited by Flipp (2012-05-11 20:32:19)

Offline

 

#10 2012-05-12 09:26:47

katjav
Member

Re: Circle data structure ?

So GOPping data structure graphics should basically be the same as a regular subpatch?

Let's say I want the circle from help browser patch 10.onoff.pd graphed on parent. Subpatch data10 has a curve, a polygon, and two numbers. For this subpatch, I select properties and set 'graph on parent', 'hide object name and arguments', X and Y size 300. At the moment when I click 'apply', the GOP size blows up, and the visible objects are gone.

Flipp, can you tell me what I do wrong here?


Katja

Offline

 

#11 2012-05-12 09:35:45

katjav
Member

Re: Circle data structure ?

BerengerRecoules wrote:

there are also a few of Chris McCormick's s-abstraction that use data struct in GOP that may be worth studying such as : s-varseq, s-varenv,s-nadsr~, s-microenv, s-controlsurface , s-arranger , etc

The file s-abstractions.tar from:

http://mccormick.cx/projects/s-abstract … e/download

can not be opened (tried on OSX and Linux). Berenger, do you have the original patches still?


Katja

Offline

 

#12 2012-05-12 13:36:12

Re: Circle data structure ?

Yes, here they are :)

this is a copy from my hard drive I'm not sure it's the whole package but at least you'll have some of those.

Cheers


Attachments:
Attachment Icon s-abstractions.zip, Size: 545,526 bytes, Downloads: 43

Offline

 

#13 2012-05-12 20:32:29

Flipp
Member

Re: Circle data structure ?

Flipp, can you tell me what I do wrong here?

Hmm, no. ...It seems to be all correct.
The GOP-size blowing up can be considered normal, I think (actually I think the struct-stuff is a little buggy...) Everything should be looking ok later on.
Although that didn't happen when I did the same with the patch. ..I use windows and pd0.42.5...
Maybe have a look at the attached patch. I only selected "GOP" and set the x- & y-range from 0 to 299.

...from time to time it would be quite handy to have some developers around here..


Attachments:
Attachment Icon 10.onoff-GOPtest.pd, Size: 2,230 bytes, Downloads: 58

Offline

 

#14 2012-05-13 21:57:23

Flipp
Member

Re: Circle data structure ?

I'm just curious...does it work?!

Offline

 

#15 2012-05-13 22:28:35

katjav
Member

Re: Circle data structure ?

Berenger, thanks for posting the s-abstractions. Very nice to learn that an xy-pad in vanilla Pd is actually possible!

Flipp, your GOP version of 10.onoff.pd works here (I happen to be on Linux today), in a sense.The objects appear at microscopic scale, not like the size they have in the original patch. But the key point, which I always overlooked, is the fact that data structures behave like arrays, where 'range' is an  important parameter to set. Normally, range is most important for arrays and x-y size is most important for regular GOPs, but in case of data structures, both seem to be important.

Okay, learned a lot from this thread so far. Thanks.

Katja

Offline

 

#16 2012-05-13 23:46:32

Flipp
Member

Re: Circle data structure ?

Yeah, actually the GOP-range works just like the arrays range. If you select the array's canvas-properties there one can see the same behavior. ...I guess that arrays must be something like inbuild structures. If one just knew the name of that structure one could build a vanilla [arraysize]...

Just to point it out, the "range" (in pixels) stands for an imaginary frame inside the subpatch in which all the graphics should be placed. This then is scaled to the "size" of the subwindow. So for a 1:1 scaling one has to meet "range_max - range_min = size"

Offline

 

#17 2012-05-14 09:23:55

katjav
Member

Re: Circle data structure ?

Jonathan Wilkes is very familiar with the data structure C code in Pd and indeed he once mentioned that 'array' is a data structure preset with limited properties (fixed color and line thickness). He has written a 'canvas get method', which can request all sorts of info from any canvas:

http://lists.puredata.info/pipermail/pd … 16855.html

So far, the method is not yet implemented in Pd but it is relatively easy to compile vanilla Pd with Jonathan's patch file, and he's done a very cute interactive test patch, featuring data structures again.

Now back to the circle, initial topic of this thread: it would be cool to have an abstraction [complexplane] featuring the unit circle, where you could set a complex number as a point or vector. With such an abstraction, all sorts of visualization demo's could be done, even animations. For example, the working of resonant filters could be demonstrated, or the multiplication of complex roots of unity like used in fft. I'm tempted to start working on it, now that this thread has made some aspects of data structures clearer.


Katja

Offline

 

#18 2012-05-15 00:16:41

nau
Member

Re: Circle data structure ?

Hi there,

this discussion was for me a pretext to go further with my data-structure learning.

Here's a patch drawing a polygonal approximation of a circle, with controllable number of vertices and radius.
An array holds the (x,y) pairs of vertices plus one, which is a copy of the first pair.
[plot] does the work, i'll go on further trying other representation objects.

Hope this will save time to somebody. (I mean for those who don't intend to write abstractions ;-))

Nau

Last edited by nau (2012-05-15 00:17:49)


Attachments:
Attachment Icon circle_example.pd, Size: 2,885 bytes, Downloads: 55

Offline

 

#19 2012-05-15 01:03:59

katjav
Member

Re: Circle data structure ?

Here is a visualization of the complex plane, with a draggable complex point for which xy coordinates, radius and angle are shown. No animations yet.

Nau, your solution with [plot] is much better than [drawpolygon]. I'll use it in a next version of [complexplane].



Katja


Attachments:
Attachment Icon complexplane.pd, Size: 6,281 bytes, Downloads: 50

Offline

 

#20 2012-05-15 10:58:51

katjav
Member

Re: Circle data structure ?

OK now it is an abstraction [complexplane] with axes, unit-circle and a draggable complex vector which can also be set via inlets. By way of test, an animation of [cpole~] is done.

A pole-zero GUI (like MaxMsp has it) would be possible with similar technique. But the math behind pole-zero plots is not trivial.

Anyway, I'm starting to understand data structures better now. The only thing I could not get done is a fat (draggable) point according to Flipp's description. The complex datapoint in [complexplane] is a square instead but I would like a circular point better. If the two sets of coordinates are identical, the polygon is just not drawn. Flipp, could you find a way to replace the square in [pd $0-radius-template] with a fat (draggable) point?


Katja


Edit: oops, it was drawing ellipses instead of spirals, uploaded an update.

Last edited by katjav (2012-05-15 18:21:36)


Attachments:
Attachment Icon complexplane.zip, Size: 4,865 bytes, Downloads: 42

Offline

 

#21 2012-05-15 18:47:28

jmmmp
Member

Re: Circle data structure ?

Hi Katja,

didn't you get the materials of my data structures workshop in Weimar? In one of them there's a small animation of some circles getting bigger - data-s_07.pd, the circles template.

Joćo

Offline

 

#22 2012-05-15 19:48:24

katjav
Member

Re: Circle data structure ?

Hey Joćo! A real data structure expert is joining in, great. Yes I have your workshop patches. It's magic. Data structures are so powerful, if only you know how to handle them. I completely forgot about the click messages.

It should be possible to make a [led] abstraction, like the Max object, a toggle with the appearance of [bang]. And what about [knob]? Would be cool to build a set of data structure GUI abstractions. In vanilla Pd.

Katja

Offline

 

#23 2012-05-15 21:10:35

jmmmp
Member

Re: Circle data structure ?

Hi,

about [led], I'm not sure if J Kreidler already did a similar thing. There was also an object somewhere that was a bang which could be rescaled in both dimensions.

A data-s-gui abstraction library could be nice, yes. I already did a version of [swatch], but it wasn't ready in time to be included in 0.43 (it also has a circle). Does the attached file work?

I myself can't help much now (am too busy), but to give advices is cheap:
- in case you want to do gui abstractions, don't try anything that has too much movement (data-s are tcl, and tcl is slow);
- to avoid memory space conflicts from using several templates with the same name, it's better to use $0 in all templates+scalars. for that you should create the scalars at loadbang, e.g. like I do in [swatch], [jmmmp/pd-colors] (a good resource for anyone using colors with data-s) or in [jmmmp/bezier] (a more complex example)

Although data structures can be very powerful as a composition/data display tool, since Pd was started [and apparently Pd started because of them] they didn't evolve that much. People can do lobbying to Miller, to see if the puts some more work into them. I already sent some mails several times, suggesting the simple operations I usually mention in my workshop, which require lots of coding.

Another thing that might be looked up by a programmer can be, porting the ftm library from Max/MSP. It's much more robust and mature than Pd's data structures, and, quite frankly, we would all win if we could use this - http://ftm.ircam.fr/index.php/Main_Page and http://sourceforge.net/projects/ftm/.
Besides all the data display+handling apparatus, ftm also has some very good audio objects, which use the data stored by the libraries. IOhannes already did some work in the port, but apparently it stopped.

Joćo

Offline

 

#24 2012-05-15 23:44:12

nau
Member

Re: Circle data structure ?

jmmmp wrote:

didn't you get the materials of my data structures workshop in Weimar?

Is it possible to download it from somewhere ? 
I couldn't find it on the net, and it seems very interesting !

Thanks,

Nau

Offline

 

#25 2012-05-15 23:50:13

Flipp
Member

Re: Circle data structure ?

Hi Katja,
attached is the edited patch. I have created the point and I "styled" the radius-line accordingly (hope that's after your fancy). (And I adjusted some small things). The point is draggable, although the zone in which it reacts to the mouse is rather small. ..maybe it interferes with the other drawings?!

Another way to draw the point would be a separate [struct] (and scalar) for it (eg. like you did with the unit-circle), but that's more complicated. ...and can be even more cpu-intensive, I think..


Hey Joćo,
could you share your workshop-patches overhere as well, please?!
And is there a reason why you just go to "899" instead of "999" for the color in your pd-colors patch?? I thought rgb-values go up to 999!?!
...and I can't find your bezier-patch anywhere, seems to be missing...


Flipp

Last edited by Flipp (2012-05-16 00:02:27)


Attachments:
Attachment Icon complexplane2.pd, Size: 8,470 bytes, Downloads: 78

Offline

 

Board footer

Powered by PunBB
© Copyright 2002–2005 Rickard Andersson


pd.webring info