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
The program will either edit grammar files or find the grammar that describes a shape. This behavior will be determined by the presence of the -d parameter
58
+
59
+
## Grammar Editing
60
+
61
+
Firstly, if the user does not give the -d parameter. Then the <input_file> parameter is the name of the file that contains the L-system grammar and the parameters that will be used. For example for the koch curve, the file is:
62
+
63
+
{
64
+
"axiom" : "F",
65
+
"left_angle": 90.0,
66
+
"right_angle": 90.0,
67
+
"step_length": 5,
68
+
"order": 5,
69
+
"start_angle" : 0,
70
+
"rules" : {
71
+
"F": "F+F-F-F+F"
72
+
}
73
+
}
74
+
75
+
The file contains the following fields:
76
+
* axiom: the axiom
77
+
* left_angle: the angle of the left turn
78
+
* right_angle: the angle of the right turn
79
+
* step_length: the length of the step
80
+
* order: the number of applications of the rules
81
+
* start_angle: the value of the starting angle
82
+
* rules: the rules of grammar
83
+
84
+
If the parameter -m is given, the program prints the result string as an output. If the user gives the [output_file] parameter, [output_file] is the name of a file to be created. This file will consist of lines. Each line of the file will contain two pairs of coordinates:
85
+
86
+
`(x1, y1) (x2, y2)`
87
+
88
+
## Examples
89
+
### Example 1
90
+
91
+
### Example 2
92
+
93
+
### Example 3
94
+
95
+
### Example 4
96
+
97
+
### Example 5
98
+
99
+
### Example 6
100
+
101
+
### Example 7
34
102
35
-
If we apply the rule five times, we will get a much larger string, with 6,249 characters, which gives us the following shape:
0 commit comments