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 › Maximum dimensions of ellipse()
Page Index Toggle Pages: 1
Maximum dimensions of ellipse() ? (Read 276 times)
Maximum dimensions of ellipse() ?
Mar 20th, 2009, 2:53pm
 
Rather simple question, but something that wonders me:
is there a maximum dimension for one of the two ellipse() shape variables?

So more exact: in ellipse(0,0,a,b): are a and b limited in dimension?

Or is this error caused due to the dimensions of my window, since the error (see below) only occurs when I zoom in/out or pan my object of rings outside a certain distance of my window....


Reason for this question: I get the following error:

Exception in thread "Animation Thread" java.lang.ArrayIndexOutOfBoundsException: 720
at processing.core.PGraphics3D.ellipseImpl(PGraphics3D.java:2636)
at processing.core.PGraphics.ellipse(PGraphics.java:1517)
at processing.core.PApplet.ellipse(PApplet.java:6952)
at Masonry_Free_Form_Designtool_0319.draw(Masonry_Free_Form_Designtool_0319.java:17
00)
at processing.core.PApplet.handleDraw(PApplet.java:1406)
at processing.core.PApplet.run(PApplet.java:1311)
at java.lang.Thread.run(Thread.java:613)
Re: Maximum dimensions of ellipse() ?
Reply #1 - Mar 20th, 2009, 3:45pm
 
What version of Processing do you use
See the list of revisions:
Quote:
PROCESSING 1.0.2 (REV 0164) - 21 February 2009

+ OutOfMemoryError with ellipse() in P3D and OPENGL
 http://dev.processing.org/bugs/show_bug.cgi?id=1086

+ ArrayIndexOutOfBoundsException with P3D and OPENGL
 http://dev.processing.org/bugs/show_bug.cgi?id=1117

If you have the error with latest version of Processing, I think you should report it in one of these bugs (or create a new, I don't know what fry prefers in this case).
Re: Maximum dimensions of ellipse() ?
Reply #2 - Mar 20th, 2009, 3:51pm
 
Thanks, I indeed didn't download the newest version after 1.01.
My mistake, from now on I will try to watch for newest version better again.

But the quality of the ellipses I get is a lot lower as it was with version 1.01. Is there a new 'function' to adapt the quality, and if so: which? And if not: how come the quality is so much less?
Re: Maximum dimensions of ellipse() ?
Reply #3 - Mar 20th, 2009, 4:43pm
 
I fear I can't answer your questions, except perhaps by looking at SVN history of the implementation...

Maybe fry will answer your questions, if he stumbles upon this thread.

I can only guess: perhaps the algorithm is iterative, and the new one does less iterations to avoid exhausting resources, but then have a lesser quality. I don't know OpenGL, but if it doesn't have ellipse primitives, you have to simulate them with polygons having more or less sides. The more side, the better quality, but it needs more memory and slow down processing.
Re: Maximum dimensions of ellipse() ?
Reply #4 - Mar 21st, 2009, 2:17pm
 
Ok, I have found the 'problem':

// returning to pre-1.0 version of algorithm because of problems
   int rough = (int)(4+Math.sqrt(w+h)*3);
   int accuracy = PApplet.constrain(rough, 6, 100);

So the higher w and h are, the more pieces are used to show the ellipse. The (maybe ugly illegal, but working) solution is:
1. scale
2. use the inverse of this scale in the size of your w and h.

Code:

pushMatrix();
scale(0.1);
ellipse(0, 0, (10*w) , (10*h) );
popMatrix();
Page Index Toggle Pages: 1