[026] How to Control Approximate Split (~) Works in Esri CityEngine
Discover the 1/3 threshold rule for approximate splits to perfectly manage leftover geometry dimensions without creating useless polygons.
This tutorial explores the specific mathematical criteria CityEngine uses to handle remaining dimensions when using the approximate split operator (~). By understanding the "1/3 rule," you can predict exactly when a rule will create an additional segment or simply distribute the remainder across existing ones, ensuring your procedural models remain clean and geometrically logical.
Core Logic of Approximate Split (~)
Let's continue from last time and look into the specific criteria for approximate splitting.
To explain it simply: if the remaining length exceeds 1/3 of the approximate split value following the '~' operator, CityEngine reduces the approximate size and performs one additional split.
Basic Split Example (134m Rectangle)
I will draw a rectangle with a width of 134m. From the top, I will set the StartRules to Lot1, Lot2, and Lot3 in sequence.
Take a look at the code below.
Lot1 --> split(x){~99 : A}*
Lot2 --> split(x){~100 : A}*
Lot3 --> split(x){~101 : A}*
A --> color(1,0,0) X.
Rule Behavior Breakdown (Lot1 / Lot2 / Lot3)
Line 1: Lot1 performs an approximate repeating split with ~99.
The leftover area is 35m, so 35/99 ≈ 0.3535, which is a value greater than 1/3 (0.333...).
Line 2: Lot2 performs an approximate repeating split with ~100.
The leftover area is 34m, so 34/100 = 0.34, which is also a value greater than 1/3.
Line 3: Lot3 performs an approximate repeating split with ~101.
The leftover area is 33m, so 33/101 ≈ 0.326, which is a value smaller than 1/3.
Let's look at the results.
Result Interpretation of 134m Split
As you can see in the figure, segments where the leftover portion exceeds 1/3 of the approximate split value are split once more, whereas segments where it is 1/3 or less are not split further.
In the case of Lot1 and Lot2, because the leftover exceeds 1/3, they split one more time, dividing the area into equal parts.
Extended 300m Split Example
To help with your understanding, I'll add one more example before finishing for today. I will perform an approximate repeating split on a 300m wide rectangle using the following values. Try to guess how they will be split by looking at the image and the code.
Approximate Split Behavior Across Multiple Values
Looking at the results:
I hope the results came out as you expected.
Let's try just one more. If we split a 300m rectangle as shown below, what shape will it take?
Advanced Repeating Split Structure
Lot1 --> split(x){ 50 : A | { ~10 : B | ~20 : C }* | 50 : A }
A --> color(1,0,0) X.
B --> color(0,1,0) X.
C --> color(0,0,1) X.
The result is...
How Fixed and Approximate Splits Interact
Shall we do one more? What would it look like if we split a 300m wide rectangle with the following code?
Lot1 -->
split(x){ 50 : A | 2 : split(x){~5 : B | ~10 : C}* | 50 : A | 1 : split(x){~10 : B | ~20 : C}* | 50 : A }*
A --> color(1,0,0) X.
B --> color(0,1,0) X.
C --> color(0,0,1) X.
Line 2: There are areas fixed at 50m at both ends and in the middle, and between them are areas divided by a 2:1 ratio.
Multi-Level Repeating Split Logic
The area with the ratio of 2 has been approximate-repeating split by 5 and 10, and the area with the ratio of 1 has been approximate-repeating split by 10 and 20.
Furthermore, the entire sequence is being repeating-split again.
The resulting pattern is shown below.
I believe it turned out exactly as you expected.
In the next session, we will learn how to split based on the percentage (%) ratio of the shape's size.
- Learn previous workflow in [025] How to Split Shapes Using Relative Ratios (~) in CityEngine
- Continue learning with [027] How to Use Absolute Percentage Splits (') in CityEngine CGA
Comments
Post a Comment
Feel free to leave a comment if you have any questions about Global Mapper or CityEngine. I will get back to you with a sincere response as soon as possible. (Please note that all comments are moderated and manually approved to maintain a high-quality community. Promotional or spam content will not be published.)