Question: Need help with Processing homework. Java Create a window with size 600 x 600 Draw a circle with radius 25. The center of the circle
Need help with Processing homework. Java
Create a window with size 600 x 600
Draw a circle with radius 25. The center of the circle is 200 pixels away from the center of the window.
Rotate the circle around the center of the window.
Declare a global variable named rotationalSpeed to control the speed of rotation. If its value is 1, then the circle rotates 1 degree counterclockwise each time when the draw method is called.
Implement a method called rotate to rotate a point by a given angle around the origin. Here is the method header:
void rotate(float theta, PVector point)
The method updates the point variable with the new location of the point after rotation.
The PVector class is a predefined class in the Processing library. It is just like the Vector2D class you implemented by yourself except it supports more functions for vectors. You can directly use it in your program.
Implement a method called convertDegreesToRadians to convert degrees to radians. Here is the method header:
float convertDegreesToRadians(float d)
Use the rotate method and convertDegreesToRadians method in your program to rotate the circle.
This is what i have so far....
float r = 200; float theta;
void setup() { size(600, 600); background(50); }
void draw() { float x = r * cos(theta); float y = r * sin(theta); fill(255); translate(width/2, height/2); ellipse(x, y, 50, 50); //rotationalSpeed theta += .05; }
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
