Skip to content

tkz-elements examples

Inner Circles

Example 1 Inner circle in an angular sector

Inner circle
View Comments Comments
View TeX code
% !TEX TS-program = lualatex
% Created by Alain Matthes on 2025.06.
\documentclass[margin = 12 pt]{standalone} 
\usepackage[mini]{tkz-euclide}
\usepackage{tkz-elements}
\usepackage{amsmath, amssymb}
\begin{document} 
  
\directlua{dofile("inner_sector.lua")}

\begin{tikzpicture}[scale =.75]
 \tkzGetNodes
 \tkzFillCircle[orange!30,opacity=.4](O,T)
 \tkzFillCircle[yellow!60,opacity=.4](W,M)
 \tkzDrawCircles(O,T W,M)
 \tkzDrawPoints(O,A,B,M,W,H,D)
 \tkzDrawSegments(O,A O,B A,B O,M B,D M,D)
 \tkzLabelPoints(O,W,H)
 \tkzLabelPoints[right](A,M)
 \tkzLabelPoints[left](B,D)
\end{tikzpicture}

\end{document} 

View Lua code
init_elements() 
z.O = point(0, 0)
z.T = point(4, 0)
C.OT = circle(z.O, z.T)
z.A = C.OT:point(0.05)
z.B = C.OT:point(0.20)
z.M = C.OT:midarc(z.A, z.B)
-- circle tangent to (OA) and (OB) through M, inside the sector
local centers = line(z.O, z.A):c_ll_p(line(z.O, z.B), z.M)
for i = 1, centers:count() do
  local c = centers:get(i)
  if point.abs(c - z.O) < point.abs(z.M - z.O) then z.W = c end
end
z.H = intersection(line(z.A, z.B), line(z.O, z.M))
L.pp = line(z.A, z.B):parallel_from(z.M)
z.D = intersection(L.pp, line(z.O, z.B))



Example 2 Inner circles in a semi-circle

Inner circles
View TeX code
% !TEX TS-program = lualatex
% Created by Alain Matthes on 2025.06.
\documentclass[margin = 12pt]{standalone} 
\usepackage[mini]{tkz-euclide}
\usepackage{tkz-elements}
\begin{document} 
  
\directlua{loadfile("inner_circles.lua")(0.10)}

\begin{tikzpicture}
 \tkzGetNodes
 \tkzDrawPoints(A,B,M)
 \tkzDrawSegment[black](A,B)
 \tkzDrawArc[black,fill=green!20](M,B)(A)
 \tkzFillCircle[fill=orange!50](O1,C) 
 \tkzFillCircle[fill=yellow!50](O2,E)
 \tkzDrawCircle(O1,C) 
 \tkzDrawCircle(O2,E)
 \tkzDrawPoints(P)
 \tkzDrawSegment[black](M,P) 
 \tkzDrawPoints(C,E,O1,O2)    
\end{tikzpicture}

\end{document} 
View Lua code
init_elements()
-- among the solutions, the center lying between the vertex and the contact point
local function inner_center(centers, v, t)
  local d = point.abs(t - v)
  for i = 1, centers:count() do
    local c = centers:get(i)
    if point.abs(c - v) < d then return c end
  end
end
local pos = ...
z.A = point(0,0)
z.B = point(10,0)
L.AB = line(z.A, z.B)
z.M = L.AB.mid
C.MB = circle(z.M, z.B)
z.X1 = point(8, 0)
L.X1X2 = L.AB:orthogonal_from(z.X1)
--z.P = intersection(L.X1X2, C.MB)
z.P =  C.MB:point(pos)
T.AMP = triangle(z.A, z.M, z.P)
L.MX3 = T.AMP:bisector(z.M)
z.C = intersection(L.MX3, C.MB)
T.PMB = triangle(z.P, z.M, z.B)
L.MX4 = T.PMB:bisector(z.M)
z.E = intersection(L.MX4, C.MB)
-- circle tangent to (MA) and (MP) through C, inside the sector
local centers = line(z.M, z.A):c_ll_p(line(z.M, z.P), z.C)
z.O1 = inner_center(centers, z.M, z.C)
local centers = line(z.M, z.B):c_ll_p(line(z.M, z.P), z.E)
z.O2 = inner_center(centers, z.M, z.E)