Write checks and follow the design process as you write these functions.
Move to parabola. Input any point, output a point on the graph of y=x^2
.
Find the output point by moving vertically up or down from the input point until you reach the graph of y=x^2
.
to-parabola: posn(initial) -> posn
If you have time, make an animation that shows a gray circle where the mouse is and then connects that via a gray line to a blue circle on the parabola. You can use my 400x400 parabola image to see the whole parabola. (Read the code I used to make the parabola if you want.)
If you want to see an upward facing parabola in people coordinates, you should use the formula below:
(define (f x)
(+ 200 (* -1/200 (- x 200) (- x 200))))
Input a color, output a new color.
mix-color: color -> color
Hot-Cold. Take in a posn and output a color. The color will depend on the distance of the point from (100,200).
hot-cold: posn -> color