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 › How to create a perfect circle/ellipse
Page Index Toggle Pages: 1
How to create a perfect circle/ellipse ? (Read 4782 times)
How to create a perfect circle/ellipse ?
Dec 19th, 2009, 1:22pm
 
I want to create a perfect circle without any anti-aliasing or jaggies.

Is this possible with processing?
Re: How to create a perfect circle/ellipse ?
Reply #1 - Dec 19th, 2009, 3:03pm
 
You may need to be more specific about your needs.  Presumably you want more than just ellipse
Re: How to create a perfect circle/ellipse ?
Reply #2 - Dec 20th, 2009, 1:09am
 
Also look at smooth().
Re: How to create a perfect circle/ellipse ?
Reply #3 - Dec 20th, 2009, 2:29am
 
... and you probably mean "without any aliasing".

Anti-aliasing is what you do to get rid of that.
Re: How to create a perfect circle/ellipse ?
Reply #4 - Dec 20th, 2009, 3:28am
 
JR wrote on Dec 20th, 2009, 2:29am:
... and you probably mean "without any aliasing".

Anti-aliasing is what you do to get rid of that.


That's exactly what I mean. The closest I have come to it, is using P2D or JAVA2D as the renderer, but even with smooth() or hint(ENABLE_OPENGL_4X_SMOOTH() there is anti-aliasing.

What i am looking to achieve is the perfect circle tracing the exterior of a compact disc or DVD would create. That pixel perfection.

I may have to create a large sketch, create the circle and then scale back down; but in my mind that would still result in the software-anti-aliasing which I don't want.
Re: How to create a perfect circle/ellipse ?
Reply #5 - Dec 20th, 2009, 5:18am
 
andrewowaun wrote on Dec 19th, 2009, 1:22pm:
I want to create a perfect circle without any anti-aliasing or jaggies.

Is this possible with processing


Without anti-aliasing you can't get a perfect circle.
It is dependent on your display's dot pitch.
http://en.wikipedia.org/wiki/Dot_pitch

Code:

void setup(){
size(300,300,JAVA2D);
smooth();
ellipseMode(CENTER);
}

void draw(){
background(0);
ellipse(width/2,height/2,250,250);
}
Re: How to create a perfect circle/ellipse ?
Reply #6 - Dec 20th, 2009, 11:34pm
 
andrewowaun wrote on Dec 20th, 2009, 3:28am:
there is anti-aliasing.

To be clear (correct vocabulary is important in Internet technical communication Smiley):
JR rightfully corrects you (I haven't caught the mistake): if you draw in binary colors (eg. pure black & white), you get a stairs effect on diagonal lines, ie. you see each pixel distinctly, jagged, with saw teeth...
It is called "aliasing".
To avoid this, computer people put half-tone pixels between the pure pixels, blurring a bit the line but making it smoother.
It is called "anti-aliasing".
Re: How to create a perfect circle/ellipse ?
Reply #7 - Dec 21st, 2009, 3:50am
 
andrewowaun wrote on Dec 20th, 2009, 3:28am:
I may have to create a large sketch, create the circle and then scale back down; but in my mind that would still result in the software-anti-aliasing which I don't want.


If this is intended for print you'll definitely need to create a larger sketch.  Good quality print resolution is around 300dpi (though you can get away with lower); and whilst people often mistakenly suggest monitors run at 72dpi it's certainly correct that they have a much lower resolution than print: so what might look good on screen may still look aliased (i.e. jaggy) in print.

If you aim for 300dpi then it's simply a matter of knowing the dimensions of your printed output in inches and multiplying by 300 to get the pixel dimensions...  It's likely to be big, but if its for print you'll be doing individual renders rather than looping in draw Wink
Re: How to create a perfect circle/ellipse ?
Reply #8 - Dec 23rd, 2009, 7:51am
 
andrewowaun wrote on Dec 19th, 2009, 1:22pm:
I want to create a perfect circle without any anti-aliasing or jaggies.

Is this possible with processing

A perfect circle is a purely hypothetical construct. If you look close enough, a real DVD has bumpy edges (look closer still and you might find what you thought were edges aren't even there!..)

Quote:
I may have to create a large sketch, create the circle and then scale back down; but in my mind that would still result in the software-anti-aliasing which I don't want.


You need to say what you do want, then, since it seems you have asked for a program (software) to produce an anti-aliased image, but you are also saying you don't want software anti-aliasing.

If it is for print, consider producing a PDF or some other vector output format which the target device can render at whatever resolution it likes.

-spxl
Re: How to create a perfect circle/ellipse ?
Reply #9 - Dec 23rd, 2009, 8:04am
 
A PDF will certainly make it simpler to deliver the image to the printer but it is not by definition vector-based: you can quite easily insert a low resolution raster image into a PDF that will look dreadful in print.  Saying that I've no idea how Processing generates PDFs, so maybe they are always vector based?
Re: How to create a perfect circle/ellipse ?
Reply #10 - Dec 24th, 2009, 6:43am
 
*rolls eyes*

If it is for print, consider producing a PDF (or some other vector-capable format) with vector objects which the target device can render at whatever resolution it likes.

By "vector" I mean non-bitmapped, as in capable of representing mathematical curves, line segments, and other geometric constructs.
Re: How to create a perfect circle/ellipse ?
Reply #11 - Dec 24th, 2009, 7:20am
 
Sorry - maybe that was a little pedantic of me; but it is worth making our replies idiot-proof, just in case Wink
Page Index Toggle Pages: 1