Geometry Diagrams

Illustrated · 4 min

Howdy! The following is a basic guide for how to use our totally awesome geo feature! geo is a powerful tool built to allow Expii users to quickly draw diagrams for use in explaining geometric concepts or solving problems.

The first thing to remember is that you need to always start your diagrams with the tag <geo> and end them with

</geo>

**geo**'s default is a display view of $[-\sqrt2, \sqrt2]$. We can make points appear by specifying their Cartesian coordinates as follows:



<geo>
O = [0,0]
A = [1,1]
B = [-1,1]
C = [0.5,0]
D= [0.3,-1]
</geo>

Notice how the points automatically label themselves!


If you've ever done a geometry problem before, you've probably noticed that lots of things lie on the same circle. Odds are, computers are way better at doing boring calculations than you, so to save you the effort of figuring out exactly where these concyclic points go, **geo** has a convenient code for you: **cis**. cis(x) will create a point lying on the unit circle (the circle centered at (0,0) with radius one), rotated x degrees counterclockwise from the positive x-axis:
> A = cis 30
is the same as $A=(\cos 30^{\circ}, \sin 30^{\circ})$. The following picture demonstrates this, as well as the **unitcircle** command, which does exactly what you think it does.



<geo>
O=[0,0]
W = unitcircle
A= cis 45
B = cis -45
C= cis 180
D= [1,1]
</geo>

Points don't just exist by themselves, however. Geometers love connecting them with lines, so **geo** predictably comes with a feature enabling you budding geometers to do the same!

With **geo**, you can either draw the line through two points or the segment between them. The former is done with **two hyphens (A--B)** and the latter with **two periods (A..B)**. These lines/segments can be further modified by appending words: **colors** (possibilities include cyan, red, green, blue, gray, black, yellow, and orange) and **style** (dashed or dotted). If the color modifier is omitted, the line will be black; if the style modifier is omitted, the line will be a solid, unbroken one.



<geo>
O=[0,0]
W = unitcircle green
A= cis 45
B = cis -45
C= cis 180
D= [1,1]
A--B
B..C
O..B red
O..C orange dashed
D--O dotted
</geo>

**geo** can also draw more fancy, complicated points and lines. The standard triangle centers can all be easily created: **centroid**, **orthocenter**, **incenter**, **circumcenter**, **9ptcenter**. Points can be also be created at the **intersection** of two given lines, or you can **reflect** a given point over another point or line. Basic arithmetic operations can be done on the points (addition and subtraction, as well as multiplication/division by a scalar) -- the midpoint of A and B, is, for example, also given by **M=[A/2+B/2]**.

**geo** can also draw special lines and circles. For three given points, **circumcircle**, **incircle**, and **9ptcircle** all construct these circles for the triangle the points form. **circle** creates the circle centered at one given point, going through the other. We can construct the **perpendicular** through a point to a line, and the **foot** of that perpendicular. We can also draw the **triangle** containing three points, or more generally, a **path** of segments connecting arbitrarily many points (this path can be **closed**).

These diagrams get awfully complicated; sometimes when we draw them all the lines and circles cover up a point's label. We can manually rotate that label though by appending the command **R#** (for some number #), placing the label at an angle # degrees from the horizontal (compare where the label of the incenter in the following diagram lands with and without the command).



<geo>
A = cis 0
B = cis 80
C = cis 200
M = midpoint A B
O = [0,0]
I = incenter A B C R0
I = incenter A B C
K = [2*A/3+B/3]
w = incircle A B C green dashed
X = intersection w B..C
t = path A B C closed red
l = perpendicular A B..C
D = foot A B..C
Q = reflect A O
p = A--Q
Y = reflect B A--Q
c = circumcircle A B C
n = 9ptcircle A B C blue
m = circle M A dotted cyan
a = path B Q C Y closed yellow
</geo>

Last, but certainly not least, is the **wow** feature. Adding this command after creating a line segment or an angle will automatically generate tick marks when a pair of them have the same length/measure. Wow! If you want to a number (or any other label!) to show up, denoting the length of the segment, it can be inserted with quotation marks. The following diagram demonstrates labeling segments and using wow:


