We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpSyntax Questions › interpolation without intermediary array
Page Index Toggle Pages: 1
interpolation without intermediary array (Read 493 times)
interpolation without intermediary array
Aug 8th, 2009, 12:48am
 
hello i have one array  and 2 functions. Each of these functions change the values of my array.I would like to know if its posible to interpolate the values when i call the functions withouth using an intermediary array.  Is is possible? if so, is it a good idea? or is it better or more convenient to use an intermediary array?

Code:



float[] coords;


void setup(){
size(500, 500 );
coords = new float[20];

}



void draw(){
background(250, 0, 0);
if (keyPressed == true) {
fill_array_a();
} else {
fill_array_b();
}

for (int i = 0 ; i < 20 ; i ++) {
ellipse( coords[i] , 20 , 30, 30);
}
}


void fill_array_a(){
coords[0] = 21;
coords[1] = 122;
coords[2] = 126;
coords[3] = 156;
coords[4] = 37;
coords[5] = 93;
}


void fill_array_b(){
coords[0] = 163;
coords[1] = 21;
coords[2] = 93;
coords[3] = 27;
coords[4] = 75;
coords[5] = 99;
}






Re: interpolation without intermediary array
Reply #1 - Aug 8th, 2009, 1:24am
 
Why are you making a new thread instead of answering koogy or extending the thread

Beside, he gave the answer to this question: since you know the number of steps, you can use the destination array to store the increments. Of course, you still need two arrays (instead of three). I don't see why you want to save on array number anyway.

If you prefer to do the job of the computer, you can make the second function to increment the array values of hand computed increments... Ie. you store the increments in the code instead of in a data array.
Re: interpolation without intermediary array
Reply #2 - Aug 8th, 2009, 3:12am
 
because it is a different question, before i asked about interpolating one array into another, now i have one array and i want to change the values of that array interpolating them with a function
Re: interpolation without intermediary array
Reply #3 - Aug 8th, 2009, 3:51am
 
I am not overly convinced, but anyway.
Beside, I think I answered your question.
Page Index Toggle Pages: 1