geometry

Import it with @use:geometry, then call its constructs under that name.

Pack
Five figures on one plane: a blue triangle lettered A, B and C, an orange right-angled triangle with its square marked, a shaded teal sector with its angle marked θ, a purple hexagon, and a grey circle with a red tangent at the end of its radius.Five figures on one plane: a blue triangle lettered A, B and C, an orange right-angled triangle with its square marked, a shaded teal sector with its angle marked θ, a purple hexagon, and a grey circle with a red tangent at the end of its radius.
@use:geometry

#Constructs

geometry.triangle-abc
A triangle from its three vertices, with the corners lettered. The letters are what this is for: polygon draws the outline in one line already, and then every figure wants three dots and three letters placed beside them without landing on the sides. Each letter is a point's label, so the graph's own label layout keeps it clear of the ink.
A blue triangle with a dot at each corner, the corners lettered A, B and C.A blue triangle with a dot at each corner, the corners lettered A, B and C.
ax
Corner A's x coordinate.
Default0
ay
Corner A's y coordinate.
Default0
bx
Corner B's x coordinate.
Default4
by
Corner B's y coordinate.
Default0
cx
Corner C's x coordinate.
Default1
cy
Corner C's y coordinate.
Default3
a-label
Corner A's label.
inline
Default$A$
b-label
Corner B's label.
inline
Default$B$
c-label
Corner C's label.
inline
Default$C$
fill-style
How the triangle's interior is filled — outlined leaves it empty.
enum
Defaultoutlined
opacity
The fill's opacity, from 0 to 1.
Default1
colour
The outline, fill and corner points' colour.
paint
Defaultblue
geometry.right-triangle
A right-angled triangle standing on its corner, the square marked and each side labelled — the figure trigonometry is taught on. The legs are LENGTHS rather than opposite corners: a runs right from the corner and b runs up from it, so the right angle is where the two meet and cannot be put anywhere else. The sides are drawn as three segments rather than as one polygon because each one carries a label, and a label belongs to the side it names.
A blue right-angled triangle with the right angle marked by a square, its sides labelled adjacent, opposite and hypotenuse.A blue right-angled triangle with the right angle marked by a square, its sides labelled adjacent, opposite and hypotenuse.
a
The length of the horizontal leg, running right from the right-angle corner.
Default4
b
The length of the vertical leg, running up from the right-angle corner.
Default3
x
The right-angle corner's x coordinate.
Default0
y
The right-angle corner's y coordinate.
Default0
a-label
The horizontal leg's label.
inline
Default$a$
b-label
The vertical leg's label.
inline
Default$b$
c-label
The hypotenuse's label.
inline
Default$c$
colour
The three sides and the right-angle mark's colour.
paint
Defaultblue
geometry.pythagoras
The Pythagoras figure: a right triangle with a square drawn outward on each of its three sides, each square labelled with its area. The hypotenuse's square is the one nobody wants to work out by hand. Its far corners are the near ones displaced by the hypotenuse turned a quarter turn — (−a,b)(-a, b) becomes (b,a)(b, a) — which is why the figure comes out as four coordinates and not as a construction.
A right-angled triangle with a square drawn outward on each side: a blue square labelled a² below, a green one labelled b² to the left, and a larger orange one labelled c² on the hypotenuse.A right-angled triangle with a square drawn outward on each side: a blue square labelled a² below, a green one labelled b² to the left, and a larger orange one labelled c² on the hypotenuse.
a
The length of the horizontal leg, running right from the right-angle corner.
Default4
b
The length of the vertical leg, running up from the right-angle corner.
Default3
x
The right-angle corner's x coordinate.
Default0
y
The right-angle corner's y coordinate.
Default0
a-label
The square on side aa's area label.
inline
Default$a^2$
b-label
The square on side bb's area label.
inline
Default$b^2$
c-label
The square on the hypotenuse's area label.
inline
Default$c^2$
a-colour
The square on side aa's colour.
paint
Defaultblue
b-colour
The square on side bb's colour.
paint
Defaultgreen
c-colour
The square on the hypotenuse's colour.
paint
Defaultorange
colour
The triangle's own sides and right-angle mark's colour.
paint
Defaultneutral
geometry.regular-ngon
A regular polygon of any number of sides, about a centre. Drawn side by side with @for, because a series is text the compiler reads in one piece and a loop generates elements rather than entries: the last side closes the shape because its far corner is the turn come all the way round. turn rotates the whole figure — a square at 45° stands on a corner, and at 0° it sits flat. It also derives its interior angle, so a lesson can state the number beside the figure without writing it twice: name the call and read #id.interior. The angles read sides and nothing else, which is what lets them be worked out as the document compiles — sides drives the @for, so it is a compile-time position that can never hold a value waiting on the reader, whereas radius and turn are parametised and so are not arithmetic the compiler can finish. The lengths go through the first side the figure draws instead, which follows a slider on radius.
Three regular polygons side by side: a teal square, a pentagon standing on a side and a purple hexagon.Three regular polygons side by side: a teal square, a pentagon standing on a side and a purple hexagon.
sides
How many sides the polygon has.
Default6
radius
The distance from the centre to each corner.
Default3
cx
The centre's x coordinate.
Default0
cy
The centre's y coordinate.
Default0
turn
The rotation of the whole figure, in degrees — a square at 45° stands on a corner.
Default0
width
The sides' line width.
Default2
colour
The sides' colour.
paint
Defaultpurple
geometry.midpoint
The point halfway between two others, lettered, with the segment it halves drawn behind it. The segment is drawn as its two HALVES so that ticks can mark them equal: one tick on each is the notation for "these two lengths are the same", and it is the whole reason a midpoint is worth marking rather than stating.
A teal segment with its midpoint dotted and labelled M, one tick on each half marking them equal.A teal segment with its midpoint dotted and labelled M, one tick on each half marking them equal.
x1
The first end's x coordinate.
Default0
y1
The first end's y coordinate.
Default0
x2
The second end's x coordinate.
Default4
y2
The second end's y coordinate.
Default2
ticks
How many tick marks show on each half of the segment, marking them equal.
Default1
label
The midpoint's label.
inline
Default$M$
colour
The segment and midpoint's colour.
paint
Defaultteal
geometry.perpendicular-bisector
A segment, its midpoint, and the perpendicular bisector through it — the locus of the points equidistant from the two ends. The bisector runs length either side of the midpoint along the segment's normal, which is the segment turned a quarter turn and divided by its own length. Written out that division is the whole construct: it is what keeps the arms the length they were asked for however long the segment is.
A grey segment with its midpoint dotted and a dashed red line crossing it there at a right angle, the square marked.A grey segment with its midpoint dotted and a dashed red line crossing it there at a right angle, the square marked.
x1
The segment's first end, x coordinate.
Default0
y1
The segment's first end, y coordinate.
Default0
x2
The segment's second end, x coordinate.
Default4
y2
The segment's second end, y coordinate.
Default2
length
How far the bisector runs either side of the midpoint.
Default2
label
The bisector's label.
inline
Default
style
The bisector's stroke.
enum
Defaultdashed
colour
The original segment and its midpoint's colour.
paint
Defaultgrey
bisector-colour
The bisector and its right-angle mark's colour.
paint
Defaultred
geometry.circle-arc
An arc of a circle, from one bearing to another, both in degrees anticlockwise from the right. A parametric curve rather than a run of points: the arc is exact at every zoom, and there is no vertex count to pick. fill-style shades what the arc encloses on its own, which is the SEGMENT of the circle — the piece the chord between its ends cuts off. The slice from the centre is sector, because that region closes somewhere else. circle-arc rather than arc because a define may not take a library node's name, and arc is one — the great-circle overlay on the geo canvas.
A teal arc of a circle from 20° round to 160°, labelled s.A teal arc of a circle from 20° round to 160°, labelled s.
radius
The circle's radius.
Default3
from
The bearing the arc starts at, in degrees anticlockwise from the right.
Default0
to
The bearing the arc ends at, in degrees anticlockwise from the right.
Default90
cx
The circle's centre, x coordinate.
Default0
cy
The circle's centre, y coordinate.
Default0
width
The arc's line width.
Default2
fill-style
How the segment the arc cuts off with its chord is filled — outlined leaves it empty.
enum
Defaultoutlined
label
The arc's label.
inline
Default
colour
The arc's colour.
paint
Defaultteal
geometry.sector
A sector: the arc between two bearings and the two radii that close it, with the angle at the centre marked. fill-style shades the slice. The arc is drawn here rather than handed to circle-arc for exactly that reason: a sector's region closes through the CENTRE, and an arc left to itself closes across its own chord — which is a different shape and a different piece of the circle.
A shaded teal sector of a circle between 20° and 160°, closed by two radii, with the angle at the centre marked θ and its value shown.A shaded teal sector of a circle between 20° and 160°, closed by two radii, with the angle at the centre marked θ and its value shown.
radius
The circle's radius.
Default3
from
The bearing the sector starts at, in degrees anticlockwise from the right.
Default0
to
The bearing the sector ends at, in degrees anticlockwise from the right.
Default90
cx
The circle's centre, x coordinate.
Default0
cy
The circle's centre, y coordinate.
Default0
width
The arc and two radii's line width.
Default2
fill-style
How the sector is filled — outlined leaves it empty.
enum
Defaultoutlined
label
The angle at the centre's label.
inline
Default$\theta$
show-value
Show the angle's numeric value beside its label.
bool
Defaultfalse
colour
The sector's arc, radii and angle mark's colour.
paint
Defaultteal
geometry.circle-radius
A circle with its centre dotted and one radius drawn out to a bearing, labelled. size on the circle mark IS the radius, so the segment ends exactly on the circumference — which is the one thing a hand-written version of this figure tends to get wrong.
A grey circle with its centre dotted and one teal radius drawn out to the circumference, labelled r.A grey circle with its centre dotted and one teal radius drawn out to the circumference, labelled r.
radius
The circle's radius.
Default3
cx
The circle's centre, x coordinate.
Default0
cy
The circle's centre, y coordinate.
Default0
at
The bearing the radius is drawn out to, in degrees anticlockwise from the right.
Default40
label
The radius segment's label.
inline
Default$r$
fill-style
How the circle's interior is filled — outlined leaves it empty.
enum
Defaultoutlined
radius-style
The radius segment's stroke.
enum
Defaultsolid
colour
The circle outline and centre point's colour.
paint
Defaultgrey
radius-colour
The radius segment's colour.
paint
Defaultteal
geometry.tangent
A tangent touching a circle at a bearing, with the radius to the point of contact and the right angle between them — the circle theorem, drawn.
A grey circle with a radius labelled r out to a point T, and a red tangent line touching the circle at T, the right angle between them marked.A grey circle with a radius labelled r out to a point T, and a red tangent line touching the circle at T, the right angle between them marked.
radius
The circle's radius.
Default3
at
The bearing of the point of contact, in degrees anticlockwise from the right.
Default55
length
How far the tangent line runs either side of the point of contact.
Default3
cx
The circle's centre, x coordinate.
Default0
cy
The circle's centre, y coordinate.
Default0
fill-style
How the circle's interior is filled — outlined leaves it empty.
enum
Defaultoutlined
label
The point of contact's label.
inline
Default$T$
radius-label
The radius segment's label.
inline
Default$r$
colour
The circle outline and centre point's colour.
paint
Defaultgrey
tangent-colour
The tangent line, right-angle mark and point of contact's colour.
paint
Defaultred
geometry.unit-circle-point
The unit circle with one angle taken round it: the radius to the point, the cosine along the axis and the sine standing on it, each in its own colour. The two legs are what the figure is for — cos⁡θ\cos\theta is the distance across and sin⁡θ\sin\theta the distance up, and drawn in different colours they stop being two entries in a table.
The unit circle with a blue radius out to a point P at angle θ, an orange leg along the x axis labelled cos θ and a green leg standing up to P labelled sin θ.The unit circle with a blue radius out to a point P at angle θ, an orange leg along the x axis labelled cos θ and a green leg standing up to P labelled sin θ.
at
The angle taken round the circle, in degrees anticlockwise from the right.
Default55
radius
The circle's radius.
Default1
label
The point's label.
inline
Default$P$
angle-label
The angle at the centre's label.
inline
Default$\theta$
cos-label
The cosine leg's label, the segment along the axis.
inline
Default$\cos\theta$
sin-label
The sine leg's label, the segment standing on the axis.
inline
Default$\sin\theta$
colour
The point, its radius and the angle mark's colour.
paint
Defaultblue
cos-colour
The cosine leg's colour.
paint
Defaultorange
sin-colour
The sine leg's colour.
paint
Defaultgreen
geometry.parallel-cut
Two parallel lines cut by a transversal, with the corresponding angles marked at both crossings — the figure every angle rule is read off. The lower line is y=0y = 0 and the upper is y=y = gap; the transversal crosses the lower one at the origin and the upper one gap / tan along, which is where the second angle is marked. Both angles are measured from the same direction and labelled the same, because that is the claim the picture makes.
Two horizontal grey parallel lines cut by a purple transversal, the angle it makes with each line marked θ at both crossings.Two horizontal grey parallel lines cut by a purple transversal, the angle it makes with each line marked θ at both crossings.
gap
The vertical distance between the two parallel lines.
Default3
angle
The angle the transversal makes with the lines, in degrees.
Default55
span
How far each parallel line is drawn either side of the transversal.
Default10
label
Both marked angles' label.
inline
Default$\theta$
colour
The two parallel lines' colour.
paint
Defaultgrey
cut-colour
The transversal, its two marked angles and the two crossing points' colour.
paint
Defaultpurple

Last updated