go to previous page   go to home page   go to next page

Answer:

The center is at x = width/2 and y = height/2.

Remember that the upper-left corner is at (0, 0)


Geometry

Unit circle with angle

Consider the method that draws the star:

drawStar( Graphics gr, int x, int y, int size )

Each line (of the six) starts at the center, and ends at a point on the circle of radius size. The X distance from the center of a point on a circle is size*cos( theta ). The Y distance from the center of a point on a circle is size*sin( theta ).

All you need to do is find the six values for theta and the six endpoints are yours.


QUESTION 8:

How many radians are there in a circle?