File: structure-synth.1

package info (click to toggle)
structure-synth 1.5.0-7
  • links: PTS
  • area: main
  • in suites: bookworm, sid, trixie
  • size: 2,416 kB
  • sloc: cpp: 10,212; python: 164; makefile: 71; sh: 15
file content (237 lines) | stat: -rw-r--r-- 11,288 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
.\" 
.TH "Structure Synth" "1" "April 2009" "" ""
.SH "NAME"
structure\-synth \- application for creating 3D structures
.SH "SYNOPSIS"
.B structure\-synth
.SH "DESCRIPTION"
Structure Synth is an application for creating 3D structures from a set of user specified rules. The resulting structures can be viewed in the integrated OpenGL viewer or exported to various formats. The program was inspired by the CFDG syntax by Chris Coyne, and the Context Free GUI by Mark Lentczner and John Horigan.
.SH "STATES, TRANSFORMATIONS AND ACTIONS"
Structure Synth is all about states. A state describes the current coordinate system and the current coloring mode. The coordinate system determines the position, orientation and size of all object drawn while in the current state.

States are modified by transformations. For instance we can move the coordinate system one unit in the x\-direction by applying the transformation: { x 1 }. Similarly we can rotate the coordinate system 90 degrees about the x\-axis by applying:{ rx 90 }. States are automatically combined while parsing, that is { x 1 x 1 } is equal to { x 2 }.

States can be combined with rule calls to create actions. { x 2 } box is an example of a transformation followed by a rule call. 'box' is a built\-in rule. Not surprisingly, this rule draws a box located at (0,0,0) \-> (1,1,1) in the current coordinate system.

.SS "Iterated actions:"

It is possible to apply iterated actions, this is done using the multiplication symbol: for instance 3 * { x 2 } box would be equal to creating three actions:

  { x 2 } box
  { x 4 } box
  { x 6 } box

.SS "Color transformations:"

Similar to the spatial transformations it is also possible to transform the current rendering color. Structure Synth uses HSV (Hue, Saturation and Value) for representing colors \- this is perhaps not as familiar as the RGB color model, but offers a slightly more intuitive representation once you get used to it (at least that is what some people claim \- personally I still find it easier think in terms of red, green and blue components). The color transformations are applied using the 'hue', 'saturation' and 'value' operators.

The next example demonstrates both iterated actions and color transformations to draw a nice color cube:

  10 * { x 1 hue 36 } 10 * { y 1 sat 0.9 } 10 * { z 1 b 0.9 } box

Here is another example demonstrating different kinds of transformations:

  10 * { x 2 } box
  1 * { y 2 } 10 * { x 2 rx 6 } box
  1 * { y 4 } 10 * { x 2 hue 9 } box
  1 * { y 6 } 10 * { x 2 s 0.9 } box

.SS "Built\-in rules:"

The Box is an example of one the primitives \- built\-in rules \- in Structure Synth. The other built\-in rules are: Sphere, Dot, Grid, Line, Cylinder, Mesh, CylinderMesh. 

.SH "MAKING RULES"
Custom rules are the key to creating complex and sophisticated structures. Rules are created using the 'rule' keyword. A rule can used the same way as any built\-in primitive. The most important aspect of rules are, that they are able to call themselves. Take a look at the following example:

  R1
  
  rule R1 {
    { x 0.9 rz 6 ry 6 s 0.99  sat 0.99  } R1
    { s 2 } sphere
  }

Notice that this rule recursively calls itself. It would never terminate \- however Structure Synth has a default maximum recursion depth of 1000 recursions. This value can be changes using the 'set maxdepth xxx' command. Another way to force termination would be using the 'set maxobjects xxx' keyword, which makes Structure Synth keep track of the number of objects drawn.

.SS "Adding some randomness:"

