Action:
|
Creates a new pattern that is a reflection of the specified one through a given plane.
|
|
Filename:
|
kern/kern_scm/pattern_scm.cxx
|
|
Syntax:
|
(pattern:reflect pat root normal)
|
|
Arg Types:
|
pat
|
pattern
|
|
root
|
position
|
|
normal
|
gvector
|
|
Returns:
|
pattern
|
|
Description:
|
Creates a pattern that is a reflection of the pattern
pat.
|
|
|
pat specifies a pattern.
|
|
|
root specifies a point on the plane of reflection.
|
|
|
normal specifies the normal to the reflection plane.
|
|
Example:
|
; pattern:reflect
|
|
; 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 copy of the prism
|
|
(define prismr (entity:copy prism))
|
|
;; prismr
|
|
; make a pattern
|
|
(define t1 (transform:translation (gvector 0 0 0)))
|
|
;; t1
|
|
(define t2 (transform:translation (gvector 2 2 0)))
|
|
;; t2
|
|
(define t3 (transform:translation (gvector 4 0 0)))
|
|
;; t3
|
|
(define t4 (transform:translation (gvector 0 4 0)))
|
|
;; t4
|
|
(define t5 (transform:translation (gvector 4 4 0)))
|
|
;; t5
|
|
(define pat (pattern:from-list
|
|
|
(list t1 t2 t3 t4 t5)))
|
|
;; pat
|
|
; reflect the pattern about the origin
|
|
(define root (position 0 0 0))
|
|
;; root
|
|
(define normal (gvector 1 1 0))
|
|
;; normal
|
|
(define patr (pattern:reflect pat root normal))
|
|
;; patr
|
|
; apply the original pattern to the original prism
|
|
(define apply (entity:pattern prism pat))
|
|
;; apply
|
|
; apply the reflected pattern to the copy
|
|
(define body (entity:pattern prismr patr))
|
|
;; body
|