TUIO / QC : hit tests problems

franz's picture

Hi, i'm using TUIO in QC to input finger presses. If it is relatively easy to test one TUIO cursor object against a HIT test patch , how would you test a structure of Cursors against a structure of Hit tests ?

any design suggestions welcome.

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

cwright's picture
Re: TUIO / QC : hit tests problems

for structures of both, your best bet right now is some JS code

s.rozsa's picture
Re: TUIO / QC : hit tests problems

Hey Franz,

not sure if i understand that right but i have a kind of "lightbox" application where it is tested if a touchpoint of a TUIO structure corresponds with an image from another structure inside the javascript code... The script(s) are ugly and crudly hacked together from some different sources - but it might be of help... I'm very interrested BTW in every aspect of QC and TUIO. So would be great if you can report if you have something new...

http://kineme.net/Discussion/ProgrammingQuartzComposerPatches/Javascript...

franz's picture
Re: TUIO / QC : hit tests problems

i guess some more hair-loosing nights....

s.rozsa's picture
Re: TUIO / QC : hit tests problems

Hey Franz, did you solved this problem? If yes, i'm very curious about how...

franz's picture
Re: TUIO / QC : hit tests problems

not sorted, but i've got a couple ideas.... i'll work on it next week.

dust's picture
Re: TUIO / QC : hit tests problems

there is some cool java script in this file that might help, forgot where i got it, im thinking nuigroup

PreviewAttachmentSize
zOrder.qtz32.81 KB

franz's picture
Re: TUIO / QC : hit tests problems

hey dust, this patch is a VERY interesting reading. It doesn't sort the problem however. To have multiple HIT inputs, you can either use a Javascript that will test the whole Cursors structure, or test it by hand, with the use of KnM Structure tools (by demultiplexexing the Cursors, testing , then re-making the structure by hand). And i must say it works pretty nicely.

s.rozsa's picture
Re: TUIO / QC : hit tests problems

ummm... well to be more exact about the credits: the original java-script is from Jacopo Mangiavacchi posted on the QC-dev mailinglist. The patch here by Dust is made by me and downloaded over NUIgroup...

You can see a bit more improved version in the thread posted above... As Franz is stating: it does not really making hit-testing and the sorting is also somehow odd and leads to some problems if you enable/disable the depth checking (see also the posting above).

Franz. if you have some better hit-testing/sorting examples, i would be glad to put that in the lightbox app...

franz's picture
Re: TUIO / QC : hit tests problems

Here's a multibutton tester. It will work up to 10 fingers.

Note that putting a button at coordinates 0,0 will always output true. Sorry, no time ATM to fix this. I would be glad if you can test it with a MTsurface. Tell me how it goes, in case.

You'll need KnM Structure tools to run the patch, tho'.

PreviewAttachmentSize
frzCURSORS.qtz38.46 KB

s.rozsa's picture
Re: TUIO / QC : hit tests problems

Hey franz,

yeah - your compo is working fine on the table (excepting the zero coordinates)... Well actually if it is working with the TUIOsim it will work with our table. You will have some differences in the behaviour if you are using "maccell" or "xspeed"/"yspeed" (depending on the used tracker). Regarding your problem with the zero coordinates - well that is ALLWAYS a big one with the TUIO structure (at least on MY side). If there is no touch, the value is allways "0"... This will lead to several problems with QC and TUIO (iterations, hit-testing, sorting etc.). One hackish way i found is using a conditional to check if there is a structure member or not (see the upped example). In this one i have also used the "Hit Test" private patch - so be sure that the privat patches are enabled...

I have made in the past also some other testings by altering this button composition. In that case i use a rectangle to test if the cursor is inside the coordinates (no working TUIO example right now - i used the old TUIO pluging and that's not compatible wit the current one - different coordinates...). But here is the original composition where you could hook up the TUIO...

PreviewAttachmentSize
frzCURSORS_mod.qtz44.03 KB
upload-1120951706-Button With Label.qtz169.84 KB

gtoledo3's picture
Re: TUIO / QC : hit tests problems

Oh you made that patch? It's nice. You might want to try out a SoftRecCI filter on the pictures... it would give the edges of your pics a nice smoothed effect.

dust's picture
Re: TUIO / QC : hit tests problems

haha,

i was wondering if you where going to notice your work or not. sorry i realize that patch was a bit out of contextual reference in regards to hit testing etc..

thought maybe some people over here might have a look at it and get some ideas.

this might be a diversion from tuio but webkit does multi touch java script ??

check out this guys light box.

http://tlrobinson.net/blog/2008/07/11/multitouch-javascript-virtual-ligh...

it seems to kind of work with a mac book pro glass trackpad as well ?

franz's picture
Re: TUIO / QC : hit tests problems

yeah, i noticed your hit test. Problem is that the patch is "private", so this is generally not a good idea to use this category, as it might be removed/changed/whatever in some next version of QC (snow ?). Regarding the 0,0 coord issue, adding a conditional comparison to the structure count - as you said- will solve the problem.

s.rozsa's picture
Re: TUIO / QC : hit tests problems

thanks George, - regarding the edges and also the "actual" version of the patch, you can have a look at this thread: http://kineme.net/Discussion/ProgrammingQuartzComposerPatches/Javascript...

But be aware that the composition does not working with the actual version of the TUIO QC plugin since the coordinate systems are changed in the actual plugin. So the patch needs some reworking (would be anyhow necessary - the whole spaghetti-salad is somehow confusing - unfortunatly i do not have the time right now to do that...

@dust: no, your posting is NOT unrelated to the therad, since the two JS patches are actually doing the hit testing... Regarding the work of Tim Robbins: not webkit does not supports multitouch, but Tim did a very clever Hack simulating multitouch. He is storing the first mouseclick on the picture and handling the second mouseclick as the "fake MT event"... But really impressing. Part of that code you can find in my QC-composition - it is used for the image manipulation (rotate/scale/move)... Based on his work there is tough also a JS implementation with REAL multitouch for the iPhone. But that's a completly different thing (unfortunately) 'cos the iPhone SDK is offering real Touchevents...