Forums > Jitter

jit.gl.render xyz coordinates

April 21, 2008 | 10:44 am

Hi all,

I’m using jit.gl.render in tri-grid mode (and playing a movie into it for testing purposes). If I set the geometry dims to 4, I get a grid of 3 x 3 squares with diagonals going across each square. OK so far. I would like to analyse the position of each intersection so I get a list of xyz coordinates as they move. Simple question – how do i do it?!

Cheers

Rob

===================================

Rob Godman
Reader in Music
Programme Leader for Composition

John Lill Centre for Music Studies
Faculty for the Creative and Cultural Industries.
University of Hertfordshire
United Kingdom

T (44) 01707 284583
M 0781 249 1670
E r.godman@herts.ac.uk

For more information ….
http://www.uhshop.co.uk/subcat6-1344.aspx
http://perseus.herts.ac.uk/uhinfo/staff/?id=719376
http://www.herts.ac.uk/artdes1/research/papers/wpades/vol4/index.html
http://www.thedark.net
===================================


April 21, 2008 | 1:11 pm

i think a patch would be useful to understand what you are trying to do… it’s a bit unclear what you are using to create the geometry in jit.gl.render.

as an initial pointer, i would suggest something like geometry matrix > jit.spill, then parse the list out into groups of 3 (xyz coords).

hth,

justin


April 22, 2008 | 8:51 am

Hi Justin,

Thanks for your reply. I’m using the jit.gl.render.grid patch from the Jitter examples folder as a starting point. If I put jit.gl.render in tri-grid mode it will output the grid that I’m after. Changing the value of the geometry dims message will give me a greater or lesser number of squares (i.e. grid with a higher or lower resolution). It’s an xyz reference of these intersection points that I’m after.

Does this make sense?

Cheers

Rob


April 22, 2008 | 10:03 am

hi rob,

it kind of makes sense… although an idea of what you want to do with the xyz data could lead to other (perhaps more elegant) solutions.

on my system (mbp 2.16 / osx 10.4.11 / latest maxmspjitter) the plane doesn’t render in tri_grid mode, despite rendering with other modes. so perhaps i’m not seeing the same behaviour as you are?

Anyway i have posted an example of what i mentioned (jit.spill solution). But i can think of better ways to do this with jit.gl.grishape > jit.gl.mesh… But as i said at the start of my post, it depends on what you want to do afterwards.

justin

#P window setfont "Sans Serif" 9.;
#P window linecount 1;
#P comment 356 176 248 196617 jit.spill to "unpack" geometry matrix;
#P comment 242 305 248 196617 tri_grid doesnt display anything on my system… < ?>;
#P newex 571 235 62 196617 prepend set;
#P message 571 269 70 196617 1. 1. 0. 0.;
#P newex 571 216 112 196617 jit.spill geom @plane 4;
#P newex 457 235 62 196617 prepend set;
#P message 457 269 70 196617 1. 0. 0. 1.;
#P newex 457 216 112 196617 jit.spill geom @plane 3;
#P newex 343 235 62 196617 prepend set;
#P message 343 269 70 196617 -1. -1. 1. 1.;
#P newex 343 216 112 196617 jit.spill geom @plane 1;
#P newex 229 235 62 196617 prepend set;
#P message 229 269 70 196617 1. -1. -1. 1.;
#P newex 229 216 112 196617 jit.spill geom @plane 0;
#P number 341 108 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 316 145 61 196617 pak dim 4 1;
#P user ubumenu 65 303 68 196617 0 1 1 0;
#X add points;
#X add lines;
#X add line_strip;
#X add line_loop;
#X add triangles;
#X add tri_strip;
#X add tri_fan;
#X add quads;
#X add quad_strip;
#X add polygon;
#X add tri_grid;
#X prefix_set 0 0 0;
#P comment 134 305 94 196617 choose a primitive.;
#P newex 202 145 61 196617 jit.fill geom;
#P window linecount 4;
#P message 202 88 96 196617 plane 0 , 1 -1 -1 1 , plane 1 , -1 -1 1 1 , plane 3 , 1 0 0 1 , plane 4 , 1 1 0 0;
#P window linecount 1;
#P newex 201 176 139 196617 jit.matrix geom 5 float32 4 1;
#P newex 136 329 163 196617 jit.window gl_window @floating 1;
#P newex 17 95 58 196617 t b b erase;
#P newex 17 75 119 196617 qmetro 20 @mode usurp;
#P toggle 17 43 15 0;
#P newex 17 329 116 196617 jit.gl.render gl_window;
#P connect 21 0 23 0;
#P fasten 5 0 0 0 206 261 22 261;
#P fasten 5 0 12 0 206 204 234 204;
#P fasten 5 0 15 0 206 204 348 204;
#P fasten 5 0 18 0 206 204 462 204;
#P fasten 5 0 21 0 206 204 576 204;
#P connect 18 0 20 0;
#P connect 12 0 14 0;
#P connect 23 0 22 0;
#P connect 20 0 19 0;
#P connect 15 0 17 0;
#P connect 17 0 16 0;
#P connect 14 0 13 0;
#P connect 11 0 10 1;
#P fasten 10 0 5 0 321 171 206 171;
#P fasten 9 1 0 0 99 324 22 324;
#P connect 3 1 5 0;
#P connect 3 2 0 0;
#P connect 2 0 3 0;
#P connect 3 0 0 0;
#P connect 6 0 7 0;
#P connect 1 0 2 0;
#P window clipboard copycount 26;


