# Tutorial Notes: 08 – Mass Modeling, Part 3, Critical Concepts

Some important takeaways from Tutorial 8, in no particular order.

The geometry.area() Function:

In Figure 1, we have retrieved area figures for the ten numbered lots using the geometry.area( ) function. The code immediately below the figure assigns building height ranges to parcels based on their size: buildings over 50 meters tall will appear only on three of the lots in the figure.

• ```attr height =
case geometry.area < 1000: rand(20,50)
else: rand(50,150)```

The geometry.isRectangular Function

• Change roughly 20 percent of base model shapes from rectangular to cylindrical. The (20) parameter has little effect; it is the 20% parameter that determines the percentage of affected shapes.
```Envelope -->
case geometry.isRectangular(20):
20% : i("cyl.obj") RecursiveSetbacks
else: RecursiveSetbacks
else: RecursiveSetbacks```

Apply attributes in percentages

• Half of the shapes using this attribute will be assigned a value of 0.4; the other half will be assigned a value of 0.6.
• `whatever = 50%: 0.4 else: 0.6`

Reorient shapes by rotating a percentage of scopes

• Half of the L-shapes will be rotated 90 degrees on their y-axes
• ```LShape -->
50% : shapeL(wingWidth, wingWidth) { shape : LFootprint }
else : rotateScope(0, 90, 0)
shapeL(wingWidth, wingWidth) { shape : LFootprint }```

Use conditional logic to determine which rules are applied

• ```LUShapes -->
case geometry.isRectangular(15):
case scope.sx > scope.sz :
60%  :UShape
else : LShape
else: LShape
else: BasicFootprint```

Recursive rules can apply as long as certain parameters are met

• ```attr floorheight = 5

RecursiveSetbacks -->
case scope.sy > 2 * floorheight :
split(y){ 'lowHeight : Mass | ~1: Setback }
else: s('1, floorheight, '1) Mass

Setback -->
s('scale, '1, 'scale) center(xz)
RecursiveSetbacks
```

We are introduced to the setback(setbackDistance) operation and its various parameters including street. *** and remainder for creating setbacks between the street and structures on lots.  In Figure 2, the setback is created along street front using the street.front property in the code below.

• ```/**
* File: setbackExperiment.cga
* Created: 3 Apr 2017 21:25:02 GMT
*/

version "2016.1"

attr distance = 10

attr height =
case geometry.area > 1000: rand(10, 20)
else: rand(5, 10)

attr distanceStreet =
20%: 10
else: rand(4, 6)

attr distanceBuildings =
30%: 0
else: rand(4, 8)

Lot --> Parcel

LotInner --> OpenSpace

Parcel -->
setback(distanceStreet)
{ street.front: OpenSpace
| remainder: SubParcel }

SubParcel -->
setback(distanceBuildings / 2)
{ noStreetSide: OpenSpace
| remainder: Footprint }

Footprint --> extrude(height)

OpenSpace --> color("#77ff77")
```