[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [sc-users] lindenmayer



Thanks for this post Julian.

I have an intro. to this topic at http://www.avatar.com.au/courses/Lsystems/
Its pretty old but was for composers and animators
 Feel free to link to it.

ciao,

David



There is a new version of the rewriting system extensions:
http://swiki.hfbk-hamburg.de:8888/MusicTechnology/727

Rules can be now fully context-sensitive and rewriting can be done on any recursion level n without iterating through the whole string n times. This allows dynamic or stream based axioms (resulting in an L-system-filter).




an example for parsing user input:



(
var e, w, b, r, m, u, f, z, level=0;
e = nil;
w = SCWindow("test", Rect(40,40, 200, 200)).front;
w.view.decorator = FlowLayout(w.bounds.copy.left_(30).top_(30));
b = { |i| { |j|
	var c = ({ "abcd".choose } ! 3).join;
	SCButton(w, Rect(0,0, 30,25))
		.states_([[c, Color.black]])
		.action_({ f.(c) });
} ! 4; w.view.decorator.nextLine } ! 4;

w.view.decorator.nextLine;
SCButton(w, Rect(0,0, 30,25))
		.states_({ |i| [i.asString, Color.black]} ! 8)
.action_({ |b| level = b.value; m = z.rewriteString(r, level); });

r = ["aa" -> "abab", "ba" -> "....aa", "c" -> "dab"];
z = r {
		loop {
			if(e.isNil) { e.yield } { e.do(_.yield); e = nil; }
		}
	};
m = z.rewriteString(r, level);

u = fork {
	var a, b;
	loop {
		a = b;
		b = m.next;
		if(a.notNil and: b.isNil) { "\n".post };
		(b ? "").post;
		0.04.wait;
	}
};

f = { |c| e = c; };
w.onClose = { u.stop };
)


--





.
_______________________________________________
sc-users mailing list
sc-users@xxxxxxxxxxxxxxx
http://www.create.ucsb.edu/mailman/listinfo/sc-users


--
--------------------------------------------------------------------------------------------------------------------
David Worrall
Avatar Space Design P/L		Sonic Communications Research Group
www.avatar.com.au		Universityf Canberra
www.mindthemarkets.com.au	creative.canberra.ecu.au/worrall/
-------------------------------------------------------------------------------------------------------------------