Now, in order to things interesting, we will probably want to create something less static \- by adding some randomness. In Structure Synth this is achieved by creating multiple definitions for the same rule:

  R1
  
  rule R1 {
    { x 0.9 rz 6 ry 6 s 0.99  sat 0.99  } R1
    { s 2 } sphere
  }
  
  rule R1  {
    { x 0.9 rz \-6 ry 6 s 0.99  sat 0.99  } R1
    { s 2 } sphere
  }

Notice the 'R1' rule has two definitions. Now, whenever the Structure Synth builder needs to call the 'R1' rule, it will choose one of the definitions at random.
.SH "REFERENCE"
.SS "Actions:"

Termination criteria:
.TP 
\fBset maxdepth [integer]:\fR
Breaks after [integer] iterations (generations). This will also serve as a upper recursion limit for all rules.
.TP 
\fBset maxobjects [integer]:\fR
After [integer] objects have been created, the construction is terminated.
.PP 
Other:
.TP 
\fBset seed [integer]:\fR
Allows you to set the random seed. This makes it possible to reproduce creations.
.TP 
\fBset background [color]:\fR
Allows you to set the background color. Colors are specified as text\-strings parsed using Qt's color parsing, allowing for standard HTML RGB specifications (e.g. #F00 or #FF0000), but also SVG keyword names (e.g. red or even lightgoldenrodyellow).
.PP 
.SS "Rule modifiers:"

.TP 
\fBmd / maxdepth [integer]:\fR
Rule Retirement.Sets the maximum recursive for the rule. The rule would not execute any actions after this limit has been reached.
.TP 
\fBmd / maxdepth [integer] > [rulename]:\fR
Rule Retirement with substitution.Sets the maximum recursive for the rule. After this limit has been reached [rulename] will be executed instead this rule.
.TP 
\fBw / weight [float]:\fR
Ambiguous rules.If several rules are defined with the same name, a random definition is chosen according to the weight specified here. If no weight is specified, the default weight of 1 is used.
.PP 
.SS "Transformations:"

Geometrical transformations:
.TP 
\fBx [float]:\fR
X axis translation. The float argument is the offset measured in units of the local coordinate system.
.TP 
\fBy [float]:\fR
Y axis translation. As above.
.TP 
\fBz [float]:\fR
Z axis translation. As above.
.TP 
\fBrx [float]:\fR
Rotation about the x axis. The 'float' argument is the angle specified in degrees. The rotation axis is centered at the unit cube in the local coordinate system: that is the rotation axis contains the line segment from (0, 0.5, 0.5) \-> (1, 0.5, 0.5). 
.TP 
\fBry [float]:\fR
Rotation about the y axis. As above. 
.TP 
\fBrz [float]:\fR
Rotation about the z axis. As above. 
.TP 
\fBs [float]:\fR
Resizes the local coordinate system. Notice that the center for the resize is located at the center of the unit cube in the local system (at (0.5,0.5,0.5)).
.TP 
\fBs [f1] [f2] [f3]:\fR
Resizes the local coordinate system. As above but with separate scale for each dimension.
.TP 
\fBm [f1] ... [f9]:\fR
Applies the specified 3x3 rotation matrix to the transformation matrix for the current state. About the argument order: [f1],[f2],[f3] defines the first row of the matrix.
.TP 
\fBfx:\fR
Mirrors the local coordinate system about the x\-axis. As above the mirroring planes is centered at the cube.
.TP 
\fBfy:\fR
Mirrors the local coordinate system about the y\-axis.
.TP 
\fBfz:\fR
Mirrors the local coordinate system about the z\-axis.
.PP 
Color space transformations:
.TP 
\fBh / hue [float]:\fR
Adds the 'float' value to the hue color parameter for the current state. Hues are measured from 0 to 360 and wraps cyclicly \- i.e. a hue of 400 is equal to a hue of 40.
.TP 
\fBsat [float]:\fR
Multiplies the 'float' value with the saturation color parameter for the current state. Saturation is measured from 0 to 1 and is clamped to this interval (i.e. values larger then 1 are set to 1).
.TP 
\fBb / brightness [float]:\fR
Multiples the 'float' value with the brightness color parameter for the current state. Brightness is measured from 0 to 1 and is clamped to this interval. Notice that parameter is sometimes called 'V' or 'Value' (and the color space is often refered to as HSV).
.TP 
\fBa / alpha [float]:\fR
Multiplies the 'float' value with the alpha color parameter for the current state. Alpha is measured from 0 to 1 and is clamped to this interval. An alpha value of zero is completely transparant, and an alpha value of one is completely opaque.
.TP 
\fBcolor [color]:\fR
This commands sets the color to an absolut color (most other transformations are relative modifications on the current state). Colors are specified as text\-strings parsed using Qt's color parsing, allowing for standard HTML RGB specifications (e.g. #F00 or #FF0000), but also SVG keyword names (e.g. red or even lightgoldenrodyellow).
.PP 
Drawing primitives:
.TP 
\fBbox:\fR
solid box
.TP 
\fBgrid:\fR
wireframe box
.TP 
\fBsphere:\fR
the round thingy (as of now this primitive has some issues \- e.g. ellipsoids are not working.)
.TP 
\fBline:\fR
along x axis, centered in y,z plane.
.TP 
\fBpoint:\fR
centered in coordinate system.
.TP 
\fBtriangle:\fR
creates a custom polygon. Specify the coordinates as follows: Triangle[0,0,0;1,0,0;0.5,0.5,0.5]
.TP 
\fBmesh:\fR
prototype mesh
.TP 
\fBcylinder:\fR
the symmetry axis will be the current x axis. [Not implemented]
.TP 
\fBtube:\fR
polygonal cylinder (will be drawn smoothly as the coordinate system transforms). [Not implemented]
.PP 
.SS "Preprocessor commands:"

