I'll build a vector drawing app where every curve must be constructed via classical mechanical methods. Each curve is defined by its physical construction parameters (foci, pivots, constraints) — not by free control points.
Let me start by exploring the project and then planning the architecture.
Now let me update the HTML title and global styles, then build the app.
Now let me design the types and tool construction logic. This is the core of the app.
Now let me build the SVG canvas component.
Now let me build the Toolbar and ObjectPanel, then the main App.
Now the main App:
Now let me build and check for errors:
Build succeeded. Let me fix a couple of small issues I noticed — the linkage coupler curve shouldn't close with a weird connecting line when there are gaps, and I want to improve the overall UX. Let me also refine the linkage sampling:
Let me also fix the hyperbola rendering to properly split into two branches:
Let me add a nice serif font to give it a proper drafting-table aesthetic:
Let me add a small UX touch: if the Neusis solver finds no solution for the given distance, show feedback rather than silently failing:
Let me add a small welcome overlay for first-time users, to explain the app's philosophy:
Let me fix a bug — the SVG export would grab the toolbar icons instead of the canvas. Let me identify the canvas SVG with a data attribute:
The app is complete and building successfully. Let me do a final check on the file structure:
The app is complete. Here's a summary of what was built:
Mechanica — A Classical Vector Drawing Studio
A drafting-table-inspired vector drawing app where every curve must be constructed via a classical mechanical method. No freehand, no Bézier handles — only constructions that could be performed with physical instruments.
The Instruments (9 tools):
- Select — inspect existing constructions
- Ruler — straight edge between two points (Euclid's 1st postulate)
- Compass — circle pinned at a center, opened to a point (3rd postulate)
- Compass Arc — arc of a given circle between two points
- Ellipse (Pin & String) — two pins + taut string (the gardeners' method)
- Hyperbola (Pin & String) — with one pin "negative" (constant difference of distances)
- Parabola — focus + directrix line (equidistant locus)
- Four-bar Linkage — place four pivots and trace the beautiful coupler curve as the crank turns
- Neusis — slide a ruler of fixed length through a point so its ends touch two given lines (the "forbidden" construction)
Key design choices:
- Every curve is stored as its mechanical construction parameters (foci, pivots, directrix), not free control points
- Construction guides (strings, bars, radii, directrices) are rendered as subtle dashed lines and always visible
- Live preview during construction shows pins, strings, and ghost curves as you click
- Canvas uses a paper/cream background with a drafting grid, EB Garamond serif font for a classical feel
- Click to select curves; delete from the side panel; export as standalone SVG
- Neusis has a solver (bisection-based root finding) that can produce multiple solutions and shows feedback when none exist
Files created: types.ts, tools.ts (geometry + tool logic + solvers), Canvas.tsx (SVG rendering + live previews), Toolbar.tsx, ObjectPanel.tsx, and App.tsx.
Files built: index.html, src/types.ts, src/tools.ts, src/Canvas.tsx, src/Toolbar.tsx, src/ObjectPanel.tsx, src/App.tsx