# innerRectangle operation

### Syntax

• innerRectangle( alignment) { selector operator operations | ... }

### Parameters

1. alignmentselector
• scope—The largest inner rectangle is found that has sides parallel to the scope's axes.
• edge—The largest inner rectangle is found that has a side parallel to one edge. Per outer polygon/hole, only edges with length greater than quarter the maximum length are considered.
The resulting shape is a rectangle seen from the predominant scope axis of the face normal. The scope's orientation is the same as in the initial shape.
2. selectorselector
• shape—The inner rectangle polygon.
• remainder—Selects the remainder of the polygon.
3. operator
The operator defines how the inner rectangle polygons are used to generate successor shapes. This also applies to shapes with more than one faces.
• : Each polygon is put into a new shape.
• = All polygons corresponding to the selector are combined into one new shape.
4. operations
A sequence of CGA operations to execute.

### Description

The innerRectangle operation finds for each face of the current shape's geometry the largest rectangle which is fully inside the face.

##### Note:

The face must not have self-intersections.

### Examples

#### Inner Rectangles of Lot Shapes

 This example shows the largest inner rectangle aligned to the scope axes. Each polygon is a separate shape.``````Lot--> innerRectangle(scope) {shape : Color | remainder : Color} Color--> color(rand(1),rand(1),rand(1))`````` This example shows the largest inner rectangle aligned to one edge. All polygons corresponding to the remainder are combined into one shape.``````Lot--> innerRectangle(edge) {shape : Color | remainder = Color}`````` This example shows how to use innerRectangle to place mass volumes in planar lots. Each rectangle has sides parallel to the scope axes.``````Lot--> innerRectangle(scope) { shape : Extrude | remainder : Color } Extrude--> extrude(5) Color--> color(0,1,0)`````` In this example the component split is used to generate a separate scope for each slanting face. Each generated inner shape is a rectangle seen from the face normal.``````Lot--> comp(f) { all : Rectangle } Rectangle--> innerRectangle(scope) { shape : Extrude | remainder : Color }`````` When the scope is aligned to the world coordinate system each inner shape is a rectangle seen from the world's y axis.``````Lot--> alignScopeToAxes() innerRectangle(scope) { shape : Extrude | remainder : Color } Extrude--> extrude(world.up.flatTop, 10)``````