A class hierarchy for callable objects that can generate 2D patterns.
Once initialized, PatternGenerators can be called to generate a
value or a matrix of values from a 2D function, typically
accepting at least x and y.
A PatternGenerator's Parameters can make use of Parameter's
precedence attribute to specify the order in which they should
appear, e.g. in a GUI. The precedence attribute has a nominal
range of 0.0 to 1.0, with ordering going from 0.0 (first) to 1.0
(last), but any value is allowed.
The orientation and layout of the pattern matrices is defined by
the SheetCoordinateSystem class, which see.
Note that not every parameter defined for a PatternGenerator will
be used by every subclass. For instance, a Constant pattern will
ignore the x, y, orientation, and size parameters, because the
pattern does not vary with any of those parameters. However,
those parameters are still defined for all PatternGenerators, even
Constant patterns, to allow PatternGenerators to be scaled, rotated,
translated, etc. uniformly.
|
|
__call__(self,
**params_to_override)
Call the subclasses 'function' method on a rotated and scaled coordinate system. |
source code
|
|
|
|
__create_and_rotate_coordinate_arrays(self,
x,
y,
orientation)
Create pattern matrices from x and y vectors, and rotate
them to the specified orientation. |
source code
|
|
|
|
__setup_xy(self,
bounds,
xdensity,
ydensity,
x,
y,
orientation)
Produce pattern coordinate matrices from the bounds and
density (or rows and cols), and transforms them according to
x, y, and orientation. |
source code
|
|
|
|
_apply_mask(self,
params,
mat)
Create (if necessary) and apply the mask to the given matrix mat. |
source code
|
|
|
|
function(self,
params)
Function to draw a pattern that will then be scaled and rotated. |
source code
|
|
|
Inherited from param.parameterized.Parameterized:
__getstate__,
__init__,
__repr__,
__setstate__,
__str__,
debug,
defaults,
force_new_dynamic_value,
get_param_values,
get_value_generator,
inspect_value,
message,
print_param_values,
script_repr,
set_dynamic_time_fn,
state_pop,
state_push,
verbose,
warning
Inherited from object:
__delattr__,
__getattribute__,
__hash__,
__new__,
__reduce__,
__reduce_ex__,
__setattr__
|
|
|
__abstract = True
bool(x) -> bool
|
|
|
bounds = BoundingRegionParameter(default= BoundingBox(points= ...
BoundingBox of the area in which the pattern is generated.
|
|
|
mask = param.Parameter(default= None, precedence=-1, doc= ...
Optional object (expected to be an array) with which to multiply the
pattern array after it has been created, before any output_fn is
applied.
|
|
|
mask_shape = param.ClassSelector(param.Parameterized, default=...
Optional PatternGenerator used to construct a mask to be applied to
the pattern.
|
|
|
offset = param.Number(default= 0.0, softbounds= (-1.0, 1.0), p...
Additive offset to input pattern, defaulting to 0.0
|
|
|
orientation = param.Number(default= 0.0, softbounds= (0.0, 2* ...
Polar angle of pattern, i.e., the orientation in the Cartesian coordinate
system, with zero at 3 o'clock and increasing counterclockwise.
|
|
|
output_fn = param.ClassSelector(OutputFn, default= IdentityOF(...
Optional function to apply to the pattern array after it has been created.
|
|
|
position = param.Composite(attribs= ['x', 'y'], precedence=-1,...
Coordinates of location of pattern center.
|
|
|
scale = param.Number(default= 1.0, softbounds= (0.0, 2.0), pre...
Multiplicative strength of input pattern, defaulting to 1.0
|
|
|
size = param.Number(default= 1.0, bounds= (0.0, None), softbou...
Determines the overall size of the pattern.
|
|
|
x = param.Number(default= 0.0, softbounds= (-1.0, 1.0), preced...
X-coordinate location of pattern center.
|
|
|
xdensity = param.Number(default= 10, bounds= (0, None), preced...
Density (number of samples per 1.0 length) in the x direction.
|
|
|
y = param.Number(default= 0.0, softbounds= (-1.0, 1.0), preced...
Y-coordinate location of pattern center.
|
|
|
ydensity = param.Number(default= 10, bounds= (0, None), preced...
Density (number of samples per 1.0 length) in the y direction.
|
|
Inherited from param.parameterized.Parameterized:
name,
print_level
|