diff options
author | Norbert Preining <norbert@preining.info> | 2023-12-09 03:03:37 +0000 |
---|---|---|
committer | Norbert Preining <norbert@preining.info> | 2023-12-09 03:03:37 +0000 |
commit | 1bac51c9be71358b55925783e16f3d8bc03d630b (patch) | |
tree | 3e7fe5a309cf68674318a5396ebb83fa5f7a051e /macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_rectangle.lua | |
parent | 24d8cd26aa53d1cac2260d29c6cf1c387a61a32a (diff) |
CTAN sync 202312090303
Diffstat (limited to 'macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_rectangle.lua')
-rw-r--r-- | macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_rectangle.lua | 67 |
1 files changed, 48 insertions, 19 deletions
diff --git a/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_rectangle.lua b/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_rectangle.lua index 142ddbd8b2..7c53646978 100644 --- a/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_rectangle.lua +++ b/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_rectangle.lua @@ -1,6 +1,6 @@ -- tkz_elements-rectangle.lua --- date 23/12/03 --- version 1.40c +-- date 23/12/08 +-- version 1.50c -- 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 @@ -59,36 +59,65 @@ function rectangle: new (za, zb,zc,zd) end function rectangle : angle (zi,za,an) + local zb,zc,zd local zc = symmetry_ (zi,za) local zb = rotation_(zi,-an,zc) local zd = symmetry_ (zi,zb) return rectangle : new (za,zb,zc,zd) end -function rectangle : gold (za,zb) - a = point.arg (zb-za) - local d = point.abs(zb-za)/tkzphi - local zc = zb : north (d/scale) - zc = rotation_ (zb,a,zc) - local zd = za : north (d/scale) - zd = rotation_ (za,a,zd) - return rectangle : new (za,zb,zc,zd) +function rectangle : gold (za,zb,swap) + local zc,zd + local a = point.arg (zb-za) + local d = point.abs(zb-za)/tkzphi + if swap == nil then swap = false end + if swap then + zc = zb : south (d/scale) + zc = rotation_ (zb,a,zc) + zd = za : south (d/scale) + zd = rotation_ (za,a,zd) + return rectangle : new (za,zb,zc,zd) + else + zc = zb : north (d/scale) + zc = rotation_ (zb,a,zc) + zd = za : north (d/scale) + zd = rotation_ (za,a,zd) + return rectangle : new (za,zb,zc,zd) + end end -function rectangle : diagonal (za,zc) - local zb = point (zc.re,za.im) - local zd = point (za.re,zc.im) +function rectangle : diagonal (za,zc,swap) + local zb,zd + if swap == nil then swap = false end + if swap then + zd = point (zc.re,za.im) + zb = point (za.re,zc.im) + return rectangle : new (za,zb,zc,zd) + else + zb = point (zc.re,za.im) + zd = point (za.re,zc.im) return rectangle : new (za,zb,zc,zd) end +end -function rectangle : side (za,zb,d) - a = point.arg (zb-za) - local zc = zb : north (d/scale) - zc = rotation_ (zb,a,zc) - local zd = za : north (d/scale) - zd = rotation_ (za,a,zd) +function rectangle : side (za,zb,d,swap) + local a,zc,zd + a = point.arg (zb-za) + if swap == nil then swap = false end + if swap then + zc = zb : south (d/scale) + zc = rotation_ (zb,a,zc) + zd = za : south (d/scale) + zd = rotation_ (za,a,zd) + return rectangle : new (za,zb,zc,zd) + else + zc = zb : north (d/scale) + zc = rotation_ (zb,a,zc) + zd = za : north (d/scale) + zd = rotation_ (za,a,zd) return rectangle : new (za,zb,zc,zd) end +end ------------------- function rectangle : get_lengths () |