A question for someone with a more mathematical mind.
When drawing a circle on the screen using vector graphics, is there a way to calculate how many vertices should used given a specific radius, to make it appear smooth (pixel-level accuracy)? This will be less given a smaller radius, but it appears it's not directly proportional to the radius or circumference.
Thanks,
Matthew Rule
Calculate Vertices for Circle
A circle that has a radius or r units has a circumference of 2*pi*r units. Thus, a circle that has a radius of 100 pixels has a circumference of approximately 628 pixels. If you then want roughly pixel-accuracy, you can use 628 line segments. You can probably use half or so, but that's up to you to experiment and see what's good enough.
I did some back-of-the-envelope computation and came up with pi*sqrt(radius/2) . Try it, or something proportional to it and see how well it works perceptually.
The whole point of vector graphics is to encode resolution-independent graphics, the concept of pixel is meaningless in this context. Normally you just encode "draw circle at position C, radius R", and then just use whatever graphics API you have to draw said circle at the resolution you want (possibly with anti-aliasing).
Or maybe I'm misunderstanding the question...
Or maybe I'm misunderstanding the question...
“If I understand the standard right it is legal and safe to do this but the resulting value could be anything.”
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement