CHAPTER 10

Curves


Curves are drawn by loops. Each iteration of a loop that draws a curve generates one straight segment, the beginning point and the end point of which lie on the mathematically defined curve.

- The Approximation of Curves by Straight Segments:

10.1 Curve

prog10_1.png

  1. void setup(){
  2. size(800,600);
  3. }
  4.  
  5. void draw(){
  6. line(481,354,518,195);
  7. line(518,195,677,290);
  8. line(677,290,605,472);
  9. line(605,472,404,471);
  10. line(404,471,306,324);
  11. }

10.2 Curve

prog10_2.png

  1. void setup(){
  2. size(800,600);
  3. }
  4.  
  5. void draw(){
  6. line(481,354,447,264);
  7. line(447,264,518,195);
  8. line(518,195,616,208);
  9. line(616,208,677,290);
  10. line(677,290,671,393);
  11. line(671,393,605,472);
  12. line(605,472,505,500);
  13. line(505,500,404,471);
  14. line(404,471,332,398);
  15. line(332,398,306,324);
  16. }

Comments

Leave a Reply



(Your email will not be publicly displayed.)


Captcha Code

Click the image to see another captcha.