# Kitchen-diner in a Victorian terrace: the back of an 1890s mid-terrace house from the architect's plan, in
# metres with the plan's sizes in mm (m). The kitchen fills the 1.8 m side strip (the hob on the side wall,
# the sink across its end), the wall to the rear room is taken out over 3 m for an island with two stools,
# the dining table sits in the neck by the courtyard doors, the garden room with sliding doors is beyond.
# The wet room and utility are drawn as closed blocks. Checked: 900 mm round the island on the kitchen
# sides, 837 to the larder, and the 772 mm gap between the chimney pier and the table's chairs.
# The courtyard side is cut low to look in. x: 0 = the strip's outer wall; y: 0 = the main house.
units("m")
m = 0.001
H = 2400
plaster, fronts, top, isl = "#f1eee8", "#e8e4dc", "#9fa3a4", "#71807b"
CH = 91

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

box(5.605, 9.772, 0.1, at=(-0.15, -0.3, -0.1), name="floor", color="oak planks")
# the side strip's outer wall, the wet room and utility as one closed block, the pier that stays
wall(-150, 0, 0, 4037, name="side wall")
wall(-150, 4037, 1796, 5904, name="wet room")
wall(-150, 5904, 2146, 9172, name="utility")
wall(1796, 3928, 2146, 5904, name="pier")
wall(2146, 4780, 2451, 5588, name="pier, chimney side")
box(0.034, 0.56, 2.04, at=(2.146, 5.96, 0), name="utility door (frosted glass)", color="#cfd8d8")
# the wall to the main house: double doors from the strip, the stub, the larder, the door to the hall
wall(-150, -300, 117, 0, name="house wall")
wall(117, -300, 1176, 0, 2050, H, name="over the double doors")
wall(1176, -300, 4203, 0, name="house wall 2")
wall(4203, -300, 5056, 0, 2050, H, name="over the hall door")
wall(5056, -300, 5100, 0, name="house wall 3")
wall(1796, 0, 2146, 916, name="wall stub")
box(1.742, 0.916, 2.2, at=(2.146, 0, 0), name="larder", color=fronts)
# the courtyard side, cut low to see in; the French doors' threshold
wall(5100, -300, 5400, 2743, 0, 600, name="courtyard wall (cut)")
wall(5100, 3928, 5400, 5562, 0, 600, name="courtyard wall (cut) 2")
wall(5155, 5562, 5455, 9172, 0, 600, name="garden room wall (cut)")
box(0.3, 1.185, 0.04, at=(5.1, 2.743, 0), name="French doors (courtyard)", color="#b9a888")
# the garden end: sliding doors
gw = wall(-150, 9172, 5455, 9472, name="garden wall")
window(w=300, h=215, panes=3, at=(2.19, 9.2, 0.02), wall=gw)

# ---- the strip: units on the side wall (hob), the sink run across its end ----
y = 987
for w, kind in [(45, "doors"), (60, "dishwasher"), (60, "hob_oven"), (80, "drawers")]:
    base_unit(w=w, d=60, h=CH, kind=kind, color=fronts, top=top, at=(0, y * m, 0), turn=90)
    y = y + w * 10
box(0.6, 0.6, 0.87, at=(0, 3.437, 0), name="corner unit", color=fronts)
box(0.6, 0.6, 0.04, at=(0, 3.437, 0.87), name="corner top", color=top)
x = 600
for w, kind in [(100, "sink"), (19, "doors")]:
    u = base_unit(w=w, d=60, h=CH, kind=kind, color=fronts, top=top, at=(x * m, 3.3, 0))
    u.move(0, 4.037 - u.max[1], 0)
    x = x + w * 10

# ---- the island 2.63 x 0.81, two stools on the sink side ----
x = 1560
for kind in ["drawers", "doors", "drawers", "doors"]:
    base_unit(w=60, d=60, h=CH, kind=kind, worktop=False, color=isl, at=(x * m, 1.771, 0))
    x = x + 600
box(2.631, 0.808, 0.04, at=(1.509, 1.751, 0.87), name="island top", color=top)
for x in [2900, 3600]:
    bar_stool(w=40, h=65, at=(x * m, 2.6, 0))

# ---- the neck: table 1.53 x 0.81, a bench on the wall, three chairs ----
dining_table(w=153, d=81, h=75, at=(3.754, 4.018, 0), turn=90)
box(0.377, 1.526, 0.45, at=(4.69, 4.018, 0), name="bench", color="oak")
for y in [4250, 4900]:
    chair(w=45, d=50, at=(3.23, y * m, 0), turn=90)
chair(w=45, d=50, at=(3.935, 3.5, 0), turn=180)

# ---- the garden room: two armchairs by the doors, the tall coffee unit ----
armchair(at=(2.2, 8.15, 0), turn=90)
a2 = armchair(at=(4.0, 8.15, 0), turn=270)
a2.move(5.14 - a2.max[0], 0, 0)
for y in [6736, 7336]:
    tall_unit(w=60, d=60, h=215, kind="larder", color=fronts, at=(2.146, y * m, 0), turn=90)

# ---- notes ----
dim((0.602, 2.3, 0), (1.509, 2.3, 0), offset=0.001, text="900")
dim((1.75, 2.559, 0), (1.75, 3.437, 0), offset=0.001, text="900")
dim((3.0, 0.916, 0), (3.0, 1.751, 0), offset=0.001, text="837")
dim((2.451, 5.0, 0), (3.23, 5.0, 0), offset=0.001, text="772")
label("French doors from the courtyard", at=(6.3, 3.3, 0.3))
label("hall", at=(4.63, -0.7, 0.3))
label("main house", at=(0.65, -0.8, 0.3))
label("larder", at=(3.0, 0.45, 2.3))
label("wet room, utility", at=(0.9, 6.3, 2.5))
label("garden room, sliding doors", at=(3.7, 7.6, 0.2))
label("hob", at=(0.3, 2.34, 1.5), to=(0.3, 2.34, 0.92))
label("sink", at=(1.1, 3.75, 1.6), to=(1.1, 3.75, 0.92))
