Action:
|
Creates a pattern parallel to a surface.
|
|
Filename:
|
kern/kern_scm/pattern_scm.cxx
|
|
APIs:
|
api_surface_pattern
|
|
Syntax:
|
(pattern:surface entity num-u num-v root
|
|
|
[on-boundary=#f] [dir-u dir-v])
|
|
Arg Types:
|
entity
|
entity
|
|
num-u
|
integer
|
|
num-v
|
integer
|
|
root
|
position
|
|
on-boundary
|
boolean
|
|
dir-u
|
gvector
|
|
dir-v
|
gvector
|
|
Returns:
|
pattern
|
|
|
entity specifies a face entity.
|
|
|
num-u and
num-v arguments specify the number of elements along u and v directions respectively.
|
|
|
root specifies the position (which can be on or off the seed pattern entity, as desired) to be mapped to the pattern sites.
|
|
|
If
on-boundary is set to true (#t), the pattern extends to the face boundary.
|
|
|
If
dir-u and
dir-v are specified, the orientation of the pattern members follow the surface normal. In this case, these vectors specify the directions, relative to the seed entity, that are mapped to the u- and v-directions of the face. By default, pattern members are oriented identically to one another.
|
|
Example:
|
; pattern:surface
|
|
; 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 pos origin)
|
|
;; pos
|
|
(define radius 20)
|
|
;; radius
|
|
(define long_start 0)
|
|
;; long_start
|
|
(define long_end 90)
|
|
;; long_end
|
|
(define lat_start -360)
|
|
;; lat_start
|
|
(define lat_end 360)
|
|
;; lat_end
|
|
(define normal (gvector 0 0 1))
|
|
;; normal
|
|
(define face (face:sphere pos radius
|
|
|
long_start long_end lat_start lat_end normal))
|
|
;; face
|
|
(define u_num 8)
|
|
;; u_num
|
|
(define v_num 6)
|
|
;; v_num
|
|
(define root origin)
|
|
;; root
|
|
(define pat (pattern:surface face
|
|
|
u_num v_num root))
|
|
;; pat
|
|
(entity:delete face)
|
|
;; ()
|
|
; apply the pattern to the prism
|
|
(define body (entity:pattern prism pat))
|
|
;; body
|