Download presentation
Presentation is loading. Please wait.
1
Fractos ● Is a parser and visualizer for L-Systems ● Objectoriented, C++ ● Uses OpenGL for visualization ● Adopts LinSys3D's syntax ● Allows freely definable alphabet
2
Fractos What is an L-System ? ● Mathematical construct used to simulate natural development ● Develops stepwise from a simple term, called seed ● Development is done by rules that match to the function calls in the term ● The meaning of the term is unspecified, but it often contains drawing commands
3
Fractos AlphabetRules Seed & Result terms L-System components
4
Fractos The Alphabet ● Defines the meaning of the different function calls ● A function call can be: - primitive drawing command (line, cylinder, etc) - space transformation (rotation, translation, etc) - mesh drawing command - an internal signal (transports information) ● Example: F(t) is defined as line drawing command rz(t) is a space transformation, rotates around z axis
5
Fractos The Seed and Result Terms (1) ● Define the state of the L-System at a certain stage ● Are a sequence of function calls mixed with special commands ● Special commands are: - Graphics state push (symbol [ ) - Graphics state pop (symbol ] ) ● Is the input to Fractos' visualizer
6
Fractos The Seed and Result Terms (2) ● Example terms & visualizations: “F(1)” – a line, length 1: “F(1.5) [ rz(45) F(1) ] [ rz(-45) F(1) ]”:
7
Fractos The Rules (Example) F(t), *, *, []: <> F(t * 1.5) [rz(45) F(t) ] Function call to replace Optional: Precondition and postcondition Optional: Parameter condition (e.g. t < 9) Replacement term Optional: Probability value 0 < p < 1.0
8
Fractos L-Systems Example ● Alphabet - F(t), line primitive, color green - G(t), line primitive, color yellow - rz(t), space transformation, rotation in z-axis ● Rules F(t),*,*,[]:<> G(t) [ rz(25) F(t) ] [ rz(-25) F(t) ] G(t) F(t) G(t),*,*,[]:<> G(t*1.6) ● Seed F(1)
9
Fractos L-Systems Example – Graphical result
10
Fractos L-Systems Example – Sourcecode Lsys lsys(10); //maximum depth 10 // create a rotation function around z lsys.AddFunction_SpaceTransform("rz", 0x4, 0x0, 0x0); lsys.AddFunction_Primitive("F", PRT_LINE, 0, 0.8, 0); lsys.AddFunction_Primitive("G", PRT_LINE, 0.8, 0.8, 0); lsys.SetResult(0, "F(1)"); lsys.AddRule("F(t),*,*,[]:<> G(t) [ rz(25) F(t) ] [ rz(-25) F(t) ] G(t) F(t)"); lsys.AddRule("G(t),*,*,[]:<> G(t*1.6)"); lsys.Develop(); // called repeatedly until level 7 reached lsys.DrawLevel(7);
11
Fractos Technical background ● Contains a general lexical parser for mathematical terms (inside the function calls) and command sequences ● Uses GLib for dynamic arrays, parsing and message handling ● Uses OpenGL for visualization ● Prepared for 3D mesh drawing
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.