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

Action: Constructs a pattern Scheme data type.

Filename: kern/kern_scm/pattern_scm.cxx

Syntax: (pattern {trans-vec [x-vec [y-vec [scale [z-vec


[keep [root-transf]]]]]]} | in-pat |


{positions [root]})

Arg Types: trans-vec law

x-vec law

y-vec law

scale law

z-vec law

keep boolean

root-transf transform

in-pat pattern

positions position | (position ...)

root position

Returns: pattern

Description: This extension constructs a pattern based upon the supplied arguments. The pattern may be based upon laws or upon a list of positions. (The latter type may only be used to generate translational patterns. For more general kinds of list-based patterns, use the pattern:from-list extension). In the case of law-based patterns, the user need only provide laws necessary for the creation of the pattern.


trans-vec argument governs the translations.


x-vec, y-vec and z-vec specify the orientation of the body axes of the pattern elements. Together, they govern the rotations. If z-vec is omitted, the z axis is assumed to be given by the cross product of the x-vec and y-vec. It is therefore necessary to specify z-vec only if the pattern contains reflections.


scale defines a scale law to be applied to the existing pattern. The scale law may evaluate either to a scalar for uniform scaling or a gvector for non-uniform scaling.


keep may be specified as false (#f) to suppress the pattern elements whose indices lie within the ranges of the other laws.


root-transf may be used if the seed pattern element should be transformed. Without it, the seed remains unchanged.


in-pat specifies a pattern. If in-pat alone is supplied, the extension merely makes a copy of this.


positions may be used to provide a list of pattern positions.


root specifies the neutral point about which the scaling takes place (i.e., the point on the seed entity that remains fixed while the entity's dimensions are altered).

Example: ; pattern

; Create a translation law and attach a domain.

(define trans-vec (law "DOMAIN


(VEC (10*X, 5*Y, 0), 0, 5, 0, 4)"))

;; trans-vec

; Create orientation laws.

(define x-vec (law "VEC (COS (X*PI/4),


SIN (X*PI/4), 0)"))

;; x-vec

(define y-vec (law "VEC (0,0,1)"))

;; y-vec

; Create a pattern from the laws.

(define pat (pattern trans-vec x-vec y-vec))

;; pat
PDF/KERN/14SCI.PDF
HTM/DATA/KERN/KERN/14SCI/0050.HTM