<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: CGA Randomize split inner section / repeats in ArcGIS CityEngine Questions</title>
    <link>https://community.esri.com/t5/arcgis-cityengine-questions/cga-randomize-split-inner-section-repeats/m-p/691930#M9119</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I was able to achieve this using this, but there is got a better way &lt;IMG src="https://community.esri.com/legacyfs/online/emoticons/happy.png" /&gt;&lt;/P&gt;&lt;P style="color: #600060; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;opTopFloor2&lt;SPAN style="color: #000000;"&gt; --&amp;gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;SPAN class=""&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: #600060;"&gt;split&lt;/SPAN&gt;(x) { &lt;SPAN style="color: #0000c0;"&gt;rand&lt;/SPAN&gt;(1.0, 7.0) : &lt;SPAN style="color: #600060;"&gt;split&lt;/SPAN&gt;(x) { &lt;SPAN style="color: #0000c0;"&gt;rand&lt;/SPAN&gt;(0.0, 1.0) : &lt;SPAN style="color: #600060;"&gt;colorRed&lt;/SPAN&gt; &lt;SPAN style="color: #600060;"&gt;X.&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;SPAN class=""&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;| &lt;SPAN style="color: #0000c0;"&gt;rand&lt;/SPAN&gt;(0.0, 1.0) : &lt;SPAN style="color: #600060;"&gt;colorGreen&lt;/SPAN&gt; &lt;SPAN style="color: #600060;"&gt;X.&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;SPAN class=""&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;| &lt;SPAN style="color: #0000c0;"&gt;rand&lt;/SPAN&gt;(0.0, 1.0) : &lt;SPAN style="color: #600060;"&gt;colorBlue&lt;/SPAN&gt; &lt;SPAN style="color: #600060;"&gt;X.&lt;/SPAN&gt;}* }*&lt;/P&gt;&lt;P style="margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;IMG alt="" class="jive-emoji image-1 jive-image j-img-original" src="/legacyfs/online/482242_Screen Shot 2020-02-14 at 11.49.59 AM.png" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 14 Feb 2020 16:50:19 GMT</pubDate>
    <dc:creator>DaveLajoie</dc:creator>
    <dc:date>2020-02-14T16:50:19Z</dc:date>
    <item>
      <title>CGA Randomize split inner section / repeats</title>
      <link>https://community.esri.com/t5/arcgis-cityengine-questions/cga-randomize-split-inner-section-repeats/m-p/691929#M9118</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Guys,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is there a way to change the random value for each iteration during split?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="color: #600060; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;opTopFloor&lt;SPAN style="color: #000000;"&gt; --&amp;gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;SPAN class=""&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: #600060;"&gt;split&lt;/SPAN&gt;(x) { &lt;SPAN style="color: #0000c0;"&gt;rand&lt;/SPAN&gt;(1.0, 5.0) : &lt;SPAN style="color: #600060;"&gt;colorRed&lt;/SPAN&gt; &lt;SPAN style="color: #600060;"&gt;X.&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;SPAN class=""&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;| &lt;SPAN style="color: #0000c0;"&gt;rand&lt;/SPAN&gt;(1.0, 5.0) : &lt;SPAN style="color: #600060;"&gt;colorGreen&lt;/SPAN&gt; &lt;SPAN style="color: #600060;"&gt;X.&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;SPAN class=""&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;| &lt;SPAN style="color: #0000c0;"&gt;rand&lt;/SPAN&gt;(1.0, 5.0) : &lt;SPAN style="color: #600060;"&gt;colorBlue&lt;/SPAN&gt; &lt;SPAN style="color: #600060;"&gt;X.&lt;/SPAN&gt;}*&lt;/P&gt;&lt;P style="margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;/P&gt;&lt;P style="margin: 0.0px 0.0px 0.0px 0.0px;"&gt;it appears the rand() is evaluated once, instead of each iteration.&lt;/P&gt;&lt;P style="margin: 0.0px 0.0px 0.0px 0.0px;"&gt;What I would need is that each iteration {}* would provide a new random number&lt;/P&gt;&lt;P style="margin: 0.0px 0.0px 0.0px 0.0px;"&gt;doable?&lt;/P&gt;&lt;P style="margin: 0.0px 0.0px 0.0px 0.0px;"&gt;Tx&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 14 Feb 2020 16:46:43 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-cityengine-questions/cga-randomize-split-inner-section-repeats/m-p/691929#M9118</guid>
      <dc:creator>DaveLajoie</dc:creator>
      <dc:date>2020-02-14T16:46:43Z</dc:date>
    </item>
    <item>
      <title>Re: CGA Randomize split inner section / repeats</title>
      <link>https://community.esri.com/t5/arcgis-cityengine-questions/cga-randomize-split-inner-section-repeats/m-p/691930#M9119</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I was able to achieve this using this, but there is got a better way &lt;IMG src="https://community.esri.com/legacyfs/online/emoticons/happy.png" /&gt;&lt;/P&gt;&lt;P style="color: #600060; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;opTopFloor2&lt;SPAN style="color: #000000;"&gt; --&amp;gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;SPAN class=""&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: #600060;"&gt;split&lt;/SPAN&gt;(x) { &lt;SPAN style="color: #0000c0;"&gt;rand&lt;/SPAN&gt;(1.0, 7.0) : &lt;SPAN style="color: #600060;"&gt;split&lt;/SPAN&gt;(x) { &lt;SPAN style="color: #0000c0;"&gt;rand&lt;/SPAN&gt;(0.0, 1.0) : &lt;SPAN style="color: #600060;"&gt;colorRed&lt;/SPAN&gt; &lt;SPAN style="color: #600060;"&gt;X.&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;SPAN class=""&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;| &lt;SPAN style="color: #0000c0;"&gt;rand&lt;/SPAN&gt;(0.0, 1.0) : &lt;SPAN style="color: #600060;"&gt;colorGreen&lt;/SPAN&gt; &lt;SPAN style="color: #600060;"&gt;X.&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;SPAN class=""&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;| &lt;SPAN style="color: #0000c0;"&gt;rand&lt;/SPAN&gt;(0.0, 1.0) : &lt;SPAN style="color: #600060;"&gt;colorBlue&lt;/SPAN&gt; &lt;SPAN style="color: #600060;"&gt;X.&lt;/SPAN&gt;}* }*&lt;/P&gt;&lt;P style="margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;IMG alt="" class="jive-emoji image-1 jive-image j-img-original" src="/legacyfs/online/482242_Screen Shot 2020-02-14 at 11.49.59 AM.png" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 14 Feb 2020 16:50:19 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-cityengine-questions/cga-randomize-split-inner-section-repeats/m-p/691930#M9119</guid>
      <dc:creator>DaveLajoie</dc:creator>
      <dc:date>2020-02-14T16:50:19Z</dc:date>
    </item>
    <item>
      <title>Re: CGA Randomize split inner section / repeats</title>
      <link>https://community.esri.com/t5/arcgis-cityengine-questions/cga-randomize-split-inner-section-repeats/m-p/691931#M9120</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You are correct.&amp;nbsp; The random number is evaluated, and the repeat split is applied using that number for all repeated parts.&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;split(x) { rand(0,1): X. }*‍‍

