diff --git a/1.png b/1.png new file mode 100644 index 0000000..360ae4e Binary files /dev/null and b/1.png differ diff --git a/2.png b/2.png new file mode 100644 index 0000000..53bb086 Binary files /dev/null and b/2.png differ diff --git a/3.png b/3.png new file mode 100644 index 0000000..1f208ae Binary files /dev/null and b/3.png differ diff --git a/4.png b/4.png new file mode 100644 index 0000000..ff0b933 Binary files /dev/null and b/4.png differ diff --git a/5.png b/5.png new file mode 100644 index 0000000..c956dd6 Binary files /dev/null and b/5.png differ diff --git a/6.png b/6.png new file mode 100644 index 0000000..34da8ef Binary files /dev/null and b/6.png differ diff --git a/7.png b/7.png new file mode 100644 index 0000000..a91e9bb Binary files /dev/null and b/7.png differ diff --git a/README.md b/README.md index 91c9197..b7e65b9 100644 --- a/README.md +++ b/README.md @@ -1,22 +1,54 @@ # lab03-grammars -Let's practice using grammars! For this lab, please pull up the L-system node in Houdini. +## 0. Group members: + +Tongwei Dai + +Siyuan Fu ## 1. Wheat grammar puzzle -Look at these iterations (n = 1, 2, 3) of a one-rule grammar. Using the built in symbols in Houdini, design a grammar that produces this output. Take a screenshot of your rules.\ -square1 -square2 -square3 +The grammar we used for this part is +``` +F=FF[-FF]F[-FF]FF- +``` +where the `[-FF]` is the branch, and the `FF` is the stem, and the `-` at the end makes the recursive part is rotated after each iteration. + +The axiom is simply `F`. + +### Screenshots: + +square1 +square1 +square1 ## 2. Square grammar puzzle -How about this one? Take a screenshot of your rules.\ -square1 -square2 -square3 - -## 3. Custom plant -Choose a plant in the world. Working off a reference, design a grammar that mimics the structure of that plant. Unlike our simple puzzles, please use multiple rules for greater complexity. Think carefully about the structure of your grammar! EXPLAIN the structure of your plant in the README. What are the components? What do each of the rules do? Be sure to also include images of a few iterations of your output plant. - -## Submission -- Create a pull request against this repository -- In your readme, list your solutions and format your README nicely -- Profit +the grammar we used for this part is +``` +F=F+F-F-F+F +``` +which gives the simple shape show in the first screenshot. The rest are just the result of further recursion. To fix the orientation of the whole structure, we appended a transform node. + +The axiom is simply `F`. + +### Screenshots: + +square1 +square1 +square1 + +## 3. Sunflower +square1 + +We used parametric and conditional production rules to model the head of a sunflower. + +``` +A(n) : n < 900 = +(137.5)[f(n^(0.5))J]A(n+1) +A(n) = +(137.5)[f(n^(0.5))K]A(n+1) +``` + +We start with `A(0)`. + +Some the magic numbers such as `137.5` and the square root are results of the studies on [Phyllotaxis Pattern](https://en.wikipedia.org/wiki/Phyllotaxis). The formula is derived from the Golden Ratio and has been observed in many natural phenomena. + +The intuition behind the production rules is that we always "stay" in the center of the flower head. At each iteration, the turtle turns by `137.5` degrees, then moves forward by the square root of the current iteration number, places an object, and then snaps back to the middle. The process continues until all objects are placed. + +Since we will only have `1000` iterations, the conditon `n < 900` makes sure that the turtle places the leaf `J` for the first 900 steps. Otherwise, it will use the leaf `K` which is a sunflower leaf mesh. \ No newline at end of file diff --git a/lab.hipnc b/lab.hipnc new file mode 100644 index 0000000..aedec50 Binary files /dev/null and b/lab.hipnc differ