Forums > Jitter

diagonal lines with jit.gl.sketch

April 3, 2007 | 4:35 pm

Hi community,
I have created a little patch to draw some lines in a jit.window. I am using [jit.gl.sketch] with the command [lineto $1 $2].
The problem is:
If I use [pack] to get the x- and y-coordinates to [jit.gl.sketch], I can draw also diagonal lines. But a vertical line (Y) is not possible because of the right inlet to [pack]! I would have to change also X, but so Inever get a clear vertical line.
If I use [pak] I can draw also a proper vertical line (Y), but for a diagonal line I just get some kind of "zig-zag"…
Could anybody has a look on this patch to solve this problem?

#P window setfont "Sans Serif" 18.;
#P window linecount 1;
#P comment 383 124 20 9109522 Y;
#P comment 600 126 20 9109522 Y;
#P comment 477 125 20 9109522 X;
#P comment 265 125 20 9109522 X;
#P window setfont "Sans Serif" 9.;
#P number 528 97 35 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P number 318 97 35 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P flonum 596 204 35 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P flonum 477 204 35 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P number 596 160 35 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 596 179 32 9109513 / 128.;
#P newex 477 181 32 9109513 / 128.;
#P number 477 163 35 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P flonum 380 207 35 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P flonum 261 207 35 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P window setfont "Sans Serif" 14.;
#P comment 32 256 128 9109518 Create the lines;
#P window setfont "Sans Serif" 9.;
#P number 380 163 35 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 340 234 50 9109513 pack 0. 0.;
#P message 340 414 56 9109513 lineto $1 $2;
#P window setfont "Fixedwidth Serif" 10.;
#P newex 38 175 182 9240586 jit.window etcha 5 41 325 281;
#B color 5;
#P user panel 31 168 193 32;
#X brgb 149 197 161;
#X frgb 0 0 0;
#X border 0;
#X rounded 0;
#X shadow 0;
#X done;
#P window setfont "Sans Serif" 9.;
#P window linecount 3;
#P comment 158 348 62 9109513 turn antialiasing on/off;
#P toggle 158 394 15 0;
#P window linecount 2;
#P message 158 420 79 9109513 antialias $1 , blend_enable $1;
#P window linecount 1;
#P hidden message 262 417 50 9109513 set 0;
#P hidden newex 185 392 50 9109513 t b;
#P newex 380 182 32 9109513 / 128.;
#P newex 261 184 32 9109513 / 128.;
#P user jit.fpsgui 88 385 60 9109513 0;
#P newex 44 326 43 9109513 jit.qball;
#P number 89 277 35 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P toggle 44 277 15 0;
#P newex 44 303 55 9109513 metro 20;
#P newex 44 357 55 9109513 t b erase b;
#P newex 273 471 158 9109513 jit.gl.sketch etcha @color 0. 0. 0. 1.;
#P newex 44 470 199 9109513 jit.gl.render etcha @erase_color 0.7 0.7 0.7 1.;
#P window setfont "Sans Serif" 18.;
#P message 249 359 61 9109522 reset;
#P window setfont "Sans Serif" 9.;
#P number 261 166 35 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P user panel 32 256 426 255;
#X brgb 255 251 43;
#X frgb 0 0 0;
#X border 0;
#X rounded 0;
#X shadow 0;
#X done;
#P newex 554 234 45 9109513 pak 0. 0.;
#P window setfont "Sans Serif" 14.;
#P window linecount 3;
#P comment 249 40 177 9109518 here I get a clear diagonal , but can’t draw just a vertical line;
#P comment 461 40 185 9109518 here I can draw a vertical line , but for diagonal I just get a zig-zag line;
#P user panel 247 38 183 219;
#X brgb 196 250 243;
#X frgb 0 0 0;
#X border 1;
#X rounded 0;
#X shadow 0;
#X done;
#P user panel 458 39 191 218;
#X brgb 206 228 134;
#X frgb 0 0 0;
#X border 1;
#X rounded 0;
#X shadow 0;
#X done;
#P connect 38 0 31 0;
#P connect 38 0 34 0;
#P connect 37 0 6 0;
#P connect 37 0 27 0;
#P fasten 19 0 6 0 267 439 329 439 329 153 266 153;
#P fasten 19 0 9 0 267 439 278 439;
#P fasten 19 0 27 0 267 439 329 439 329 153 385 153;
#P fasten 19 0 31 0 267 439 542 439 542 152 482 152;
#P fasten 19 0 34 0 267 439 542 439 542 152 601 152;
#P fasten 7 0 18 0 254 391 190 391;
#P fasten 7 0 9 0 254 443 278 443;
#P connect 30 0 26 1;
#P connect 12 0 11 0;
#P connect 11 0 14 0;
#P connect 14 0 10 0;
#P connect 10 0 8 0;
#P fasten 10 1 8 0 71 415 49 415;
#P connect 10 2 15 0;
#P connect 13 0 11 1;
#P connect 21 0 20 0;
#P fasten 18 0 19 0 190 412 267 412;
#P connect 6 0 16 0;
#P connect 16 0 29 0;
#P fasten 20 0 9 0 163 457 278 457;
#P fasten 25 0 9 0 345 443 278 443;
#P fasten 29 0 26 0 266 229 345 229;
#P fasten 4 0 25 0 559 399 345 399;
#P connect 26 0 25 0;
#P connect 27 0 17 0;
#P connect 17 0 30 0;
#P connect 31 0 32 0;
#P connect 32 0 35 0;
#P fasten 35 0 4 0 482 224 559 224;
#P fasten 36 0 4 1 601 224 594 224;
#P connect 34 0 33 0;
#P connect 33 0 36 0;
#P window clipboard copycount 43;

