diff options
Diffstat (limited to 'macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_line.lua')
-rw-r--r-- | macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_line.lua | 39 |
1 files changed, 15 insertions, 24 deletions
diff --git a/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_line.lua b/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_line.lua index 1e45a544db..d8c8944835 100644 --- a/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_line.lua +++ b/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_line.lua @@ -1,6 +1,6 @@ -- tkz_elements_lines.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 @@ -25,8 +25,9 @@ function line: new(za, zb) local south_pb = rotation_ (zb,math.pi/2,za) local west = rotation_ (za,math.pi/2,north_pa) local east = rotation_ (zb,math.pi/2,south_pb) - local slope = point.arg(zb-za) + local slope = angle_normalize_(point.arg(zb-za)) local length = point.mod(zb-za) + local vec = vector : new (za,zb) local o = {pa = za, pb = zb, north_pa = north_pa, @@ -38,6 +39,7 @@ function line: new(za, zb) slope = slope, mid = mid, type = type, + vec = vec, length = length} setmetatable(o, self) self.__index = self @@ -62,10 +64,9 @@ end -- Result -> boolean ------------------- function line: in_out (pt) - local sc,epsilon - epsilon = 10^(-12) + local sc sc = math.abs ((pt-self.pa)^(pt-self.pb)) - if sc <= epsilon + if sc <= tkz_epsilon then return true else @@ -74,10 +75,9 @@ function line: in_out (pt) end function line: in_out_segment (pt) - local sc,epsilon - epsilon = 10^(-12) + local sc sc = point.mod (pt-self.pa) + point.mod (pt-self.pb) - point.mod(self.pb-self.pa) - if sc <= epsilon + if sc <= tkz_epsilon then return true else @@ -430,14 +430,11 @@ end line.euclid = line.sublime function line: euclide (swap) - if swap == nil then - swap = false - end -if swap then + if swap == nil then + return triangle : new (self.pa,self.pb, rotation_ (self.pa,math.pi/5,self.pb)) + else return triangle : new (self.pa,self.pb, rotation_ (self.pa,-math.pi/5,self.pb)) -else - return triangle : new (self.pa,self.pb, rotation_ (self.pa,math.pi/5,self.pb)) - end + end end function line: divine () @@ -464,14 +461,8 @@ function line: egyptian () 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 - +line.golden = line.sublime +line.golden_gnomon = line.divine ------------------------------ -- Result -> couple of points |