April 22, 2008 | 10:26 am

and an example of the other way…

j

#P window setfont "Sans Serif" 9.;
#P window linecount 1;
#P newex 185 223 51 196617 zl slice 3;
#P newex 379 49 64 196617 unpack 9 10;
#P newex 379 30 58 196617 loadbang;
#P number 582 252 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 582 230 62 196617 zl len;
#P window linecount 15;
#P message 415 260 124 196617 1. 0.75 0.5 0.25 0. -0.25 -0.5 -0.75 -1. 1. 0.75 0.5 0.25 0. -0.25 -0.5 -0.75 -1. 1. 0.75 0.5 0.25 0. -0.25 -0.5 -0.75 -1. 1. 0.75 0.5 0.25 0. -0.25 -0.5 -0.75 -1. 1. 0.75 0.5 0.25 0. -0.25 -0.5 -0.75 -1. 1. 0.75 0.5 0.25 0. -0.25 -0.5 -0.75 -1. 1. 0.75 0.5 0.25 0. -0.25 -0.5 -0.75 -1. 1. 0.75 0.5 0.25 0. -0.25 -0.5 -0.75 -1. 1. 0.75 0.5 0.25 0. -0.25 -0.5 -0.75 -1.;
#P user jit.fpsgui 100 194 60 196617 3;
#P window linecount 1;
#P newex 249 224 100 196617 prepend draw_mode;
#P message 185 118 83 196617 dim $1 $1 , bang;
#P window linecount 2;
#P newex 185 137 139 196617 jit.gl.gridshape @shape plane @matrixoutput 1;
#P window linecount 1;
#P comment 432 177 306 196617 jit.spill to "unpack" geometry matrix , careful of list length > 255;
#P newex 415 223 62 196617 prepend set;
#P newex 415 195 112 196617 jit.spill geom @plane 0;
#P number 185 99 35 9 4 100 3 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P user ubumenu 220 194 68 196617 0 1 1 0;
#X add points;
#X add lines;
#X add line_strip;
#X add line_loop;
#X add triangles;
#X add tri_strip;
#X add tri_fan;
#X add quads;
#X add quad_strip;
#X add polygon;
#X add tri_grid;
#X prefix_set 0 0 0;
#P comment 289 196 94 196617 choose a primitive.;
#P newex 185 249 139 196617 jit.gl.mesh gl_window;
#P newex 136 353 163 196617 jit.window gl_window @floating 1;
#P newex 17 75 58 196617 t b b erase;
#P newex 17 55 119 196617 qmetro 20 @mode usurp;
#P toggle 17 23 15 0;
#P newex 17 353 116 196617 jit.gl.render gl_window;
#P fasten 12 0 15 0 190 180 105 180;
#P connect 12 0 21 0;
#P fasten 12 0 9 0 190 180 420 180;
#P connect 21 0 5 0;
#P connect 9 0 10 0;
#P fasten 9 0 17 0 420 213 587 213;
#P fasten 20 1 7 0 438 173 225 173;
#P fasten 20 0 8 0 384 82 190 82;
#P connect 19 0 20 0;
#P connect 17 0 18 0;
#P connect 10 0 16 0;
#P fasten 14 0 5 0 254 245 190 245;
#P connect 7 1 14 0;
#P connect 8 0 13 0;
#P connect 13 0 12 0;
#P connect 3 2 0 0;
#P connect 2 0 3 0;
#P connect 3 0 0 0;
#P connect 1 0 2 0;
#P window clipboard copycount 22;


May 8, 2008 | 9:04 am

Hi Justin – sorry for the late reply on this one. I couldn’t open these patches (even with placing additional headers). However, from having a look at the text I see where you are going and have got a load of numbers! I understand the matrix is now giving me a list of numbers but I’m not sure that they are really coordinates of the grid?

Cheers

Rob


May 12, 2008 | 3:19 pm

yes, it looks like the coordinates are not right… could be a problem with the ordering of the coordinates. I have tried with triangular grid, but it doesnt seem to differ.

some insight from someone at c74 would be good. dont have much time at the moment to look into this!

here’s the patch as an attachment.

j


May 20, 2008 | 9:59 am

Hi – many thanks for this. yeap, still not sure what all these numbers mean! (not the first time I’ve had this feeling in all my years of using max/msp). However, i suspect there is a solution in here and I’ll dig further.

Cheers

Rob


Viewing 8 posts - 1 through 8 (of 8 total)