The class Compound | The Document and Graphics Classes | The Undo Mechanism

## The class `Rectangle`

The class `Rectangle` represents the drawing primitive of a parallelogram with optional rounded corners. When drawn interactively the object is an axis aligned rectangle. After applying affine transformations the rectangle may not be a rectangle anymore, but it will remain a parallelogram.

In Sketch, a rectangle is represented by the affine transformation necessary to map the unit square (opposite corners (0, 0) and (1, 1)), to the parallelogram. This is an elegant and convenient but also somewhat unusual representation.

The transformation is of course stored as a transformation object.

The rounded corners are defined by two floating point numbers `radius1` and `radius2`. Both numbers define a radius of the ellipses that make up the rounded corners of the unit square, `radius1` defines the horizontal radius and `radius2` the vertical radius. Valid values lie in the range 0.0 <= radius1,radius2 <= 0.5.

The class Compound | The Document and Graphics Classes | The Undo Mechanism