Advertisement
Guest User

Untitled

a guest
Aug 28th, 2016
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.18 KB | None | 0 0
  1. // Task 1
  2.  
  3. // Part 1
  4. // unit_line_at : Number → Point
  5.  
  6. // Part 2
  7. function vertical_line(pt, length){
  8. var x_new = x_of(pt);
  9. return function(t) {
  10. return make_point(x_new,
  11. y_of(pt) + length * t);
  12. };
  13. }
  14.  
  15. // Part 3
  16. // vertical_line : (Point, Number) → Point
  17.  
  18. // Part 4
  19. // (draw_connected(200))(vertical_line(make_point(0.5, 0.25), 0.5));
  20.  
  21. // Task 2
  22. /*
  23. Short answer: Symmetricity
  24.  
  25. Longer answer: The points start out dense and become thinner in
  26. alternative_unit_circle while in unit_circle, they are evenly spaced.
  27.  
  28. From the implementation of the two functions, we have
  29. x = sin(theta) and y = cos(theta), which is the parametric equation of a circle.
  30.  
  31. If we think of t as time, the pen moves in a circular path but with
  32. different speed in the two cases.
  33.  
  34. In unit_circle, theta varies linearly to t (constant speed, physics stuff)
  35. so the points are evenly spaced.
  36.  
  37. In alternative_unit_circle, theta is directly proportional to time squared,
  38. which means the larger t gets, the faster the pen moves
  39. (constant positive linear acceleration, physics stuff again).
  40.  
  41. Thus the increasingly sparse points in the alternative version.
  42. */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement