Skip to content

tkz-elements examples

About tkz-elements

About tkz-elements

tkz-elements is a Lua library that performs the computations needed to define the objects of a Euclidean geometry figure: points, lines, circles, conics, triangles, quadrilaterals, paths, … All numerical work happens in Lua; drawing is done with tkz-euclide (recommended) or plain TikZ.

Main features

  • Object-oriented design: classes point, line, circle, conic, triangle, quadrilateral, path, … with attributes and methods.
  • Rich geometry toolbox: bisectors, altitudes, tangents, radical axis and center, Poncelet point, orthopole, Kimberling points, mixtilinear circles, Morley, Soddy and Napoleon constructions, Apollonius problems and more.
  • Transformations on objects: rotations, homotheties, symmetries, inversions and affinities apply to points and to whole objects, which keep their class.
  • Utilities: formatting, equation solving, angles, barycentric and trilinear coordinates, comparisons, rounding.
  • Lua → TikZ transfer: computed objects are sent to TikZ/tkz-euclide with simple macros (\tkzGetNodes, \tkzDrawPath, \tkzUseLua, …).

Version 6.00c (2026-10-11)

A major release: complete revision of the Lua code, clear error messages and more accurate computations (exact contact point of two tangent circles, Feuerbach point and triangle, tangent_from, …). New: EL_from_equation, EL_conjugate (Rytz construction), affinities and htm_apply on objects, occs:point, triangle:angle, get(i) for quadrilaterals, quadrilateral:area, is_cyclic, poncelet_point.

Undocumented methods have been removed (set_*, …), get_points is deprecated (use obj:get()), and several degenerate cases now raise an error instead of returning nil. See CHANGELOG.md before updating existing documents.

All the tkz-elements examples of this site have been checked with tkz-elements 6.00c and tkz-euclide 5.14c.

Requirements

  • LuaLaTeX (Lua 5.3) and a recent TeX distribution (TeX Live, MacTeX or MiKTeX);
  • tkz-euclide 5.14c (recommended) or TikZ. If you use xcolor, load it before tkz-euclide.

Quick start

% !TEX TS-program = lualatex
\documentclass{standalone}
\usepackage[mini]{tkz-euclide}
\usepackage{tkz-elements}
\begin{document}
\directlua{
  init_elements()
  z.A = point(0, 0)
  z.B = point(2, 0)
  z.C = point(1, 1.2)
}
\begin{tikzpicture}
  \tkzGetNodes
  \tkzDrawPolygon(A,B,C)
  \tkzDrawPoints(A,B,C)
  \tkzLabelPoints(A,B,C)
\end{tikzpicture}
\end{document}

Links