# Narrow bathroom with niches: a 400 x 127 cm bathroom whose long wall has two 26 cm deep niches (158 and
# 62 cm wide) either side of a 25 cm load-bearing column, in metres. Its owner's layout checked: a 100 x 70
# shower tray in the 158 niche sticks out 44 cm into the room and leaves 83 cm in front of it; a wall-hung
# WC and bidet on the 140 cm wall leave 73 cm; a 26 cm cabinet beside the shower sits flush with the column;
# the basin in the 62 niche leaves 107 cm. A sliding shower door is drawn, as a swinging one would block
# the way. The long wall with the niches is full height; the others are cut low to look in.
# x: 0 = window wall, 4.00 = door wall; y: 0 = the long plain wall, 1.27 = the niche wall's face.
units("m")
WALL, CAB, WH, GLASS = "#f1eee8", "#e8e4dc", "#f4f2ee", "#9ec3d6"
TILE = "#e9e7e2 tile"
H = 2.4

def door_in(x, y, turn, w, open, hinge, swing, color):
    t = door(w=w, h=210, turn=turn, open=open, hinge=hinge, swing=swing, at=(0, 0, 0))
    fx, fy = t.part("frame top").min[0], t.part("frame top").min[1]
    t.delete()
    return door(w=w, h=210, turn=turn, open=open, hinge=hinge, swing=swing, color=color, at=(x - fx, y - fy, 0))

# floor: 400 x 127, plus the 26 cm niches
box(4.0, 1.27, 0.05, at=(0, 0, -0.05), name="floor", color=TILE)
box(1.58, 0.26, 0.05, at=(1.40, 1.27, -0.05), name="floor of the 158 niche", color=TILE)
box(0.62, 0.26, 0.05, at=(3.23, 1.27, -0.05), name="floor of the 62 niche", color=TILE)

# the long wall with the niches (full height), the others cut
box(1.55, 0.41, H, at=(-0.15, 1.27, 0), name="wall 140", color=WALL)
box(1.58, 0.15, H, at=(1.40, 1.53, 0), name="back of the 158 niche", color=WALL)
box(0.25, 0.41, H, at=(2.98, 1.27, 0), name="load-bearing column 25", color=WALL)
box(0.62, 0.15, H, at=(3.23, 1.53, 0), name="back of the 62 niche", color=WALL)
box(0.30, 0.41, H, at=(3.85, 1.27, 0), name="wall", color=WALL)
box(4.3, 0.15, 0.3, at=(-0.15, -0.15, 0), name="long wall (cut)", color=WALL)
box(0.15, 1.27, 1.0, at=(-0.15, 0, 0), name="window wall (cut)", color=WALL)
box(0.15, 0.7, 0.03, at=(-0.15, 0.25, 1.0), name="window", color=GLASS)
box(0.15, 0.55, 1.0, at=(4.0, 0.72, 0), name="door wall (cut)", color=WALL)
door_in(4.025, 0.04, 90, 68, 90, "right", "in", WH)

# wall-hung WC and bidet on the 140 wall
def wall_hung(x, name):
    box(0.36, 0.54, 0.22, at=(x, 0.73, 0.2), name=name, color="#f4f4f2")
    box(0.36, 0.5, 0.02, at=(x, 0.75, 0.42), name=name + ", seat", color="#ffffff")
wall_hung(0.25, "wall-hung WC")
wall_hung(0.83, "wall-hung bidet")

# shower 100 x 70 in the 158 niche, the 26 cm cabinet beside it flush with the column
box(1.0, 0.7, 0.05, at=(1.40, 0.83, 0), name="shower tray 100 x 70", color="#f4f4f2")
box(0.01, 0.44, 2.0, at=(2.39, 0.83, 0.05), name="side glass", color=GLASS)
box(0.5, 0.01, 2.0, at=(1.40, 0.83, 0.05), name="fixed glass", color=GLASS)
box(0.5, 0.01, 2.0, at=(1.88, 0.82, 0.05), name="sliding panel", color=GLASS)
box(0.56, 0.26, 2.0, at=(2.42, 1.27, 0), name="cabinet 26 cm", color=CAB)

# basin in the 62 niche
washbasin(w=60, d=46, at=(3.24, 1.07, 0))

dim((2.0, 0, 0), (2.0, 0.83, 0), offset=0, text="83")
dim((0.43, 0, 0), (0.43, 0.73, 0), offset=0, text="73")
dim((3.54, 0, 0), (3.54, 1.07, 0), offset=0, text="107")
label("shower 100 x 70", at=(1.9, 1.2, 2.1))
label("cabinet 26", at=(2.7, 1.4, 2.05))
label("column 25", at=(3.1, 1.4, 2.45))
label("window", at=(-0.6, 0.6, 0))
label("WC", at=(0.43, 1.0, 0.5))
label("bidet", at=(1.01, 1.0, 0.5))
label("door", at=(4.5, 0.35, 0))
