Deriving from Documentation as well as examples in the Gallery I understand the number/natural parameters
in shapes declarations. Still I struggle with adjustment- and shape parameters in shape declarations and
haven't seen yet any examples thereof anywhere. It is possible to show examples in the documentation ?
And is tr really an abbreviation for transformation ?
Adjustment- & shape parameters in shape declaration
Moderators: MtnViewJohn, chris, mtnviewmark
Adjustment- & shape parameters in shape declaration
kind regards from DeFleur
- MtnViewJohn
- Site Admin
- Posts: 882
- Joined: Fri May 06, 2005 2:26 pm
- Location: Mountain View, California
- Contact:
Re: Adjustment- & shape parameters in shape declaration
Here is a shape parameter example. I will put it in the wiki too.
Code: Select all
startshape test
shape foo(number sz)
{
SQUARE [r 0..90 s sz]
}
shape curve(number scale, number turn, shape thingie)
{
thingie [] // invoke thingie with parameters already bound
curve(=) [[y 0.5 s scale r turn y 0.5]]
}
shape test {
curve(0.97, 3, foo(0.5)) [] // bind 0.5 to sz in shape foo here
}
- MtnViewJohn
- Site Admin
- Posts: 882
- Joined: Fri May 06, 2005 2:26 pm
- Location: Mountain View, California
- Contact:
Re: Adjustment- & shape parameters in shape declaration
Here is an adjustment parameter example. I forgot to put examples in the wiki. tr and transformation are not keywords in Context Free. trans and transform are the keywords used for inserting an adjustment variable or parameter into another adjustment.
Code: Select all
startshape test
shape foo(number sz)
{
SQUARE [r 0..90 s sz]
}
shape curve(adjustment change, shape thingie)
{
thingie[] // invoke thingie with parameters already bound
curve(=) [transform change]
}
shape test {
curve([[y 0.5 s 0.97 r 3 y 0.5]], foo(0.5)) [] // bind 0.5 to sz here
}
Re: Adjustment- & shape parameters in shape declaration
Appreciate posted examples and food for thoughts.
kind regards from DeFleur