summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_misc.lua
blob: ed4dd949a136ede72560b01715e991b53812bff6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
-- tkz_elements_functions_maths.lua
-- date 23/12/24
-- version 1.72c
-- Copyright 2023  Alain Matthes
-- This work may be distributed and/or modified under the
-- conditions of the LaTeX Project Public License, either version 1.3
-- of this license or (at your option) any later version.
-- The latest version of this license is in
--   http://www.latex-project.org/lppl.txt
-- and version 1.3 or later is part of all distributions of LaTeX
-- version 2005/12/01 or later.
-- This work has the LPPL maintenance status “maintained”.
-- The Current Maintainer of this work is Alain Matthes.
-- ----------------------------------------------------------------
-- 
-- ----------------------------------------------------------------
function get_points (obj)
if obj.type == 'line' then return   obj.pa,obj.pb
 elseif
  obj.type  == 'triangle' then return   obj.pa,obj.pb,obj.pc
  elseif 
  obj.type == 'circle' then   return obj.center,obj.through
  elseif 
  obj.type == 'ellipse' then   return obj.pc,obj.pa,obj.pb
  elseif 
  obj.type == 'square' or obj.type == 'rectangle' or obj.type == 'quadrilateral' or obj.type == 'parallelogram'
  then   return obj.pa,obj.pb,obj.pc,obj.pd
end
end

function set_lua_to_tex (t)
   for k,v in pairs(t) do
    token.set_macro(v,_ENV[v],'global')
   end
end  
-- version 1.60 center pour deux cercles ?
function radical_center (C1,C2,C3)
   local t1,t2,t3,t4
   t1,t2 = radical_axis_ (C1.center,C1.through,C2.center,C2.through)
   if C3 == nil then
    return  intersection_ll_ (t1,t2,C1.center,C2.center)
   else
   t3,t4 = radical_axis_ (C3.center,C3.through,C2.center,C2.through)
return intersection_ll_ (t1,t2,t3,t4)
end
end
-- version 1.60 modif case 2 circles
function  radical_circle (C1,C2,C3)
   local rc
    if C3 == nil then
       rc = radical_center (C1,C2)
       return C1 : orthogonal_from (rc)
    else
   rc = radical_center (C1,C2,C3)
 return C1 : orthogonal_from (rc)
end
end