# Tactiverge Academy — companion code for "A tool-agnostic CAD workflow with free software"
# Lesson: https://tactiverge.win/academy/mechanical-design/cad-fundamentals/free-cad-workflows/
# Licence: MIT (see https://tactiverge.win/open-engineering/). Examples appear in lesson order.

# ── Example 1 ────────────────────────────────────────
import math

def chord_error(radius, facets):
    """Largest gap between a true circle and a polygon with this many sides."""
    return radius * (1 - math.cos(math.pi / facets))

for n in [12, 32, 128]:
    print(f"{n:3d} facets: {chord_error(10.0, n):.3f} mm")
