trevorld / gridpattern

@@ -14,6 +14,7 @@
Loading
14 14
#' \item{rhombitrihexagonal}{Creates a rhombitrihexagonal tiling made out of
15 15
#'                           dodecagons, hexagons, and squares.}
16 16
#' \item{snub_square}{Creates a snub square tiling made of squares and triangles.}
17 +
#' \item{snub_trihexagonal}{Creates a snub trihexagonal tiling made of hexagons and triangles.}
17 18
#' \item{square}{Creates a square tiling made of squares.}
18 19
#' \item{triangular}{Creates a triangular tiling made of equilateral triangles.}
19 20
#' \item{trihexagonal}{Creates a trihexagonal tiling made of hexagons and triangles.}
@@ -74,7 +75,7 @@
Loading
74 75
#' @export
75 76
names_polygon_tiling <- c("herringbone", "hexagonal", "pythagorean",
76 77
                          "rhombitrihexagonal",
77 -
                          "snub_square", "square",
78 +
                          "snub_square", "snub_trihexagonal", "square",
78 79
                          "triangular", "trihexagonal",
79 80
                          "truncated_square", "truncated_hexagonal",
80 81
                          "truncated_trihexagonal")
@@ -110,6 +111,7 @@
Loading
110 111
                 hexagonal = create_hexagonal_tiling(xyi, gp, spacing, angle),
111 112
                 pythagorean = create_pythagorean_tiling(xyi, gp, spacing, angle),
112 113
                 snub_square = create_snub_square_tiling(xyi, gp, spacing, angle),
114 +
                 snub_trihexagonal = create_snub_trihex_tiling(xyi, gp, spacing, angle),
113 115
                 square = create_square_tiling(xyi, gp, spacing, angle),
114 116
                 rhombitrihexagonal = create_rhombitrihexagonal_tiling(xyi, gp, spacing, angle),
115 117
                 triangular = create_triangular_tiling(xyi, gp, spacing, angle),
@@ -230,6 +232,32 @@
Loading
230 232
    gList(sq1, tri, sq2)
231 233
}
232 234
235 +
create_snub_trihex_tiling <- function(xyi, gp, spacing, angle) {
236 +
    scale_star <- star_scale(6, 60 + 60, external = TRUE)
237 +
    n_col <- length(gp$fill)
238 +
    gp_tri1 <- gp_tri2 <- gp_hex <- gp
239 +
    if (n_col == 2) {
240 +
        gp_tri1$fill <- gp_tri2$fill <- gp$fill[1L]
241 +
        gp_hex$fill <- gp$fill[2L]
242 +
    } else if (n_col == 3) {
243 +
        gp_tri2$fill <- gp$fill[1L]
244 +
        gp_hex$fill <- gp$fill[2L]
245 +
        gp_tri1$fill <- gp$fill[3L]
246 +
    }
247 +
    tri1 <- polygonGrob(xyi$x, xyi$y, xyi$id, default.units = "npc",
248 +
                        gp = gp_tri1, name = "triangles.1")
249 +
    tri2 <- patternGrob("regular_polygon", xyi$x, xyi$y, xyi$id,
250 +
                        shape = "star6", scale = scale_star,
251 +
                        grid = "hex_circle",
252 +
                        angle = angle, rot = 19, spacing = spacing,
253 +
                        density = 1.305, gp = gp_tri2, name = "triangles.2")
254 +
    hex <- patternGrob("regular_polygon", xyi$x, xyi$y, xyi$id,
255 +
                       shape = "convex6", grid = "hex_circle",
256 +
                       angle = angle, rot = 49, spacing = spacing,
257 +
                       density = scale_star * 1.305, gp = gp_hex, name = "hexagons")
258 +
    gList(tri1, tri2, hex)
259 +
}
260 +
233 261
create_square_tiling <- function(xyi, gp, spacing, angle) {
234 262
    grob <- patternGrob("regular_polygon", xyi$x, xyi$y, xyi$id,
235 263
                        shape = "square", density = 1,
Files Coverage
R 93.59%
Project Totals (32 files) 93.59%

No yaml found.

Create your codecov.yml to customize your Codecov experience

Sunburst
The inner-most circle is the entire project, moving away from the center are folders then, finally, a single file. The size and color of each slice is representing the number of statements and the coverage, respectively.
Icicle
The top section represents the entire project. Proceeding with folders and finally individual files. The size and color of each slice is representing the number of statements and the coverage, respectively.
Grid
Each block represents a single file in the project. The size and color of each block is represented by the number of statements and the coverage, respectively.
Loading