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 › Why jitter with moving curves
Page Index Toggle Pages: 1
Why jitter with moving curves? (Read 955 times)
Why jitter with moving curves?
Oct 20th, 2009, 12:05pm
 
If you run the code below, at some point within the first couple minutes you should see floating curves whose edges occasionally 'snap' into and out of place - it's not completely smooth and has an obvious jittery quality. Can someone explain this to me, and is there a way to eliminate it?


import processing.opengl.*;

void setup() {
 size(720, 720, OPENGL);
 frameRate(40);
}

float a = random(-1, 1);
float b = random(-1, 1);
float c = random(-1, 1);
float d = random(-1, 1);
float e = random(-1, 1);
float f = random(-1, 1);
float g = random(-1, 1);
float h = random(-1, 1);


void draw() {
 background(75, 60, 85);

 a = a + .002;
 b = b + .0025;
 c = c + .001;
 d = d + .0015;
 e = e + .0005;
 f = f + .003;
 g = g + .0035;
 h = h + .0015;

 noStroke();
 fill(20, 220);
 curve(width/2+sin(b)*(width/2+100), width/2+sin(c)*(width/2+100), width/2+sin(d)*(width/2+100), width/2+sin(e)*(width/2+100), width/2+sin(f)*(width/2+100), width/2+sin(g)*(width/2+100), width/2+sin(h)*(width/2+100), width/2+sin(a)*(width/2+100));
}
Re: Why jitter with moving curves?
Reply #1 - Oct 21st, 2009, 12:00am
 
It might be a problem with the renderer. I see the same issue with P3D but not with default one (JAVA2D).
I think it is when going over some critical numbers (PI or 2*PI for example).
I used
Code:
void mousePressed()
{
println(a + " " + b + " " + c + " " + d + " " + e + " " + f + " " + g + " " + h);
}

to check that.
Re: Why jitter with moving curves?
Reply #2 - Oct 21st, 2009, 2:10am
 
Thanks, PhiLho - that's very helpful. I just assumed that the OpenGL graphics would be superior. I suppose I should report this as a bug? It's possibly a problem with the anti-aliasing algorithms?

I have a couple of related questions. First, since I'm now using the default renderer, does it make a difference whether I put smooth() in setup or within draw? Second, does it make sense to use both smooth() and bezierDetail if I'm working with bezier curves? And finally, if you  look at this image:

http://www.mti.dmu.ac.uk/~rherrema/graphics/sf-05757.tif

you will see how jagged are the lines on the curves. Since I'd like to print out some of these frame grabs, this is a real problem. What is the best way to solve this? Run at very large resolution?

Again, many thanks for your help.

Re: Why jitter with moving curves?
Reply #3 - Oct 21st, 2009, 2:56am
 
It is better to put smooth() in setup, it is a global setting.
bezierDetail(): the reference says it is not useful in JAVA2D.
And for printing, yes, larger images can help. Or use PDF output (vector based).
Re: Why jitter with moving curves?
Reply #4 - Oct 21st, 2009, 3:31am
 
Do you mean convert the TIFF to PDF? saveFrame() doesn't offer PDF . . .
Re: Why jitter with moving curves?
Reply #5 - Oct 21st, 2009, 6:50am
 
See PDF Export.
Page Index Toggle Pages: 1