Action:
|
Creates an elliptical pattern.
|
|
Filename:
|
kern/kern_scm/pattern_scm.cxx
|
|
APIs:
|
api_elliptical_pattern
|
|
Syntax:
|
(pattern:elliptical center normal num
|
|
|
[not-rotate=#f root [angle=360
|
|
|
[ratio=1 major-axis]]])
|
|
Arg Types:
|
center
|
position
|
|
normal
|
gvector
|
|
num
|
integer
|
|
not-rotate
|
boolean
|
|
root
|
position
|
|
angle
|
real
|
|
ratio
|
real
|
|
major-axis
|
gvector
|
|
|
|
Returns:
|
pattern
|
|
Description:
|
Creates a one-dimensional elliptical pattern defined by an axis of rotation.
|
|
|
center and
normal define the (global) position and orientation of the axis.
|
|
|
num argument defines the number of entities in the pattern.
|
|
|
When
not-rotate is
#t, the elements of the pattern are kept in a fixed, relative orientation. In which case,
root is required because it defines the position mapped to the pattern sites.
|
|
|
angle defines the angular extent of the pattern, with positive/negative values producing patterns proceeding clockwise/counter-clockwise (accordingly) about the normal vector.
|
|
|
ratio defines the ratio of minor/major radii of the pattern.
|
|
|
major-axis defines the direction of the ellipse's major axis.
|
|
Example:
|
; pattern:elliptical
|
|
; Make a prism to demonstrate command.
|
|
(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
|
|
; Output Original
|
|
|
; Redefine position of origin.
|
|
(define origin (position 1 2 3))
|
|
;; origin
|
|
; Reposition prism.
|
|
(define transform (entity:transform prism
|
|
|
(transform:axes origin (gvector 1 0 0)
|
|
|
(gvector 0 1 0))))
|
|
;; transform
|
|
; Make a pattern.
|
|
(define center (position 11 2 3))
|
|
;; center
|
|
(define normal (gvector 0 0 1))
|
|
;; normal
|
|
(define num 24)
|
|
;; num
|
|
(define not-rotate #f)
|
|
;; not-rotate
|
|
(define root origin)
|
|
;; root
|
|
(define ang 360)
|
|
;; ang
|
|
(define ratio 0.5)
|
|
;; ratio
|
|
(define major-axis (gvector 2 1 0))
|
|
;; major-axis
|
|
(define pat (pattern:elliptical center normal num
|
|
|
not-rotate root ang ratio major-axis))
|
|
;; pat
|
|
; Apply the pattern to the prism.
|
|
(define body (entity:pattern prism pat))
|
|
;; body
|
|
; Output Result
|
|
|
|
|
Figure 14-3. pattern:elliptical
|