You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -66,27 +67,120 @@ To install TreeSim_Lpy, follow these steps (adapted from the `L-Py documentation
66
67
67
68
lpy
68
69
69
-
6. **Install TreeSim_Lpy**:
70
70
71
-
With the conda environment for L-Py set, next we need to clone the TreeSim_Lpy repository. To do that run
71
+
Tutorials
72
+
---------
72
73
73
-
.. code-block:: sh
74
+
There are many things you may want to modify as you grow your own trees. Here are some tutorials for some of the more common changes:
75
+
76
+
1. **Changing Apple Geometry:**
77
+
78
+
The call production of the apples happens in the ``grow_object(o)`` section:
79
+
80
+
.. code-block:: python
81
+
82
+
elif'Apple'in o.name:
83
+
produce [S(.1/2, .09/15)f(.1)&(180)A(.1, .09)]
84
+
85
+
86
+
87
+
The apple's base is generated with the ``A(bh, r)`` production rule seen below.
88
+
89
+
.. code-block:: python
90
+
91
+
A(bh, r):
92
+
curves = make_apple_curve()
93
+
base_curve = curves[0]
94
+
top_curve = curves[1]
95
+
nproduce SetColor(230,0,0) SectionResolution(60)
96
+
produce nF(bh, .01, r, base_curve) ^(180) nF(bh/5, .1, r, top_curve)^(180)#S(bh/2,r/15)
97
+
98
+
The parameters represent the base height of the apple and the radius of the apple. If you wanted to create a completely new apple geometry, just replace the code in this A section. However, if you simply want to edit the existing shape of the apple, that can be done in the ``make_apple_curve()`` section.
99
+
100
+
The apple is made with two curves: a curve that marks the base of the apple, and a curve that marks the indentation on top of the apple. These curves are generated as different Curve2D objects, then turned into QuantisedFunction objects. This is necessary because of the way the apple is produced ``nF``. ``nF`` has an optional parameter ``radiusvariation`` which must be a quantized function. ``nF`` produces a cylinder in n steps, and these curves work by specifying how large the radius for the cylinder should be at each step.
101
+
102
+
Currently, the stem is produced separately from the apple base. The stem is created in a slightly different way than the apple. A NurbsCurve2D object is returned from the ``make_stem_curve()`` function. This curve is used in ``SetGuide`` to mark how the stem will be generated. ``nF`` is used to follow the guide while generating a cylinder, and there is no ``radiusvariation`` this time.
103
+
104
+
.. code-block:: python
105
+
106
+
S(sh,r):
107
+
stem_curve = make_stem_curve()
108
+
nproduce SetColor(100,65,23)
109
+
produce SetGuide(stem_curve, sh) _(r)nF(sh, .1, r)
110
+
111
+
112
+
2. **Changing Leaf Geometry:**
113
+
114
+
.. code-block:: python
115
+
116
+
L(l):
117
+
nproduce SetColor(0,225,0)
118
+
119
+
curves = make_leaf_guide()
120
+
curve1 = curves[0]
121
+
curve2 = curves[1]
122
+
123
+
produce _(.0025) F(l/10){[SetGuide(curve1, l) _(.001).nF(l, .01)][SetGuide(curve2, l)_(.001).nF(l, .01)]}
0 commit comments