Action:
|
Scales a single element of an existing pattern.
|
|
Filename:
|
kern/kern_scm/pattern_scm.cxx
|
|
Syntax:
|
(pattern:scale-element pat coords scale root)
|
|
Arg Types:
|
pat
|
pattern
|
|
coords
|
real
|
|
scale
|
real | gvector
|
|
root
|
position
|
|
Returns:
|
pattern
|
|
Description:
|
Scales the element specified by
coords of an existing pattern about the position root by an amount
scale.
|
|
|
pat specifies a pattern.
|
|
|
coords identify the element in the pattern.
|
|
|
scale argument specifies the scale value to be applied. The
scale may be a real number, for uniform scaling, or a vector, for non-uniform scaling.
|
|
|
root specifies the neutral point about which the scaling takes place (i.e., the point on the seed entity that remains fixed while the entity's dimensions are altered).
|
|
Example:
|
; pattern:scale-element
|
|
; 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 trans (entity:transform prism
|
|
|
(transform:axes origin
|
|
|
(gvector 1 0 0) (gvector 0 1 0))))
|
|
;; trans
|
|
; make a pattern
|
|
(define center origin)
|
|
;; center
|
|
(define normal (gvector 0 0 1))
|
|
;; normal
|
|
(define num-radial 4)
|
|
;; num-radial
|
|
(define num-angular 5)
|
|
;; num-angular
|
|
(define spacing 3)
|
|
;; spacing
|
|
(define pat (pattern:radial center normal
|
|
|
num-radial num-angular spacing))
|
|
;; pat
|
|
; modify the pattern
|
|
(define scaling 2)
|
|
;; scaling
|
|
(define root origin)
|
|
;; root
|
|
(set! pat (pattern:scale-element pat
|
|
|
(list 0 0) scaling root))
|
|
;; #[pattern
|
|
;; trans-vec:
|
"DOMAIN(VEC(-1,0,0)*COS
|
|
;; (1.256637061435917*X2)*3*X+VEC
|
|
;; (0,-1,0)*SIN(1.256637061435917*X2)
|
|
;; *3*X+VEC (1,2,3),0,3,0,4)"
|
|
;; x-vec:
|
"VEC(-1,0,0)*COS
|
|
;; (1.256637061435917*X2)+VEC
|
|
;; (0,-1,0)*SIN(1.256637061435917*X2)"
|
|
;; y-vec:
|
"VEC(0,0,1)"
|
|
;; z-vec:
|
"null_law"
|
|
;; scale:
|
"null_law"
|
|
;; keep:
|
"PIECEWISE(X>0,X,X2<1)"
|
|
;; [list]]
|
|
; apply the pattern to the prism
|
|
(define body (entity:pattern prism pat))
|
|
;; body
|
|
(law:equal-test (length (entity:vertices body)) 96)
|
|
;; #t
|