Package 'truchet'

Title: Package for creating Truchet tiles and random mosaics
Description: This package includes utility functions to create Truchet tiles and arrange them to create mosaics.
Authors: Antonio Páez [aut, cre]
Maintainer: Antonio Páez <[email protected]>
License: MIT + file LICENSE
Version: 0.0.0.9007
Built: 2024-11-02 05:28:48 UTC
Source: https://github.com/paezha/truchet

Help Index


Flexible Truchet tiles

Description

Flexible Truchet tiles

Usage

st_truchet_boutique(x = 0, y = 0, type = "ribbon_1")

Arguments

x

A number with the x coordinate of the center of the tile

y

A number with the y coordinate of the center of the tile

type

A single character to designate a type of tile; currently supported options are "ribbon_1", "ribbon_2", "ribbon_3", "ribbon_4", "paradise_1", "paradise_2", "paradise_3", "paradise_4", "silk_1", "silk_2", "silk_3", "silk_4", "rainbow_1", "rainbow_2", "cloud_1", "cloud_2", "cloud_3", "cloud_4"

Value

A data frame with one or more objects of type sf representing one or more tiles depending on type

Note

For a discussion of variable tiling patterns see: Robert J.Krawczyk (2020) Infinitely Variable Tiling Patterns: From Truchet to Sol LeWitt Revisited, Patterns, 1:5, 1-4, 10.1016/j.patter.2020.100084 and Robert J.Krawczyk (2011) Truchet tilings revisited, Proceedings of ISAMA 2011, 69-77 http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.378.5320&rep=rep1&type=pdf#page=69

Examples

st_truchet_boutique(type = "ribbon_1")
st_truchet_boutique(type = "ribbon_2")

Dissolving the boundaries of individual tiles in Truchet mosaics

Description

Dissolving the boundaries of individual tiles in Truchet mosaics

Usage

st_truchet_dissolve(mosaic)

Arguments

mosaic

a mosaic produced by function st_truchet_ms

Value

An object of type sf with the mosaic after dissolving the boundaries of individual tiles

Examples

mosaic <- st_truchet_ms()
mosaic <- st_truchet_dissolve(mosaic)

Flexible Truchet tiles

Description

Flexible Truchet tiles

Usage

st_truchet_flex(x = 0, y = 0, type = "Al", b = 1/2)

Arguments

x

A number with the x coordinate of the center of the tile

y

A number with the y coordinate of the center of the tile

type

A single character to designate a type of tile; currently supported options are "Ac", "Bc", "Cc", "Dc", "As", "Bs", "Cs", "Ds"

b

A number between zero and one that controls the shape of the boundary between the two parts of the tile

Value

A list with one or more objects of type sf representing one or more tiles depending on type

Note

For a discussion of Truchet patterns see: Robert Bosch & Urchin Colley (2013) Figurative mosaics from flexible Truchet tiles, Journal of Mathematics and the Arts, 7:3-4, 122-135, 10.1080/17513472.2013.838830

Examples

st_truchet_flex(type = "Al")
st_truchet_flex(type = "Cl")

Mosaics with flexible Truchet tiles

Description

Mosaics with flexible Truchet tiles

Usage

st_truchet_fm(
  df = NULL,
  tiles = c("Al", "Cl"),
  b = 1/2,
  xlim = c(1, 3),
  ylim = c(1, 6)
)

Arguments

df

an (optional) data frame with the following columns: x and y (the coordinates of the tiles in a 1 by 1 grid), tiles (characters with types of tiles to use for mosaic), b (control of the boundary; defaults to 1/2)

tiles

a character vector with types of tiles to use for mosaic (default: c("dr", "dl"))

b

A number between zero and one that controls the shape of the boundary between the two parts of the tile

xlim

a numeric vector of length 2 giving the range of the x coordinates of the mosaic (ignored if argument df is an input)

ylim

a numeric vector of length 2 giving the range of the y coordinates of the mosaic (ignored if argument df is an input)

Value

An object of type sf with the tiles arranged as a mosaic

Note

For a discussion of Truchet patterns see http://arearugscarpet.blogspot.com/2014/04/the-curse-of-truchets-tiles.html

Examples

mosaic <- st_truchet_fm()
plot(mosaic)
mosaic <- st_truchet_fm(b = 1/3)
plot(mosaic)

Truchet tiles made with polygons

Description

