setbackToArea operation

Syntax

  • setbackToArea(area) { selector operator operations | ... }
  • setbackToArea(area, uvSet) { selector operator operations | ... }
  • setbackToArea(area, minDistances) { selector operator operations | ... }
  • setbackToArea(area, minDistances, uvSet) { selector operator operations | ... }
  • setbackToArea(area, minDistances, maxDistances) { selector operator operations | ... }
  • setbackToArea( area, minDistances, maxDistances, uvSet) { selector operator operations | ... }

Parameters

  1. areafloat
    The desired area of the setback remainder. Must be >0.
  2. minDistances, maxDistancesfloat[]
    An array containing setback distances separately for each face edge. The applied setback will be in this range.
  3. uvSet, selector, operator, operations
    All other parameters are the same as for the setback operation.

Description

The setbackToArea operation is similar to the setback operation. The difference is that setback distances are automatically chosen such that the remainder fulfills a given area.

If no minDistances are given the setback distances are chosen to be equal for each edge. If minDistances are specified then these distances are increased by a common offset such that area is satisfied. Optionally, maxDistances define maximum values for the applied distances.

The desired area cannot be achieved when the minimum distances are too large, the maximum distances are too small or the area of the current shape is smaller than the specified area.

Note:

The remainder depends on the setbacks of selected edges. If you are only interested in the remainder shape you still have to provide a setback selector:

setbackToArea(area) { all = NIL | remainder = X. }

Related

Examples

Setback to area

Left: A square shape with an area of 400 is setback to an area of 100. Right: A setback is performed such that all setback faces have an area of 300.

Left --> setbackToArea(100) { all      = NIL   |
                             remainder = Green }

Right --> setbackToArea(geometry.area - 300)
                            { all      = Green }
Square shape setback to area

A L-shaped setback to area 100 and 300.

attr area = 100

Lot --> setbackToArea(area) { front     = Blue  |
                              left      = Red   |
                              remainder = Green }
L-shaped setback to area

A setback to area 100 on the same shape at different scales.

Lot --> setbackToArea(100) { all       = Blue  |
                             remainder = Green }
setback to area 100

Lower and upper bounds

The setback to restricted by minimum and maximum distances (highlighted in red). Note that by passing the arrays to a parameterized Lot rule the comp function is evaluated only once per array.

attr area = 300

minDists = comp(fe) { all : rand(3)    }
maxDists = comp(fe) { all : rand(3, 6) }

ShowDists(dists) -->
    setback(dists) { all       = NIL |
                     remainder = 
                       comp(e) { all = Red } }

Lot --> Lot(minDists, maxDists) 

Lot(minD, maxD) -->
    ShowDists(minD)
    ShowDists(maxD)
    setbackToArea(area, minD, maxD)
                           { all       = NIL   |
                             remainder = Green }

In this topic