pattern:index-to-coords
List of: Scheme Extensions
Subjects: Patterns
Contents: Kernel

Action: For the specified pattern, returns the pattern coordinates associated with the specified pattern index.

Filename: kern/kern_scm/pattern_scm.cxx

Syntax: (pattern:index-to-coords pat index)

Arg Types: pat pattern

index integer

Returns: (real ...)


pat specifies a pattern.


index specifies a pattern index.

Example: ; pattern:index-to-coords

; 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 center origin)

;; center

(define center origin)

;; center

(define normal (gvector 0 0 1))

;; normal

(define num-radial 4)

;; num-radial

(define num-angular 5)

;; num-angular

(define spacing 3)

;; spacing

(define pat1


(pattern:radial center normal


num-radial num-angular spacing))

;; pat1

; find the pattern coords of a specific element

(define index 13)

;; index

(define coords (pattern:index-to-coords pat1 index))

;; coords
PDF/KERN/14SCI.PDF
HTM/DATA/KERN/KERN/14SCI/0067.HTM