SubstitutionTilings.jl Core Definitions
Dilation groups and substitution systems
SubstitutionTilings.CoreDefs.DGroupElem
— TypeDGroupElem
A subtype of DGroupElem
is the type of elements of some group with a dilation. It should implement the functions id
, *
, inv
and dilate
.
SubstitutionTilings.CoreDefs.SubSystem
— TypeSubSystem{G, D, L}
The description of a substitution system with coordinates in G
, labels of type L
and dilation coefficients of type D
. G
should be a subset of DGroupElem
implementing dilate(λ :: D, g :: G)
.
SubstitutionTilings.CoreDefs.autocorrelation
— MethodGiven a (primitive) substitution system S
, some collar initial_collar
and some patch patch
(both centered at the origin) and some depth depth
, calculates the autocorrelation measure of a tiling for all differences between supertiles of depth depth
. The values are accurate as long as depth
is high enough to force collars. weights(i :: L,g :: G,j :: L)
gives the weight used to compute the autocorrelation: by default it is constantly 1
collar_in
should be implemented.
SubstitutionTilings.CoreDefs.center_patch
— Methodcenter_patch
Translates the patch so that the first tile is located at the identity.
SubstitutionTilings.CoreDefs.dilate
— Functiondilate(λ, g)
embed_aff
dilates an group element g
by the coefficient λ
.
SubstitutionTilings.CoreDefs.draw
— Functiondraw(t :: T, action :: Symbol)
T
should be a type of prototiles and s
should be an action Luxor recognizes when drawing shapes (such as :fill
or :stroke
). draw(t,s)
should then draw some geometric primitives in a Luxor context using the action s
.
SubstitutionTilings.CoreDefs.draw
— Methoddraw(t :: Pair{<:DGroupElem, T}, sc, hue, action)
If t
is a tile, draw(t, sc, hue, action)
draws it using draw(t[1], action)
after applying the transformation embed_aff(t[2])
with scale sc
, hue hue
and action p action
.
SubstitutionTilings.CoreDefs.embed_aff
— Functionembed_aff(g)
embed_aff
should return the embedding of g
as an element of Aff(2)
. This should be a vector length 6
with the three columns of the augmented matrix of the transformation, ignoring its last row. For example, if g
should be embedded as a reflection along the x axis followed by a translation by (1,0)
, the output should be [1., 0., 0., -1., 1., 0.]
. This is the format Luxor uses to represent affine transformations.
SubstitutionTilings.CoreDefs.empirical_frequency
— Methodempirical_frequency(patch, tiling)
Computes the empirical relative frequency of patch
in the tiling
: that is, computes how many translates of patch
are subsets of tiling
divided by the total amount of tiles in tiling
.
SubstitutionTilings.CoreDefs.frequency
— MethodGiven a (primitive) substitution system S
, some collar initial_collar
and some patch patch
(both centered at the origin) and some depth depth
calculates the frequency of patch
in S
. initial_collar
is used to construct a total collaring and doesn't matter as long as it's a legal collar. depth
determines how the level at which the frequency is calculated: the result is only exact if depth
is high enough, but lower values result in faster computation.
Requires collar_in
to be implemented for the given substitution system.
SubstitutionTilings.CoreDefs.id
— Functionid(g)
Returns the identity element of the group g
belongs to.
SubstitutionTilings.CoreDefs.substitute
— Functionsubstitute(S, tiling, n, [in_bounds, window])
Applies n
inflation steps of the tiling: each step dilates the tiling and then substitutes each tile according to the substitution rule of S. This version computes the substitution depth first: this is more efficient unless the substitution rule has lots of overlaps (see substitute_bf
)
Optionally, one can filter which tiles are computed by providing in_bounds
and window
. If provided, in_bounds
should be a test function in_bounds(tile, n, window)
which recieves a tile, a depth and the supplied window, and outputs whether the tile should be substituted further or discarded. This can be used to greatly reduce compute times when rendering images of tilings.
SubstitutionTilings.CoreDefs.substitute_bf
— Functionsubstitute_bf(S, tiling,n=1)
Set version of the substitute function: use when the substitution rule has overlaps
SubstitutionTilings.CoreDefs.total_collaring
— Methodtotal_collaring(S, initial_collar)
Given a (primitive) substitution system S
and some collar initial_collar
(centered at the origin), construct its total collaring. The result is given as a tuple (collars, Sc)
where collars
is the list of all collars that happen in S
-legal tilings and Sc
is the corresponding substitution system, where the labels are integers constituting indexes in collars
.
Requires collar_in
to be implemented for the given substitution system.
SubstitutionTilings.CoreDefs.transition_matrix
— Methodtransition_matrix(S, order)
Given a substitution system S
and a list of labels order
, computes the transition matrix of S
in that order
Index
SubstitutionTilings.CoreDefs.DGroupElem
SubstitutionTilings.CoreDefs.SubSystem
SubstitutionTilings.CoreDefs.autocorrelation
SubstitutionTilings.CoreDefs.center_patch
SubstitutionTilings.CoreDefs.dilate
SubstitutionTilings.CoreDefs.draw
SubstitutionTilings.CoreDefs.draw
SubstitutionTilings.CoreDefs.embed_aff
SubstitutionTilings.CoreDefs.empirical_frequency
SubstitutionTilings.CoreDefs.frequency
SubstitutionTilings.CoreDefs.id
SubstitutionTilings.CoreDefs.substitute
SubstitutionTilings.CoreDefs.substitute_bf
SubstitutionTilings.CoreDefs.total_collaring
SubstitutionTilings.CoreDefs.transition_matrix