Action:
|
Returns the requested pattern transform.
|
|
Filename:
|
kern/kern_scm/pattern_scm.cxx
|
|
Syntax:
|
(pattern:get-transform pat [index1 [index2]])
|
|
Arg Types:
|
pat
|
pattern
|
|
index1
|
integer
|
|
index2
|
integer
|
|
Returns:
|
transform
|
|
Description:
|
This extension returns a transform associated with the pattern specified by
pat. By default, the root transformation is returned.
|
|
|
pat specifies a pattern.
|
|
|
If
index1 is given, the relative transformation for the pattern element indexed by its value is returned;
|
|
|
If both
index1 and
index2 are given, the transformation that generates the element indexed by
index2 from the element indexed by
index1 is returned.
|
|
Example:
|
; pattern:get-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 (position 1 2 3))
|
|
;; 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)
|
|
;; ()
|
|
; get the root transform
|
|
(define t_root (pattern:get-transform pat))
|
|
;; t_root
|
|
;get the first transform
|
|
(define t_0 (pattern:get-transform pat 0))
|
|
;; t_0
|
|
; print the two transforms
|
|
(transform:print t_root)
|
|
; rotation no reflection no shear not identity
|
|
; translation part:
|
|
; 4.111957 -27.965300 -0.288970
|
|
; affine part:
|
|
; 0.951057 0.000000 -0.309017
|
|
; -0.294459 0.303314 -0.906253
|
|
; 0.093729 0.952891 0.288469
|
|
; scaling part:
|
|
; 1.000000
|
|
;; #[transform 118280584]
|
|
(transform:print t_0)
|
|
; rotation no reflection no shear not identity
|
|
; translation part:
|
|
; 4.755283 -24.500000 -1.545085
|
|
; affine part:
|
|
; -0.294459 0.303314 -0.906253
|
|
; 0.951057 0.000000 -0.309017
|
|
; -0.093729 -0.952891 -0.288469
|
|
; scaling part:
|
|
; 1.000000
|
|
;; #[transform 118280584]
|