Skip to main content

Rect

Rect is an axis-aligned rectangle. Drawn rectangles from std::layout::rect and construction rectangles from std::layout::crect both have this type.

Fields​

FieldTypeDescription
x0FloatLeft edge.
y0FloatBottom edge.
x1FloatRight edge.
y1FloatTop edge.
wFloatWidth, x1 - x0.
hFloatHeight, y1 - y0.
layerStringLayer name. A construction rectangle may have none.

How the fields relate​

Give any combination of edges and sizes that pins the rectangle down, and the solver derives the rest:

let r = std::layout::rect("met1", x0=10., y0=20., w=100., h=80.);
eq(r.x1, 110.);
eq(r.y1, 100.);

Arguments such as x0 are constraints. Arguments such as x0i are initial values for whatever is left free.