球拍幻灯片2Htdp Pict

时间:2019-08-25 15:57:27

标签: lisp racket

我正在尝试使用球拍创建图像。我想尝试制作华夫饼干,但似乎无法弄清楚。这是我的代码:

#lang slideshow

(require 2htdp/image)

(define (waffle img)

    (define two-p (hc-append img (rectangle 10 10 "solid" "white") img (rectangle 10 10 "solid" "white") img))

    (vc-append two-p (rectangle 10 10 "solid" "white") two-p (rectangle 10 10 "solid" "white") two-p))

(circle 35 "solid" "yellow")

(waffle (rectangle 10 10 "solid" "brown"))

我想将矩形覆盖到圆上。我应该怎么做?我使用的是正确的库还是应该使用其他库?

1 个答案:

答案 0 :(得分:1)

我设法通过使用cc-superimpose解决了它!我的代码现在看起来像这样:

#lang slideshow

(require 2htdp/image)

(define (waffle img)

  (define two-p (hc-append img (rectangle 10 10 "solid" "yellow") img (rectangle 10 10 "solid" "yellow") img))

  (vc-append two-p (rectangle 10 10 "solid" "yellow") two-p (rectangle 10 10 "solid" "yellow") two-p))

(cc-superimpose

 (circle 37 "solid" "yellow")

 (waffle (rectangle 10 10 "solid" "brown")))