.TP 
\fB#define varname value:\fR
substitutes every occurrence of 'varname' with 'value'. Value may contain spaces.
.PP 
.SS "For Context Free / CFDG users:"

The EisenScript syntax in Structure Synth has a lot in common with CFDG.

There are however a few important differences:
.TP 
\fBContext sensitivity:\fR
A CFDG script can be viewed as a grammar, where the production rules are independent of their context \- or put differently \- when choosing between rules CFDG does not have any knowledge of the history of system. This 'Context Free' property of CFDG was deliberately omitted in EisenScript, simply for pragmatic reasons: some structures would be difficult to create without having some way to change the rules after a certain number of recursions.
.TP 
\fBThe 'startrule' statement:\fR
in CFDG startrules are explicitly specified. In EisenScript, a more generic approach is used: statements which can be used in a rule definition, can also be used at the top\-level scope, so in order to specify a start\-rule, just write the name of the rule.
.TP 
\fBTermination criteria:\fR
in CFDG recursion automatically terminates when the objects produced are too small to be visible. This is a very elegant solution, but it is not easy to do in a dynamic 3D world, where the user can move and zoom with the camera. Several options exist in Structure Synth for terminating the rendering.
.TP 
\fBTransformation order:\fR
in CFDG transformations (which CFDG refers to as adjustments) in curly brackets are not applied in the order of appearence, and if multiple transformations of the same type are applied, only the last one is actually carried out. For transformations in square brackets in CFDG the order on the other hand is significant. In Structure Synth the transformation order is always significant: transformations are applied starting from the right\-most one.
.PP 
.SH "EXAMPLE"
Below is an EisenScript sample:

  /*
    Sample Torus.
  */
  
  set maxdepth 100
  r1
  36  * { x \-2 ry 10   } r1
  
  rule r1 maxdepth 10 {
     2 * { y \-1 } 3 * { rz 15 x 1 b 0.9 h \-20  } r2
     { y 1 h 12 a 0.9  rx 36 }  r1
  }
  
  rule r2 {
     { s 0.9 0.1 1.1 hue 10 } box // a comment
  }
  
  rule r2 w 2 {
     { hue 113 sat 19 a 23 s 0.1 0.9 1.1 } box
  }
.SH "SEE ALSO"
http://structuresynth.sourceforge.net/