L-System variables in expression functions

   4886   5   2
User Avatar
Member
6 posts
Joined: Nov. 2008
Offline
Hello,

How can I use L-System variables in expression functions within rules ?
I can for example create a conditional rule like …

A(h) : `sqrt(4)` = 2 -> F …

But I can't use:
A(h) : `sqrt(h)` = 2 -> F …

Is there any way to do that ?

Thanks,

Frank
Frank Aalbers
Effects TD
Pixar Animation Studios
User Avatar
Staff
2540 posts
Joined: July 2005
Offline
Hmmm… It works when I use a variable in to rand() in a simple lsystem rules.

Is there a file you can send in to Support to try out and start a case with?

btw there are a couple undocumented features in lsystems (that should be documented).
One is strdump() to expand parts of rules in-place.
strdump( iterations, <rules_to_duplicate>)
There's at least one school like the old school!
User Avatar
Member
412 posts
Joined: July 2005
Offline
I'd like to know about some of those additional undocumented features…

I tried experimenting with Frank's issue and couldn't get very far in a solution. For the most part, only arithmetic operators seemed to be happy when included in a conditional statement. Of course in the situation of sqrt(), you could just use h^0.5 in place and get it to work, but I highly doubt he was actually needing to get the sqrt function to work, and was more so wanting any expressions in the conditional statement to process successfully.
Dave Quirus
User Avatar
Member
6 posts
Joined: Nov. 2008
Offline
Indeed, I did not specifically needed sqrt. The problem is that not all of them are available. What I'm really worried about is when making custom expression functions specifically needed for conditions in L-Systems. Will it be able to use those ?

I'll see if I can make some time and create a test file.

Thanks for looking into this.

Frank
Frank Aalbers
Effects TD
Pixar Animation Studios
User Avatar
Staff
2540 posts
Joined: July 2005
Offline
I know rand() works in the lsystem rules and use it quite often.

I'll dig and report back if there's more.


-jeff
There's at least one school like the old school!
User Avatar
Member
412 posts
Joined: July 2005
Offline
hey jeff,

try this out:

Premise: A
Rule 1: A(h):h^0.5<5=FA(h+1)

vs

Premise: A
Rule 1: A(h):sqrt(h)<5=FA(h+1)

according to my understanding, the first setup should quit after 25 iterations (and it does so accordingly). However, the second should do the same and it does not.

rand() does seem to work fine in the condition, however i guess the question has to do with all expression functions, and in Frank's case, custom expression functions being able to work in the conditional statement. i just happen to be curious myself to be quite honest..

thanks!
dave
Dave Quirus
  • Quick Links