Difference between revisions of "Snowflake Assignment"

From CSE425S Wiki
Jump to navigation Jump to search
 
(17 intermediate revisions by the same user not shown)
Line 5: Line 5:
 
[https://docs.racket-lang.org/teachpack/2htdpimage.html Racket Image Library Documentation]
 
[https://docs.racket-lang.org/teachpack/2htdpimage.html Racket Image Library Documentation]
 
==placement==
 
==placement==
: [https://docs.racket-lang.org/teachpack/2htdpimage.html#%28def._%28%28lib._2htdp%2Fimage..rkt%29._beside%29%29 beside]
+
: [https://docs.racket-lang.org/teachpack/2htdpimage.html#%28def._%28%28lib._2htdp%2Fimage..rkt%29._beside%2Falign%29%29 beside/align]
: [https://docs.racket-lang.org/teachpack/2htdpimage.html#%28def._%28%28lib._2htdp%2Fimage..rkt%29._above%29%29 above]
+
: [https://docs.racket-lang.org/teachpack/2htdpimage.html#%28def._%28%28lib._2htdp%2Fimage..rkt%29._flip-vertical%29%29 flip-vertical]
: [https://docs.racket-lang.org/teachpack/2htdpimage.html#%28def._%28%28lib._2htdp%2Fimage..rkt%29._overlay%29%29 overlay] [https://docs.racket-lang.org/teachpack/2htdpimage.html#%28def._%28%28lib._2htdp%2Fimage..rkt%29._overlay%2Falign%29%29 overlay/align]
+
: [https://docs.racket-lang.org/teachpack/2htdpimage.html#%28def._%28%28lib._2htdp%2Fimage..rkt%29._above%2Falign%29%29 above/align]
 +
: [https://docs.racket-lang.org/teachpack/2htdpimage.html#%28def._%28%28lib._2htdp%2Fimage..rkt%29._overlay%2Falign%2Foffset%29%29 overlay/align/offset]
 
: [https://docs.racket-lang.org/teachpack/2htdpimage.html#%28def._%28%28lib._2htdp%2Fimage..rkt%29._rotate%29%29 rotate]
 
: [https://docs.racket-lang.org/teachpack/2htdpimage.html#%28def._%28%28lib._2htdp%2Fimage..rkt%29._rotate%29%29 rotate]
==shapes==
 
: [https://docs.racket-lang.org/teachpack/2htdpimage.html#%28def._%28%28lib._2htdp%2Fimage..rkt%29._triangle%29%29 triangle]
 
: [https://docs.racket-lang.org/teachpack/2htdpimage.html#%28def._%28%28lib._2htdp%2Fimage..rkt%29._circle%29%29 circle]
 
: [https://docs.racket-lang.org/teachpack/2htdpimage.html#%28def._%28%28lib._2htdp%2Fimage..rkt%29._square%29%29 square]
 
: [https://docs.racket-lang.org/teachpack/2htdpimage.html#%28def._%28%28lib._2htdp%2Fimage..rkt%29._rectangle%29%29 rectangle]
 
: [https://docs.racket-lang.org/teachpack/2htdpimage.html#%28def._%28%28lib._2htdp%2Fimage..rkt%29._frame%29%29 frame]
 
  
=Snowflake=
+
==line==
==Symmetric==
+
: [https://docs.racket-lang.org/teachpack/2htdpimage.html#%28def._%28%28lib._2htdp%2Fimage..rkt%29._line%29%29 line]
[https://en.wikipedia.org/wiki/Sierpi%C5%84ski_triangle Sierpiński Triangle]
 
  
<nowiki>(define (sierpinski-triangle side-length n)
+
==empty-image==
  (raise 'not-yet-implemented #t))</nowiki>
+
: [https://docs.racket-lang.org/teachpack/2htdpimage.html#%28def._%28%28lib._2htdp%2Fimage..rkt%29._empty-image%29%29 empty-image]
  
{| class="wikitable" style="text-align: center; "
+
=Spiral Demo=
|[[File:Snowflake-symmetric_0.svg|200px]]
+
<youtube>AIGeMxka0MQ</youtube>
|[[File:Snowflake-symmetric_1.svg|200px]]
+
 
|[[File:Snowflake-symmetric_2.svg|200px]]
+
=Code to Implement=
|[[File:Snowflake-symmetric_3.svg|200px]]
+
==Snowflake==
|[[File:Snowflake-symmetric_4.svg|200px]]
+
<nowiki>(define (snowflake len iter is-flipped)
|-
+
  (raise (error 'not-yet-implemented)))))
|n=0
+
 
|n=1
+
(define (snowflake-symmetric len iter)
|n=2
+
  (snowflake len iter #f))
|n=3
+
 
|n=4
+
(define (snowflake-flipped len iter)
|}
+
  (snowflake len iter #t))</nowiki>
  
==Flipped==
+
===Symmetric===
<nowiki>(define (sierpinski-carpet side-length n)
 
  (raise 'not-yet-implemented #t))</nowiki>
 
 
{| class="wikitable" style="text-align: center; "
 
{| class="wikitable" style="text-align: center; "
|[[File:Snowflake-flipped_0.svg|200px]]
+
|[[File:Snowflake-symmetric_0.svg]]
|[[File:Snowflake-flipped_1.svg|200px]]
+
|[[File:Snowflake-symmetric_1.svg]]
|[[File:Snowflake-flipped_2.svg|200px]]
+
|[[File:Snowflake-symmetric_2.svg]]
|[[File:Snowflake-flipped_3.svg|200px]]
+
|[[File:Snowflake-symmetric_3.svg]]
|[[File:Snowflake-flipped_4.svg|200px]]
+
|[[File:Snowflake-symmetric_4.svg]]
 
|-
 
|-
|n=0
+
|iter=0
|n=1
+
|iter=1
|n=2
+
|iter=2
|n=3
+
|iter=3
|n=4
+
|iter=4
 
|}
 
|}
  
=Branch=
+
===Flipped===
<nowiki>(define (branch length iter)
 
  (raise 'not-yet-implemented #t))</nowiki>
 
 
 
 
{| class="wikitable" style="text-align: center; "
 
{| class="wikitable" style="text-align: center; "
|[[File:Branch_0.svg|200px]]
+
|[[File:Snowflake-flipped_0.svg]]
|[[File:Branch_1.svg|200px]]
+
|[[File:Snowflake-flipped_1.svg]]
|[[File:Branch_2.svg|200px]]
+
|[[File:Snowflake-flipped_2.svg]]
|[[File:Branch_3.svg|200px]]
+
|[[File:Snowflake-flipped_3.svg]]
|[[File:Branch_4.svg|200px]]
+
|[[File:Snowflake-flipped_4.svg]]
|[[File:Branch_5.svg|200px]]
 
|[[File:Branch_6.svg|200px]]
 
|[[File:Branch_7.svg|200px]]
 
 
|-
 
|-
 
|iter=0
 
|iter=0
Line 73: Line 59:
 
|iter=3
 
|iter=3
 
|iter=4
 
|iter=4
|iter=5
 
|iter=6
 
|iter=7
 
 
|}
 
|}

Latest revision as of 08:49, 17 November 2020

Lindenmayer system

Dragon trees.jpg

Racket Image Library

Racket Image Library Documentation

placement

beside/align
flip-vertical
above/align
overlay/align/offset
rotate

line

line

empty-image

empty-image

Spiral Demo

Code to Implement

Snowflake

(define (snowflake len iter is-flipped)
  (raise (error 'not-yet-implemented)))))

(define (snowflake-symmetric len iter)
  (snowflake len iter #f))

(define (snowflake-flipped len iter)
  (snowflake len iter #t))

Symmetric

Snowflake-symmetric 0.svg Snowflake-symmetric 1.svg Snowflake-symmetric 2.svg Snowflake-symmetric 3.svg Snowflake-symmetric 4.svg
iter=0 iter=1 iter=2 iter=3 iter=4

Flipped

Snowflake-flipped 0.svg Snowflake-flipped 1.svg Snowflake-flipped 2.svg Snowflake-flipped 3.svg Snowflake-flipped 4.svg
iter=0 iter=1 iter=2 iter=3 iter=4