Pictures of geometry
Geo computes; graphics draws. This page covers the pictures (tilings, solids, patterns, finite planes, constructions step by step) and how geo's exact plane meets graphics' exact plane.
tilingFigure("3.4.6.4"); // a patch of the rhombitrihexagonal tiling
tilingPatch("3.3.3.3.6", { radius: 6 }); // { ok, polygons, choices }: every inner vertex checked
solidPicture(solids.icosahedron()); // lit faces under a camera
wallpaperFigure(wallpaper.pattern("p6m", [["1/10", "1/5"]]));
incidenceFigure(fano()); // the Fano plane as its Levi graph
constructionFrames(c); // frames: one step of a construction each
toGraphics(point("1/2", "sqrt(3)/2")); // the same point in graphics, exactly
figureSVG(fig); // any of these as SVG (also PNG, PDF, TikZ, text)
Growing a tiling from its vertex type
A vertex type such as 3.4.6.4 says which regular polygons meet at every vertex, in order round it. tilingPatch(type) starts with one vertex at the origin, the polygons of the type placed round it, and grows outward. At each open vertex it asks which rotations and reflections of the type fit the polygons already there, in their angles and order. If exactly one does, the missing polygons are placed. If no way fits, or a polygon would overlap another, there is no such tiling. When every open vertex allows more than one way, the nearest takes the first one, and choices counts these choices; the chirality of the snub tilings is one. At the end every vertex well inside the patch is checked to have exactly the type round it.
Run over all 21 vertex types, growth succeeds for exactly the 11 that the parity argument leaves, and fails for the other 10: two independent arguments that agree. Coordinates are floats (edges of length 1), so the picture is marked estimated; the combinatorics are what is checked.
Solids, patterns and finite planes
solidPicture(p) draws a Polyhedron with its faces lit and coloured by their number of sides, in a box that keeps its proportions. wallpaperFigure(pattern) builds a basis from the pattern's Gram matrix, repeats the cell and colours the points by label: the pictures behind the 17 wallpaper groups. incidenceFigure(g) draws a finite geometry as its Levi graph: points on one side, lines on the other, an edge for each incidence. A projective plane of order has of each and edges at every vertex.
Constructions step by step
constructionFrames(c) turns a recorded construction into frames: each frame adds what one step made, in the highlight colour, with the step's text as its note. framesSVG plays them. geoFigure(items) draws points, lines, circles, segments, polygons and triangles together; it is exact when every coordinate is rational and estimated otherwise (the objects stay exact in geo).
Joining the two kernels
Graphics has exact plane geometry with coordinates in : numbers . Geo works with all real algebraic numbers, which it needs: the incentre of a triangle with rational vertices involves several square roots. toGraphics(x) moves a point, line, circle, polygon or triangle across exactly when each number in it is rational or quadratic: a quadratic number is a root of , so it is , with the sign that matches its value. Anything of higher degree is refused rather than rounded. fromGraphics goes the other way, so a figure can be built with graphics' tools and its theorems checked in geo.
| call | returns |
|---|---|
| tilingPatch(type, { radius }) | { type, ok, polygons, vertices, choices, reason? } |
| tilingFigure(type, { radius, view }) | A figure of the patch, or a refusal with the reason |
| solidPicture(polyhedron, { cam }) | A figure of the solid |
| wallpaperFigure(pattern, { cells }) | A figure of the pattern over cells |
| incidenceFigure(geometry) | The Levi graph as a figure |
| constructionFrames(construction) | Frames, one per step |
| geoFigure(items, { x, y }) | Geo objects in one figure |
| toSurd(x), toGraphics(x), fromGraphics(x) | The join with graphics' exact plane |
| figureSVG, figurePNG, figurePDF, figureTikZ, figureASCII, framesSVG, framesPNG | Drawing, from @ratmath/graphics |
@ratmath/geo and Core's Rational in scope. The last line's value is shown; PRINT(…) adds lines, TEX(…) typesets math.