split: how is the  number of repetitions calculated?

481
3
05-20-2014 05:40 AM
VladimirElistratov
New Contributor II
I don't understand how the number of repetitions is calculated for some complex cases with nested repetitions with floating sizes.

For example, let's take the second example in this page of the CityEngine Manual.

[ATTACH=CONFIG]33917[/ATTACH]

...
rhythm_example01 --> split(x){ ~2: X(2) | { ~1: Y(1.5) | ~1: Z(1) }* }*
...


Could you please explain, how the number of repetitions is calculated for that example?
Is the procedure described somewhere in the manual?

Thanks in advance!
0 Kudos
3 Replies
MatthiasBuehler1
Frequent Contributor
Hi,


You did not pick an easy example. 🙂

The split() is the most advanced and important operation. It's very powerful and thus does some very complex things internally.

Simplest for you to understand is that it tries to evaluate even out multiple options for potential splits and then chooses the version that creates the least 'stretching'.

Just get familiar with ', ~ and * for the beginning.

If that is clear, then you have already 95% of all you even want to code handled.

Ok ?

Matt
0 Kudos
VladimirElistratov
New Contributor II

Just get familiar with ', ? and * for the beginning.


' is for the relative size
* is the repeat switch
What is ? (question mark). Did you mean ~ (floating size)?

Anyway, I'll read the documentation for the split operation.
0 Kudos
MatthiasBuehler1
Frequent Contributor
ah shit. yes, sorry, I meant '~'.. (fixed it in the above post)

it's really best to play with this and not try to analyze the most complex examples in the beginning .. 😉

m.
0 Kudos