Whether to consider modifying the "~" algorithm in the split

603
4
06-07-2020 07:44 AM
biaozeng
New Contributor III

Whether to consider modifying the "~" algorithm in the split, it is difficult to make adaptive segmentation in the current rules. For example, I created a 15m pattern to invade the values in which I have added ~, which cannot be well adapted. Zoom is applied to the 5m or 30m face. Very limited

For example, in this video, I need to apply the same rule to boxes of different sizes. It has a very bad effect.

YouTube 

0 Kudos
4 Replies
CherylLau
Esri Regular Contributor

Unfortunately, the video link above doesn't work for me, so I can't see the "bad effect" that you mention.  It says the video is unavailable because it is private.

Although the images are nice, I'm not exactly sure what your desired goal is.  I can guess that 1 is bad because it makes some elements too small and that 2 is bad because it abruptly cuts the tiles at the end.  However, I don't understand what is wrong with 3.

Questions:

(1) What is your desired output for the red, green, and blue tiles when your facade width is short, medium, and long?

(2) What is the cga code used to generate your examples 1, 2, and 3?

If I were to make a guess, I think you have a pattern which should be about 15m, and you would like to repeat this pattern across a facade of any width such that the pattern stays as close to 15m as possible.  The ratios between the tiles in the pattern should also be kept.  The pattern consists of a blue tile on the left, a green tile in the middle, and a red tile on the end, where the green is about 75% of the size of the red one, and the blue is about 50% of the red one.  In this case, I would use a repeating split that splits out pieces that are approximately 15m (your pattern width).  Then, for each pattern piece, do another split that splits it into blue, green, and red tiles.

Facade -->
   split(x) { ~15: Pattern }*
	
Pattern -->
   split(x) { ~0.5: color(0,0,1) Blue
            | ~0.75: color(0,1,0) Green
            | ~1: color(1,0,0) Red }
‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍

In order to avoid extremely small tile pieces, you could also put a case statement in the Facade rule to check if the width is larger than some minimum threshold before doing the split.

biaozeng
New Contributor III

Thank you very much for your reply. Your method can solve the segmentation of faces larger than 15m in my problem. If it is applied to faces smaller than 15, for example: 5 7 9 11 this size, we still have to create multiple rules separately to judge by conditions. . Not very convenient.

0 Kudos
CherylLau
Esri Regular Contributor

You could put a case statement in the Facade rule like this:

Facade -->
   case scope.sx < 15:
      // make the facade however you want it to be when it is <15m
   else:
      split(x) { ~15: Pattern }*‍‍‍‍‍

You can also skip the case, and then you will get small pieces when the facade is < 15m, which I think is what you wanted to avoid.  It just depends on what you want.  If you don't want to scale the three tiles proportionally, then you have to tell the computer what you do want.

0 Kudos
biaozeng
New Contributor III

Sorry, I changed the previous video permissions,...cityengine CGA - YouTube 

In some of the smaller buildings in the video, the facade elements of the standard floor are excessively reduced and squeezed

0 Kudos