# Guest room behind a wardrobe: a 3.45 x 3.00 m open space (ceiling 2.38 m) closed off as a guest room, in
# metres with the sizes written in cm (c). The owners' 1.90 m wardrobe, turned to face the corridor, makes
# most of the partition; a 90 cm sliding door runs behind its back on a rail, and a fixed glazed panel in a
# steel frame fills the last 65 cm to the wall. Inside, 3.45 x 2.40 m clear: a 2 m sofa bed (1.40 open),
# a 100 x 50 desk under the window, a low sideboard. The right wall is cut at 0.6 m to look in.
# x: 0 = left wall; y: 0 = the partition line, the corridor below it.
units("m")
c = 0.01
H = 238
plaster = "#f1eee8"
steel = "#2b2b2e"

def wall(x0, y0, x1, y1, z0=0, z1=H, name="wall", color=plaster):
    return box((x1 - x0) * c, (y1 - y0) * c, (z1 - z0) * c, at=(x0 * c, y0 * c, z0 * c), name=name, color=color)

box(3.65, 4.3, 0.05, at=(-0.1, -1.2, -0.05), name="floor", color="oak planks")
back = wall(-10, 300, 355, 310, name="back wall")
wall(-10, -120, 0, 300, name="left wall")
wall(345, -120, 355, 300, 0, 60, name="right wall (cut)")
window(w=110, h=110, panes=2, at=(0.30, 3.01, 1.0), wall=back)

# ---- the partition line: wardrobe facing the corridor | sliding door | fixed glass ----
wd = wardrobe(w=190, d=60, h=236, at=(0, 0, 0))
yb = wd.max[1]
box(0.93, 0.04, 2.08, at=(0.97, yb + 0.01, 0), name="sliding door (open)", color="#e6dcc8")
box(1.86, 0.06, 0.05, at=(0.97, yb, 2.1), name="door rail", color=steel)
wall(190, 0, 280, 5, 215, H, name="over the door")
fr = box(0.03, 0.05, 2.38, at=(2.8, 0, 0)) + box(0.03, 0.05, 2.38, at=(3.42, 0, 0)) + box(0.65, 0.05, 0.04, at=(2.8, 0, 0)) + box(0.65, 0.05, 0.04, at=(2.8, 0, 2.34))
fr.name = "glass frame"
fr.paint(steel)
box(0.59, 0.02, 2.3, at=(2.83, 0.015, 0.04), name="fixed glass", color="#cfe3ea")

# ---- the guest room, 3.45 x 2.40 clear ----
sofa(w=200, d=95, at=(0, 0.72, 0), turn=90)
box(0.45, 2.0, 0.004, at=(0.95, 0.72, 0), name="bed open to 140", color="#e9e2d2")
top = box(1.0, 0.5, 0.03, at=(1.75, 2.5, 0.72), name="desk", color="oak")
for x in [1.75, 2.72]:
    box(0.03, 0.5, 0.72, at=(x, 2.5, 0), name="desk side", color="oak")
chair(w=45, d=50, at=(2.02, 1.93, 0), turn=180)
sideboard(w=120, d=40, h=75, at=(3.0, 1.2, 0), turn=270)

# ---- notes ----
dim((0, 0, H * c), (1.9, 0, H * c), offset=0.25, text="1.90")
dim((1.9, -0.25, 0), (2.8, -0.25, 0), offset=0.001, text="90")
dim((2.8, -0.25, 0), (3.45, -0.25, 0), offset=0.001, text="65")
dim((1.4, 1.72, 0), (3.05, 1.72, 0), offset=0.001, text="1.65")
dim((3.55, 0.6, 0.6), (3.55, 3.0, 0.6), offset=0.2, text="2.40")
label("wardrobe, doors to the corridor", at=(0.95, -0.55, 1.6), to=(0.95, 0, 1.3))
label("sliding door", at=(2.35, -0.75, 0.9), to=(2.35, 0, 1.0))
label("fixed glass panel", at=(3.5, -0.75, 1.9), to=(3.12, 0, 1.6))
label("sofa bed 200, opens to 140", at=(0.7, 1.72, 1.15))
label("desk 100 x 50", at=(2.25, 2.75, 1.25))
label("corridor", at=(0.55, -1.0, 0.05))
