pattern:concatenate
List of: Scheme Extensions
Subjects: Patterns
Contents: Kernel

Action: Creates a new pattern by concatenating two existing ones.

Filename: kern/kern_scm/pattern_scm.cxx

Syntax: (pattern:concatenate pat1 pat2 [transform])

Arg Types: pat1 pattern

pat2 pattern

transform transform

Returns: pattern

Description: Creates a new pattern by concatenating two existing ones, optionally applying a transform to the second.


pat1 specifies the first pattern.


pat2 specifies the second pattern.


transform is an optional argument specifying the transformation to be applied to the second pattern.

Example: ; pattern:concatenate

; make a prism

(define height 1)

;; height

(define maj_rad 1)

;; maj_rad

(define min_rad 0.5)

;; min_rad

(define num_sides 3)

;; num_sides

(define prism (solid:prism height


maj_rad min_rad num_sides))

;; prism

; position the prism

(define origin (position 1 2 3))

;; origin

(define transform (entity:transform prism


(transform:axes


origin (gvector 1 0 0) (gvector 0 1 0))))

;; transform

; make a pattern

(define x-vec (gvector 2 0 0))

;; x-vec

(define num_x 8)

;; num_x

(define pat1 (pattern:linear x-vec num_x))

;; pat1

; make another pattern

(define center (position -4 2 3))

;; center

(define normal (gvector 0 0 1))

;; normal

(define num 8)

;; num

(define pat2 (pattern:elliptical center normal num))

;; pat2

; concatenate the patterns

(define pat (pattern:concatenate pat1 pat2))

;; pat

; apply the pattern to the prism

(define body (entity:pattern prism pat))

;; body
PDF/KERN/14SCI.PDF
HTM/DATA/KERN/KERN/14SCI/0056.HTM