Due: Thursday 10/10 10:00am
Submission name: w14_graphs
For this assignment, you may want to 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
theta
represents a measure in degrees.
- Returns the y value given:
drawSineCurve(int x, float amplitude, int k, int d)
- Calls
getSinY
, usingx
as the value fortheta
. - Draws a dot of diameter
d
with the center of(x, getSineY...)
- Calls
plotCircle(int theta, int r, int cx, int cy, int d)
- Draws a dot of diameter
d
at(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
Write a program with setup
and draw
to test these functions:
- Create a 600x600 screen.
- In
draw
use the current frame fortheta
. - 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.