summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--pict.scm24
1 files changed, 15 insertions, 9 deletions
diff --git a/pict.scm b/pict.scm
index 1d4777e..e1a6f82 100644
--- a/pict.scm
+++ b/pict.scm
@@ -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)))