Examples Gallery¶
Complex geometric constructions and theorems demonstrating Geolet's capabilities.
Euler Line¶
The orthocenter (H), centroid (G), and circumcenter (O) of any triangle are collinear. This line is called the Euler line.
"""Euler line example - line through orthocenter, centroid, and circumcenter."""
from geolet import autofigure, line, point, triangle
@autofigure
def euler_line():
A = point(0, 0, "A", label_dir="SW")
B = point(6, 0, "B", label_dir="SE")
C = point(2, 5, "C", label_dir="N")
T = triangle(A, B, C)
# Orthocenter (intersection of altitudes)
H = T.orthocenter("H", label_dir="S", color="red")
# Centroid (intersection of medians)
G = T.centroid("G", label_dir="S", color="blue")
# Circumcenter (intersection of perpendicular bisectors)
O = T.circumcenter("O", label_dir="S", color="green")
# Euler line through H and O (also passes through G)
euler = line(H, O, color="purple", style="dashed")
Nine-Point Circle¶
The nine-point circle (also called the Euler circle or Feuerbach circle) passes through nine significant points of a triangle:
- The midpoints of the three sides
- The feet of the three altitudes
- The midpoints of the segments from the vertices to the orthocenter
"""Nine-point circle (Euler circle / Feuerbach circle).
Given triangle ABC with altitudes AD, BE, and CF. Let H be the orthocenter of
triangle ABC. Let MA, MB, and MC be the midpoints of sides BC, CA, and AB
respectively. Let HA, HB, and HC be the midpoints of segments AH, BH, and CH.
Prove that these nine points lie on a single circle:
D, E, F, MA, MB, MC, HA, HB, HC.
The nine points are:
- D, E, F: feet of the altitudes
- MA, MB, MC: midpoints of the sides
- HA, HB, HC: midpoints from vertices to orthocenter
"""
from geolet import (
autofigure,
circumcenter,
circumcircle,
foot,
midpoint,
orthocenter,
point,
segment,
)
@autofigure
def nine_point_circle():
# Triangle vertices
A = point(0, 4, "A", label_dir="N")
B = point(-1, 0, "B", label_dir="SW")
C = point(5, 0, "C", label_dir="SE")
# Triangle sides
seg_ab = segment(A, B)
seg_bc = segment(B, C)
seg_ca = segment(C, A)
# Orthocenter H
H = orthocenter(A, B, C, "H", label_dir="S")
# Circumcenter O of triangle ABC (defined early for declaration order)
O = circumcenter(A, B, C, "O", label_dir="N", color="red")
# Center of nine-point circle O_9 is the midpoint of O and H
O_9 = midpoint(O, H, "O_9", label_dir="N", color="blue")
# Feet of altitudes (D, E, F)
D = foot(A, seg_bc, "D", label_dir="S") # Foot from A to BC
E = foot(B, seg_ca, "E", label_dir="NE") # Foot from B to CA
F = foot(C, seg_ab, "F", label_dir="NW") # Foot from C to AB
# Midpoints of sides (MA, MB, MC)
MA = midpoint(B, C, "M_A", label_dir="S") # Midpoint of BC
MB = midpoint(C, A, "M_B", label_dir="NE") # Midpoint of CA
MC = midpoint(A, B, "M_C", label_dir="NW") # Midpoint of AB
# Midpoints from vertices to orthocenter (HA, HB, HC)
HA = midpoint(A, H, "H_A", label_dir="E") # Midpoint of AH
HB = midpoint(B, H, "H_B", label_dir="W") # Midpoint of BH
HC = midpoint(C, H, "H_C", label_dir="E") # Midpoint of CH
# Show O_9 is midpoint of O and H with equal length segments
seg_o_o9 = segment(O, O_9, color="purple", marks=1) # O to O_9
seg_o9_h = segment(O_9, H, color="purple", marks=1) # O_9 to H
# The nine-point circle passes through all nine points
# We can define it using any three of them
nine_pt_circle = circumcircle(D, E, F, color="blue", style="dashed")
IMO 2025 Problem 2¶
A complex geometry problem from the International Mathematical Olympiad, showcasing circles, circumcenters, tangent lines, and parallel lines.
"""IMO 2025 Problem 2 - Circles, circumcenters, and tangent lines.
Let Ω and Γ be circles with centres M and N, respectively, such that the
radius of Ω is less than the radius of Γ. Suppose Ω and Γ intersect at two
distinct points A and B. Line MN intersects Ω at C and Γ at D, so that
C, M, N, D lie on MN in that order. Let P be the circumcentre of triangle ACD.
Line AP meets Ω again at E ≠ A and meets Γ again at F ≠ A. Let H be the
orthocentre of triangle PMN.
Prove that the line through H parallel to AP is tangent to the circumcircle
of triangle BEF.
Proposed by Trần Quang Hùng, Vietnam
"""
from geolet import (
autofigure,
circle,
circumcenter,
circumcircle,
intersection,
line,
orthocenter,
parallel,
point,
segment,
)
@autofigure
def imo_2025_p2():
# Circle centers
M = point(0, 0, "M", label_dir="SW")
N = point(3, 0, "N", label_dir="SE")
# Circles Ω (blue, radius 2) and Γ (green, radius 2.5)
omega = circle(M, 2.0, color="blue")
gamma = circle(N, 2.5, color="green")
# A, B: intersection points of Ω and Γ
A = intersection(omega, gamma, "A", index=0, label_dir="N")
B = intersection(omega, gamma, "B", index=1, label_dir="S")
# Line MN for intersections (underscore prefix to exclude from drawing)
_line_mn_path = line(M, N)
# C: line MN intersects Ω (left of M)
# D: line MN intersects Γ (right of N)
C = intersection(omega, _line_mn_path, "C", index=1, label_dir="W")
D = intersection(gamma, _line_mn_path, "D", index=0, label_dir="E")
# P: circumcenter of triangle ACD
P = circumcenter(A, C, D, "P", label_dir="W")
# Circumcircle of triangle ACD (center P)
circle_acd = circumcircle(A, C, D, color="purple", style="dashed")
# Line AP (extended) - needed for E, F intersections
line_ap = line(A, P, color="purple", style="dashed")
# E: line AP meets Ω again at E ≠ A (index 1 to get second intersection)
E = intersection(omega, line_ap, "E", index=1, label_dir="NW")
# F: line AP meets Γ again at F ≠ A (index 1 to get second intersection)
F = intersection(gamma, line_ap, "F", index=1, label_dir="S")
# H: orthocenter of triangle PMN
H = orthocenter(P, M, N, "H", label_dir="E")
# Triangle PMN
seg_pm = segment(P, M)
seg_mn = segment(M, N)
seg_np = segment(N, P)
# Line MN (shown as segment C--D)
line_mn = segment(C, D, style="dashed")
# Triangle ACD
seg_ac = segment(A, C)
seg_cd = segment(C, D)
seg_da = segment(D, A)
# Circumcircle of BEF (the key circle for the theorem)
circle_bef = circumcircle(B, E, F, color="red")
# Tangent line: through H parallel to AP
tangent_line = parallel(line_ap, H, color="orange", style="dashed")
Running Examples¶
Generate output from any example file:
# Generate Asymptote source
geolet generate examples/euler_line.py
# Generate PDF
geolet generate examples/euler_line.py -f pdf
# Generate SVG
geolet generate examples/euler_line.py -f svg
List all available examples:
Generate all examples: