Reputation: 387
So I am having quite a difficult problem.
I kind of want a method like this:
public Color[][] createCircle(Color c, int d)
{
Color[][] Data = new Color[d][d];
//fillColorArrayForCircle(Data);
return Data;
}
In Theory this method renders a circle (not filled out) of the Diameter d into a 2D color Array and then returns it. (Everything that is part of the Circle is Color C, the rest is null. The center of the circle is at [d-(d-1)/2]²) However I have no idea, how to determine in what places the "pixels" need to be.
I also looked up http://en.wikipedia.org/wiki/Midpoint_circle_algorithm however I didn't understand it. (extremely complicated imo)
It would be very nice if one of you could show me the correct implementation and/or explain to me how I can come up with one. greetings!
Upvotes: 0
Views: 318
Reputation: 17794
If this is some sort of homework, then this answer will not be satisfactory, but if it is a real problem, then a workaround would be the following:
Upvotes: 1