pattern:edge
List of: Scheme Extensions
Subjects: Patterns
Contents: Kernel

Action: Creates a pattern parallel to an edge.

Filename: kern/kern_scm/pattern_scm.cxx

APIs: api_edge_pattern

Syntax: (pattern:edge entity-list number root


[on-endpoints=#f] [normal-dir tangent-dir])

Arg Types: entity-list entity | (entity...)

number integer

root position

on-endpoints boolean

normal-dir gvector

tangent-dir gvector

Returns: pattern

Description: Creates a one-dimensional pattern of number elements, equally spaced in parameter space, parallel to an edge.


entity-list argument may consist of an edge, a face and one of its bounding edges, or a coedge.


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-endpoints is set to #t, the pattern could be extended to the endpoints of the edge.


normal-dir and tangent-dir specify the directions, relative to the seed entity, that are mapped to the normal and tangent directions of the edge, respectively. If normal-dir and tangent-dir are specified, the pattern members instead follow the curvature of the edge. By default, pattern members are oriented identically to one another. (When entity-list consists entirely of a single edge, a rail law is generated to determine the normal direction of the edge.)

Example: ; pattern:edge

; 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 axis_start (position 0 -25 0))

;; axis_start

(define axis_end (position 0 25 0))

;; axis_end

(define start-dir (gvector 1 0 0))

;; start-dir

(define radius 5)

;; radius

(define thread_distance 10)

;; thread_distance

(define edge (edge:helix axis_start axis_end


start-dir radius thread_distance))

;; edge

(define num 50)

;; num

(define root origin)

;; root

(define on-endpoints #f)

;; on-endpoints

(define rail-dir (gvector 1 0 0))

;; rail-dir

(define tangent-dir (gvector 0 1 0))

;; tangent-dir

(define pat (pattern:edge edge num


root on-endpoints rail-dir tangent-dir))

;; pat

(entity:delete edge)

;; ()

; apply the pattern to the prism

(define body (entity:pattern prism pat))

;; body
PDF/KERN/14SCI.PDF
HTM/DATA/KERN/KERN/14SCI/0061.HTM