I really a litle bit stucked at that point!
Thanks a lot!
Johannes


April 4, 2007 | 5:22 am

The problem is that for the diagonal you need the list sent every time with the same value for x and y, and you don’t get that with pak. The problem is exaggerated when the control is moved more quickly, depending on the render rate. In the end, you need to use both pack (for diagonal) and pak (for Y only).

Here are some adjustments that help a little.

Tim

#P window setfont "Sans Serif" 9.;
#P window linecount 1;
#P hidden message 280 446 33 196617 set 0;
#P message 435 92 39 196617 set $1;
#P window setfont "Sans Serif" 12.;
#P comment 380 117 58 196620 diagonal;
#P window setfont "Sans Serif" 9.;
#P message 428 166 39 196617 set $1;
#P message 414 233 39 196617 set $1;
#P window setfont "Sans Serif" 18.;
#P comment 472 116 20 196626 Y;
#P comment 328 112 20 196626 X;
#P window setfont "Sans Serif" 9.;
#P number 390 142 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P flonum 463 217 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P number 463 143 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 463 197 46 196617 / 128.;
#P flonum 390 208 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P flonum 320 206 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P window setfont "Sans Serif" 14.;
#P comment 39 284 128 196622 Create the lines;
#P window setfont "Sans Serif" 9.;
#P number 390 170 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 347 235 53 196617 pack 0. 0.;
#P message 347 472 70 196617 lineto $1 $2;
#P window setfont "Fixedwidth Serif" 10.;
#P newex 45 182 182 1441802 jit.window etcha 5 41 325 281;
#B color 5;
#P user panel 38 175 193 32;
#X brgb 149 197 161;
#X frgb 0 0 0;
#X border 0;
#X rounded 0;
#X shadow 0;
#X done;
#P window setfont "Sans Serif" 9.;
#P window linecount 3;
#P comment 165 376 62 196617 turn antialiasing on/off;
#P toggle 165 422 15 0;
#P window linecount 2;
#P message 165 448 79 196617 antialias $1 , blend_enable $1;
#P window linecount 1;
#P hidden message 320 445 14 196617 0;
#P hidden newex 192 420 30 196617 t b b;
#P newex 390 188 46 196617 / 128.;
#P newex 320 185 46 196617 / 128.;
#P user jit.fpsgui 95 413 60 196617 0;
#P newex 51 354 43 196617 jit.qball;
#P number 96 305 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P toggle 51 305 15 0;
#P newex 51 331 55 196617 metro 20;
#P newex 51 385 55 196617 t b erase b;
#P newex 280 499 177 196617 jit.gl.sketch etcha @color 0. 0. 0. 1.;
#P newex 51 498 228 196617 jit.gl.render etcha @erase_color 0.7 0.7 0.7 1.;
#P window setfont "Sans Serif" 18.;
#P message 256 387 61 196626 reset;
#P window setfont "Sans Serif" 9.;
#P number 320 142 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P user panel 39 284 426 255;
#X brgb 255 251 43;
#X frgb 0 0 0;
#X border 0;
#X rounded 0;
#X shadow 0;
#X done;
#P newex 414 255 45 196617 pak 0. 0.;
#P fasten 28 0 23 0 468 185 425 185 425 165 395 165;
#P fasten 28 0 36 0 468 185 519 185 519 88 440 88;
#P connect 28 0 27 0;
#P fasten 25 0 22 0 325 228 352 228;
#P fasten 25 0 33 0 325 228 419 228;
#P fasten 3 0 14 0 261 419 197 419;
#P fasten 3 0 5 0 261 471 285 471;
#P fasten 36 0 30 0 440 138 395 138;
#P fasten 36 0 23 0 440 160 395 160;
#P fasten 30 0 2 0 395 162 315 162 315 138 325 138;
#P connect 30 0 23 0;
#P fasten 30 0 34 0 395 160 433 160;
#P fasten 15 0 30 0 325 444 382 444 382 138 395 138;
#P fasten 14 1 37 0 217 442 285 442;
#P connect 37 0 5 0;
#P fasten 14 0 15 0 197 440 325 440;
#P fasten 34 0 28 0 433 183 459 183 459 139 468 139;
#P connect 33 0 0 0;
#P connect 27 0 29 0;
#P fasten 29 0 0 1 468 249 454 249;
#P connect 13 0 26 0;
#P connect 23 0 13 0;
#P connect 22 0 21 0;
#P fasten 0 0 21 0 419 446 352 446;
#P fasten 21 0 5 0 352 492 285 492;
#P fasten 16 0 5 0 170 485 285 485;
#P connect 12 0 25 0;
#P connect 2 0 12 0;
#P connect 17 0 16 0;
#P connect 9 0 7 1;
#P connect 6 2 11 0;
#P fasten 6 1 4 0 78 443 56 443;
#P connect 6 0 4 0;
#P connect 10 0 6 0;
#P connect 7 0 10 0;
#P connect 8 0 7 0;
#P connect 26 0 22 1;
#P window clipboard copycount 38;


