Action:
|
Creates a new pattern by applying random rotations at each of the pattern sites.
|
|
Filename:
|
kern/kern_scm/pattern_scm.cxx
|
|
APIs:
|
api_random_orient_pattern
|
|
Syntax:
|
(pattern:random-orient pat [min-axial max-axial
|
|
|
axial-dir min-tilt max-tilt tilt-dir])
|
|
Arg Types:
|
pat
|
pattern
|
|
min-axial
|
real
|
|
max-axial
|
real
|
|
axial-dir
|
gvector
|
|
min-tilt
|
real
|
|
max-tilt
|
real
|
|
tilt-dir
|
gvector
|
|
Returns:
|
pattern
|
|
Description:
|
Randomizes the given pattern by applying random rotations at each of the pattern sites. The default arguments yield a totally random rotation.
|
|
|
pat specifies a pattern.
|
|
|
min-axial and max-axial arguments specify the range of values in the axial direction specified by
axial-dir.
|
|
|
axial-dir specifies the axial direction.
|
|
|
min-tilt and
max-tilt arguments specify the range of values in the tilt direction specified by
tilt-dir.
|
|
|
tilt-dir specifies the tilt direction. If the
tilt-dir direction is not orthogonal to
axial-dir, only its orthogonal component is used.
|
|
Example:
|
; pattern:random-orient
|
|
; 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 root origin)
|
|
;; root
|
|
(define min-axial 0)
|
|
;; min-axial
|
|
(define max-axial 360)
|
|
;; max-axial
|
|
(define axial-dir (gvector 1 0 0))
|
|
;; axial-dir
|
|
(define min-tilt 0)
|
|
;; min-tilt
|
|
(define max-tilt 0)
|
|
;; max_tiilt
|
|
(define tilt-dir (gvector 0 0 1))
|
|
;; tilt-dir
|
|
(set! pat (pattern:random-orient pat root
|
|
|
min-axial max-axial axial-dir
|
|
|
min-tilt max-tilt tilt-dir))
|
|
;; #[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
|