orders of growth and tree recursion cosc 450 programming
play

Orders of Growth and Tree Recursion CoSc 450: Programming Paradigms - PowerPoint PPT Presentation

CoSc 450: Programming Paradigms 04 Orders of Growth and Tree Recursion CoSc 450: Programming Paradigms 04 Graphics primitive operations CoSc 450: Programming Paradigms 04 Graphics primitive operations y 1 x -1 0 1 -1 Co-ordinate


  1. CoSc 450: Programming Paradigms 04 Orders of Growth and Tree Recursion

  2. CoSc 450: Programming Paradigms 04 Graphics primitive operations

  3. CoSc 450: Programming Paradigms 04 Graphics primitive operations y 1 x -1 0 1 -1 Co-ordinate system

  4. CoSc 450: Programming Paradigms 04 C-Curve code (define c-curve (lambda (x0 y0 x1 y1 level) (if (= level 0) (line x0 y0 x1 y1) (let ((xmid (/ (+ x0 x1) 2)) (ymid (/ (+ y0 y1) 2)) (dx (- x1 x0)) (dy (- y1 y0))) (let ((xa (- xmid (/ dy 2))) (ya (+ ymid (/ dx 2)))) (overlay (c-curve x0 y0 xa ya (- level 1)) (c-curve xa ya x1 y1 (- level 1))))))))

  5. CoSc 450: Programming Paradigms 04 C-Curve code (define c-curve (lambda (x0 y0 x1 y1 level) Base case (if (= level 0) (line x0 y0 x1 y1) (let ((xmid (/ (+ x0 x1) 2)) (ymid (/ (+ y0 y1) 2)) (dx (- x1 x0)) (dy (- y1 y0))) (let ((xa (- xmid (/ dy 2))) (ya (+ ymid (/ dx 2)))) (overlay (c-curve x0 y0 xa ya (- level 1)) (c-curve xa ya x1 y1 (- level 1))))))))

  6. CoSc 450: Programming Paradigms 04 C-Curve code (define c-curve (lambda (x0 y0 x1 y1 level) (if (= level 0) (line x0 y0 x1 y1) (let ((xmid (/ (+ x0 x1) 2)) (ymid (/ (+ y0 y1) 2)) (dx (- x1 x0)) (dy (- y1 y0))) (let ((xa (- xmid (/ dy 2))) (ya (+ ymid (/ dx 2)))) (overlay (c-curve x0 y0 xa ya (- level 1)) (c-curve xa ya x1 y1 (- level 1)))))))) Induction case

  7. CoSc 450: Programming Paradigms 04 (x1, y1) (xa, ya) (x0, y0) The three key points in a c-curve of level greater than zero. Figure 4.10

  8. CoSc 450: Programming Paradigms 04 (x1, y1) Level = 0 (xa, ya) (x0, y0) The three key points in a c-curve of level greater than zero. Figure 4.10

  9. CoSc 450: Programming Paradigms 04 (x1, y1) Level = 1 (xa, ya) (x0, y0) The three key points in a c-curve of level greater than zero. Figure 4.10

  10. CoSc 450: Programming Paradigms 04 (x1, y1) Level = 2 (xa, ya) (x0, y0) The three key points in a c-curve of level greater than zero. Figure 4.10

  11. CoSc 450: Programming Paradigms 04 Sierpinski’s gasket — Exercise for the student An example of Sierpinski’s gasket. Figure 4.6

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend