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 & HelpPrograms › efficient density mapping
Page Index Toggle Pages: 1
efficient density mapping (Read 416 times)
efficient density mapping
Aug 20th, 2006, 11:13am
 
Hiya,

[Don't know whether to post this to infoviz or to another topic thread, but here goes]

I'm mapping some data about cell metabolization to dot densities, using nested loops, where D is a density stepping value, e.g.:

for (int i=0; i<100; i=i+D){  
for (int j=0; j<100; j=j+D){
           point (i,j);  
}
}

By increasing or decreasing the value for D, I can change the dot-density in the area. Simple stuff. The tricky bit is that I have an array of 25000+ datapoints for D and  for the best user experience, I want to animate through the array as fast as computationally possible.

Is this a sensible approach, or should I use lerp()? Is there a better approach to representing a dot density that I haven't thought of?

Extra credit: does P bog down under big arrays? If so, should I break up the data set into manageable chunxx?

Thanks!
-Brock

PS to Ben: Nice dissertation.
Re: efficient density mapping
Reply #1 - Aug 26th, 2006, 12:43am
 
rather than using point(), use the pixels[] array and the P3D renderer and set the pixels directly. so something like this will be speedy:

Code:
size(800, 800, P3D);
background(0);
for (int i = 0; i < 100; i += D) {
for (int j = 0; j < 100; j += D) {
pixels[j*width + i] = #FFFFFF;
}
}


mmm, that's speedy good fun.

thanks re: dissertation.
Page Index Toggle Pages: 1