Ah! You found a bug! Did you build the Mesh2D chugin from source? You can fix it by changing line 137 of Mesh2D.cpp from int to float and recompiling.

I'll submit a pull request to fix it in git.

Thanks for finding this!

Joel

Dr. Joel W. Matthys, DMA
Lecturer in Music Theory & Composition
Carroll University, 100 N. East Ave., Waukesha WI 53186
262-524-7185

On 11/29/2014 10:29 PM, Jean Menezes da Rocha wrote:
Hello,

I am trying to get Mesh2D into an useful thing. However, even though I assign
arbitrary float values to .xpos or .ypos, they always return zero regardless of my 
explicit declaration.

When I run, for instance, the example mesh-help.ck from the repo and ask ChucK to print all values, I get always zero for .xpos and .ypos:

Mesh2D mesh1 => dac.left;
Mesh2D mesh2 => dac.right;
0.5 => mesh1.gain => mesh2.gain;

while (true)
{
Math.random2(2,12) => mesh1.x;
Math.random2(2,12) => mesh1.y;
Math.randomf() => mesh1.xpos;
Math.randomf() => mesh1.ypos;
1 => mesh1.noteOn;
250::ms => now;
Math.random2(2,12) => mesh2.x;
Math.random2(2,12) => mesh2.y;
Math.randomf() => mesh2.xpos;
Math.randomf() => mesh2.ypos;
1 => mesh2.noteOn;
250::ms => now;
<<<mesh1.x(), mesh1.y(), mesh1.xpos(), mesh1.ypos()>>>;
<<<mesh2.x(), mesh2.y(), mesh2.xpos(), mesh2.ypos()>>>;
}

# chuck mesh-help.ck

11 9 0.000000 0.000000 
4 5 0.000000 0.000000 
4 9 0.000000 0.000000 
10 11 0.000000 0.000000 
6 5 0.000000 0.000000 
2 3 0.000000 0.000000 
5 6 0.000000 0.000000 
2 6 0.000000 0.000000 
3 7 0.000000 0.000000 
10 2 0.000000 0.000000


...and so on.

What do you think about it?

Best regards!

--
Jean Menezes da Rocha
Compositor
Professor -- Faculdades Est
Mestre e Doutorando em Composição pela Universidade Federal da Bahia


_______________________________________________
chuck-users mailing list
chuck-users@lists.cs.princeton.edu
https://lists.cs.princeton.edu/mailman/listinfo/chuck-users