diff options
author | Karl Berry <karl@freefriends.org> | 2024-01-16 21:29:12 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2024-01-16 21:29:12 +0000 |
commit | 076968e12d60e0cf6bfb65612dee786d49d3a0cb (patch) | |
tree | 6610904708c77fc0fb7ac99eace088d1d2f0586f /Master/texmf-dist/tex/latex | |
parent | 67f9344098e309a9414bbe29f7e8de16b8bb47a7 (diff) |
tkz-elements (16jan24)
git-svn-id: svn://tug.org/texlive/trunk@69461 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex')
22 files changed, 356 insertions, 189 deletions
diff --git a/Master/texmf-dist/tex/latex/tkz-elements/tkz-elements.sty b/Master/texmf-dist/tex/latex/tkz-elements/tkz-elements.sty index 903691bcc38..2b388229e47 100644 --- a/Master/texmf-dist/tex/latex/tkz-elements/tkz-elements.sty +++ b/Master/texmf-dist/tex/latex/tkz-elements/tkz-elements.sty @@ -1,6 +1,6 @@ % encoding : utf8 -% tkz-elements.sty v1.72c -% Copyright 2023 Alain Matthes +% tkz-elements.sty v1.82c +% Copyright 2024 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. @@ -11,7 +11,7 @@ % This work has the LPPL maintenance status “maintained”. % The Current Maintainer of this work is Alain Matthes. -\ProvidesPackage{tkz-elements}[23/12/24 v1.72c Graphic Object Library] +\ProvidesPackage{tkz-elements}[2024/01/16 v1.82c Graphic Object Library] \RequirePackage{luacode} \directlua{require "tkz_elements_main"} @@ -36,7 +36,9 @@ n = string.len(K) if n >1 then _,_,ft, sd = string.find( K , "(.+)(.)" ) - if sd == "p" then K=ft.."'" end + if sd == "p" then K=ft.."'" end + _,_,xft, xsd = string.find( ft , "(.+)(.)" ) + if xsd == "p" then K=xft.."'".."'" end end tex.print("\\coordinate ("..K..") at ("..V.re..","..V.im..") ;\\\\") end} diff --git a/Master/texmf-dist/tex/latex/tkz-elements/tkz_elements_circle.lua b/Master/texmf-dist/tex/latex/tkz-elements/tkz_elements_circle.lua index e81609f6ee4..ae257221f47 100644 --- a/Master/texmf-dist/tex/latex/tkz-elements/tkz_elements_circle.lua +++ b/Master/texmf-dist/tex/latex/tkz-elements/tkz_elements_circle.lua @@ -1,7 +1,7 @@ -- tkz_elements-circles.lua --- date 23/12/24 --- version 1.72c --- Copyright 2023 Alain Matthes +-- date 2024/01/16 +-- version 1.82c +-- Copyright 2024 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. @@ -17,9 +17,8 @@ circle = {} function circle: new (c, t) -- c --> center t --> through local type = 'circle' - local ra = line :new (c,t) - local anti = antipode_ (c,t) - local di = line : new (anti, t) + local ct = line :new (c,t) + local opp = antipode_ (c,t) local radius = point.abs ( c - t ) local south = c - point (0,radius) local east = c + point (radius,0) @@ -27,8 +26,8 @@ function circle: new (c, t) -- c --> center t --> through local west = c - point (radius,0) local o = { center = c, through = t, - ra = ra, - di = di, + ct = ct, + opp = opp, radius = radius, south = south, east = east, @@ -75,18 +74,11 @@ function circle: in_out_disk (pt) end end -function circles_position (C1,C2) - local d,max,min - d = point.mod(C1.center-C2.center) - max = C1.radius + C2.radius - min = math.abs ( C1.radius - C2.radius) - if d > max then return "outside" - elseif d == max then return "outside tangent" -- epsilon - elseif d == min then return "inside tangent" -- epsilon - elseif d < min then return "inside" - else return "intersect" - end +-- new version 1.80 added +function circle : circles_position (C) + return circles_position_ (self.center,self.radius,C.center,C.radius) end + ----------------------- -- real -- ----------------------- @@ -122,7 +114,7 @@ function circle: point (t) return rotation_ (self.center,phi,self.through) end -function circle: random_pt(lower, upper) +function circle: random_pt (lower, upper) local t math.randomseed( tonumber(tostring(os.time()):reverse():sub(1,6)) ) phi = lower + math.random() * (upper - lower) @@ -136,6 +128,21 @@ end function circle: external_similitude (C) return external_similitude_ (self.center,self.radius,C.center,C.radius) end + +function circle : common_tangent(C) + local o,s1,s2,t1,t2 + o = external_similitude_ (self.center,self.radius,C.center,C.radius) + + if self.radius < C.radius then + t1,t2 = tangent_from_ (C.center,C.through,o) + s1,s2 = tangent_from_ (self.center,self.through,o) + return s1,t1,t2,s2 + else + s1,s2 = tangent_from_ (C.center,C.through,o) + t1,t2 = tangent_from_ (self.center,self.through,o) + return s1,t1,t2,s2 + end +end ----------------------- -- lines -- ----------------------- @@ -148,12 +155,41 @@ function circle: tangent_from (pt) t1,t2 = tangent_from_ (self.center,self.through,pt) return line :new (pt,t1),line : new (pt,t2) end - + -- version 1.80 function circle: radical_axis (C) local t1,t2 + if self.radius > C.radius then t1,t2 = radical_axis_ (self.center,self.through,C.center,C.through) - return line : new (t1,t2) + else + t1,t2 = radical_axis_ (C.center,C.through,self.center,self.through) end + return line :new (t1,t2) + end + + -- version 1.80 +function circle: radical_center (C1,C2) +if C2 == nil then + if self.radius > C1.radius then + return radical_center_ (self.center,self.through,C1.center,C1.through) + else + return radical_center_ (C1.center,C1.through,self.center,self.through) + end +else + return radical_center3 (self,C1,C2) +end +end + -- version 1.80 +function circle : radical_circle (C1,C2) + local rc + if C2 == nil then + rc = self : radical_center (C1) + return self : orthogonal_from (rc) + else + rc = self : radical_center (C1,C2) + return C1 : orthogonal_from (rc) + end +end + -- version 1.60 new function circle : external_tangent(C) local i,t1,t2,k,T1,T2 @@ -230,7 +266,7 @@ function circle: inversion (...) else t = {} for i=1,tp.n do - table.insert( t , inversion_ (self.center,self.through , tp[i]) ) + table.insert( t , inversion_ (self.center,self.through , tp[i]) ) end return table.unpack ( t ) end diff --git a/Master/texmf-dist/tex/latex/tkz-elements/tkz_elements_class.lua b/Master/texmf-dist/tex/latex/tkz-elements/tkz_elements_class.lua index 9f8670a1b7a..91b12ce31ee 100644 --- a/Master/texmf-dist/tex/latex/tkz-elements/tkz_elements_class.lua +++ b/Master/texmf-dist/tex/latex/tkz-elements/tkz_elements_class.lua @@ -1,6 +1,6 @@ -- tkz_elements_class.lua --- date 23/12/24 --- version 1.72c +-- date 2024/01/16 +-- version 1.82c -- from class.lua (Simple Lua Classes from Lua-users wiki) -- Compatible with Lua 5.1 (not 5.0). -- http://lua-users.org/wiki/SimpleLuaClasses DavidManura diff --git a/Master/texmf-dist/tex/latex/tkz-elements/tkz_elements_ellipse.lua b/Master/texmf-dist/tex/latex/tkz-elements/tkz_elements_ellipse.lua index bb8495336be..f3fa0d173b4 100644 --- a/Master/texmf-dist/tex/latex/tkz-elements/tkz_elements_ellipse.lua +++ b/Master/texmf-dist/tex/latex/tkz-elements/tkz_elements_ellipse.lua @@ -1,7 +1,7 @@ -- tkz_elements-ellipses.lua --- date 23/12/24 --- version 1.72c --- Copyright 2023 Alain Matthes +-- date 2024/01/16 +-- version 1.82c +-- Copyright 2024 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. diff --git a/Master/texmf-dist/tex/latex/tkz-elements/tkz_elements_functions_circles.lua b/Master/texmf-dist/tex/latex/tkz-elements/tkz_elements_functions_circles.lua index cde3c027ac0..33477340d3d 100644 --- a/Master/texmf-dist/tex/latex/tkz-elements/tkz_elements_functions_circles.lua +++ b/Master/texmf-dist/tex/latex/tkz-elements/tkz_elements_functions_circles.lua @@ -1,7 +1,7 @@ -- tkz_elements_functions_circles.lua --- date 23/12/24 --- version 1.72c --- Copyright 2023 Alain Matthes +-- date 2024/01/16 +-- version 1.82c +-- Copyright 2024 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. @@ -51,40 +51,55 @@ function inversion_ (c,p,pt) local r = (ry*ry)/d return c+polar_ (r,point.arg(pt-c)) end - + +function circles_position_ (c1,r1,c2,r2) + local d,max,min,epsilon + epsilon = 10^(-12) + d = point.mod(c1-c2) + max = r1+r2 + min = math.abs ( r1 - r2) + if d > max then return "outside" + elseif math.abs(d - max) < epsilon then return "outside tangent" -- epsilon + elseif math.abs(d - min) < epsilon then return "inside tangent" -- epsilon + elseif d < min then return "inside" + else return "intersect" + end +end + function radical_axis_ (c1,p1,c2,p2) - local d,m,m1,m2,epsilon,ci,cj,ck,cm,cn,r1,r2,t + local ci,cj r1 = point.abs(c1-p1) r2 = point.abs(c2-p2) - epsilon = 10^(-12) - d = point.abs (c2 - c1) - m = d - (r1+r2) - m1 = math.abs (d - (r1+r2)) - m2 = math.abs (d - math.abs(r1-(r2))) - if m2 < epsilon then - ci = rotation_ (p1,math.pi/2,c2) - cj = rotation_ (p1,-math.pi/2,c2) - return ci,cj - elseif m1 < epsilon then -- circles tangent - -- z.A = point : new ( x , y ) contact - t,t = intersection_cc_ (c1,p1,c2,p2) - ci = rotation_ (t,math.pi/2,c2) - cj = rotation_ (t,-math.pi/2,c2) - return ci,cj - -- circles disjoints - elseif m > 0 then - ck = rotation_ (c1,math.pi/3,c2) - ci,cj = intersection_cc_ (c1,p1,ck,c1) - cm,cn = intersection_cc_ (c2,p2,ck,c1) - ci = intersection_ll_ (ci,cj,cm,cn) - cj = symmetry_axial_ (c1,c2,ci) -- projection_ (c1,c2,ci) - return ci,cj - else - ci,cj = intersection_cc_ (c1,p1,c2,p2) - return ci,cj - end + d = point.abs(c1-c2) + h = (r1*r1-r2*r2+d*d)/(2*d) + ck = radical_center_ (c1,p1,c2,p2) + cj = rotation_ (ck,-math.pi/2,c1) + ci = symmetry_ (ck,cj) + return cj,ci end +function radical_center_ (c1,p1,c2,p2) + local d,r1,r2,h + r1 = point.abs(c1-p1) + r2 = point.abs(c2-p2) + d = point.abs(c1-c2) + h = (r1*r1-r2*r2+d*d)/(2*d) + return h*(c2-c1)/d+c1 +end + +-- version 1.60 center pour deux cercles ? +function radical_center3 (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 + + function south_pole_ (c,p) local r r = point.abs (c-p) @@ -117,7 +132,7 @@ end -- version 1.60 new function midcircle_(C1,C2) local state,r,s,t1,t2,T1,T2,p,a,b,c,d,Cx,Cy,i,j - state = circles_position(C1,C2) + state = circles_position_(C1.center,C1.radius,C2.center,C2.radius) i = barycenter_ ({C2.center,C1.radius},{C1.center,-C2.radius}) j = barycenter_ ({C2.center,C1.radius},{C1.center,C2.radius}) t1,t2 = tangent_from_ (C1.center,C1.through,i) diff --git a/Master/texmf-dist/tex/latex/tkz-elements/tkz_elements_functions_intersections.lua b/Master/texmf-dist/tex/latex/tkz-elements/tkz_elements_functions_intersections.lua index a3d5bd3a9d8..be7eea4461b 100644 --- a/Master/texmf-dist/tex/latex/tkz-elements/tkz_elements_functions_intersections.lua +++ b/Master/texmf-dist/tex/latex/tkz-elements/tkz_elements_functions_intersections.lua @@ -1,7 +1,7 @@ -- tkz_elements_intersections.lua --- date 23/12/24 --- version 1.72c --- Copyright 2023 Alain Matthes +-- date 2024/01/16 +-- version 1.82c +-- Copyright 2024 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. diff --git a/Master/texmf-dist/tex/latex/tkz-elements/tkz_elements_functions_lines.lua b/Master/texmf-dist/tex/latex/tkz-elements/tkz_elements_functions_lines.lua index 4b27ec821fc..642d0488090 100644 --- a/Master/texmf-dist/tex/latex/tkz-elements/tkz_elements_functions_lines.lua +++ b/Master/texmf-dist/tex/latex/tkz-elements/tkz_elements_functions_lines.lua @@ -1,7 +1,7 @@ -- tkz_elements_functions_lines.lua --- date 23/12/24 --- version 1.72c --- Copyright 2023 Alain Matthes +-- date 2024/01/16 +-- version 1.82c +-- Copyright 2024 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. @@ -50,7 +50,7 @@ function online_ (a,b,t) return (z1+z2)/2 end -- triangle specific -function equilateral_tr (a,b) +function equilateral_tr_ (a,b) return rotation_ (a,math.pi/3,b) end diff --git a/Master/texmf-dist/tex/latex/tkz-elements/tkz_elements_functions_maths.lua b/Master/texmf-dist/tex/latex/tkz-elements/tkz_elements_functions_maths.lua index a3c2de28aad..0702b0a568b 100644 --- a/Master/texmf-dist/tex/latex/tkz-elements/tkz_elements_functions_maths.lua +++ b/Master/texmf-dist/tex/latex/tkz-elements/tkz_elements_functions_maths.lua @@ -1,7 +1,7 @@ -- tkz_elements_functions_maths.lua --- date 23/12/24 --- version 1.72c --- Copyright 2023 Alain Matthes +-- date 2024/01/16 +-- version 1.82c +-- Copyright 2024 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. diff --git a/Master/texmf-dist/tex/latex/tkz-elements/tkz_elements_functions_points.lua b/Master/texmf-dist/tex/latex/tkz-elements/tkz_elements_functions_points.lua index 309b7c762c9..dfe86444dfa 100644 --- a/Master/texmf-dist/tex/latex/tkz-elements/tkz_elements_functions_points.lua +++ b/Master/texmf-dist/tex/latex/tkz-elements/tkz_elements_functions_points.lua @@ -1,7 +1,7 @@ -- tkz_elements_functions_points.lua --- date 23/12/24 --- version 1.72c --- Copyright 2023 Alain Matthes +-- date 2024/01/16 +-- version 1.82c +-- Copyright 2024 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. diff --git a/Master/texmf-dist/tex/latex/tkz-elements/tkz_elements_functions_regular.lua b/Master/texmf-dist/tex/latex/tkz-elements/tkz_elements_functions_regular.lua index 423e13a9378..4c0db753937 100644 --- a/Master/texmf-dist/tex/latex/tkz-elements/tkz_elements_functions_regular.lua +++ b/Master/texmf-dist/tex/latex/tkz-elements/tkz_elements_functions_regular.lua @@ -1,7 +1,7 @@ -- tkz_elements_functions_regular.lua --- date 23/12/24 --- version 1.72c --- Copyright 2023 Alain Matthes +-- date 2024/01/16 +-- version 1.82c +-- Copyright 2024 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. @@ -15,7 +15,7 @@ --------------------------------------------------------------------------- -- --------------------------------------------------------------------------- -function regular_(c,th,s) +function regular_(c,th,s) -- center through side local r,t,dep dep = angle_normalize(point.arg (th-c)) t = {} diff --git a/Master/texmf-dist/tex/latex/tkz-elements/tkz_elements_functions_triangles.lua b/Master/texmf-dist/tex/latex/tkz-elements/tkz_elements_functions_triangles.lua index 3d92bdb8190..c5741479124 100644 --- a/Master/texmf-dist/tex/latex/tkz-elements/tkz_elements_functions_triangles.lua +++ b/Master/texmf-dist/tex/latex/tkz-elements/tkz_elements_functions_triangles.lua @@ -1,7 +1,7 @@ -- tkz_elements_functions_triangles.lua --- date 23/12/24 --- version 1.72c --- Copyright 2023 Alain Matthes +-- date 2024/01/16 +-- version 1.82c +-- Copyright 2024 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. diff --git a/Master/texmf-dist/tex/latex/tkz-elements/tkz_elements_line.lua b/Master/texmf-dist/tex/latex/tkz-elements/tkz_elements_line.lua index 1143659bfb1..1e45a544db0 100644 --- a/Master/texmf-dist/tex/latex/tkz-elements/tkz_elements_line.lua +++ b/Master/texmf-dist/tex/latex/tkz-elements/tkz_elements_line.lua @@ -1,7 +1,7 @@ -- tkz_elements_lines.lua --- date 23/12/24 --- version 1.72c --- Copyright 2023 Alain Matthes +-- date 2024/01/16 +-- version 1.82c +-- Copyright 2024 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. @@ -51,6 +51,10 @@ function line: distance (pt) return point.mod(projection(self,pt)-pt) end +function length(a,b) + return point.abs (a-b) +end + function line: slope () return slope_(self.pa,self.pb) end @@ -118,6 +122,36 @@ end function line: normalize_inv () return normalize_ (self.pb,self.pa) end + +function line: _east (d) + local d = d or 1 + return self.pb+ d/self.length * (self.pb-self.pa) +end + +function line: _west (d) + local d = d or 1 + return self.pa+ d/self.length * (self.pa-self.pb) +end + +function line: _north_pa (d) + local d = d or 1 + return d/self.length * ( self.north_pa - self.pa ) + self.pa +end + +function line: _south_pa (d) + local d = d or 1 + return d/self.length *( self.south_pa - self.pa ) + self.pa +end + +function line: _south_pb (d) + local d = d or 1 + return d/self.length *( self.south_pb - self.pb ) + self.pb +end + +function line: _north_pb (d) + local d = d or 1 + return d/self.length *( self.north_pb - self.pb ) + self.pb +end -------------- transformations ------------- function line: translation_pt ( pt ) return translation_ ( self.pb-self.pa,pt ) @@ -262,7 +296,7 @@ function line: ll_from ( pt ) end function line: ortho_from ( pt ) - return line : new (pt,pt+(self.pb-self.pa)*point(0,1)) + return line : new (pt+(self.pb-self.pa)*point(0,-1),pt+(self.pb-self.pa)*point(0,1)) end function line: mediator () @@ -304,12 +338,10 @@ function line: equilateral (swap) if swap then return triangle : new (self.pa,self.pb,rotation_ (self.pa,-math.pi/3,self.pb)) else - return triangle : new (self.pa,self.pb,rotation_ (self.pa,math.pi/3,self.pb)) - + return triangle : new (self.pa,self.pb,rotation_ (self.pa,math.pi/3,self.pb)) end end - function line: isosceles (phi,swap) local pta,ptb if swap == nil then @@ -324,9 +356,55 @@ function line: isosceles (phi,swap) ptb = rotation_ (self.pb,-phi,self.pa) return triangle : new (self.pa,self.pb, intersection_ll_ (self.pa,pta,self.pb,ptb )) end - end +function line: two_angles (alpha,beta) + local pta,ptb,pt + pta = rotation_ (self.pa,alpha,self.pb) + ptb = rotation_ (self.pb,-beta,self.pa) + pt = intersection_ll_ (self.pa,pta,self.pb,ptb) + return triangle : new (self.pa,self.pb,pt) +end + +function line: school () + local pta,ptb,pt + pta = rotation_ (self.pa,math.pi/6,self.pb) + ptb = rotation_ (self.pb,-math.pi/3,self.pa) + pt = intersection_ll_ (self.pa,pta,self.pb,ptb) + return triangle : new (self.pa,self.pb,pt) +end + +function line: half () + local x,pt + x = midpoint_(self.pa,self.pb) + pt = rotation_ (self.pb,-math.pi/2,x) + return triangle : new (self.pa,self.pb,pt) +end + +function line: sss (a,b) + local pta,ptb,i,j + pta = self.pa + point ( a, 0 ) + ptb = self.pb + point ( -b , 0) + i,j = intersection_cc_ (self.pa,pta,self.pb,ptb) + return triangle : new (self.pa,self.pb,i),triangle : new (self.pa,self.pb,j) +end + +function line: ssa (a,phi) + local x,y,pt + x = rotation_ (self.pb,-phi,self.pa) + y = self.pa + polar_ ( a , self.slope) + i,j = intersection_lc_ (self.pb,x,self.pa,y) + return triangle : new (self.pa,self.pb,i),triangle : new (self.pa,self.pb,j) +end + +function line: sas (a,phi) + local x,pt + x = self.pa + polar_ ( a , self.slope) + pt = rotation_ (self.pa,phi,x) + return triangle : new (self.pa,self.pb,pt) +end +---- sacred triangles ---- + function line: gold (swap) local pt if swap == nil then @@ -341,6 +419,16 @@ else end end +function line: sublime () + local pta,ptb,pt + pta = rotation_ (self.pa,2*math.pi/5,self.pb) + ptb = rotation_ (self.pb,-2*math.pi/5,self.pa) + pt = intersection_ll_ (self.pa,pta,self.pb,ptb) + return triangle : new (self.pa,self.pb,pt) +end + +line.euclid = line.sublime + function line: euclide (swap) if swap == nil then swap = false @@ -352,20 +440,39 @@ else end end -function line: golden (swap) - local pt - local pta,ptb - if swap == nil then - swap = false - end -if swap then - pt = rotation_ (self.pa,-2*math.pi/5,self.pb) - return triangle : new (self.pa,self.pb, self.pa + (pt-self.pa) * tkzphi) -else - pt = rotation_ (self.pa,2*math.pi/5,self.pb) - return triangle : new (self.pa,self.pb, self.pa + (pt-self.pa) * tkzphi) - end +function line: divine () + local pta,ptb,pt,h + pta = rotation_ (self.pa,math.pi/5,self.pb) + ptb = rotation_ (self.pb,-math.pi/5,self.pa) + pt = intersection_ll_ (self.pa,pta,self.pb,ptb) + return triangle : new (self.pa,self.pb,pt) +end + +function line: cheops () + local m,n,pt + m = midpoint_ (self.pa,self.pb) + n = rotation_ (m,- math.pi/2,self.pa) + pt = m + (n-m)* tkzsqrtphi + return triangle : new (self.pa,self.pb,pt) end + +function line: egyptian () + local n,pt + n = rotation_ (self.pb,- math.pi/2,self.pa) + pt = self.pb + (n-self.pb)/point.mod(n-self.pb)*self.length* 0.75 + return triangle : new (self.pa,self.pb,pt) +end +line.pythagoras = line.egyptian +line.isis = line.egyptian + +function line: golden () + local n,pt + n = rotation_ (self.pb,- math.pi/2,self.pa) + pt = self.pb + (n-self.pb)/tkzphi + return triangle : new (self.pa,self.pb,pt) +end + + ------------------------------ -- Result -> couple of points ------------------------------ diff --git a/Master/texmf-dist/tex/latex/tkz-elements/tkz_elements_main.lua b/Master/texmf-dist/tex/latex/tkz-elements/tkz_elements_main.lua index 44842d2d9c9..132f193667c 100644 --- a/Master/texmf-dist/tex/latex/tkz-elements/tkz_elements_main.lua +++ b/Master/texmf-dist/tex/latex/tkz-elements/tkz_elements_main.lua @@ -1,7 +1,7 @@ -- tkz_elements-main.lua --- date 23/12/24 --- version 1.72c --- Copyright 2023 Alain Matthes +-- date 2024/01/16 +-- version 1.82c +-- Copyright 2024 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. diff --git a/Master/texmf-dist/tex/latex/tkz-elements/tkz_elements_misc.lua b/Master/texmf-dist/tex/latex/tkz-elements/tkz_elements_misc.lua index ed4dd949a13..23f088983fe 100644 --- a/Master/texmf-dist/tex/latex/tkz-elements/tkz_elements_misc.lua +++ b/Master/texmf-dist/tex/latex/tkz-elements/tkz_elements_misc.lua @@ -1,7 +1,7 @@ -- tkz_elements_functions_maths.lua --- date 23/12/24 --- version 1.72c --- Copyright 2023 Alain Matthes +-- date 2024/01/16 +-- version 1.82c +-- Copyright 2024 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. @@ -33,26 +33,31 @@ function set_lua_to_tex (t) 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) + +function bisector (a,b,c) + local i + i = in_center_ (a,b,c) + return line : new (a,intersection_ll_ (a,i,b,c)) end + +function altitude (a,b,c) + local o,p + o = ortho_center_ (a,b,c) + p = projection_ (b,c,a) + return line : new (a,p) 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) + +function bisector_ext(a,b,c) -- n =1 swap n=2 2 swap + local i,p + i = in_center_ (a,b,c) + p = rotation_ (a,math.pi/2,i) + return line : new (a,p) end + +function equilateral (a,b) + return equilateral_tr_ (a,b) end +function midpoint (a,b) + return (a+b)/2 +end
\ No newline at end of file diff --git a/Master/texmf-dist/tex/latex/tkz-elements/tkz_elements_parallelogram.lua b/Master/texmf-dist/tex/latex/tkz-elements/tkz_elements_parallelogram.lua index 6ed56cc8280..386eb023e07 100644 --- a/Master/texmf-dist/tex/latex/tkz-elements/tkz_elements_parallelogram.lua +++ b/Master/texmf-dist/tex/latex/tkz-elements/tkz_elements_parallelogram.lua @@ -1,7 +1,7 @@ -- tkz_elements_parallelogram.lua --- date 23/12/24 --- version 1.72c --- Copyright 2023 Alain Matthes +-- date 2024/01/16 +-- version 1.82c +-- Copyright 2024 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. @@ -16,7 +16,7 @@ --------------------------------------------------------------------------- parallelogram = {} -function parallelogram: new (za, zb, zc,zd) +function parallelogram: new (za, zb, zc, zd) local d,epsilon epsilon = 10^(-8) local zi = midpoint_ (za,zc) diff --git a/Master/texmf-dist/tex/latex/tkz-elements/tkz_elements_point.lua b/Master/texmf-dist/tex/latex/tkz-elements/tkz_elements_point.lua index 4997b857d8d..7530dfc96a7 100644 --- a/Master/texmf-dist/tex/latex/tkz-elements/tkz_elements_point.lua +++ b/Master/texmf-dist/tex/latex/tkz-elements/tkz_elements_point.lua @@ -1,7 +1,7 @@ -- tkz_elements_point.lua --- date 23/12/24 --- version 1.72c --- Copyright 2023 Alain Matthes +-- date 2024/01/16 +-- version 1.82c +-- Copyright 2024 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. @@ -187,7 +187,7 @@ function point: new ( a,b ) end function point: polar ( radius, phi ) - return scale * polar_ ( radius, phi ) + return point: new (radius * math.cos(phi), radius * math.sin(phi)) end function point: polar_deg ( radius, phi ) @@ -196,22 +196,22 @@ end function point: north(d) local d = d or 1 - return self+ polar_ ( d * scale, math.pi/2 ) + return self+ polar_ ( d , math.pi/2 ) end function point: south(d) local d = d or 1 - return self + polar_ ( d * scale, 3 * math.pi/2 ) + return self + polar_ ( d , 3 * math.pi/2 ) end function point: east(d) local d = d or 1 - return self+ polar_( d * scale, 0 ) + return self+ polar_( d , 0 ) end function point: west(d) local d = d or 1 - return self + polar_ ( d * scale, math.pi ) + return self + polar_ ( d , math.pi ) end -- ---------------------------------------------------------------- -- transformations diff --git a/Master/texmf-dist/tex/latex/tkz-elements/tkz_elements_quadrilateral.lua b/Master/texmf-dist/tex/latex/tkz-elements/tkz_elements_quadrilateral.lua index 57d8af3aae4..e80065540b7 100644 --- a/Master/texmf-dist/tex/latex/tkz-elements/tkz_elements_quadrilateral.lua +++ b/Master/texmf-dist/tex/latex/tkz-elements/tkz_elements_quadrilateral.lua @@ -1,7 +1,7 @@ -- tkz_elements_quadrilateral.lua --- date 23/12/24 --- version 1.72c --- Copyright 2023 Alain Matthes +-- date 2024/01/16 +-- version 1.82c +-- Copyright 2024 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. diff --git a/Master/texmf-dist/tex/latex/tkz-elements/tkz_elements_rectangle.lua b/Master/texmf-dist/tex/latex/tkz-elements/tkz_elements_rectangle.lua index 600d31665b6..abb9c2f8e9f 100644 --- a/Master/texmf-dist/tex/latex/tkz-elements/tkz_elements_rectangle.lua +++ b/Master/texmf-dist/tex/latex/tkz-elements/tkz_elements_rectangle.lua @@ -1,7 +1,7 @@ -- tkz_elements-rectangle.lua --- date 23/12/24 --- version 1.72c --- Copyright 2023 Alain Matthes +-- date 2024/01/16 +-- version 1.82c +-- Copyright 2024 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. @@ -36,7 +36,7 @@ function rectangle: new (za, zb,zc,zd) local bd = line : new (zb,zd) local length = point.mod (zb-za) local width = point.mod (zd-za) - local diagonal = point.abs (zc-za) + local diagonal = point.abs (zc-za) local o = { pa = za, pb = zb, pc = zc, @@ -47,7 +47,7 @@ function rectangle: new (za, zb,zc,zd) da = da, cd = cd, bd = bd, - diagonal = diagonal, + diagonal = diagonal, exradius = exradius, center = center, length = length, diff --git a/Master/texmf-dist/tex/latex/tkz-elements/tkz_elements_regular.lua b/Master/texmf-dist/tex/latex/tkz-elements/tkz_elements_regular.lua index c0749917f5f..dbd62732055 100644 --- a/Master/texmf-dist/tex/latex/tkz-elements/tkz_elements_regular.lua +++ b/Master/texmf-dist/tex/latex/tkz-elements/tkz_elements_regular.lua @@ -1,7 +1,7 @@ -- tkz_elements_regular.lua --- date 23/12/24 --- version 1.72c --- Copyright 2023 Alain Matthes +-- date 2024/01/16 +-- version 1.82c +-- Copyright 2024 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. diff --git a/Master/texmf-dist/tex/latex/tkz-elements/tkz_elements_square.lua b/Master/texmf-dist/tex/latex/tkz-elements/tkz_elements_square.lua index 4c3ce738004..e9854efbe32 100644 --- a/Master/texmf-dist/tex/latex/tkz-elements/tkz_elements_square.lua +++ b/Master/texmf-dist/tex/latex/tkz-elements/tkz_elements_square.lua @@ -1,7 +1,7 @@ -- tkz_elements-square.lua --- date 23/12/24 --- version 1.72c --- Copyright 2023 Alain Matthes +-- date 2024/01/16 +-- version 1.82c +-- Copyright 2024 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. diff --git a/Master/texmf-dist/tex/latex/tkz-elements/tkz_elements_triangle.lua b/Master/texmf-dist/tex/latex/tkz-elements/tkz_elements_triangle.lua index 4a0c892f605..d68084d5f88 100644 --- a/Master/texmf-dist/tex/latex/tkz-elements/tkz_elements_triangle.lua +++ b/Master/texmf-dist/tex/latex/tkz-elements/tkz_elements_triangle.lua @@ -1,7 +1,7 @@ -- tkz_elements_triangles.lua --- date 23/12/24 --- version 1.72c --- Copyright 2023 Alain Matthes +-- date 2024/01/16 +-- version 1.82c +-- Copyright 2024 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. @@ -56,6 +56,15 @@ end ----------------------- -- points -- ----------------------- +-- version 1.80 +function triangle: trilinear (a,b,c) + return barycenter_ ( {self.pa,a*self.a },{self.pb,b*self.b},{self.pc,c*self.c} ) +end + +function triangle: barycentric (a,b,c) + return barycenter_ ( {self.pa,a },{self.pb,b},{self.pc,c} ) +end + function triangle: bevan_point () return circum_center_ ( self : excentral_tr()) end @@ -128,6 +137,11 @@ function triangle : point (t) return self.ca : point ((t*p-self.c-self.b)/self.a) end end + +function triangle : soddy_center () + local s,i,j,k + return soddy_center_ (self.pa,self.pb,self.pc) +end ------------------- -- Result -> line ------------------- @@ -152,17 +166,20 @@ function triangle: symmedian_line (n) end function triangle: altitude (n) - local a,b,c,o + local a,b,c,o,p a = self.pa b = self.pb c = self.pc o = ortho_center_ (a,b,c) if n==1 then - return line : new (b,intersection_ll_ (b,o,a,c)) + p = projection_ (a,c,b) + return line : new (b,p) elseif n==2 then - return line : new (c,intersection_ll_ (c,o,a,b)) + p = projection_ (a,b,c) + return line : new (c,p) else - return line : new (a,intersection_ll_ (a,o,b,c)) + p = projection_ (b,c,a) + return line : new (a,p) end end @@ -223,7 +240,7 @@ local a,b,c,i,u,v,w end end ----------------------- --- circles -- +--- Result -> circles -- ----------------------- function triangle: euler_circle () return circle : new (euler_center_ ( self.pa , self.pb , self.pc),midpoint_( self.pb , self.pc)) @@ -281,6 +298,12 @@ local ma,mb,mc,sp return circle : new (sp,projection_ (ma,mb,sp)) end + +function triangle : soddy_circle () + local s,i + s,i = soddy_center_ (self.pa,self.pb,self.pc) + return circle : new ( s , i ) +end ------------------- -- Result -> triangle ------------------- @@ -367,19 +390,6 @@ function triangle: parallelogram () local x = self.pc + self.pa - self.pb return x end - -function triangle: check_equilateral () - local A,B,C,epsilon - epsilon = 10 ^(-8) - A = self.pb - self.pc - B = self.pa - self.pc - C = self.pa - self.pb - if (point.abs(A)-point.abs(B) < epsilon) and (point.abs(B)-point.abs(C) < epsilon) - then - tex.print("equilateral !!") - error("something went wrong!") - end -end function triangle: area () return area_(self.pa,self.pb,self.pc) @@ -396,15 +406,7 @@ end function triangle: check_equilateral () return check_equilateral_ (self.pa,self.pb,self.pc) end -function triangle : soddy_center () - local s,i,j,k - return soddy_center_ (self.pa,self.pb,self.pc) -end -function triangle : soddy_circle () - local s,i - s,i = soddy_center_ (self.pa,self.pb,self.pc) - return circle : new ( s , i ) -end + return triangle
\ No newline at end of file diff --git a/Master/texmf-dist/tex/latex/tkz-elements/tkz_elements_vector.lua b/Master/texmf-dist/tex/latex/tkz-elements/tkz_elements_vector.lua index 17d56843048..c2802cd41fc 100644 --- a/Master/texmf-dist/tex/latex/tkz-elements/tkz_elements_vector.lua +++ b/Master/texmf-dist/tex/latex/tkz-elements/tkz_elements_vector.lua @@ -1,7 +1,7 @@ -- tkz_elements_vectors.lua --- date 23/12/24 --- version 1.72c --- Copyright 2023 Alain Matthes +-- date 2024/01/16 +-- version 1.82c +-- Copyright 2024 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. |