diff options
author | Ricardo Wurmus <rekado@elephly.net> | 2019-06-15 00:00:52 +0200 |
---|---|---|
committer | Ricardo Wurmus <rekado@elephly.net> | 2019-06-15 00:00:52 +0200 |
commit | 14f245ca321cb97fc93944dd0f795a72ddb0d35f (patch) | |
tree | fc140aedd0ff74e88a3f5a2c56a7a86500b768df | |
parent | 2bd2fd9dd827285e8aee96ac887961cc00287e5b (diff) |
pict: octagon: Consider the border-width in the total dimensions.
* pict.scm (octagon): Do not cut off the edges by considering the line
width when computing the outer dimensions; add docstring.
-rw-r--r-- | pict.scm | 24 |
1 files changed, 15 insertions, 9 deletions
@@ -649,15 +649,21 @@ override the line color and line thickness." #:key (border-color "black") (border-width 1)) - (let ((third (exact->inexact (/ size 3)))) - (polygon `((0 . ,(* 2 third)) - (0 . ,third) - (,third . 0) - (,(* 2 third) . 0) - (,size . ,third) - (,size . ,(* 2 third)) - (,(* 2 third) . ,size) - (,third . ,size)) + "Return an octagon (more accurately a p8 symmetric isogonal octagon) +with a maximum width of SIZE. The keys BORDER-COLOR (a string) and +BORDER-WIDTH (a number) are accepted to override the default line +color and line thickness." + (let* ((half-line-width (exact->inexact (/ border-width 2))) + (size* (- size half-line-width)) + (third (exact->inexact (/ size 3)))) + (polygon `((,half-line-width . ,(* 2 third)) + (,half-line-width . ,third) + (,third . ,half-line-width) + (,(* 2 third) . ,half-line-width) + (,size* . ,third) + (,size* . ,(* 2 third)) + (,(* 2 third) . ,size*) + (,third . ,size*)) #:border-color border-color #:border-width border-width))) |