Truchet tiles made with polygons

Usage

st_truchet_l(x = 0, y = 0, type = "dl")

Arguments

x

A number with the x coordinate of the center of the tile

y

A number with the y coordinate of the center of the tile

type

A single character to designate a type of tile; currently supported options are "dl", "dr"

Value

A list with one or more objects of type sf representing one or more tiles depending on type

Note

For a discussion of Truchet patterns see http://arearugscarpet.blogspot.com/2014/04/the-curse-of-truchets-tiles.html

Examples

st_truchet_l(type = "dl")
st_truchet_l(type = "dr")

Truchet mosaics

Description

Truchet mosaics

Usage

st_truchet_ms(
  df = NULL,
  p1 = 1,
  p2 = 0,
  p3 = 0,
  tiles = c("dr", "dl"),
  xlim = c(1, 3),
  ylim = c(1, 6)
)

Arguments

df

an (optional) data frame with the following columns: x and y (the coordinates of the tiles in a 1 by 1 grid), tiles (characters with types of tiles to use for mosaic), scale_p (the scale of the tile to be placed at each coordinate)

p1

a number between 0 and 1 with the proportion of spots in the mosaic to cover with tiles of scale 1 (the sum of p1, p2, p3 must be equal to one, or less to avoid empty spots in the mosaic)

p2

a number between 0 and 1 with the proportion of spots in the mosaic to cover with tiles of scale 1/2

p3

a number between 0 and 1 with the proportion of spots in the mosaic to cover with tiles of scale 1/4

tiles

a character vector with types of tiles to use for mosaic (default: c("dr", "dl"))

xlim

a numeric vector of length 2 giving the range of the x coordinates of the mosaic (ignored if argument df is an input)

ylim

a numeric vector of length 2 giving the range of the y coordinates of the mosaic (ignored if argument df is an input)

Value

An object of type sf with the tiles arranged as a mosaic

Note

For a discussion of multi-scale Truchet patterns see https://christophercarlson.com/portfolio/multi-scale-truchet-patterns/

Examples

mosaic <- st_truchet_ms()
plot(mosaic)
mosaic <- st_truchet_ms(p1 = 0.8, p2 = 0.16, p3 = 0.04)
plot(mosaic)
mosaic <- st_truchet_ms(p1 = 0.6, p2 = 0.3, p3 = 0.1, tiles = c("|", "-"))
plot(mosaic)

Truchet tiles made with polygons

Description

Truchet tiles made with polygons

Usage

st_truchet_p(x = 0, y = 0, type = "dl", scale_p = 1)

Arguments

x

A number with the x coordinate of the center of the tile

y

A number with the y coordinate of the center of the tile

type

A single character to designate a type of tile; currently supported options are "dl", "dr", "-", "|", "+.", "+", "x.", "tn", "fnw", "fne", "fsw", "fse", "ane", "asw"

scale_p

A number to designate the scale of the tile; currently supported options are 1, 1/2, and 1/4

Value

A list with one or more objects of type sf representing one or more tiles depending on type

Note

For a discussion of multi-scale Truchet patterns see https://christophercarlson.com/portfolio/multi-scale-truchet-patterns/

Examples

st_truchet_p(type = "-")
st_truchet_p(type = "fnw", scale_p = 1/2)

Truchet mosaics

Description

Truchet mosaics

Usage

st_truchet_ss(df = NULL, tiles = c("dr", "dl"), xlim = c(1, 3), ylim = c(1, 6))

Arguments

df

an (optional) data frame with the following columns: x and y (the coordinates of the tiles in a 1 by 1 grid), tiles (characters with types of tiles to use for mosaic), scale_p (the scale of the tile to be placed at each coordinate)

tiles

a character vector with types of tiles to use for mosaic (default: c("dr", "dl"))

xlim

a numeric vector of length 2 giving the range of the x coordinates of the mosaic (ignored if argument df is an input)

ylim

a numeric vector of length 2 giving the range of the y coordinates of the mosaic (ignored if argument df is an input)

Value

An object of type sf with the tiles arranged as a mosaic

Note

For a discussion of multi-scale Truchet patterns see https://christophercarlson.com/portfolio/multi-scale-truchet-patterns/

Examples

mosaic <- st_truchet_ss()
plot(mosaic)
mosaic <- st_truchet_ss(tiles = c("dl", "dr"))
plot(mosaic)