Help with math calculation. Keeping the particles emitter on the stage.

coyne's picture

Hi everyone.

I am new to this amasing composer and in need of some help with the math patch.

I started making a particle app with the wonderful particle tools and connected them to the output of the tuioPatch.

My problem is that my tuio provider sends the x,y cordinates in decimals from 0.0 - 1.0 and i dont have enough math skills to translate that to cover the viewer.

I read another tutorial on the matter and that stated this. The TUIO sends values between 0 and 1, but the viewer expects values for x to be between 0 and 4, and y to be between -3 and 2.

here the page: http://wiki.nuigroup.com/HOWTO:_Smoke-like_demo_with_Quartz_Composer_and...

Tried this with no luck. Playing around it seems that my viewer expects values from x: -1 to 1 and for y: -0.75 to 0.75. If anyone here know how yo solve this with an equation in the math patch or if there is any other solution please let me know.

Thanks for a great community

regards niklas

PreviewAttachmentSize
firstParticleApp.qtz16.93 KB

usefuldesign.au's picture
TUIO co-ordinates

Quartz Composer uses Normalised screen co-ordinates, nominally from -1 to 1 in the x-axis and -a to a in the y-axis. the range -a to a is determined by the aspect ratio of the window (eg 4:3, 16:9). (0,0) is always in the middle of the window (far-as-i-know).

QC also uses pixel dimensions for image widths and crops.

Converting from the [-1,1] range to [0,1] or vis-vesa as you want is just a case of contracting/expanding the range (* or / by 2) and offset (+ or - 1).

The composition you are following is using completely different range of values but they are getting processed so the window co-ords probably have nothing to do with it. After all that!

The attached comp has your patches filled out as per web page plus conversion maths patches to go from QC > TUIO > QC co-ord ranges.

Other than that no exp with TUIO or much with particles :)

PreviewAttachmentSize
TUIO<>QC coordinate systems.qtz9.89 KB

coyne's picture
Thanks for the fast

Thanks for the fast reply. Eager to try it out but have to wait until i get home later on.

Didnt understand the last sentence though?

If it refers to my poor explanation skills its because i still haven`t learn how to do like so many other that puts in yellow notes to explain whats going on.

sorry about that.

best regards

niklas

cwright's picture
stickies

To place a note, right click in the editor, and select "Add Note" -- very handy, esp with discussing problems/techniques etc.

usefuldesign.au's picture
Nothing

Just saying I haven't actually used these patches myself so can't give complete answer/fix.