Assuming x and y are initialized as x = width, y = height/2, the following code should draw a series of circles in an ellipse, or part of an ellipse. However, I think there is something wrong with how I am expressing the equation in processing language because y always equals 0. Line 2 is the questionable code formula for an ellipse where you know the height and width (in this case the window dimensions) and the x value.
- for (int i = 0; i <= width/2;i++)
- {
- x = x - i;
- y = (-height/width) * sqrt(sq(width) - sq(x));
- ellipse(x,y,14,14);
- println(str(y));
- }
2