// Figures for Part III: the causal reference of Chapter 7 and the image
// lattice of Chapter 8.
import type { ReactElement } from 'react'
import { Arrowheads, Figure, Label, Node, arrow } from './svg.tsx'
import { faded, ink, method } from '../plot/palette.ts'
/** A larger grid, run for fewer steps than it is wide, is exact in the region. */
export function Causality() {
const cx = 250
const cy = 132
const r = 44
const e = 96
return (
)
}
/** The mirror rooms and image sources of a rectangular room, in plan. */
export function Images() {
const W = 120
const H = 72
const ox = 358 - 1.5 * W
const oy = 20
const xs = 0.3
const ys = 0.62
const xr = 0.72
const yr = 0.3
const rooms: ReactElement[] = []
const imgs: ReactElement[] = []
let chosen: [number, number] = [0, 0]
for (let a = -1; a <= 1; a++) {
for (let b = -1; b <= 1; b++) {
const x = ox + (a + 1) * W
const y = oy + (b + 1) * H
rooms.push(
,
)
// the image in room (a, b) is mirrored once for every odd index
const fx = a % 2 === 0 ? xs : 1 - xs
const fy = b % 2 === 0 ? ys : 1 - ys
const px = x + fx * W
const py = y + fy * H
if (a === 1 && b === 0) chosen = [px, py]
imgs.push(
,
)
}
}
const R: [number, number] = [ox + W + xr * W, oy + H + yr * H]
const S: [number, number] = [ox + W + xs * W, oy + H + ys * H]
// the path from the image in the right-hand room crosses the shared wall
const wx = ox + 2 * W
const t = (wx - chosen[0]) / (R[0] - chosen[0])
const hitY = chosen[1] + t * (R[1] - chosen[1])
return (
{rooms}
{imgs}
)
}