diff options
Diffstat (limited to 'macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_functions_intersections.lua')
-rw-r--r-- | macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_functions_intersections.lua | 21 |
1 files changed, 9 insertions, 12 deletions
diff --git a/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_functions_intersections.lua b/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_functions_intersections.lua index be7eea4461..7dd2c59c32 100644 --- a/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_functions_intersections.lua +++ b/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_functions_intersections.lua @@ -1,6 +1,6 @@ -- tkz_elements_intersections.lua --- date 2024/01/16 --- version 1.82c +-- date 2024/02/04 +-- version 2.00c -- 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 @@ -33,10 +33,9 @@ end -- function -- line ellipse function intersection_le (L,E) - local a,b,c,d,t1,t2,z1,z2,A,B,Bx,By,Ax,Ay,Rx,Ry,epsilon,sd + local a,b,c,d,t1,t2,z1,z2,A,B,Bx,By,Ax,Ay,Rx,Ry,sd A = (L.pa - E.center)*(point(math.cos(E.slope),-math.sin(E.slope))) B = (L.pb - E.center)*(point(math.cos(E.slope),-math.sin(E.slope))) - epsilon = 10^(-6) Rx = E.Rx Ry = E.Ry Ax = A.re @@ -62,7 +61,7 @@ function intersection_le (L,E) return z2*(point(math.cos(E.slope),math.sin(E.slope))) + E.center, z1*(point(math.cos(E.slope),math.sin(E.slope))) + E.center end -- if - elseif math.abs(d) < epsilon + elseif math.abs(d) < tkz_epsilon then t1 = (-(b))/(2*a) z1 = point ( Ax + (Bx-Ax)*t1 , Ay + (By-Ay)*t1 ) @@ -74,8 +73,7 @@ function intersection_le (L,E) end function intersection_ll_ (a,b,c,d) - local x1,x2,x3,x4,y1,y2,y3,y4,DN,NX,NY,epsilon - epsilon = 10^(-12) + local x1,x2,x3,x4,y1,y2,y3,y4,DN,NX,NY x1 = a.re y1 = a.im x2 = b.re @@ -85,7 +83,7 @@ function intersection_ll_ (a,b,c,d) x4 = d.re y4 = d.im DN = (x1-x2)*(y3-y4) - (y1-y2)*(x3-x4) - if math.abs ( DN ) < epsilon then + if math.abs ( DN ) < tkz_epsilon then return false else NX = (x1*y2-y1*x2)*(x3-x4) - (x1-x2)*(x3*y4-y3*x4) @@ -95,18 +93,17 @@ function intersection_ll_ (a,b,c,d) end function intersection_lc_ (pa,pb,c,p) - local zh, dh, arg_ab, test, phi,epsilon,c1,c2,r + local zh, dh, arg_ab, test, phi,c1,c2,r r = point.mod (c-p) - epsilon = 10^(-12) zh = projection_ (pa,pb,c) dh = point.abs (c - zh) arg_ab = point.arg (pa - pb) - if dh < epsilon + if dh < tkz_epsilon then return c + polar_ (r , math.pi + arg_ab), -- through center c + polar_ (r , arg_ab) - elseif math.abs (r - dh) < epsilon + elseif math.abs (r - dh) < tkz_epsilon then return zh , zh -- tangent elseif dh > r |