Several uniform regular polygon tiling patterns can be achieved by use of grid.pattern_regular_polygon()
plus occasionally grid.polygon()
to set a background color. This vignette highlights several such tiling patterns plus a couple notable non-uniform tiling patterns.
library("grid")
library("gridpattern")
function() {
add_borders <-pushViewport(viewport(x=0.25, y=0.75, width=0.5, height=0.5))
grid.rect(gp = gpar(fill = NA, col = "white", lwd = 6))
popViewport()
pushViewport(viewport(x=0.75, y=0.75, width=0.5, height=0.5))
grid.rect(gp = gpar(fill = NA, col = "white", lwd = 6))
popViewport()
pushViewport(viewport(x=0.25, y=0.25, width=0.5, height=0.5))
grid.rect(gp = gpar(fill = NA, col = "white", lwd = 6))
popViewport()
pushViewport(viewport(x=0.75, y=0.25, width=0.5, height=0.5))
grid.rect(gp = gpar(fill = NA, col = "white", lwd = 6))
popViewport()
} c(0, 0, 1, 1)
x_sq <- c(0, 1, 1, 0)
y_sq <-# colorblind accessible scheme https://jfly.uni-koeln.de/color/
grDevices::rgb(0.35, 0.70, 0.90)
blue <- grDevices::rgb(0.95, 0.90, 0.25)
yellow <- grDevices::rgb(0.80, 0.40, 0.00)
red <- grDevices::rgb(0.00, 0.60, 0.50)
green <- grDevices::rgb(0.90, 0.60, 0.00) orange <-
When we consider the background to be a triangle fill color we can straight-forwardly achieve several of the uniform colorings of a triangular tiling using the “convex3” shape with the “hex” grid.
function(...) {
grid.triangular_tiling <-grid.pattern_regular_polygon(..., shape = "convex3", density = 1, grid = "hex",
spacing = 0.2, angle = 0, rot = 180)
}# 1 color uniform triangular tiling
pushViewport(viewport(x=0.25, y=0.75, width=0.5, height=0.5))
grid.polygon(x_sq, y_sq, gp = gpar(fill = yellow, col = NA))
gpar(fill = yellow, col = "black")
gp <-grid.triangular_tiling(gp = gp)
popViewport()
# 2 color uniform triangular tiling
pushViewport(viewport(x=0.75, y=0.75, width=0.5, height=0.5))
grid.polygon(x_sq, y_sq, gp = gpar(fill = yellow, col = NA))
gpar(fill = red, col = "black")
gp <-grid.triangular_tiling(gp = gp)
popViewport()
# 3 color uniform triangular tiling
pushViewport(viewport(x=0.25, y=0.25, width=0.5, height=0.5))
grid.polygon(x_sq, y_sq, gp = gpar(fill = yellow, col = NA))
gpar(fill = c(blue, red), col = "black")
gp <-grid.triangular_tiling(gp = gp)
popViewport()
# 4 color uniform triangular tiling
pushViewport(viewport(x=0.75, y=0.25, width=0.5, height=0.5))
grid.polygon(x_sq, y_sq, gp = gpar(fill = yellow, col = NA))
gpar(fill = c(red, blue, green), col = "black")
gp <-grid.triangular_tiling(gp = gp)
popViewport()
add_borders()
We can achieve the nine non-staggered uniform colorings of a square tiling using the “square” shape and the appropriate “type” (and perhaps “subtype”).
# 2 color uniform square tiling (1212)
pushViewport(viewport(x=0.25, y=0.75, width=0.5, height=0.5))
gpar(fill = c(yellow, red), col = "black")
gp <-grid.pattern_regular_polygon(shape = "square", density = 1,
spacing = 0.2, angle = 0, gp = gp)
popViewport()
# 2 color uniform square tiling (1122)
pushViewport(viewport(x=0.75, y=0.75, width=0.5, height=0.5))
gpar(fill = c(yellow, red), col = "black")
gp <-grid.pattern_regular_polygon(shape = "square", density = 1, type = "horizontal",
spacing = 0.2, angle = 0, gp = gp)
popViewport()
# 3 color uniform square tiling (1213)
pushViewport(viewport(x=0.25, y=0.25, width=0.5, height=0.5))
gpar(fill = c(yellow, red, blue), col = "black")
gp <-grid.pattern_regular_polygon(shape = "square", density = 1,
spacing = 0.2, angle = 0, gp = gp)
popViewport()
# 4 color uniform square tiling (1234)
pushViewport(viewport(x=0.75, y=0.25, width=0.5, height=0.5))
gpar(fill = c(yellow, red, blue, green), col = "black")
gp <-grid.pattern_regular_polygon(shape = "square", density = 1,
spacing = 0.2, angle = 0, gp = gp)
popViewport()
add_borders()
We can achieve all the uniform colorings of a hexagonal tiling using the “convex6” shape with the “hex” grid and the appropriate “type”. Replacing the “convex6” shape with an appropriately scaled “star6” shape results in a uniform tiling using star polygons.
function(..., shape = "convex6", spacing = 0.2) {
grid.hexagonal_tiling <- star_scale(6, 30)
scale <-grid.pattern_regular_polygon(..., shape = shape, density = 1, grid = "hex",
spacing = spacing, scale = scale, angle = 0)
}# 1 color uniform hexagonal tiling
pushViewport(viewport(x=0.25, y=0.75, width=0.5, height=0.5))
gpar(fill = yellow, col = "black")
gp <-grid.hexagonal_tiling(gp = gp)
popViewport()
# One of several 2 color uniform hexagonal tiling
pushViewport(viewport(x=0.75, y=0.75, width=0.5, height=0.5))
gpar(fill = c(red, yellow), col = "black")
gp <-grid.hexagonal_tiling(gp = gp)
popViewport()
# 3 color uniform hexagonal tiling
pushViewport(viewport(x=0.25, y=0.25, width=0.5, height=0.5))
gpar(fill = c(yellow, red, blue), col = "black")
gp <-grid.hexagonal_tiling(gp = gp)
popViewport()
# (4.6_{π/6})^3
pushViewport(viewport(x=0.75, y=0.25, width=0.5, height=0.5))
grid.polygon(x_sq, y_sq, gp = gpar(fill = yellow, col = NA))
gpar(fill = red, col = "black")
gp <-grid.hexagonal_tiling(shape = "star6", spacing = 0.3, gp = gp)
popViewport()
add_borders()
We can achieve the uniform colorings of a elongated triangular tiling using the “elongated_triangle” grid and the “convex4” and “convex3” shapes.
function(...) {
grid.elongated_triangular_tiling <-grid.polygon(x_sq, y_sq, gp = gpar(fill = yellow, col = NA))
grid.pattern_regular_polygon(..., shape = rep(c("convex4", "convex3"), each = 2),
density = rep(c(1.41, 1.15), each = 2),
grid = "elongated_triangle",
type = "square_tiling", subtype = "3412",
spacing = 0.2, angle = 0,
rot = rep(c(45, 0), each = 2))
}# 1 color elongated triangular tiling
pushViewport(viewport(x=0.25, y=0.75, width=0.5, height=0.5))
gpar(fill = yellow, col = "black")
gp <-grid.elongated_triangular_tiling(gp = gp)
popViewport()
# 2 color elongated triangular tiling
pushViewport(viewport(x=0.75, y=0.75, width=0.5, height=0.5))
gpar(fill = c(red, red, yellow, yellow), col = "black")
gp <-grid.elongated_triangular_tiling(gp = gp)
popViewport()
# 3 color elongated triangular tiling
pushViewport(viewport(x=0.25, y=0.25, width=0.5, height=0.5))
gpar(fill = c(red, blue, yellow, yellow), col = "black")
gp <-grid.elongated_triangular_tiling(gp = gp)
popViewport()
add_borders()
We can achieve the two uniform colorings of a snub square tiling using a “star4” shape and a “convex4” shape.
function(..., gp_sq, gp_sq2 = gp_sq, gp_tri = gp_sq) {
grid.snub_square <- star_scale(4, 90 + 60, external = TRUE)
scale_star <-grid.polygon(x_sq, y_sq, gp = gp_sq)
grid.pattern_regular_polygon(shape = "star4", scale = scale_star,
angle = 0, rot = 15, spacing = 0.2,
density = 1.4, gp = gp_tri)
grid.pattern_regular_polygon(shape = "convex4", scale = scale_star,
angle = 0, rot = 60, spacing = 0.2,
density = scale_star * 1.4, gp = gp_sq2)
}
# 2 color uniform snub square tiling
pushViewport(viewport(x=0.25, y=0.75, width=0.5, height=0.5))
gpar(fill = yellow, col = "black")
gp_y <- gpar(fill = red, col = "black")
gp_r <-grid.snub_square(gp_sq = gp_y, gp_tri = gp_r)
popViewport()
# 3 color uniform snub square tiling
pushViewport(viewport(x=0.75, y=0.75, width=0.5, height=0.5))
gpar(fill = blue, col = "black")
gp_b <-grid.snub_square(gp_sq = gp_r, gp_sq2 = gp_b, gp_tri = gp_y)
popViewport()
# 1 color uniform hexagonal tiling
pushViewport(viewport(x=0.25, y=0.25, width=0.5, height=0.5))
grid.snub_square(gp_sq = gp_y)
popViewport()
pushViewport(viewport(x=0.75, y=0.25, width=0.5, height=0.5))
popViewport()
add_borders()
We can achieve the two uniform colorings of a truncated square tiling using the “convex8” shape rotated 22.5 degrees. Adding in an extra (possibly alternating) “star8” shape results in a uniform tiling using star polygons.
# 2 color uniform truncated square tiling
pushViewport(viewport(x=0.25, y=0.75, width=0.5, height=0.5))
gpar(fill = red, col = NA)
gp <-grid.polygon(x_sq, y_sq, gp = gp)
gpar(fill = yellow, col = "black")
gp <-grid.pattern_regular_polygon(shape = "convex8", density = 1.082, rot = 22.5,
angle = 0, spacing = 0.3, gp = gp)
popViewport()
# 3 color uniform truncated square tiling
pushViewport(viewport(x=0.75, y=0.75, width=0.5, height=0.5))
gpar(fill = blue, col = NA)
gp <-grid.polygon(x_sq, y_sq, gp = gp)
gpar(fill = c(red, yellow), col = "black")
gp <-grid.pattern_regular_polygon(shape = "convex8", density = 1.082, rot = 22.5,
angle = 0, spacing = 0.3, gp = gp)
popViewport()
# 3 color uniform truncated square tiling with star
pushViewport(viewport(x=0.25, y=0.25, width=0.5, height=0.5))
gpar(fill = red, col = NA)
gp <-grid.polygon(x_sq, y_sq, gp = gp)
gpar(fill = yellow, col = "black")
gp <-grid.pattern_regular_polygon(shape = "convex8", density = 1.082, rot = 22.5,
angle = 0, spacing = 0.3, gp = gp)
gpar(fill = orange, col = "black")
gp <- star_scale(8, 60, external = TRUE)
scale <-grid.pattern_regular_polygon(shape = "star8", density = 1.082, rot = 22.5,
angle = 0, scale = scale, spacing = 0.3, gp = gp)
popViewport()
# 4 color uniform truncated square tiling with an alternating star
pushViewport(viewport(x=0.75, y=0.25, width=0.5, height=0.5))
gpar(fill = blue, col = NA)
gp <-grid.polygon(x_sq, y_sq, gp = gp)
gpar(fill = c(red, yellow), col = "black")
gp <-grid.pattern_regular_polygon(shape = "convex8", density = 1.082, rot = 22.5,
angle = 0, spacing = 0.3, gp = gp)
gpar(fill = orange, col = c("black"))
gp <-grid.pattern_regular_polygon(shape = c("null", "star8"),
density = 1.082, rot = 22.5,
angle = 0, scale = scale, spacing = 0.3, gp = gp)
popViewport()
add_borders()
We can achieve a truncated hexagonal tiling using the “convex12” shape with a 15 degree rotation in a “hex_circle” grid. The related “star12” variations are fun tilings as well.
# 2 color uniform truncated hexagonal tiling
function(..., shape = "convex12") {
grid.truncated_hexagonal_tiling <- star_scale(12, 60, external = TRUE)
scale <-grid.pattern_regular_polygon(..., shape = shape, density = 1.034, spacing = 0.3,
angle = 0, rot = 15, scale = scale,
grid = "hex_circle")
}pushViewport(viewport(x=0.25, y=0.75, width=0.5, height=0.5))
gpar(fill = red, col = NA)
gp <-grid.polygon(x_sq, y_sq, gp = gp)
gpar(fill = yellow, col = "black")
gp <-grid.truncated_hexagonal_tiling(gp = gp)
popViewport()
# Add in a "convex12" star within
pushViewport(viewport(x=0.75, y=0.75, width=0.5, height=0.5))
gpar(fill = red, col = NA)
gp <-grid.polygon(x_sq, y_sq, gp = gp)
gpar(fill = yellow, col = "black")
gp <-grid.truncated_hexagonal_tiling(gp = gp)
gpar(fill = blue, col = "black")
gp <-grid.truncated_hexagonal_tiling(gp = gp, shape = "star12")
popViewport()
add_borders()
We can achieve one of the uniform colorings of a trihexagonal tiling using the “convex6” shape with a “hex_circle” grid and rotating the shape 30 degrees.
There are topologically equivalent tilings using the “star6”, “star3”, and “convex3” shapes that also provides an interesting tiling effect.
function(..., shape = "convex6", density = 1) {
grid.trihexagonal_tiling <-grid.pattern_regular_polygon(..., shape = shape, density = density, grid = "hex_circle",
spacing = 0.2, rot = 30, angle = 0)
}# 2 color uniform trihexagonal tiling
pushViewport(viewport(x=0.25, y=0.75, width=0.5, height=0.5))
grid.polygon(x_sq, y_sq, gp = gpar(fill = red, col = NA))
gpar(fill = yellow, col = "black")
gp <-grid.trihexagonal_tiling(gp = gp)
popViewport()
# 'star6' trihexagonal tiling
pushViewport(viewport(x=0.75, y=0.75, width=0.5, height=0.5))
grid.polygon(x_sq, y_sq, gp = gpar(fill = red, col = NA))
star_scale(6, 120, external = TRUE)
scale <-grid.trihexagonal_tiling(shape = "star6", scale = scale, gp = gp)
popViewport()
# 'star3' trihexagonal tiling
pushViewport(viewport(x=0.25, y=0.25, width=0.5, height=0.5))
grid.polygon(x_sq, y_sq, gp = gpar(fill = red, col = NA))
star_scale(3, 30)
scale <-grid.trihexagonal_tiling(shape = "star3", scale = scale, density=1.57, gp = gp)
popViewport()
# 'convex3' trihexagonal tiling
pushViewport(viewport(x=0.75, y=0.25, width=0.5, height=0.5))
grid.polygon(x_sq, y_sq, gp = gpar(fill = red, col = NA))
grid.trihexagonal_tiling(shape = "convex3", density=1.33, gp = gp)
popViewport()
add_borders()
We can achieve the one uniform colorings of a snub (tri)hexagonal tiling using a “star6” shape and a “convex6” shape.
function(..., gp_tri, gp_tri2 = gp_tri, gp_hex = gp_tri) {
grid.snub_trihexagonal <- star_scale(6, 60 + 60, external = TRUE)
scale_star <-grid.polygon(x_sq, y_sq, gp = gp_tri)
grid.pattern_regular_polygon(shape = "star6", scale = scale_star,
grid = "hex_circle",
angle = 0, rot = 19, spacing = 0.2,
density = 1.305, gp = gp_tri2)
grid.pattern_regular_polygon(shape = "convex6", grid = "hex_circle",
angle = 0, rot = 19 + 30, spacing = 0.2,
density = scale_star * 1.305, gp = gp_hex)
}
# 3 color uniform snub square tiling
pushViewport(viewport(x=0.25, y=0.75, width=0.5, height=0.5))
gpar(fill = yellow, col = "black")
gp_y <- gpar(fill = red, col = "black")
gp_r <- gpar(fill = blue, col = "black")
gp_b <-grid.snub_trihexagonal(gp_tri = gp_b, gp_tri2 = gp_r, gp_hex = gp_y)
popViewport()
# 2 color snub trihexagonal tiling
pushViewport(viewport(x=0.75, y=0.75, width=0.5, height=0.5))
grid.snub_trihexagonal(gp_tri = gp_y, gp_hex = gp_r)
popViewport()
# 1 color snub trihexagonal tiling
pushViewport(viewport(x=0.25, y=0.25, width=0.5, height=0.5))
grid.snub_trihexagonal(gp_tri = gp_y)
popViewport()
pushViewport(viewport(x=0.75, y=0.25, width=0.5, height=0.5))
popViewport()
add_borders()
By carefully using grid.pattern_stripe()
it is possible to achieve the truncated trihexagonal tiling.
# truncated trihexagonal
pushViewport(viewport(x=0.25, y=0.75, width=0.5, height=0.5))
grid.polygon(x_sq, y_sq, gp = gpar(fill = yellow, col = NA))
gpar(fill = red, col = "black")
gp <-grid.pattern_stripe(grid = "hex_circle", density = 0.42, spacing = 0.3,
angle = 0, gp = gp)
grid.pattern_stripe(grid = "hex_circle", density = 0.42, spacing = 0.3,
angle = -60, gp = gp)
grid.pattern_stripe(grid = "hex_circle", density = 0.42, spacing = 0.3,
angle = 60, gp = gp)
gpar(fill = blue, col = "black")
gp <-grid.pattern_regular_polygon(shape = "convex6", grid = "hex_circle",
density = 0.75, spacing = 0.3, angle = 0, gp = gp)
popViewport()
# truncated trihexagonal with 5 colors
pushViewport(viewport(x=0.75, y=0.75, width=0.5, height=0.5))
grid.polygon(x_sq, y_sq, gp = gpar(fill = green, col = NA))
gpar(fill = orange, col = "black")
gp <-grid.pattern_stripe(grid = "hex_circle", density = 0.42, spacing = 0.3,
angle = 0, gp = gp)
grid.pattern_stripe(grid = "hex_circle", density = 0.42, spacing = 0.3,
angle = -60, gp = gp)
grid.pattern_stripe(grid = "hex_circle", density = 0.42, spacing = 0.3,
angle = 60, gp = gp)
gpar(fill = c(yellow, red, blue), col = "black")
gp <-grid.pattern_regular_polygon(shape = "convex6", grid = "hex_circle",
density = 0.75, spacing = 0.3, angle = 0, gp = gp)
popViewport()
pushViewport(viewport(x=0.25, y=0.25, width=0.5, height=0.5))
popViewport()
pushViewport(viewport(x=0.75, y=0.25, width=0.5, height=0.5))
popViewport()
add_borders()
By carefully using grid.pattern_stripe()
it is also possible to achieve the rhombitrihexagonal tiling. There are also variant tilings where we add in “star12” polygons.
# rhombitrihexagonal
pushViewport(viewport(x=0.25, y=0.75, width=0.5, height=0.5))
grid.polygon(x_sq, y_sq, gp = gpar(fill = yellow, col = NA))
gpar(fill = red, col = "black")
gp <-grid.pattern_stripe(grid = "hex_circle", density = 0.25, spacing = 0.3,
angle = 0, gp = gp)
grid.pattern_stripe(grid = "hex_circle", density = 0.25, spacing = 0.3,
angle = -60, gp = gp)
grid.pattern_stripe(grid = "hex_circle", density = 0.25, spacing = 0.3,
angle = 60, gp = gp)
gpar(fill = blue, col = "black")
gp <-grid.pattern_regular_polygon(shape = "convex12", grid = "hex_circle", rot = 15,
density = 0.82, spacing = 0.3, angle = 0, gp = gp)
popViewport()
# rhombitrihexagonal with 5 colors
pushViewport(viewport(x=0.75, y=0.75, width=0.5, height=0.5))
grid.polygon(x_sq, y_sq, gp = gpar(fill = green, col = NA))
gpar(fill = red, col = "black")
gp <-grid.pattern_stripe(grid = "hex_circle", density = 0.25, spacing = 0.3,
angle = 0, gp = gp)
gpar(fill = yellow, col = "black")
gp <-grid.pattern_stripe(grid = "hex_circle", density = 0.25, spacing = 0.3,
angle = -60, gp = gp)
gpar(fill = blue, col = "black")
gp <-grid.pattern_stripe(grid = "hex_circle", density = 0.25, spacing = 0.3,
angle = 60, gp = gp)
gpar(fill = orange, col = "black")
gp <-grid.pattern_regular_polygon(shape = "convex12", grid = "hex_circle", rot = 15,
density = 0.82, spacing = 0.3, angle = 0, gp = gp)
popViewport()
# 3.4.6.3.12* rhombitrihexagonal plus star
pushViewport(viewport(x=0.25, y=0.25, width=0.5, height=0.5))
grid.polygon(x_sq, y_sq, gp = gpar(fill = yellow, col = NA))
gpar(fill = red, col = "black")
gp <-grid.pattern_stripe(grid = "hex_circle", density = 0.25, spacing = 0.3,
angle = 0, gp = gp)
grid.pattern_stripe(grid = "hex_circle", density = 0.25, spacing = 0.3,
angle = -60, gp = gp)
grid.pattern_stripe(grid = "hex_circle", density = 0.25, spacing = 0.3,
angle = 60, gp = gp)
gpar(fill = blue, col = "black")
gp <-grid.pattern_regular_polygon(shape = "convex12", grid = "hex_circle", rot = 15,
density = 0.82, spacing = 0.3, angle = 0, gp = gp)
gpar(fill = green, col = "black")
gp <- star_scale(12, 30)
scale <-grid.pattern_regular_polygon(shape = "star12", grid = "hex_circle", rot = 15,
density = 0.82, spacing = 0.3, angle = 0, gp = gp,
scale = scale)
popViewport()
pushViewport(viewport(x=0.75, y=0.25, width=0.5, height=0.5))
popViewport()
add_borders()
Some additional uniform tilings with star polygons not shown above.
# 12.12.4*
pushViewport(viewport(x=0.25, y=0.75, width=0.5, height=0.5))
grid.polygon(x_sq, y_sq, gp = gpar(fill = red, col = NA))
gpar(fill = c(yellow, blue), col = "black")
gp <-grid.pattern_regular_polygon(shape="convex12", rot=15, density=1.035,
angle=0, gp = gp, spacing=0.3)
popViewport()
# 12.3*.12.3*
pushViewport(viewport(x=0.75, y=0.75, width=0.5, height=0.5))
grid.polygon(x_sq, y_sq, gp = gpar(fill = red, col = NA))
gpar(fill = c(yellow), col = "black")
gp <-grid.pattern_regular_polygon(shape="convex12", density=1, grid = "hex_circle",
angle=0, gp = gp, spacing=0.4)
popViewport()
# 4.4*.4**
pushViewport(viewport(x=0.25, y=0.25, width=0.5, height=0.5))
grid.polygon(x_sq, y_sq, gp = gpar(fill = red, col = NA))
gpar(fill = c(yellow, blue), col = "black")
gp <- gpar(fill=yellow)
gp <- star_scale(4, 30)
scale <-grid.pattern_regular_polygon(shape="star4", density=1.60, angle=0, scale=scale,
rot=-9.5, spacing=0.3, gp = gp)
popViewport()
# 3.3.8*.4**.8*
pushViewport(viewport(x=0.75, y=0.25, width=0.5, height=0.5))
0.35
sp <- gpar(fill = red, col = "black")
gp <-grid.pattern_regular_polygon(shape = "square", density = 1, angle = 0,
spacing = sp, gp = gp)
gpar(fill = yellow, col = "black")
gp <- star_scale(4, 60)
scale <-grid.pattern_regular_polygon(shape = "star4", density = 1.14, rot = 45,
xoffset = sp / 2, yoffset = sp / 2,
angle = 0, scale = scale, spacing = sp, gp = gp)
gpar(fill = blue, col = "black")
gp <- star_scale(8, 15)
scale <-grid.pattern_regular_polygon(shape = "star8", density = 1.082, rot = 22.5,
angle = 0, scale = 0.30, spacing = sp, gp = gp)
popViewport()
add_borders()
# 3.6*.6**
pushViewport(viewport(x=0.25, y=0.75, width=0.5, height=0.5))
grid.polygon(x_sq, y_sq, gp = gpar(fill = red, col = NA))
gpar(fill = yellow, col = "black")
gp <- star_scale(6, 30)
scale <-grid.pattern_regular_polygon(shape="star6", density=1.30, angle=0, scale=scale, rot=-22.0,
spacing=0.3, grid="hex", gp=gp)
popViewport()
# 4.6.4*.6
pushViewport(viewport(x=0.75, y=0.75, width=0.5, height=0.5))
grid.polygon(x_sq, y_sq, gp = gpar(fill = yellow, col = NA))
gpar(fill = c(blue, red), col = "black")
gp <- star_scale(4, 120, external = TRUE)
scale <-grid.pattern_regular_polygon(shape=c("star4", "convex4"), density=c(1.2, 0.8),
scale = scale,
spacing = 0.2, gp = gp, angle=45)
popViewport()
# 9.3.9.3*
pushViewport(viewport(x=0.25, y=0.25, width=0.5, height=0.5))
grid.polygon(x_sq, y_sq, gp = gpar(fill = red, col = NA))
gpar(fill = blue, col = NA)
gp <-grid.pattern_stripe(spacing = 0.4, density = 0.35, angle = 0,
grid = "hex_circle", gp = gp, yoffset = 0.096)
gpar(fill = yellow, col = "black")
gp <-grid.pattern_regular_polygon(shape = "convex9", density = 1.01, angle = 0,
grid = "hex_circle", spacing = 0.4, gp = gp)
popViewport()
# 8.4*.8.4*
pushViewport(viewport(x=0.75, y=0.25, width=0.5, height=0.5))
grid.polygon(x_sq, y_sq, gp = gpar(fill = red, col = NA))
gpar(fill = yellow, col = "black")
gp <-grid.pattern_regular_polygon(shape = c("convex8", "null"), density = 1.41,
angle = 0, spacing = 0.2, gp = gp)
popViewport()
add_borders()
# 18.18.3*
pushViewport(viewport(x=0.25, y=0.75, width=0.5, height=0.5))
grid.polygon(x_sq, y_sq, gp = gpar(fill = blue, col = NA))
gpar(fill = c(red, yellow), col = "black")
gp <-grid.pattern_regular_polygon(shape = "convex18", density = 1,
grid = "hex_circle", angle = 0,
spacing = 0.2, gp = gp)
popViewport()
# Only uniform if you consider the larger squares to be four-pointed stars...
# 4.8*.4**.8*
pushViewport(viewport(x=0.75, y=0.75, width=0.5, height=0.5))
grid.polygon(x_sq, y_sq, gp = gpar(fill = blue, col = NA))
gpar(fill = c(yellow, red), col = "black")
gp <- star_scale(8, 90, external = TRUE)
scale <-grid.pattern_regular_polygon(shape = c("star8", "convex4"), scale = scale,
density = c(1.53, 1.2), rot = c(22.5, 0),
angle = 0, spacing = 0.2, gp = gp)
popViewport()
add_borders()
We can achieve a herringbone tiling by using grid.pattern_weave()
and particular “twill” weaves of the subtype “n/n(1)”.
function(..., subtype = "2/2(1)") {
grid.herringbone_tiling <-grid.pattern_weave(..., type = "twill", subtype = subtype, density = 1,
spacing = 0.1, angle = 45)
}# 1 color 2:1 herringbone
pushViewport(viewport(x=0.25, y=0.75, width=0.5, height=0.5))
gpar(fill = yellow, col = "black")
gp <-grid.herringbone_tiling(gp = gp)
popViewport()
# 2 color 2:1 herringbone
pushViewport(viewport(x=0.75, y=0.75, width=0.5, height=0.5))
gpar(fill = yellow, col = "black")
gp <-grid.herringbone_tiling(gp = gp, fill2 = red)
popViewport()
# 1 color 3:1 herringbone
pushViewport(viewport(x=0.25, y=0.25, width=0.5, height=0.5))
gpar(fill = yellow, col = "black")
gp <-grid.herringbone_tiling(gp = gp, subtype = "3/3(1)")
popViewport()
# 2 color 3:1 herringbone
pushViewport(viewport(x=0.75, y=0.25, width=0.5, height=0.5))
gpar(fill = yellow, col = "black")
gp <-grid.herringbone_tiling(gp = gp, fill2 = red, subtype = "3/3(1)")
popViewport()
add_borders()
We can get a Pythagorean tiling by setting a background color and rotating “convex4” shapes
function(...) {
grid.pythagorean_tiling <-grid.pattern_regular_polygon(..., shape = "convex4", density = 1.222,
rot = 15, spacing = 0.2, angle = -15)
}# 1 color Pythagorean tiling
pushViewport(viewport(x=0.25, y=0.75, width=0.5, height=0.5))
grid.polygon(x_sq, y_sq, gp = gpar(fill = yellow, col = NA))
gpar(fill = yellow, col = "black")
gp <-grid.pythagorean_tiling(gp = gp)
popViewport()
# 2 color Pythagorean tiling
pushViewport(viewport(x=0.75, y=0.75, width=0.5, height=0.5))
grid.polygon(x_sq, y_sq, gp = gpar(fill = yellow, col = NA))
gpar(fill = red, col = "black")
gp <-grid.pythagorean_tiling(gp = gp)
popViewport()
# 3 color Pythagorean tiling
pushViewport(viewport(x=0.25, y=0.25, width=0.5, height=0.5))
grid.polygon(x_sq, y_sq, gp = gpar(fill = yellow, col = NA))
gpar(fill = c(blue, red), col = "black")
gp <-grid.pythagorean_tiling(gp = gp)
popViewport()
# 4 color Pythagorean tiling
pushViewport(viewport(x=0.75, y=0.25, width=0.5, height=0.5))
grid.polygon(x_sq, y_sq, gp = gpar(fill = yellow, col = NA))
gpar(fill = c(red, blue, green), col = "black")
gp <-grid.pythagorean_tiling(gp = gp)
popViewport()
add_borders()
We can get a rhombille tiling by using the “rhombille_rhombus” shape:
function(gp1, gp2 = gp1, gp3 = gp2) {
grid.rhombille_tiling <-grid.pattern_regular_polygon(shape = "rhombille_rhombus", density = 1,
angle = 0, rot = -120, spacing = 0.2,
grid = "hex", gp = gp3)
grid.pattern_regular_polygon(shape = "rhombille_rhombus", density = 1,
angle = 0, rot = 120, spacing = 0.2,
grid = "hex", gp = gp2)
grid.pattern_regular_polygon(shape = "rhombille_rhombus", density = 1,
angle = 0, rot = 0, spacing = 0.2,
grid = "hex", gp = gp1)
} gpar(fill = yellow, col = "black")
gp1 <- gpar(fill = blue, col = "black")
gp2 <- gpar(fill = red, col = "black")
gp3 <-# 1 color rhombille tiling
pushViewport(viewport(x=0.25, y=0.75, width=0.5, height=0.5))
grid.rhombille_tiling(gp1)
popViewport()
# 2 color rhombille tiling
pushViewport(viewport(x=0.75, y=0.75, width=0.5, height=0.5))
grid.rhombille_tiling(gp1, gp2)
popViewport()
# 3 color rhombille tiling
pushViewport(viewport(x=0.25, y=0.25, width=0.5, height=0.5))
grid.rhombille_tiling(gp1, gp2, gp3)
popViewport()
add_borders()
We can get a tetrakis square tiling by using the “tetrakis_left” and “tetrakis_right” shapes:
function(gp1, gp2 = gp1, gp3 = gp2, gp4 = gp1) {
grid.tetrakis_tiling <-grid.pattern_regular_polygon(shape = "tetrakis_left", density = 1,
angle = 0, rot=0, gp = gp1, spacing = 0.25)
grid.pattern_regular_polygon(shape = "tetrakis_left", density = 1,
angle = 0, rot=90, gp = gp4, spacing = 0.25)
grid.pattern_regular_polygon(shape = "tetrakis_left", density = 1,
angle = 0, rot=180, gp = gp1, spacing = 0.25)
grid.pattern_regular_polygon(shape = "tetrakis_left", density = 1,
angle = 0, rot=270, gp = gp4, spacing = 0.25)
grid.pattern_regular_polygon(shape = "tetrakis_right", density = 1,
angle = 0, rot=0, gp = gp2, spacing = 0.25)
grid.pattern_regular_polygon(shape = "tetrakis_right", density = 1,
angle = 0, rot=90, gp = gp3, spacing = 0.25)
grid.pattern_regular_polygon(shape = "tetrakis_right", density = 1,
angle = 0, rot=180, gp = gp2, spacing = 0.25)
grid.pattern_regular_polygon(shape = "tetrakis_right", density = 1,
angle = 0, rot=270, gp = gp3, spacing = 0.25)
} gpar(fill = yellow, col = "black")
gp1 <- gpar(fill = blue, col = "black")
gp2 <- gpar(fill = red, col = "black")
gp3 <- gpar(fill = green, col = "black")
gp4 <-# 1 color tetrakis square tiling
pushViewport(viewport(x=0.25, y=0.75, width=0.5, height=0.5))
grid.tetrakis_tiling(gp1)
popViewport()
# 2 color tetrakis square tiling
pushViewport(viewport(x=0.75, y=0.75, width=0.5, height=0.5))
grid.tetrakis_tiling(gp1, gp2)
popViewport()
# 3 color tetrakis square tiling
pushViewport(viewport(x=0.25, y=0.25, width=0.5, height=0.5))
grid.tetrakis_tiling(gp1, gp2, gp3)
popViewport()
# 4 color tetrakis square tiling
pushViewport(viewport(x=0.75, y=0.25, width=0.5, height=0.5))
grid.tetrakis_tiling(gp1, gp2, gp3, gp4)
popViewport()
add_borders()
A rhombi may be produced by the “star2” shape:
# 2*.2**.2*.2**
pushViewport(viewport(x=0.25, y=0.75, width=0.5, height=0.5))
0.3
sp <- 63.5
ang <- 0.5
scale <- gpar(fill = yellow, col = "black")
gpy <-grid.pattern_regular_polygon(shape = "star2", scale = scale, angle = ang,
density = 1, spacing = sp, gp = gpy)
grid.pattern_regular_polygon(shape = "star2", scale = scale, angle = ang,
density = 1, spacing = sp, gp = gpy,
xoffset = 0.5 * sp)
gpar(fill = red, col = "black")
gpr <-grid.pattern_regular_polygon(shape = "star2", scale = scale, angle = ang,
density = 1, spacing = sp, gp = gpr,
xoffset = 0.25 * sp, yoffset = 0.5 * sp)
grid.pattern_regular_polygon(shape = "star2", scale = scale, angle = ang,
density = 1, spacing = sp, gp = gpr,
xoffset = 0.75 * sp, yoffset = 0.5 * sp)
popViewport()
# 4.2*.4.2**
pushViewport(viewport(x=0.75, y=0.75, width=0.5, height=0.5))
0.73
dens_sq <- star_scale(2, 60)
scale <- 0.88
dens_rh <- gpar(fill = yellow, col = "black")
gpy <- gpar(fill = blue, col = "black")
gpb <- gpar(fill = red, col = "black")
gpr <-grid.pattern_regular_polygon(shape = "convex4", scale = scale, angle = 0,
rot = 60,
density = dens_sq, spacing = sp, gp = gpb)
grid.pattern_regular_polygon(shape = "star2", scale = scale, angle = 0,
density = dens_rh, spacing = sp, gp = gpy,
rot = 45, xoffset = 0.5 * sp)
grid.pattern_regular_polygon(shape = "convex4", scale = scale, angle = 0,
rot = -60, yoffset = 0.5 * sp, xoffset = 0.5 * sp,
density = dens_sq, spacing = sp, gp = gpr)
grid.pattern_regular_polygon(shape = "star2", scale = scale, angle = 0,
density = dens_rh, spacing = sp, gp = gpy,
rot = -45, yoffset = 0.5 * sp)
popViewport()
# Use a "star12" instead of a "convex12" in truncated hexagonal tiling
pushViewport(viewport(x=0.25, y=0.25, width=0.5, height=0.5))
gpar(fill = yellow, col = NA)
gp <-grid.polygon(x_sq, y_sq, gp = gp)
gpar(fill = blue, col = "black")
gp <-grid.truncated_hexagonal_tiling(gp = gp, shape = "star12")
popViewport()
add_borders()