Action:
|
Creates a new pattern by applying a linear scale to an existing pattern.
|
|
Filename:
|
kern/kern_scm/pattern_scm.cxx
|
|
APIs:
|
api_linear_scale_pattern
|
|
Syntax:
|
(pattern:linear-scale pat begin-scale end-scale
|
|
|
which-dim root [merge=#t])
|
|
Arg Types:
|
pat
|
pattern
|
|
begin-scale
|
real | gvector
|
|
end-scale
|
real | gvector
|
|
which-dim
|
integer
|
|
root
|
position
|
|
merge
|
boolean
|
|
Returns:
|
pattern
|
|
Description:
|
Applies a linear scale, from
begin-scale to
end-scale, to an existing pattern, merging with any existing scaling or, optionally (with
merge=#f), replacing it.
|
|
|
pat specifies a pattern.
|
|
|
begin-scale and
end-scale specifies the starting and ending scales respectively. Both
begin-scale and
end-scale must be greater than zero. They may be given as vectors when non-uniform scaling is desired.
|
|
|
which-dim specifies the dimension in which the scale is applied.
|
|
|
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).
|
|
|
If
merge is specifies as
#f, the existing pattern is replaced. The default value is
#t.
|
|
Example:
|
; pattern:linear-scale
|
|
; 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 4 0 0))
|
|
;; x-vec
|
|
(define num_x 8)
|
|
;; num_x
|
|
(define y-vec (gvector 0 2 0))
|
|
;; y-vec
|
|
(define num_y 10)
|
|
;; num_y
|
|
(define pat (pattern:linear x-vec num_x y-vec num_y))
|
|
;; pat
|
|
; modify the pattern
|
|
(define begin-scale 0.5)
|
|
;; begin-scale
|
|
(define end-scale 2.0)
|
|
;; end-scale
|
|
(define dim 0)
|
|
;; dim
|
|
(define root origin)
|
|
;; root
|
|
(set! pat (pattern:linear-scale
|
|
|
pat begin-scale end-scale dim root))
|
|
;; #[pattern
|
|
;; trans-vec:
|
"DOMAIN(X*VEC(4,0,0)+X2*VEC
|
|
;; (0,2,0),0,7,0,9)
|
|
;; x-vec:
|
|
"null_law"
|
|
;; y-vec:
|
|
"null_law"
|
|
;; z-vec:
|
|
"null_law"
|
|
;; scale:
|
|
"null_law"
|
|
;; keep:
|
|
"null_law"
|
|
;; no list]
|
|
; apply the pattern to the prism
|
|
(define body (entity:pattern prism pat))
|
|
;; body
|