Scheme Examples Using Patterns
List of: Discussion Topic
Subjects: Examples, Patterns
Contents: Kernel

This section includes some simple Scheme examples that illustrate patterns.

Rectangular Vents

This example shows a rectangular array of vent holes.

(define glv (view:gl))
(define w1 (wire-body (edge:linear (position -50 0 -50) (position 50 0 -50))))
(define w2 (wire-body (edge:circular (position 0 -50 50 ) 30 0 180)))
(define sht (sheet:2d (sheet:skin-wires (list w1 w2))))
(define f (car (entity:faces sht)))
(define p (pattern:surface f 8 6 (position 0 0 0) #f (gvector 1 0 0)

(gvector 0 1 0)))
(define s (solid:block (position -2 -3 -4) (position 2 3 4)))
(entity:set-color s 1)
(entity:pattern s p)
(bool:subtract sht s)


Figure 4-2. Rectangular Vents

Shower Head

This example shows a radial arrangement of holes in a shower head.

(define glv (view:gl))
(define blank (solid:cylinder (position 0 0 -2) (position 0 0 2) 200 1))
(entity:set-color blank (color:rgb .8 .8 .8))
(define tool (solid:cylinder (position 0 0 -5) (position 0 0 5)10))
(define pat1 (pattern:polar-grid (position 0 0 0) (gvector 0 0 1) 6 40 (gvector 0 1 0) #t #t))
(define pat2 (pattern:linear-scale pat1 2 0.1 0 (position 0 0 0) ))
(entity:pattern tool pat2)
(solid:subtract blank tool)


Figure 4-3. Shower Head
PDF/KERN/04PATT.PDF
HTM/DATA/KERN/KERN/04PATT/0017.HTM