PasteRack.org
Paste # 47258
2021-03-02 21:50:15

Fork as a new paste.

Paste viewed 249 times.


Embed:

Threefold Symmetry II

  1. #lang htdp/bsl
  2. (require 2htdp/image)
  3.  
  4. (define pt (right-triangle 100 50 "solid" "purple"))
  5. (define pti (right-triangle 100 50 "solid" "white"))
  6. (define step1 (rotate 27 pt))
  7. (define step2 (flip-vertical step1))
  8. (define gap (square 5 "solid" "white"))
  9.  
  10. (define triangle-assembly (rotate -90 (above step2 gap step1)))
  11.  
  12. (define base-1 (circle 90 "solid" "lightgreen"))
  13. (define words (text "base" 48 "gray"))
  14. (define base-2 (overlay words base-1))
  15.  
  16. (define (crop-top img n)
  17.   (crop 0 n (image-width img) (+ (- n) (image-height img)) img))
  18.  
  19. (define base-3
  20.   (crop-top  base-2 15))
  21. (define base-4
  22.   (rotate 120 (crop-top (rotate -120 base-3)
  23.                         15)))
  24. (define base-5
  25.   (rotate -120 (crop-top (rotate 120 base-4)
  26.                          15)))
  27.  
  28. (define step3
  29.   (above triangle-assembly
  30.          gap gap gap
  31.          base-5))
  32.  
  33. (define step4a (rotate 120 step3))
  34. (define step4b (above triangle-assembly
  35.                       gap gap gap
  36.                       step4a))
  37. (define step5a (rotate 120 step4b))
  38. (define step5b (above triangle-assembly
  39.                       gap gap gap
  40.                       step5a))
  41.  
  42. "This is a picture of what you could reasonably do."
  43. "Notice the triangle placements are not perfect."
  44. (rotate 120 step5b)
  45.  
  46. ;; BOSS method
  47. ;; Put the first triangle assembly the way we did in class.
  48. ;; but put another invisible shape the same size on the other size of the circle to keep it balanced.
  49. ;; Measure the height of that to make an invisible circle to guide the placement of the other parts.
  50.  
  51. "This method shows what you can do if you really think about it."
  52.  
  53. (define step1i (rotate 27 pti))
  54. (define step2i (flip-vertical step1i))
  55. (define invisible-triangle-assembly (rotate 90 (above step2i gap step1i)))
  56.  
  57. (define step3i
  58.   (above triangle-assembly
  59.          gap gap gap
  60.          base-5
  61.          gap gap gap
  62.          invisible-triangle-assembly))
  63.  
  64. (define boss (circle (* 1/2 (image-height step3i)) "solid" "transparent"))
  65. (define step3-boss (overlay step3i boss))
  66.  
  67.  
  68. (define b4a (rotate 120 step3-boss))
  69. (define b4b (overlay/align "middle" "top" triangle-assembly b4a))
  70.  
  71. (define b5a (rotate 120 b4b))
  72. (define b5b (overlay/align "middle" "top" triangle-assembly b5a))
  73.  
  74. (rotate 120 b5b)
  75.  

=>

"This is a picture of what you could reasonably do."

"Notice the triangle placements are not perfect."

image

"This method shows what you can do if you really think about it."

image