PURE DATA forum~

...that deal with pure data

You are not logged in.

#26 2012-05-16 08:31:55

katjav
Member

Re: Circle data structure ?

Flipp, thanks for revising my patch. The background-foreground style is nice indeed, gives better contrast. But now the surprise: on my computer (OSX) the fat point is invisible! I tried Pd 0.42 and 0.43. Apparently it is not a matter of Tk version, but what else?

Anyway, the draggable area should be comfortable so it is probably better to make a scalar with more coordinates. The circle in Joćo's [swatch] is a good example. By the way, [swatch] & co make my Pd crash when closing the patch, don't know why, these patches are quite elaborate.

Joćo, it is true that data structures are CPU-intensive, because they are Tk which is an interpreted language. But isn't it the same with Juce? I remember the same frustration from using MaxMsp. With the upgrade from 4.6 to 5 the graphical facilities were greatly expanded but it got no faster.

Data structures are attractive for me because of the fact that it is all vanilla Pd. I am planning to collaborate on a math&music programme for high school kids, and to make it work on arbitrary school computers, we don't want the complicated dependencies of Pd-extended. CPU performance is not so much of an issue, as the patches will be small demo's only. On the other hand, if we want real flashy GUI, we'll probably resort to OpenFrameworks and libpd (but I still have to learn that).

Katja

Offline

 

#27 2012-05-16 12:34:29

jmmmp
Member

Re: Circle data structure ?

Hi,

here are the patches of the workshop. There are other things I wanted to program, but that will have to wait until another workshop comes through...

About [pd-colors], I think I didn't make it until 999, because afaik after 899 the last row just repeats itself. Doesn't matter how high you go, it just repeats the last row always.
You can check it yourself by creating more scalars with [until]. If I remember correctly, if you just change the number before [until], it creates more scalars, positioning them in the right place.

Can you check if [bezier] comes with pd-ext-0.43? I think it did come with the version I have here.

Suggestions/critique is always welcome.

Joćo


Attachments:
Attachment Icon data-s.workshop.jmmmp.zip, Size: 176,299 bytes, Downloads: 51

Offline

 

#28 2012-05-19 13:40:18

jmmmp
Member

Re: Circle data structure ?

Hi Katja,

I don't know Juce, so can't do any comparations.
Strange, I never had any problems with [swatch]. I noticed that patches with data structures crash more often in ubuntu than in windows (which is strange, since Pd is developed in unix), specially when closing them - at least with other more complex patches I have. But as I remember, never had that problem with these small abstractions. Is there any way of getting an error report, and send it to the developer gurus?

I will also look at your plane patch as soon as I can, unfortunately am too busy these days.

Best,

Joćo

Offline

 

#29 2012-05-19 16:32:59

jmmmp
Member

Re: Circle data structure ?

Hi Katja,

just a couple of small details about the complex plane patch (I can just look at it for some minutes):
- uau, that's a complicated circle you drew. Maybe you can adapt the circle I did in [swatch]?
- the order of creation of the scalars is the only way to determine which are shown on top of others. Probably you already know that, but just to make sure.
- there's one bug bound to happen, that you also see documented in [bezier]: when the grab points go outside the gop frame, the data structure will stop responding. It will still work, but you won't be able to grab it, you have to reset it from the outside; (look at the help file of [bezier])
- this can be avoided, if you put some limits to the action field of the scalars. Is this patch just to serve as an illustration of incoming data, or can people use it as control gui for another patch?
If the 1st, then it's not a problem. If the 2nd, then you can program some limits to the template, so that the grab points don't go outside the gop box. I don't have the reference right now, but look for the "float x(aaa:aaa)" kind of command in my workshop files.

Best,

Joćo

Offline

 

#30 2012-05-19 18:03:08

nau
Member

Re: Circle data structure ?

Very interesting, thank you.
The circle was my very first data structure patch, for tuto purpose, and I got so much back...

I wish I'll find [bezier] and [swatch], I didn'tn search them seriously yet, and I am on pd-extended 42 something.

Nau

Offline

 

#31 2012-05-19 21:38:43

katjav
Member

Re: Circle data structure ?

Joćo, there is a crash when closing [swatch-help] or [swatch-gui-help] on OSX. Sure I get a crash report for it, but I can not find the exact cause. It must be something with deallocation of GOP data, as it does not happen with [swatch] itself. In the meantime I also found that my [complexplane] makes vanilla Pd 0.43.1test5 crash (but not Pd-extended). Need some time to isolate the offending code, before filing a bug report.

About the circle again: which object in [swatch] makes the circle? There are two polygons and one curve. (Joćo, [swatch] is not included in the set you posted in this thread, I have it from your Pdcon11 workshop).

Indeed it seems that objects using the scaling format 'float x(aaa:aaa)(bbb:bbb)' do not get out of range, and other objects using variable coordinates can be made insensitive for mouseclicking in runtime with flag -x. So I modified [complexplane] in this sense, here it is again attached.


Katja


Attachments:
Attachment Icon complexplane.zip, Size: 5,792 bytes, Downloads: 26

Offline

 

#32 2012-05-19 22:12:06

jmmmp
Member

Re: Circle data structure ?

Hi,

