Question: Since normal pixels are very small, they do not show very clearly which of them are selected by Bresenham's algorithms. Use a grid to simulate

Since normal pixels are very small, they do not show very clearly which of them are selected by Bresenham's algorithms. Use a grid to simulate a screen with a very low resolution. Demonstrate both the method drawLine (with g as its first argument) of Section 4.1 and the method drawCircle of Section 4.3. Only the gridpoints of your grid are to be used as the centers of superpixels. The method putPixel is to draw a small circle with such a center and the distance dGrid of two neighboring gridpoints as its diameter. Do not change the methods drawLine and drawCircle that we have developed, but use dGrid,just mentioned, in a method putPixel that is very different from the one shown at the beginning of Section 4.1. Figure 4.19 shows a grid (with dGrid = 10) and both a line and a circle drawn in this way. As in Figure 4.1, the line shown here has the endpoints P(1, 1) and Q(12, 5) but this time the positive y-axis points downward and the origin is the upper-left corner of the drawing rectangle. The circle has radius r = 8, and is approximated by the same pixels as shown in Figure 4.6 for one eighth of this circle. The line and circle were produced by the following calls to the methods drawLine and drawCircle of Sections 4.1 and 4.3(but with a different method putPixel):

drawLine(g, 1, 1, 12, 5); // g, xP, yP, xQ, yQ drawCircle(g, 23, 10, 8); // g, xC, yC, r 

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!