# Rotating Triangle

One thing the graphics objects of the ACM libraries fail to do is to provide a method for rotating themselves. Write a class EquilateralTriangle that extends the GCompound class of the ACM libraries. Provide a constructor that has arguments that agree with the following:

EquilateralTriangle(double x, double y, double sideLength)

where x and y are the coordinates of the center of the equilateral triangle, and sideLength is (not surprisingly) the length of each side of this triangle.

Also, provide a public method of the form rotate(double theta) that will rotate the triangle by theta radians.

Now test the above, by writing a class named EquilateralTriangleRotator that extends the OneButtonBreadboard class, and that will draw a triangle with sides 200 units long in the center of the central drawing area; prompt the user for some number of full rotations to apply to the triangle; and then rotate the triangle that number of rotations about its center in a smooth, animated way.

The following fact may prove helpful:

Rotating a point $(x,y)$ about another point $(x_0,y_0)$, by an angle $\theta$ (in radians), results in the point given by $$((x-x_0)\cos \theta - (y-y_0)\sin \theta + x_0, (x-x_0)\sin \theta + (y-y_0)\cos \theta + y_0)$$

Check out the following video to see what this program should look like in action...