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.

Related

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))
Inner rectangle aligned to scope

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}
Inner rectangle aligned to edge

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)
Mass volumes in planar lots

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 }
Mass volumes with separate scopes

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)
Mass volumes aligned to world axis

In this topic