the circle in swatch is made by [drawcurve 0 2 p1x p2y p2x p3y p3x p2y p2x p1y p1x p2y]; all points are declared in the [struct] in the same patcher. I don't know if this is the most efficient way (better ask F Barknecht, J Wilkes or someone else), but the technique is the following, as I recall:
- define 5 points in a drawcurve (last point is the same as the first, to make a closed circle)
- since the whole circle (that is, 5 pairs of coordinates) has to be dynamic to move around, I use the change flag to always reset the display of the circle everytime the values change.
(something similar happens in bezier; again, that might not be the most efficient way of doing this)
- I think that [drawpolygon 0 2 p0x(0:258) p0y(0:65) p0x. p0y.] acts as boundary controller for the circle, by limiting the values sent to [set $0-rgb-sel p1x p2x p3x] and [set $0-rgb-sel p1y p2y p3y].

In general with structs, a good way to know which one is what is to connect a toggle to the drawing object (0 hides structs, =!0 shows them).

For the limiting of boundaries you only need the x(aaa:aaa) part. The bbb is for rescaling. If you leave it out, it uses the same values as the input.

Aha, my examples weren't included in the zip file. Most of them should be in Pd-Ext anyway. I'll put in a new file later.

Offline

 

#33 2012-05-20 12:57:49

jmmmp
Member

Re: Circle data structure ?

Here is an updated workshop file, with my examples. I can't put some examples of other persons, but they're available online.

Joćo


Attachments:
Attachment Icon data-s.workshop.jmmmp.zip, Size: 1,019,714 bytes, Downloads: 40

Offline

 

#34 2012-05-20 14:16:39

nau
Member

Re: Circle data structure ?

Cool ! Thanks Joćo.

Offline

 

#35 2012-05-20 22:40:37

katjav
Member

Re: Circle data structure ?

Joćo, thanks for all your explanations. I admire your perseverance, to make useful patches with these convoluted methods. If I were not so deeply involved with Pd already, I would just forget about data structures. But I still have a feeling that it is worth the effort. Weird idea, that Pure Data was conceived for exactly this aspect, which hardly anyone uses.

Katja

Offline

 

#36 2012-05-21 01:54:56

jmmmp
Member

Re: Circle data structure ?

I don't make that many so much convoluted patches :)
I guess both [bezier] and [swatch] were a kind of inspiration, and concentrated problem-solving (each was done in around 1 day). Actually it's not that different from other people who use a clock of some kind to update a gui - since [struct] outputs the operation+pointer, that serves as clock (which is an advantage to "normal" Pd).

Yes, reading Miller's original paper on Pd, this was created (mainly?) to add data structures to Max. All these years gone by, and not so much has been done - new features come very slowly, one or two in each release.
I use data structures some times when I need an interaction between a dynamic graphic + user actions. But still, they're quite basic.

I repeat again, Pd would gain a lot if someone would port ftm to Pd (or continue IOhannes' work on it). This would give us a very much more potent and elegant data structures framework.

Until then, we'll have to make due with what we have. It works nevertheless, but it is quite slow to program.

Joćo

Offline

 

#37 2012-05-24 21:37:11

Flipp
Member

Re: Circle data structure ?

katjav wrote:

But now the surprise: on my computer (OSX) the fat point is invisible!

Hmm that are bad news. I thought pd would be the same on each OS.. at least vanilla pd..
Could you try if instead of  [drawpolygon 900 8 a b a b]
something like [drawpolygon 900 8 a b a(0:10000)(0:10001) b] works??
..maybe one can trick pd ..once again..



Jmmmp, thanks again for the patches. ...how did you find something like
[send-window vis 0/1(--[pointer] ??!
If one would ask me I'd say we should add those files to the forums tutorial-section..:)
..and yeah all your files seem to come with the new pd-versions..

Offline

 

#38 2012-05-25 13:08:23

jmmmp
Member

Re: Circle data structure ?

Hi,

since I don't know how to read C, I can only wait until a feature is documented, or mentioned in the pd-list. Someone else said something about [send-window vis 0/1(--[pointer] in the list, and I took note.

I would prefer to add my files in the puredata.info website. But as I said before, I'm still waiting for another chance of presenting them, and do some more changes in the content (or maybe even in the presentation and examples, if I have the time).

Joćo

Offline

 

#39 2012-05-26 00:35:03

nau
Member

Re: Circle data structure ?

Yop,

jmmmp wrote:

- nau, that's a complicated circle you drew. Maybe you can adapt the circle I did in [swatch]?

You were right, Joćo.  But I was looking forward.

Here is a lissajous tryout, visualizing two sine signals of different frequencies.
The result is not trying to artificially compensate for the fact that it doesn't act as an oscilloscope would. 

I'll continue to play with lissajous, as i'd like to use it to make a fun gui element that renders synchro quality between two speeds, a bit in the fashion of turntables 'strobes' :http://youtu.be/KbdK94vl_Bs (event if the concepts are totally different).

Nau

Last edited by nau (2012-05-26 00:36:17)


Attachments:
Attachment Icon lissajous_tryout.pd, Size: 8,358 bytes, Downloads: 31

Offline

 

#40 2012-05-26 10:49:42

jmmmp
Member

Re: Circle data structure ?

Hi nau,

that's a very nice concept. Only one problem, data structures is very unefficient for it, you'll need lots of cpu just for the display.
Do you know cyclone/Scope~? That's the same object as max/msp, and I think it works well. Unless you need all the infos in the arrays for something else, then it's a good point to use data structures.

Offline

 

#41 2012-05-27 00:40:23

nau
Member

Re: Circle data structure ?

Yop,

thanks for reminding me of Scope~, Joćo. 
My version costs a little more than twice as [Scope~]. 
Just having fun with data structures, anyway.

Nau

Offline

 

Board footer

Powered by PunBB
© Copyright 2002–2005 Rickard Andersson


pd.webring info