<geo>
A = [0, 0]
B = [0, 0.5]
C = [1, 0.25]
D = [1, 0.75]
A..B "3"R200 wow
C..D "3" wow
B..D "5"R280 wow
A..C "5"R280 wow
</geo>

A few of **geo**'s features don't fit neatly in the categories above, so they will be listed here.  We can draw **angle** arcs (and we can manually size these **arcs** if we want). Comments can be inserted with **//**. Sometimes things like circles intersect twice; if **geo** picks the wrong intersection, you can use the **other** command to make it pick the right one (or the **near** command to pre-empt the issue). If, for whatever reason, you want to define a point but not draw it, you can do that by replacing the = with **:=**.

This last diagram, courtesy of Evan Chen, highlights basically all of the features of **geo**. We hope you enjoy using **geo** to create beautiful pictures like these in your future explanations!


<geo>
A = cis 110
B = cis 210
C = cis 330
O = circumcenter A B C R50 // Manually position label at roughly 50 degrees. 2R50 would also double the distance from the label
M = midpoint B C
D = foot A B..C // B..C creates a segment BC
E = foot B C..A
F = foot C A..B

DEF = triangle D E F blue
ABC = triangle A B C red

H = [A+B+C] // complex arithmetic!
A..D
B..E
C..F
G = centroid ABC R60
O--H green dotted // Euler Line
A..M

W = circumcircle ABC // or just "unitcircle" :)
w = circumcircle D E F // or just "9ptcircle ABC"
N = 9ptcenter ABC R90

angle H B F green wow
angle H D F green wow
angle E D H green wow
angle E C H green wow

// You can also manually specify arc sizes:
angle B F D arcs 1.2 1.4 green wow
angle E F A arcs 1 2 3 green wow
angle F A H arcs 2 wow
angle O A C arcs 2 wow

// "other" intersection
K = intersection A--D W other
L = reflect A O
H..M orange wow
M..L orange wow
D..K
A..L dotted orange

perpline L A..K // line through L perp to AK

I := incenter ABC // don't actually draw I, just define it
X = intersection A--I W near D
Y = intersection B--I W near E
Z = intersection C--I W near F

path A Z B X C Y closed cyan
</geo>

Illustrated · 1 min

Drawing rays

Here's a trick to draw a ray in expii.

For example, we want to draw ray ABAB, then we construct an invisible point XX, such that when you join AA with XX, you'll reach the desired effect.

A = [-1,0]

B = [0, 0]

X = [10000, 0]

A..X cyan

(Code for diagram above. Insert < geo > and < /geo > tags. (without the spaces))

The reason this works is that the whole diagram is drawn in a 22×222\sqrt{2} \times 2\sqrt{2} square, with center (0,0)(0, 0). Consequently, if the absolute value of the xx or yy coordinate is greater than 2\sqrt{2}, the point becomes invisible, achieving the "ray effect".

Illustrated · 1 min

In geo, the default view is [−2,2][-\sqrt2, \sqrt2]. This is so that users can take advantage of the command

A = cis 110 which sets A=(cos⁡110∘,sin⁡110∘)A = (\cos 110^{\circ}, \sin 110^{\circ}).

Here's an example diagram that highlights most of the currently available features!

Illustrated · 1 min

Example (actual documentation is on the way):

<geo>
A = cis 40
B = cis 20
A--B
C = cis 270
B--C
C--A
angle A B C wow
D = [-0.5, 0.5]
E = [0.5, 0.5]
D--E
F = [-0.5, -0.6]
G = [0.5, -0.6]
F--G red dashed
E--F
angle D E F wow
angle G F E wow
X = cis 140
Y = cis 120
Z = cis 370
X..Y
Y--Z
angle X Y Z wow
</geo>

Diagram:

Type a concept, like “slope” or “photosynthesis”.

↑ ↓ to choose · Enter to openSearch explanations and problems