yes java script would maybe be the preferred method of most for something like this. you could however use kineme structure maker as well. parse out your points with a structure index and then re assemble them with kineme structure maker if you would rather not use java script. both are simple but the java script would be predicated on some requisite knowledge of the C language in order to iterate through your loop with your index offsets. you can do the same with structure maker and a iterator in qc. im not sure which is the fastest performance wise, probably java script. here is an example of how to take a 4d structure and split it into 4 individual structures you will want to substitute the queues this might help give you an idea of how to do this without java script.
var result = new Object();
result.OneDStruc = new Array();
function (__structure OneDStruc) main (__structure TWODStruc, __index StrucCount, __number childCount)
{
var i = 0;
for(i=0;i<TWODStruc.length;i++)
{
for (a = 0; a< TWODStruc[i].length; a++){
OneDStruc[i]=TWODStruc[i][a];
}
}
return result;
}
somehow i cant get to work
i found a javascript framework that simply flattens the multidimensional array but i dont know how to implement it.
q=[]
function (__structure s1d) main (__structure s2d, __index size, __number len)
{
var result = new Object();
var j = 0;
//var c = 0;
for(var i=0;i<size;i++){
for(var n=0;n<len;n++){
j=s2d[i][n];
q.push(j);
//q[c++]=s2d[i][n];
}
}
result.s1d=q;
return result;
}
//you can push like a std vector. attached is sending OSC i used the structure //maker to make a structure to parse because i have no idea how your getting //your values. i will leave that up to you.
function (__structure s1d) main (__structure s2d, __index size, __number len)
{
var result = new Object();
var j = 0;
var f=0;
q=new Array();
for(var i=0;i<size;i++)
{
f="point00" + i;
q.push(f); //pass the point names
for(var n=0;n<len;n++)
{
j=s2d[i][n];
q.push(j);
}
}
result.s1d=q;
return result;
}
and the 1d to 2d:
but i cant seem o pass the point names so here it is anyway.
var result = new Object();
result.s2d = new Array();
function (__structure s2d) main (__structure s1d, __index size, __number len)
{
var item = new Number;
var secStruct = new Array();
for(var i=0;i<size;i++){
secStruct[i] = new Object;
for(var n=0;n<len;n++)
{
item = i * len + n;
secStruct[i] [n] = s1d[item];
}
result.s2d = secStruct;
}
return result;
}
yes java script would maybe be the preferred method of most for something like this. you could however use kineme structure maker as well. parse out your points with a structure index and then re assemble them with kineme structure maker if you would rather not use java script. both are simple but the java script would be predicated on some requisite knowledge of the C language in order to iterate through your loop with your index offsets. you can do the same with structure maker and a iterator in qc. im not sure which is the fastest performance wise, probably java script. here is an example of how to take a 4d structure and split it into 4 individual structures you will want to substitute the queues this might help give you an idea of how to do this without java script.
thanks i am going the javascript way:
somehow i cant get to work i found a javascript framework that simply flattens the multidimensional array but i dont know how to implement it.
q=[] function (__structure s1d) main (__structure s2d, __index size, __number len) { var result = new Object();
var j = 0;
//var c = 0;
for(var i=0;i<size;i++){
for(var n=0;n<len;n++){
j=s2d[i][n];
q.push(j);
//q[c++]=s2d[i][n];
} }
result.s1d=q; return result;
}
//you can push like a std vector. attached is sending OSC i used the structure //maker to make a structure to parse because i have no idea how your getting //your values. i will leave that up to you.
uau dust thanks alot!
and how can i reverse it from 1d to 2d parsing it in anyway possible?
if you have snow leopard look at the ribbon example file this will show you how to push your variables into a 2d structure
a time to share: sorry for the delay:
your 2d to 2d modified:
and the 1d to 2d: but i cant seem o pass the point names so here it is anyway.
thanks dust.