April 4, 2007 | 2:52 pm

Hi Tim!
They really helped me!! Thank you very much! I get the lines I want now.
Greetings,
Johannes


April 5, 2007 | 8:02 am

bondo is your freind

//yac

#P window setfont "Sans Serif" 9.;
#P window linecount 1;
#P newex 396 222 54 196617 pack 0. 0.;
#P window setfont "Sans Serif" 18.;
#P comment 443 103 20 196626 Y;
#P comment 660 117 20 196626 Y;
#P comment 537 116 20 196626 X;
#P comment 325 104 20 196626 X;
#P window setfont "Sans Serif" 9.;
#P number 588 88 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P number 378 88 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P flonum 656 195 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P flonum 537 195 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P number 656 151 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 656 170 46 196617 / 128.;
#P newex 537 172 46 196617 / 128.;
#P number 537 154 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P flonum 440 178 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P flonum 321 178 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P window setfont "Sans Serif" 14.;
#P comment 92 255 128 196622 Create the lines;
#P window setfont "Sans Serif" 9.;
#P number 440 134 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 396 201 54 196617 bondo 2 1;
#P message 396 412 70 196617 lineto $1 $2;
#P window setfont "Fixedwidth Serif" 10.;
#P newex 40 176 184 1441802 jit.window etcha 5 41 325 281;
#B color 5;
#P user panel 33 166 193 32;
#X brgb 149 197 161;
#X frgb 0 0 0;
#X border 0;
#X rounded 0;
#X shadow 0;
#X done;
#P window setfont "Sans Serif" 9.;
#P window linecount 3;
#P comment 218 347 62 196617 turn antialiasing on/off;
#P toggle 218 393 15 0;
#P window linecount 2;
#P message 218 419 79 196617 antialias $1 , blend_enable $1;
#P window linecount 1;
#P message 322 414 50 196617 set 0;
#P newex 245 391 50 196617 t b;
#P newex 440 153 46 196617 / 128.;
#P newex 321 157 46 196617 / 128.;
#P user jit.fpsgui 148 384 60 196617 0;
#P newex 104 325 43 196617 jit.qball;
#P number 149 276 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P toggle 104 276 15 0;
#P newex 104 302 55 196617 metro 20;
#P newex 104 356 55 196617 t b erase b;
#P newex 333 470 177 196617 jit.gl.sketch etcha @color 0. 0. 0. 1.;
#P newex 104 469 228 196617 jit.gl.render etcha @erase_color 0.7 0.7
0.7 1.;
#P window setfont "Sans Serif" 18.;
#P message 309 358 61 196626 reset;
#P window setfont "Sans Serif" 9.;
#P number 321 137 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P user panel 88 251 426 255;
#X brgb 255 251 43;
#X frgb 0 0 0;
#X border 0;
#X rounded 0;
#X shadow 0;
#X done;
#P newex 614 225 45 196617 pak 0. 0.;
#P window setfont "Sans Serif" 14.;
#P window linecount 3;
#P comment 309 31 177 196622 here I get a clear diagonal , but can’t
draw just a vertical line;
#P comment 521 31 185 196622 here I can draw a vertical line , but
for diagonal I just get a zig-zag line;
#P user panel 307 29 183 219;
#X brgb 196 250 243;
#X frgb 0 0 0;
#X border 1;
#X rounded 0;
#X shadow 0;
#X done;
#P user panel 518 30 191 218;
#X brgb 206 228 134;
#X frgb 0 0 0;
#X border 1;
#X rounded 0;
#X shadow 0;
#X done;
#P connect 37 0 6 0;
#P connect 37 0 27 0;
#P fasten 19 0 6 0 327 434 389 434 389 132 326 132;
#P fasten 19 0 9 0 327 438 338 438;
#P fasten 19 0 27 0 327 434 389 434 389 132 445 132;
#P fasten 19 0 31 0 327 434 602 434 602 147 542 147;
#P fasten 19 0 34 0 327 434 602 434 602 147 661 147;
#P connect 43 0 25 0;
#P connect 26 0 43 0;
#P connect 26 1 43 1;
#P fasten 29 0 26 0 326 197 401 197;
#P connect 30 0 26 1;
#P connect 38 0 31 0;
#P connect 38 0 34 0;
#P fasten 7 0 18 0 314 390 250 390;
#P fasten 7 0 9 0 314 442 338 442;
#P connect 27 0 17 0;
#P connect 33 0 36 0;
#P connect 34 0 33 0;
#P fasten 36 0 4 1 661 215 654 215;
#P fasten 35 0 4 0 542 215 619 215;
#P connect 32 0 35 0;
#P connect 31 0 32 0;
#P connect 17 0 30 0;
#P fasten 4 0 25 0 619 394 401 394;
#P fasten 25 0 9 0 401 442 338 442;
#P fasten 20 0 9 0 223 456 338 456;
#P connect 16 0 29 0;
#P connect 6 0 16 0;
#P fasten 18 0 19 0 250 411 327 411;
#P connect 21 0 20 0;
#P connect 13 0 11 1;
#P connect 10 2 15 0;
#P fasten 10 1 8 0 131 414 109 414;
#P connect 10 0 8 0;
#P connect 14 0 10 0;
#P connect 11 0 14 0;
#P connect 12 0 11 0;
#P window clipboard copycount 44;


April 16, 2007 | 10:34 am

Hey there,
sorry for my late answer but wasn’t connected the last weeks…
Thanks for your help Tim and Yac!!!
I am going on with my project now.
Greetings,
Johannes


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