// Let's say rand(0,1) gives us 0.3, then the split above is equivalent to the following:

split(x) { 0.3: X. }*‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In order to split into parts that have random sizes&amp;nbsp;for each part, you can't use a repeat split.&amp;nbsp; Instead, you should use a recursive split which recursively splits out one part at a time with a random size.&amp;nbsp; Here is an example which recursively splits a shape into parts &lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt;X&lt;/SPAN&gt;&amp;nbsp;that have random sizes between &lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt;[0,1]&lt;/SPAN&gt;.&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;RecursiveSplit --&amp;gt;
     case scope.sz&amp;lt;1:
          X
     else:
          split(x) { rand(0,1): X
                   | ~1: RecursiveSplit }
‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Actually, since the &lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt;split&lt;/SPAN&gt; will just stop safely when there isn't any geometry left to split, then there is no need to even have the &lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt;case&lt;/SPAN&gt; statement as the end condition.&amp;nbsp; The following is sufficient.&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;RecursiveSplit --&amp;gt;
     split(x) { rand(0,1): X.
              | ~1: RecursiveSplit }
‍‍‍&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In your case, to alternate red, green, and blue colors, one way to do this would be:&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;RecursiveSplit3 --&amp;gt;
     split(x) { rand(0,1): color(1,0,0) X.
              | rand(0,1): color(0,1,0) X.
              | rand(0,1): color(0,0,1) X.
              | ~1: RecursiveSplit3 }
&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 05:07:18 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-cityengine-questions/cga-randomize-split-inner-section-repeats/m-p/691931#M9120</guid>
      <dc:creator>CherylLau</dc:creator>
      <dc:date>2021-12-12T05:07:18Z</dc:date>
    </item>
  </channel>
</rss>

