Posted: Mon Oct 5
Due: Tuesday 10/6 10:00am
Submission name: w09_graphs
Background Information
For this assignment, you should refer to:
- Processing’s documenation for
radians - Processing’s documenation for
sin - Processing’s documenation for
cos
Write the following functions:
getSineY(int theta, float amplitude, int k)- Returns the y value given:
- \[y = amplitude\sin(\theta) + k\]
- Assume
thetarepresents a measure in degrees.
- Returns the y value given:
drawSineCurve(int x, float amplitude, int k, int d)- Calls
getSinY, usingxas the value forthetaand uses that value fory. - Draws a dot of diameter
dwith the center of(x, y)
- Calls
plotCircle(int theta, int r, int cx, int cy, int d)- Draws a dot of diameter
dat(x, y)where(x, y)is a point on the circumference of a circle with center(cx, cy)and radiusr. - Remember your algebra:
- \[x = amplitude\cos(\theta) + cx\]
- \[y = amplitude\sin(\theta) + cy\]
- Draws a dot of diameter
Put it all together:
Write a program with setup and draw to test these functions:
- Create a 600x600 screen.
- In
drawuse the current frame forthetaand user that for the circle and sine curve. - Have the sine curve wrap back to the left side of the screen when it reaches the right edge.
- Use the top half of the screen for the since curve.
- Use the bottom half of the screen for the circle.
Reference Image:
