Merge pull request #21 from ryantimpe/rglModels

Rgl models
This commit is contained in:
Ryan Timpe
2019-10-27 20:36:01 -04:00
committed by GitHub
96 changed files with 1964 additions and 927 deletions
+1
View File
@@ -68,3 +68,4 @@ brickr_colors.png
inst/doc
doc
Meta
rrgl
+7 -5
View File
@@ -1,6 +1,6 @@
Package: brickr
Title: Tools to emulate the LEGO® System in R
Version: 0.1.0.9024
Version: 0.2.0
Authors@R:
person(given = "Ryan",
family = "Timpe",
@@ -8,19 +8,20 @@ Authors@R:
email = "ryan.timpe@gmail.com")
Description:
Generate digital LEGO-esque models using tidyverse functions. Convert image files into 2D and 3D mosaics, along with piece counts and instructions.
Build 3D models using data frames with rayshader. Create brick bar charts with ggplot2.
Build 3D models using data frames with rgl. Create brick bar charts with ggplot2.
License: GPL-3
Encoding: UTF-8
LazyData: true
Depends: R (>= 3.0.2), ggplot2
Depends: R (>= 3.0.2),
ggplot2
Imports:
magrittr,
dplyr,
tidyr,
purrr,
ggplot2,
scales,
farver
farver,
colorspace
Suggests:
rayshader,
knitr,
@@ -42,6 +43,7 @@ Collate:
'bricks-from-rayshader.R'
'bricks-from-tables.R'
'build-bricks.R'
'build-bricks-rgl.R'
'build-instructions.R'
'build-mosaic.R'
'collect-bricks.R'
+1
View File
@@ -7,6 +7,7 @@ export(bricks_from_mosaic)
export(bricks_from_rayshader)
export(bricks_from_table)
export(build_bricks)
export(build_bricks_rayshader)
export(build_colors)
export(build_instructions)
export(build_mosaic)
+15 -14
View File
@@ -1,4 +1,18 @@
# brickr 0.1.1.0000
# brickr 0.2.0
* Lots of bug fixes. More to come.
## Documentation
* Issues and bugs are now actively tracked on [GitHub Issues](https://github.com/ryantimpe/brickr/issues).
## 3D Models
* `build_bricks()` now renders models in {rgl}, rather than {rayshader}. Most options for the rendering have changed. Use `build_brick_rayshader()` for previous output.
----
# brickr 0.1.1
* **Breaking:** Pretty much *EVERY* function. Seriously, check out the README and start fresh.
@@ -33,19 +47,6 @@
* `coord_brick` to prevent chart brick distortion. `coord_brick_flip` for horizontal bars.
* `scale_fill_brick` and `theme_brick` for different LEGO color options.
## TO DO
* ggplot - continuous scale
* Vignettes
- IRL
* Check() passing
** Lower Priority**
* Negative bricks are "underside"
* bricks_from_models
* ggplot plays nicely with rayshader::plot_gg()
----
# brickr 0.0.0.9200
+5 -2
View File
@@ -19,7 +19,10 @@ if(getRversion() >= "2.15.1") {
"Lego_name", "Level", "lum", "Lum", "n", "offset_x", "offset_y", "Palette",
"R", "R_lego", "shade", "shade_bw", "size1", "size2",
"stud", "stud_id", "studs",
"theme", "Tr", "TYPE", "user_color", "x", "x_comp", "x_mid", "x_scaled",
"xg", "xmax", "xmin", "xx", "y", "y_comp", "y_mid", "y_scaled", "yg", "ymax",
"theme", "Tr", "Trans_lego", "TYPE", "user_color", "ww",
"value",
"x", "x_comp", "x_mid", "x_scaled",
"xg", "xmax", "xmin", "xx",
"y", "y_comp", "y_mid", "y_scaled", "yg", "ymax",
"ymin", "yy", "z"))
}
+1 -1
View File
@@ -16,7 +16,7 @@ bricks_from_mosaic <- function(mosaic_list, mosaic_height = 6, highest_el = "lig
img_lego <- in_list$Img_lego
img_sorted_by_lum <- mosaic_list$Img_lego %>%
dplyr::left_join(lego_colors %>% dplyr::select(Lego_name = Color, lum), by = "Lego_name") %>%
dplyr::left_join(brickr::lego_colors %>% dplyr::select(Lego_name = Color, lum), by = "Lego_name") %>%
dplyr::mutate(Level = as.numeric(as.factor(cut(lum, mosaic_height)))) %>%
dplyr::do(
if(highest_el == "dark"){
+1 -1
View File
@@ -49,7 +49,7 @@ bricks_from_rayshader <- function(hillshade, heightmap, max_height = 12, img_siz
purrr::map_df(function(lvl){
dat <- img_sorted_by_lum %>%
#Only get colors at or above the current level
dplyr::filter(Level >= lvl) %>%
dplyr::filter(Level >= lvl & Level <= (lvl + 2)) %>%
#Replace any higher levels with colors in this level
dplyr::mutate(Lego_name = ifelse(Level > lvl, NA_character_, Lego_name),
Lego_color = ifelse(is.na(Lego_name), NA_character_, Lego_color),
+2 -2
View File
@@ -15,7 +15,7 @@
#' @family 3D Models
#' @export
#'
bricks_from_table <- function(matrix_table, color_guide = lego_colors, .re_level = TRUE,
bricks_from_table <- function(matrix_table, color_guide = brickr::lego_colors, .re_level = TRUE,
increment_level = 0, max_level = Inf,
increment_x = 0, max_x = Inf,
increment_y = 0, max_y = Inf,
@@ -31,7 +31,7 @@ bricks_from_table <- function(matrix_table, color_guide = lego_colors, .re_level
`Color` should match official LEGO names in the data frame `lego_colors`."
if(identical(color_guide, brickr::lego_colors)){
color_map <- lego_colors %>%
color_map <- brickr::lego_colors %>%
dplyr::rename(.value = brickrID)
} else if(is.data.frame(color_guide)){
if(ncol(color_guide) < 2){stop(color_guide_error_msg)}
+254
View File
@@ -0,0 +1,254 @@
#' Build 3D brick model with rgl
#'
#' @param brick_list List output from collect_bricks(). Contains an element \code{Img_lego}.
#' @param brick_type Type of brick to use. Default is 'brick'. Other option is 'plate', which is 1/3 the height of a brick.
#' @param background_color Default 'white'. Color of the background.
#' @param rgl_lit Default 'TRUE'. Include RGL lighting features in rendering.
#' @param outline_bricks Default 'FALSE'. Include black outlines around brick edges.
#' Set to 'TRUE' and rgl_lit='FALSE' for cartoon-looking bricks.
#' @param trans_alpha Default 0.5. Alpha level for transparent bricks.
#' @param view_levels Numeric array of Levels/z values to display. Leave as 'NULL' to include all.
#' @return 3D brick model rendered in the 'rgl' package.
#' @family 3D Models
#' @export
#'
build_bricks <- function(brick_list,
background_color = "white", rgl_lit = TRUE,
outline_bricks = FALSE,
trans_alpha = 0.5,
view_levels = NULL){
#Get previous data
in_list <- brick_list
img_lego <- in_list$Img_lego %>%
tidyr::drop_na() %>%
dplyr::select(-dplyr::contains("lum")) %>%
dplyr::left_join(lego_colors %>%
dplyr::select(Lego_name = Color, lum),
by = c("Lego_name"))
img_bricks <- in_list$Img_bricks %>%
tidyr::drop_na()%>%
dplyr::left_join(lego_colors %>%
dplyr::select(Lego_name = Color, Trans_lego, lum),
by = c("Lego_name"))
if(is.null(view_levels)){
view_levels <- unique(img_lego$Level)
}
#SET PARAMETERS ----
# For use inside brick drawing functions below
nudge = 0.01 #Space between bricks
scale = 1 #Reduce to unit size
# trans_alpha = 0.5 #Alpha of transparent bricks
height_scale = 9.6/7.8
color_outline = "black"
color_outline_trans = "white"
contrast_knobs = TRUE
contrast_lum = 0.2
knob_diameter = 5/8
outline_bricks = outline_bricks
suppress_knobs = TRUE
#For now, use the current collect_bricks output.
#This was designed for rayshader, and I don't want to drop rayshader just yet.
#Bricks without knobs ----
rgl_bricks_base <- list(
# x & y are the CENTERS of bricks. rgl scales shapes from center
x = img_bricks$xmin + 0.5 + (img_bricks$xmax - img_bricks$xmin)/2 ,
y = img_bricks$ymin + 0.5 + (img_bricks$ymax - img_bricks$ymin)/2 ,
z = img_bricks$Level,
color = img_bricks$Lego_color,
trans = img_bricks$Trans_lego,
lum = img_bricks$lum,
#Grab brick size from brick type id
width = as.numeric(substr(img_bricks$brick_type, 2, 2)),
length = as.numeric(substr(img_bricks$brick_type, 4, 4))
) %>%
purrr::transpose()
rgl_bricks_base_list <- rgl_bricks_base %>%
purrr::map(function(this_brick){
#Solid brick ----
brk_fill <- rgl::cube3d(col = this_brick$color,
alpha = if(this_brick$trans){trans_alpha}else{1})
brk_fill$vb[4,] <- brk_fill$vb[4,]/scale*2 + nudge
brk_fill2 <- brk_fill %>%
rgl::scale3d(this_brick$width, this_brick$length, height_scale) %>% #Increase height
rgl::translate3d(this_brick$x, this_brick$y, this_brick$z * height_scale)
if(outline_bricks){
# Brick Outline ----
brk_out <- rgl::cube3d(col = if(this_brick$trans){colorspace::lighten(this_brick$color)}
else{color_outline})
brk_out$vb[4,] <- brk_out$vb[4,]/scale*2 + nudge
brk_out$material$lwd <- 1
brk_out$material$front <- 'line'
brk_out$material$back <- 'line'
brk_out2 <- brk_out %>%
rgl::scale3d(this_brick$width, this_brick$length, height_scale) %>% #Increase height
rgl::translate3d(this_brick$x, this_brick$y, this_brick$z * height_scale)
out_list <- list(brk_fill2, brk_out2)
} else {
brk_out2 <- NULL
out_list <- list(brk_fill2, brk_out2)
}
#Save ----
return(out_list)
}) %>%
purrr::transpose()
#Bricks knobs ----
if(suppress_knobs){
img_lego <- img_lego %>%
dplyr::group_by(x, y) %>%
dplyr::filter(
#Keep knobs when next level is not right above it
(dplyr::lead(Level, order_by = Level) != Level + 1) |
#Or next level is na
is.na(dplyr::lead(Level, order_by = Level)) |
# Or this or next level is transparent
dplyr::lead(Trans_lego, order_by = Level) | Trans_lego
) %>%
dplyr::ungroup()
}
rgl_bricks_knobs <- list(
x = img_lego$x,
y = img_lego$y,
z = img_lego$Level,
color = img_lego$Lego_color,
trans = img_lego$Trans_lego,
lum = img_lego$lum
) %>%
purrr::transpose()
rgl_bricks_knobs_list <- rgl_bricks_knobs %>%
purrr::map(function(this_brick){
# Brick knob ----
brk_knob <- rgl::cylinder3d(matrix(c(rep(1, 3), rep(1, 3))/2, ncol=2, byrow = TRUE),
sides = 32,
radius = knob_diameter,
closed = -2)
brk_knob$vb[4,] <- brk_knob$vb[4,]/scale*2 + nudge
#Knob side color
if(contrast_knobs & !this_brick$trans){
if(this_brick$lum <= contrast_lum){
brk_knob$material$color <- colorspace::lighten(this_brick$color)
} else {
brk_knob$material$color <- colorspace::darken(this_brick$color)
}
} else{
brk_knob$material$color <- this_brick$color
}
brk_knob$material$alpha <- if(this_brick$trans){trans_alpha}else{1}
this_brick$x <- this_brick$x + 0.5
this_brick$y <- this_brick$y + 0.5
brk_knob2 <- brk_knob %>%
rgl::rotate3d(pi/2, 0, 1, 0) %>%
rgl::scale3d(1, 1, height_scale + 1.7/9.6) %>%
rgl::translate3d(0.25, -0.25, -height_scale-0.02) %>%
rgl::translate3d(this_brick$x, this_brick$y, this_brick$z * height_scale)
# Brick knob outlines ----
# These are 2-dimensional cylinders
if(outline_bricks){
brk_knob_ot_prep <- rgl::cylinder3d(matrix(c(rep(1, 3), rep(1, 3))/2, ncol=2, byrow = TRUE),
sides = 32,
radius = knob_diameter*1.015)
brk_knob_ot_prep$vb[4,] <- brk_knob_ot_prep$vb[4,]/scale*2 + nudge
brk_knob_ot_prep$material$color <- if(this_brick$trans){colorspace::lighten(this_brick$color)}
else{color_outline}
#Base of the knob
brk_knob_ot <- brk_knob_ot_prep %>%
rgl::rotate3d(pi/2, 0, 1, 0) %>%
rgl::scale3d(1, 1, 0.01) %>% #Make the height super short
rgl::translate3d(0.25, -0.25, 0.62) %>%
rgl::translate3d(this_brick$x, this_brick$y, this_brick$z * height_scale)
#Top of the knob
brk_knob_ot2 <- brk_knob_ot %>%
rgl::translate3d(0, 0, 0.22)
out_list <- list(brk_knob2, brk_knob_ot, brk_knob_ot2)
} else {
brk_knob_ot <- NULL
brk_knob_ot2 <- NULL
out_list <- list(brk_knob2, brk_knob_ot, brk_knob_ot2)
}
#Brick knob cap ----
# This uses the bricks color if the knob has contrasting sides
# Only use if the knob side is contrasted
if(contrast_knobs){
brk_knob_top <- rgl::cylinder3d(matrix(c(rep(1, 3), rep(1, 3))/2, ncol=2, byrow = TRUE),
sides = 32,
radius = knob_diameter*.99,
closed = -2)
brk_knob_top$vb[4,] <- brk_knob_top$vb[4,]/scale*2 + nudge
brk_knob_top$material$color <- this_brick$color
brk_knob_top$material$alpha <- if(this_brick$trans){trans_alpha}else{1}
#A 2-dimensional filled circle on the top the knob
brk_knob_top2 <- brk_knob_top %>%
rgl::rotate3d(pi/2, 0, 1, 0) %>%
rgl::scale3d(1, 1, 0.01) %>%
rgl::translate3d(0.25, -0.25, 0.62+0.22+0.01) %>%
rgl::translate3d(this_brick$x, this_brick$y, this_brick$z * height_scale)
out_list[[4]] <- brk_knob_top2
} else{
brk_knob_top2 <- NULL
out_list[[4]] <- brk_knob_top2
}
#Save ----
return(out_list)
}) %>%
purrr::transpose()
#Draw
shapelist <- c(rgl_bricks_base_list[[1]]
, rgl_bricks_base_list[[2]]
, purrr::flatten(rgl_bricks_knobs_list)
)
shapelist[sapply(shapelist, is.null)] <- NULL
shapelist %>%
rgl::shapelist3d(lit=rgl_lit, shininess = 100, specular = "black")
rgl::bg3d(color = background_color)
rgl::rgl.viewpoint(userMatrix = rgl::rotate3d(rgl::par3d("userMatrix"), 0, 0, 0 ,1) ,
fov=0) #All bricks, regardless of Z, are perceived as same size
}
+1 -1
View File
@@ -180,7 +180,7 @@ layer_from_bricks <- function(brick_list, brick_type = "brick", lev=1, brick_res
#' @family 3D Models
#' @export
#'
build_bricks <- function(brick_list, brick_type = "brick", brick_res = "sd",
build_bricks_rayshader <- function(brick_list, brick_type = "brick", brick_res = "sd",
view_levels = NULL, solidcolor = "#a3a2a4",
water = FALSE, waterdepth = 0, ...){
#Requires Rayshader
+4 -1
View File
@@ -11,11 +11,14 @@ build_mosaic <- function(brick_obj, title=NULL){
image <- in_list$Img_bricks
type <- in_list$mosaic_type
use_bricks <- in_list$use_bricks
coord_x <- c(min(image$xmin)+0.5, max(image$xmax)-0.5)
coord_y <- c(min(image$ymin)+0.5, max(image$ymax)-0.5)
img <- ggplot2::ggplot(in_list$Img_lego, ggplot2::aes(x=x, y=y)) +
geom_brick_rect(ggplot2::aes(fill = Lego_color), color = "#333333")+
geom_brick_rect(ggplot2::aes(fill = Lego_color), color = "#333333",
use_bricks = use_bricks)+
ggplot2::scale_fill_identity() +
ggplot2::coord_fixed(expand = 0.5)
+3 -2
View File
@@ -28,9 +28,9 @@ collect_bricks <- function(image_list, use_bricks = NULL){
) %>%
dplyr::distinct() %>%
dplyr::mutate(offset_x = purrr::map(xx, ~.x:1 -1)) %>%
tidyr::unnest() %>%
tidyr::unnest_legacy() %>%
dplyr::mutate(offset_y = purrr::map(yy, ~.x:1 -1)) %>%
tidyr::unnest() %>%
tidyr::unnest_legacy() %>%
dplyr::arrange(dplyr::desc(xx*yy), #Start with bricks with most area
xx+yy, #Then smaller perimeter... so 2x2 is before 1x4,
dplyr::desc(xx), #Then widest first, so offsets are collected
@@ -112,6 +112,7 @@ collect_bricks <- function(image_list, use_bricks = NULL){
in_list[["Img_bricks"]] <- img2
in_list[["ID_bricks"]] <- bricks_df
in_list[["pieces"]] <- pcs
in_list[["use_bricks"]] <- use_bricks
return(in_list)
}
+29 -9
View File
@@ -2,7 +2,8 @@
#'
#' Generates a plot of available brick colors. Use .names_only = TRUE to get a list of color names.
#'
#' @param .names_only Return an array of the 41 brick color names. Does not plot.
#' @param .names_only Return an array of the 41 solid brick color names and 13 transparent colors. Does not plot.
#' @param include_transparent Include transparent colors in the plot output.
#' @return A table and ggplot of brick colors & ID numbers.
#' @examples
#' #Generate plot of colors
@@ -13,25 +14,44 @@
#' @family Resources
#' @export
build_colors <- function(.names_only = FALSE){
build_colors <- function(.names_only = FALSE, include_transparent = TRUE){
if(.names_only){
return(lego_colors$Color)
}
message("Use View(lego_colors) to see these in a table format.")
tidyr::crossing(x=1:2, y=1:2, color = lego_colors$Color) %>%
dplyr::left_join(lego_colors %>% dplyr::select(color = Color, color_hex = hex), by = "color") %>%
dplyr::mutate(color = factor(gsub(" ", "\n", color),
levels = gsub(" ", "\n", lego_colors$Color))) %>%
if(include_transparent){
message("Transparent colors are only used for 3D models, not color matching in mosaics or ggplot.")
use_colors <- brickr::lego_colors$Color
use_columns <- 12
} else{
use_colors <- brickr::lego_colors %>%
dplyr::filter(!Trans_lego) %>%
dplyr::pull(Color)
use_columns <- 9
}
tidyr::crossing(x=1:2, y=1:2, color = use_colors) %>%
dplyr::left_join(lego_colors %>%
dplyr::select(color = Color, color_hex = hex, Trans_lego), by = "color") %>%
dplyr::mutate(color = factor(gsub('(.{1,8})(\\s|$)', '\\1\n', color),
levels =gsub('(.{1,8})(\\s|$)', '\\1\n', use_colors)),
alpha = ifelse(Trans_lego, 0.5, 1)) %>%
ggplot2::ggplot(aes(x=x, y=y, group=color)) +
ggplot2::labs(title = "Brick colors available in {brickr}") +
geom_brick_rect(aes(fill = color_hex), label_scale = 0.1,
geom_brick_rect(aes(fill = color_hex, alpha = alpha), label_scale = 0.1,
#Including the use_bricks inputs greatly increases the speed of this.
use_bricks = c("2x2")) +
ggplot2::coord_fixed(x=c(0.5, 2.5), y=c(0.5, 2.5)) +
ggplot2::scale_fill_identity() +
ggplot2::facet_wrap(~color, ncol = 9) +
ggplot2::theme_void()
ggplot2::scale_alpha_identity()+
ggplot2::facet_wrap(~color, ncol = use_columns) +
ggplot2::theme_void() +
ggplot2::theme(
legend.position = "none"
)
}
+6 -4
View File
@@ -117,7 +117,9 @@ scaled_to_colors <- function(image_list, method = "cie94",
#Brick colors to use ----
if(is.null(color_table)) {
brick_table <- lego_colors
brick_table <- brickr::lego_colors %>%
#No transparent colors in mosaics
dplyr::filter(!Trans_lego)
} else{
brick_table <- color_table
}
@@ -128,7 +130,7 @@ scaled_to_colors <- function(image_list, method = "cie94",
dplyr::filter(tolower(Palette) %in% color_palette)
} else {
#Black and white is simpler... cut the colors into 4 groups, then assign lightest = white, darkest = black
brick_table <- lego_colors %>%
brick_table <- brickr::lego_colors %>%
dplyr::filter(Color %in% c("White", "Black", "Medium stone grey", "Dark stone grey")) %>%
dplyr::arrange((R_lego + G_lego + B_lego)) %>%
dplyr::mutate(Lego_color = grDevices::rgb(R_lego, G_lego, B_lego))
@@ -277,8 +279,8 @@ convert_color_to_brick_dithering <- function(img_object, color_table, brick_tabl
mosaic_base[mosaic_base$B > 1, "B"] <- 1
mosaic_base[mosaic_base$R < 0, "R"] <- 0
mosaic_base[mosaic_base$G < 0, "R"] <- 0
mosaic_base[mosaic_base$B < 0, "R"] <- 0
mosaic_base[mosaic_base$G < 0, "G"] <- 0
mosaic_base[mosaic_base$B < 0, "B"] <- 0
}
}
+22 -13
View File
@@ -10,6 +10,8 @@ output:
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
rgl::setupKnitr()
library(brickr)
library(jpeg)
library(tidyverse)
@@ -27,7 +29,7 @@ library(tidyverse)
The package is divided into 3 separate systems:
- [**Mosaics**](#mosaics): Convert image files into mosaics that could be built using LEGO&reg; bricks.
- [**3D Models**](#3d-models): Build 3D LEGO&reg; models from simple data formats & [rayshader](https://www.rayshader.com/).
- [**3D Models**](#3d-models): Build 3D LEGO&reg; models from data tables using [rgl](https://cran.r-project.org/web/packages/rgl/index.html).
- [**Charts**](#charts): A [ggplot2](https://ggplot2.tidyverse.org/) extension to generate plots that resemble LEGO&reg; bricks.
brickr also includes tools help users create the Mosaics and 3D model output using real LEGO&reg; elements.
@@ -42,7 +44,7 @@ The goal of **brickr** is to provide a series of tools to integrate the LEGO&reg
- Generating interest in R and coding for new audiences with easy-to-create 3D models.
- or just embracing pure novelty.
*brickr is developed using publicly available information about LEGO&reg; products and is not officially affiliated with The LEGO Group*
*brickr is developed under the [Fair Play](https://www.lego.com/en-us/legal/notices-and-policies/fair-play/) policy using publicly available information about LEGO&reg; products. brickr is not affiliated with The LEGO Group.*
## Installation
``` r
@@ -83,7 +85,7 @@ In general, any **brickr** function that begins with `build_` generates a graphi
## 3D Models
The `bricks_from_*` series of functions creates 3D models of LEGO bricks from a variety of input formats. These models are rendered using [Tyler Morgan-Wall](https://twitter.com/tylermorganwall)'s [rayshader](https://www.rayshader.com/) package.
The `bricks_from_*` series of functions creates 3D models of LEGO bricks from a variety of input formats.
- `bricks_from_table()` & `bricks_from_excel()` convert a matrix-shaped table of integers into LEGO bricks. For simple models, this table can be made manually using `data.frame()` or `tibble::tribble()`. For more advanced models, it's recommended you use MS Excel or a .csv file. The left-most column in the table is associated with the Level or z-axis of the model. `bricks_from_excel()` is a wrapper function to more easily build models designed using a Microsoft Excel template. Please see this repo: [brickr toybox](https://github.com/ryantimpe/brickr_toybox).
@@ -91,9 +93,10 @@ The `bricks_from_*` series of functions creates 3D models of LEGO bricks from a
- `bricks_from_mosaic()` converts a 2D [mosaic](#mosaics) object from an image into 3D LEGO models, respectively. `bricks_from_rayshader()` creates a LEGO model from the same input as `rayshader::plot_3d()`.
Pass the output from any `bricks_from_*()` function to `build_bricks()` to see the 3D model. The `brick_res` option allows for higher resolution bricks in 'hd' or 'uhd', which will take longer to render.
Pass the output from any `bricks_from_*()` function to `build_bricks()` to see the 3D model.
Models are currently rendered in **rgl**. Previous versions of brickr use [Tyler Morgan-Wall](https://twitter.com/tylermorganwall)'s [rayshader](https://www.rayshader.com/) package. This option is still available by passing the output from any `bricks_from_*()` function to `build_bricks_rayshader()`. Rayshader can still be used for saving snapshots and creating animations.
```{r bricks_1, echo=TRUE, warning=FALSE, message=FALSE, fig.width=3, fig.height=3}
```{r bricks_1, rgl=TRUE, dev='png', echo=TRUE, warning=FALSE, message=FALSE, fig.width=3, fig.height=3}
library(brickr)
#This is a brick
@@ -105,9 +108,11 @@ brick <- data.frame(
brick %>%
bricks_from_table() %>%
build_bricks(brick_res = "uhd")
build_bricks()
#Rotate the default view for a better snapshot
rgl::par3d(userMatrix = rgl::rotate3d(rgl::par3d("userMatrix"), 0.75*pi, 0, 0 ,1))
rayshader::render_snapshot( clear = TRUE)
```
### Stacking bricks
@@ -116,7 +121,7 @@ The Level column in the input table determines the elevation of the bricks. `bri
For larger models, use `tibble::tribble()` to more easily visualize the model. For very large models, use a csv or Excel.
```{r bricks_5, echo=TRUE, warning=FALSE, message=FALSE, fig.width=4, fig.height=4}
```{r bricks_5, rgl=TRUE, dev='png', echo=TRUE, warning=FALSE, message=FALSE, fig.width=4, fig.height=4}
my_first_model <- tibble::tribble(
~Level, ~X1, ~X2, ~X3, ~x4, ~x5, ~X6, ~x7, ~x8,
"A", 1, 1, 1, 0, 1, 1, 1, 1,
@@ -149,16 +154,17 @@ brick_colors <- tibble::tribble(
my_first_model %>%
bricks_from_table(brick_colors) %>%
build_bricks(theta = 210, brick_res = "uhd")
build_bricks()
rayshader::render_snapshot(clear = TRUE)
#Rotate the default view for a better snapshot
rgl::par3d(userMatrix = rgl::rotate3d(rgl::par3d("userMatrix"), 1.1*pi, 0, 0 ,1))
```
### Programmatically build models
Use `bricks_from_coords()` to programmatically build 3D LEGO models instead of manually drawing them in a spreadsheet or table. Here you must provide whole number coordinates for x, y, and z, along with an official LEGO color name for each point.
```{r bricks_6, echo=TRUE, warning=FALSE, message=FALSE, fig.width=5, fig.height=5}
```{r bricks_6, rgl=TRUE, dev='png', echo=TRUE, warning=FALSE, message=FALSE, fig.width=5, fig.height=5}
radius <- 4
sphere_coords <- expand.grid(
x = 1:round((radius*2.5)),
@@ -177,11 +183,14 @@ sphere_coords <- expand.grid(
sphere_coords %>%
bricks_from_coords() %>%
build_bricks(brick_res = "uhd", phi = 30, theta = 30)
build_bricks(outline_bricks = TRUE, rgl_lit = FALSE)
rayshader::render_snapshot(clear = TRUE)
rgl::par3d(userMatrix = rgl::rotate3d(rgl::par3d("userMatrix"), 1.1*pi/4, 0, 0 ,1))
```
The option `outline_bricks = TRUE` adds a black outline around the edges of the bricks. Setting `rgl_lit = FALSE` turns off automated lighting effects from rgl. Changing these two inputs together renders bricks in a more cartoon fashion.
### Examples
More examples using `bricks_from_table()` and `bricks_from_coords()` can be found at the links below.
+28 -15
View File
@@ -20,8 +20,8 @@ The package is divided into 3 separate systems:
- [**Mosaics**](#mosaics): Convert image files into mosaics that could
be built using LEGO® bricks.
- [**3D Models**](#3d-models): Build 3D LEGO® models from simple data
formats & [rayshader](https://www.rayshader.com/).
- [**3D Models**](#3d-models): Build 3D LEGO® models from data tables
using [rgl](https://cran.r-project.org/web/packages/rgl/index.html).
- [**Charts**](#charts): A [ggplot2](https://ggplot2.tidyverse.org/)
extension to generate plots that resemble LEGO® bricks.
@@ -41,8 +41,10 @@ LEGO® system with R by:
easy-to-create 3D models.
- or just embracing pure novelty.
*brickr is developed using publicly available information about LEGO®
products and is not officially affiliated with The LEGO Group*
*brickr is developed under the [Fair
Play](https://www.lego.com/en-us/legal/notices-and-policies/fair-play/)
policy using publicly available information about LEGO® products. brickr
is not affiliated with The LEGO Group.*
## Installation
@@ -101,9 +103,7 @@ functions.
## 3D Models
The `bricks_from_*` series of functions creates 3D models of LEGO bricks
from a variety of input formats. These models are rendered using [Tyler
Morgan-Wall](https://twitter.com/tylermorganwall)s
[rayshader](https://www.rayshader.com/) package.
from a variety of input formats.
- `bricks_from_table()` & `bricks_from_excel()` convert a
matrix-shaped table of integers into LEGO bricks. For simple models,
@@ -128,8 +128,13 @@ Morgan-Wall](https://twitter.com/tylermorganwall)s
as `rayshader::plot_3d()`.
Pass the output from any `bricks_from_*()` function to `build_bricks()`
to see the 3D model. The `brick_res` option allows for higher resolution
bricks in hd or uhd, which will take longer to render.
to see the 3D model. Models are currently rendered in **rgl**. Previous
versions of brickr use [Tyler
Morgan-Wall](https://twitter.com/tylermorganwall)s
[rayshader](https://www.rayshader.com/) package. This option is still
available by passing the output from any `bricks_from_*()` function to
`build_bricks_rayshader()`. Rayshader can still be used for saving
snapshots and creating animations.
``` r
library(brickr)
@@ -143,9 +148,10 @@ brick <- data.frame(
brick %>%
bricks_from_table() %>%
build_bricks(brick_res = "uhd")
build_bricks()
rayshader::render_snapshot( clear = TRUE)
#Rotate the default view for a better snapshot
rgl::par3d(userMatrix = rgl::rotate3d(rgl::par3d("userMatrix"), 0.75*pi, 0, 0 ,1))
```
![](README_files/figure-gfm/bricks_1-1.png)<!-- -->
@@ -192,9 +198,10 @@ brick_colors <- tibble::tribble(
my_first_model %>%
bricks_from_table(brick_colors) %>%
build_bricks(theta = 210, brick_res = "uhd")
build_bricks()
rayshader::render_snapshot(clear = TRUE)
#Rotate the default view for a better snapshot
rgl::par3d(userMatrix = rgl::rotate3d(rgl::par3d("userMatrix"), 1.1*pi, 0, 0 ,1))
```
![](README_files/figure-gfm/bricks_5-1.png)<!-- -->
@@ -225,13 +232,19 @@ sphere_coords <- expand.grid(
sphere_coords %>%
bricks_from_coords() %>%
build_bricks(brick_res = "uhd", phi = 30, theta = 30)
build_bricks(outline_bricks = TRUE, rgl_lit = FALSE)
rayshader::render_snapshot(clear = TRUE)
rgl::par3d(userMatrix = rgl::rotate3d(rgl::par3d("userMatrix"), 1.1*pi/4, 0, 0 ,1))
```
![](README_files/figure-gfm/bricks_6-1.png)<!-- -->
The option `outline_bricks = TRUE` adds a black outline around the edges
of the bricks. Setting `rgl_lit = FALSE` turns off automated lighting
effects from rgl. Changing these two inputs together renders bricks in a
more cartoon fashion.
### Examples
More examples using `bricks_from_table()` and `bricks_from_coords()` can
Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.0 KiB

After

Width:  |  Height:  |  Size: 5.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 53 KiB

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 48 KiB

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.8 KiB

After

Width:  |  Height:  |  Size: 5.3 KiB

Binary file not shown.
+3 -2
View File
@@ -12,12 +12,13 @@ names(color_df)
lego_colors <- color_df %>%
select(-Sample) %>%
rename_at(vars("R", "G", "B"), list(~paste0(., "_lego"))) %>%
filter(c_Palette2016, !c_Metallic, !c_Transparent, !c_Glow) %>%
rename(Trans_lego = c_Transparent) %>%
filter(c_Palette2016, !c_Metallic, !c_Glow) %>%
select(-starts_with("c_")) %>%
mutate(Palette = factor(Palette, levels = c("Universal", "Generic", "Special")),
hex = rgb2hex(R_lego, G_lego, B_lego)) %>%
mutate_at(vars(R_lego, G_lego, B_lego), list(~./255)) %>%
arrange(Palette, LEGONo) %>%
arrange(Trans_lego, Palette, LEGONo) %>%
mutate(brickrID = row_number()) %>%
select(brickrID, Color, LEGONo, Palette, everything()) %>%
#Calculate brightness of color
Binary file not shown.
+173
View File
@@ -0,0 +1,173 @@
<!-- Generated by pkgdown: do not edit by hand -->
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Page not found (404) • brickr</title>
<!-- favicons -->
<link rel="icon" type="image/png" sizes="16x16" href="http://brickr.org/favicon-16x16.png">
<link rel="icon" type="image/png" sizes="32x32" href="http://brickr.org/favicon-32x32.png">
<link rel="apple-touch-icon" type="image/png" sizes="180x180" href="http://brickr.org/apple-touch-icon.png" />
<link rel="apple-touch-icon" type="image/png" sizes="120x120" href="http://brickr.org/apple-touch-icon-120x120.png" />
<link rel="apple-touch-icon" type="image/png" sizes="76x76" href="http://brickr.org/apple-touch-icon-76x76.png" />
<link rel="apple-touch-icon" type="image/png" sizes="60x60" href="http://brickr.org/apple-touch-icon-60x60.png" />
<!-- jquery -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js" integrity="sha256-FgpCb/KJQlLNfOu91ta32o/NMZxltwRo8QtmkMRdAu8=" crossorigin="anonymous"></script>
<!-- Bootstrap -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha256-916EbMg70RQy9LHiGkXzG8hSg9EdNy97GazNG/aiY1w=" crossorigin="anonymous" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha256-U5ZEeKfGNOja007MMD3YBI0A3OSZOQbeG6z2f2Y0hu8=" crossorigin="anonymous"></script>
<!-- Font Awesome icons -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.7.1/css/all.min.css" integrity="sha256-nAmazAk6vS34Xqo0BSrTb+abbtFlgsFK7NKSi6o7Y78=" crossorigin="anonymous" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.7.1/css/v4-shims.min.css" integrity="sha256-6qHlizsOWFskGlwVOKuns+D1nB6ssZrHQrNj1wGplHc=" crossorigin="anonymous" />
<!-- clipboard.js -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/clipboard.js/2.0.4/clipboard.min.js" integrity="sha256-FiZwavyI2V6+EXO1U+xzLG3IKldpiTFf3153ea9zikQ=" crossorigin="anonymous"></script>
<!-- headroom.js -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/headroom/0.9.4/headroom.min.js" integrity="sha256-DJFC1kqIhelURkuza0AvYal5RxMtpzLjFhsnVIeuk+U=" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/headroom/0.9.4/jQuery.headroom.min.js" integrity="sha256-ZX/yNShbjqsohH1k95liqY9Gd8uOiE1S4vZc+9KQ1K4=" crossorigin="anonymous"></script>
<!-- pkgdown -->
<link href="http://brickr.org/pkgdown.css" rel="stylesheet">
<script src="http://brickr.org/pkgdown.js"></script>
<link href="http://brickr.org/extra.css" rel="stylesheet">
<meta property="og:title" content="Page not found (404)" />
<meta property="og:image" content="http://brickr.org/logo.png" />
<meta name="twitter:card" content="summary" />
<!-- mathjax -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/MathJax.js" integrity="sha256-nvJJv9wWKEm88qvoQl9ekL2J+k/RWIsaSScxxlsrv8k=" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/config/TeX-AMS-MML_HTMLorMML.js" integrity="sha256-84DKXVJXs0/F8OTMzX4UR909+jtl4G7SPypPavF+GfA=" crossorigin="anonymous"></script>
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
</head>
<body>
<div class="container template-title-body">
<header>
<div class="navbar navbar-default navbar-fixed-top" role="navigation">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<span class="navbar-brand">
<a class="navbar-link" href="http://brickr.org/index.html">brickr</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.2.0</span>
</span>
</div>
<div id="navbar" class="navbar-collapse collapse">
<ul class="nav navbar-nav">
<li>
<a href="index.html">
<span class="fas fa fas fa-home fa-lg"></span>
</a>
</li>
<li>
<a href="reference/index.html">Reference</a>
</li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">
Articles
<span class="caret"></span>
</a>
<ul class="dropdown-menu" role="menu">
<li>
<a href="articles/graphs.html">ggplot with brickr</a>
</li>
<li>
<a href="articles/models-from-other.html">3D Models from mosaics &amp; rayshader</a>
</li>
<li>
<a href="articles/models-from-program.html">3D Models programmatically</a>
</li>
<li>
<a href="articles/models-from-tables.html">3D models from tables</a>
</li>
<li>
<a href="articles/mosaics.html">Mosaics with brickr</a>
</li>
</ul>
</li>
<li>
<a href="news/index.html">Changelog</a>
</li>
</ul>
<ul class="nav navbar-nav navbar-right">
<li>
<a href="https://github.com/ryantimpe/brickr">
<span class="fab fa fab fa-github fa-lg"></span>
</a>
</li>
</ul>
</div><!--/.nav-collapse -->
</div><!--/.container -->
</div><!--/.navbar -->
</header>
<div class="row">
<div class="contents col-md-9">
<div class="page-header">
<h1>Page not found (404)</h1>
</div>
Content not found. Please use links in the navbar.
</div>
</div>
<footer>
<div class="copyright">
<p>Developed by Ryan Timpe.</p>
</div>
<div class="pkgdown">
<p>Site built with <a href="https://pkgdown.r-lib.org/">pkgdown</a> 1.4.1.</p>
</div>
</footer>
</div>
</body>
</html>
+19 -9
View File
@@ -15,21 +15,25 @@
<link rel="apple-touch-icon" type="image/png" sizes="120x120" href="apple-touch-icon-120x120.png" />
<link rel="apple-touch-icon" type="image/png" sizes="76x76" href="apple-touch-icon-76x76.png" />
<link rel="apple-touch-icon" type="image/png" sizes="60x60" href="apple-touch-icon-60x60.png" />
<!-- jquery -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js" integrity="sha256-FgpCb/KJQlLNfOu91ta32o/NMZxltwRo8QtmkMRdAu8=" crossorigin="anonymous"></script>
<!-- Bootstrap -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha256-916EbMg70RQy9LHiGkXzG8hSg9EdNy97GazNG/aiY1w=" crossorigin="anonymous" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha256-U5ZEeKfGNOja007MMD3YBI0A3OSZOQbeG6z2f2Y0hu8=" crossorigin="anonymous"></script>
<!-- Font Awesome icons -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css" integrity="sha256-eZrrJcwDc/3uDhsdt61sL2oOBY362qM3lon1gyExkL0=" crossorigin="anonymous" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.7.1/css/all.min.css" integrity="sha256-nAmazAk6vS34Xqo0BSrTb+abbtFlgsFK7NKSi6o7Y78=" crossorigin="anonymous" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.7.1/css/v4-shims.min.css" integrity="sha256-6qHlizsOWFskGlwVOKuns+D1nB6ssZrHQrNj1wGplHc=" crossorigin="anonymous" />
<!-- clipboard.js -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/clipboard.js/2.0.4/clipboard.min.js" integrity="sha256-FiZwavyI2V6+EXO1U+xzLG3IKldpiTFf3153ea9zikQ=" crossorigin="anonymous"></script>
<!-- sticky kit -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/sticky-kit/1.1.3/sticky-kit.min.js" integrity="sha256-c4Rlo1ZozqTPE2RLuvbusY3+SU1pQaJC0TjuhygMipw=" crossorigin="anonymous"></script>
<!-- headroom.js -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/headroom/0.9.4/headroom.min.js" integrity="sha256-DJFC1kqIhelURkuza0AvYal5RxMtpzLjFhsnVIeuk+U=" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/headroom/0.9.4/jQuery.headroom.min.js" integrity="sha256-ZX/yNShbjqsohH1k95liqY9Gd8uOiE1S4vZc+9KQ1K4=" crossorigin="anonymous"></script>
<!-- pkgdown -->
<link href="pkgdown.css" rel="stylesheet">
@@ -39,13 +43,14 @@
<link href="extra.css" rel="stylesheet">
<meta property="og:title" content="License" />
<meta property="og:title" content="License" />
<meta property="og:image" content="http://brickr.org/logo.png" />
<meta name="twitter:card" content="summary" />
<!-- mathjax -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/MathJax.js" integrity="sha256-nvJJv9wWKEm88qvoQl9ekL2J+k/RWIsaSScxxlsrv8k=" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/config/TeX-AMS-MML_HTMLorMML.js" integrity="sha256-84DKXVJXs0/F8OTMzX4UR909+jtl4G7SPypPavF+GfA=" crossorigin="anonymous"></script>
@@ -56,6 +61,7 @@
<![endif]-->
</head>
<body>
@@ -72,7 +78,7 @@
</button>
<span class="navbar-brand">
<a class="navbar-link" href="index.html">brickr</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.1.0.9024</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.2.0</span>
</span>
</div>
@@ -80,7 +86,7 @@
<ul class="nav navbar-nav">
<li>
<a href="index.html">
<span class="fa fa-home fa-lg"></span>
<span class="fas fa fas fa-home fa-lg"></span>
</a>
</li>
@@ -115,11 +121,10 @@
<a href="news/index.html">Changelog</a>
</li>
</ul>
<ul class="nav navbar-nav navbar-right">
<li>
<a href="https://github.com/ryantimpe/brickr">
<span class="fa fa-github fa-lg"></span>
<span class="fab fa fab fa-github fa-lg"></span>
</a>
</li>
@@ -130,6 +135,7 @@
</div><!--/.navbar -->
</header>
<div class="row">
@@ -147,19 +153,23 @@ COPYRIGHT HOLDER: Ryan Timpe
</div>
<footer>
<div class="copyright">
<p>Developed by Ryan Timpe.</p>
</div>
<div class="pkgdown">
<p>Site built with <a href="https://pkgdown.r-lib.org/">pkgdown</a> 1.3.0.</p>
<p>Site built with <a href="https://pkgdown.r-lib.org/">pkgdown</a> 1.4.1.</p>
</div>
</footer>
</div>
</body>
</html>
+19 -9
View File
@@ -15,21 +15,25 @@
<link rel="apple-touch-icon" type="image/png" sizes="120x120" href="apple-touch-icon-120x120.png" />
<link rel="apple-touch-icon" type="image/png" sizes="76x76" href="apple-touch-icon-76x76.png" />
<link rel="apple-touch-icon" type="image/png" sizes="60x60" href="apple-touch-icon-60x60.png" />
<!-- jquery -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js" integrity="sha256-FgpCb/KJQlLNfOu91ta32o/NMZxltwRo8QtmkMRdAu8=" crossorigin="anonymous"></script>
<!-- Bootstrap -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha256-916EbMg70RQy9LHiGkXzG8hSg9EdNy97GazNG/aiY1w=" crossorigin="anonymous" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha256-U5ZEeKfGNOja007MMD3YBI0A3OSZOQbeG6z2f2Y0hu8=" crossorigin="anonymous"></script>
<!-- Font Awesome icons -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css" integrity="sha256-eZrrJcwDc/3uDhsdt61sL2oOBY362qM3lon1gyExkL0=" crossorigin="anonymous" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.7.1/css/all.min.css" integrity="sha256-nAmazAk6vS34Xqo0BSrTb+abbtFlgsFK7NKSi6o7Y78=" crossorigin="anonymous" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.7.1/css/v4-shims.min.css" integrity="sha256-6qHlizsOWFskGlwVOKuns+D1nB6ssZrHQrNj1wGplHc=" crossorigin="anonymous" />
<!-- clipboard.js -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/clipboard.js/2.0.4/clipboard.min.js" integrity="sha256-FiZwavyI2V6+EXO1U+xzLG3IKldpiTFf3153ea9zikQ=" crossorigin="anonymous"></script>
<!-- sticky kit -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/sticky-kit/1.1.3/sticky-kit.min.js" integrity="sha256-c4Rlo1ZozqTPE2RLuvbusY3+SU1pQaJC0TjuhygMipw=" crossorigin="anonymous"></script>
<!-- headroom.js -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/headroom/0.9.4/headroom.min.js" integrity="sha256-DJFC1kqIhelURkuza0AvYal5RxMtpzLjFhsnVIeuk+U=" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/headroom/0.9.4/jQuery.headroom.min.js" integrity="sha256-ZX/yNShbjqsohH1k95liqY9Gd8uOiE1S4vZc+9KQ1K4=" crossorigin="anonymous"></script>
<!-- pkgdown -->
<link href="pkgdown.css" rel="stylesheet">
@@ -39,13 +43,14 @@
<link href="extra.css" rel="stylesheet">
<meta property="og:title" content="GNU General Public License" />
<meta property="og:title" content="GNU General Public License" />
<meta property="og:image" content="http://brickr.org/logo.png" />
<meta name="twitter:card" content="summary" />
<!-- mathjax -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/MathJax.js" integrity="sha256-nvJJv9wWKEm88qvoQl9ekL2J+k/RWIsaSScxxlsrv8k=" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/config/TeX-AMS-MML_HTMLorMML.js" integrity="sha256-84DKXVJXs0/F8OTMzX4UR909+jtl4G7SPypPavF+GfA=" crossorigin="anonymous"></script>
@@ -56,6 +61,7 @@
<![endif]-->
</head>
<body>
@@ -72,7 +78,7 @@
</button>
<span class="navbar-brand">
<a class="navbar-link" href="index.html">brickr</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.1.0.9024</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.2.0</span>
</span>
</div>
@@ -80,7 +86,7 @@
<ul class="nav navbar-nav">
<li>
<a href="index.html">
<span class="fa fa-home fa-lg"></span>
<span class="fas fa fas fa-home fa-lg"></span>
</a>
</li>
@@ -115,11 +121,10 @@
<a href="news/index.html">Changelog</a>
</li>
</ul>
<ul class="nav navbar-nav navbar-right">
<li>
<a href="https://github.com/ryantimpe/brickr">
<span class="fa fa-github fa-lg"></span>
<span class="fab fa fab fa-github fa-lg"></span>
</a>
</li>
@@ -130,6 +135,7 @@
</div><!--/.navbar -->
</header>
<div class="row">
@@ -367,19 +373,23 @@
</div>
<footer>
<div class="copyright">
<p>Developed by Ryan Timpe.</p>
</div>
<div class="pkgdown">
<p>Site built with <a href="https://pkgdown.r-lib.org/">pkgdown</a> 1.3.0.</p>
<p>Site built with <a href="https://pkgdown.r-lib.org/">pkgdown</a> 1.4.1.</p>
</div>
</footer>
</div>
</body>
</html>
+17 -11
View File
@@ -13,8 +13,9 @@
<link rel="apple-touch-icon" type="image/png" sizes="76x76" href="../apple-touch-icon-76x76.png">
<link rel="apple-touch-icon" type="image/png" sizes="60x60" href="../apple-touch-icon-60x60.png">
<!-- jquery --><script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js" integrity="sha256-FgpCb/KJQlLNfOu91ta32o/NMZxltwRo8QtmkMRdAu8=" crossorigin="anonymous"></script><!-- Bootstrap --><link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha256-916EbMg70RQy9LHiGkXzG8hSg9EdNy97GazNG/aiY1w=" crossorigin="anonymous">
<script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha256-U5ZEeKfGNOja007MMD3YBI0A3OSZOQbeG6z2f2Y0hu8=" crossorigin="anonymous"></script><!-- Font Awesome icons --><link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css" integrity="sha256-eZrrJcwDc/3uDhsdt61sL2oOBY362qM3lon1gyExkL0=" crossorigin="anonymous">
<!-- clipboard.js --><script src="https://cdnjs.cloudflare.com/ajax/libs/clipboard.js/2.0.4/clipboard.min.js" integrity="sha256-FiZwavyI2V6+EXO1U+xzLG3IKldpiTFf3153ea9zikQ=" crossorigin="anonymous"></script><!-- sticky kit --><script src="https://cdnjs.cloudflare.com/ajax/libs/sticky-kit/1.1.3/sticky-kit.min.js" integrity="sha256-c4Rlo1ZozqTPE2RLuvbusY3+SU1pQaJC0TjuhygMipw=" crossorigin="anonymous"></script><!-- pkgdown --><link href="../pkgdown.css" rel="stylesheet">
<script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha256-U5ZEeKfGNOja007MMD3YBI0A3OSZOQbeG6z2f2Y0hu8=" crossorigin="anonymous"></script><!-- Font Awesome icons --><link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.7.1/css/all.min.css" integrity="sha256-nAmazAk6vS34Xqo0BSrTb+abbtFlgsFK7NKSi6o7Y78=" crossorigin="anonymous">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.7.1/css/v4-shims.min.css" integrity="sha256-6qHlizsOWFskGlwVOKuns+D1nB6ssZrHQrNj1wGplHc=" crossorigin="anonymous">
<!-- clipboard.js --><script src="https://cdnjs.cloudflare.com/ajax/libs/clipboard.js/2.0.4/clipboard.min.js" integrity="sha256-FiZwavyI2V6+EXO1U+xzLG3IKldpiTFf3153ea9zikQ=" crossorigin="anonymous"></script><!-- headroom.js --><script src="https://cdnjs.cloudflare.com/ajax/libs/headroom/0.9.4/headroom.min.js" integrity="sha256-DJFC1kqIhelURkuza0AvYal5RxMtpzLjFhsnVIeuk+U=" crossorigin="anonymous"></script><script src="https://cdnjs.cloudflare.com/ajax/libs/headroom/0.9.4/jQuery.headroom.min.js" integrity="sha256-ZX/yNShbjqsohH1k95liqY9Gd8uOiE1S4vZc+9KQ1K4=" crossorigin="anonymous"></script><!-- pkgdown --><link href="../pkgdown.css" rel="stylesheet">
<script src="../pkgdown.js"></script><link href="../extra.css" rel="stylesheet">
<meta property="og:title" content="ggplot with brickr">
<meta property="og:description" content="">
@@ -38,7 +39,7 @@
</button>
<span class="navbar-brand">
<a class="navbar-link" href="../index.html">brickr</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.1.0.9024</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.2.0</span>
</span>
</div>
@@ -46,7 +47,7 @@
<ul class="nav navbar-nav">
<li>
<a href="../index.html">
<span class="fa fa-home fa-lg"></span>
<span class="fas fa fas fa-home fa-lg"></span>
</a>
</li>
@@ -84,7 +85,7 @@
<ul class="nav navbar-nav navbar-right">
<li>
<a href="https://github.com/ryantimpe/brickr">
<span class="fa fa-github fa-lg"></span>
<span class="fab fa fab fa-github fa-lg"></span>
</a>
</li>
@@ -97,6 +98,7 @@
<!--/.navbar -->
</header><div class="row">
<div class="col-md-9 contents">
<div class="page-header toc-ignore">
@@ -114,7 +116,7 @@
<h2 class="hasAnchor">
<a href="#getting-started" class="anchor"></a>Getting started</h2>
<p>brickr includes functions to render <a href="https://ggplot2.tidyverse.org/">ggplot2</a> bar charts as bricks with LEGO color themes. The main function is <code><a href="../reference/geom_brick_col.html">geom_brick_col()</a></code>, which is the brickr equivalent of <code>geom_col()</code>. Additional functions are highly recommended to ensure that proper the chart is rendered in the proper functions and proportions.</p>
<div class="sourceCode" id="cb1"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb1-1" title="1">df &lt;-<span class="st"> </span><span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/data.frame">data.frame</a></span>(<span class="dt">trt =</span> <span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/c">c</a></span>(<span class="st">"a"</span>, <span class="st">"b"</span>, <span class="st">"c"</span>), <span class="dt">outcome =</span> <span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/c">c</a></span>(<span class="fl">2.3</span>, <span class="fl">1.9</span>, <span class="fl">3.2</span>))</a>
<div class="sourceCode" id="cb1"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb1-1" title="1">df &lt;-<span class="st"> </span><span class="kw"><a href="https://rdrr.io/r/base/data.frame.html">data.frame</a></span>(<span class="dt">trt =</span> <span class="kw"><a href="https://rdrr.io/r/base/c.html">c</a></span>(<span class="st">"a"</span>, <span class="st">"b"</span>, <span class="st">"c"</span>), <span class="dt">outcome =</span> <span class="kw"><a href="https://rdrr.io/r/base/c.html">c</a></span>(<span class="fl">2.3</span>, <span class="fl">1.9</span>, <span class="fl">3.2</span>))</a>
<a class="sourceLine" id="cb1-2" title="2"></a>
<a class="sourceLine" id="cb1-3" title="3"><span class="co">#For official LEGO colors, use with scale_fill_brick and theme_brick.</span></a>
<a class="sourceLine" id="cb1-4" title="4"><span class="kw">ggplot</span>(df, <span class="kw">aes</span>(trt, outcome)) <span class="op">+</span></a>
@@ -157,7 +159,7 @@
</ul>
</li>
</ul>
<div class="sourceCode" id="cb2"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb2-1" title="1">df &lt;-<span class="st"> </span><span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/data.frame">data.frame</a></span>(<span class="dt">x =</span> LETTERS[<span class="dv">1</span><span class="op">:</span><span class="dv">10</span>], <span class="dt">y =</span> <span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/sample">sample</a></span>(<span class="dv">2</span><span class="op">:</span><span class="dv">10</span>, <span class="dv">10</span>, <span class="dt">replace =</span> <span class="ot">TRUE</span>))</a>
<div class="sourceCode" id="cb2"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb2-1" title="1">df &lt;-<span class="st"> </span><span class="kw"><a href="https://rdrr.io/r/base/data.frame.html">data.frame</a></span>(<span class="dt">x =</span> LETTERS[<span class="dv">1</span><span class="op">:</span><span class="dv">10</span>], <span class="dt">y =</span> <span class="kw"><a href="https://rdrr.io/r/base/sample.html">sample</a></span>(<span class="dv">2</span><span class="op">:</span><span class="dv">10</span>, <span class="dv">10</span>, <span class="dt">replace =</span> <span class="ot">TRUE</span>))</a>
<a class="sourceLine" id="cb2-2" title="2"></a>
<a class="sourceLine" id="cb2-3" title="3"><span class="co">#For official LEGO colors, use with scale_fill_brick and theme_brick.</span></a>
<a class="sourceLine" id="cb2-4" title="4"><span class="kw">ggplot</span>(df, <span class="kw">aes</span>(x, y)) <span class="op">+</span></a>
@@ -173,7 +175,7 @@
<a href="#coords" class="anchor"></a>Coords</h2>
<p>Using <code><a href="../reference/coord-brick.html">coord_brick()</a></code> ensures that bricks are rendered with correct proportions. Unlike other <code>coord_*</code> functions in ggplot, no other inputs are necessary.</p>
<p>For horizontal bars, use <code><a href="../reference/coord-brick.html">coord_brick_flip()</a></code>.</p>
<div class="sourceCode" id="cb3"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb3-1" title="1">df &lt;-<span class="st"> </span><span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/data.frame">data.frame</a></span>(<span class="dt">x =</span> LETTERS[<span class="dv">1</span><span class="op">:</span><span class="dv">8</span>], <span class="dt">y =</span> <span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/sample">sample</a></span>(<span class="dv">2</span><span class="op">:</span><span class="dv">10</span>, <span class="dv">8</span>, <span class="dt">replace =</span> <span class="ot">TRUE</span>))</a>
<div class="sourceCode" id="cb3"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb3-1" title="1">df &lt;-<span class="st"> </span><span class="kw"><a href="https://rdrr.io/r/base/data.frame.html">data.frame</a></span>(<span class="dt">x =</span> LETTERS[<span class="dv">1</span><span class="op">:</span><span class="dv">8</span>], <span class="dt">y =</span> <span class="kw"><a href="https://rdrr.io/r/base/sample.html">sample</a></span>(<span class="dv">2</span><span class="op">:</span><span class="dv">10</span>, <span class="dv">8</span>, <span class="dt">replace =</span> <span class="ot">TRUE</span>))</a>
<a class="sourceLine" id="cb3-2" title="2"></a>
<a class="sourceLine" id="cb3-3" title="3"><span class="kw">ggplot</span>(df, <span class="kw">aes</span>(x, y)) <span class="op">+</span></a>
<a class="sourceLine" id="cb3-4" title="4"><span class="st"> </span><span class="kw"><a href="../reference/geom_brick_col.html">geom_brick_col</a></span>(<span class="kw">aes</span>(<span class="dt">fill =</span> x), <span class="dt">two_knob =</span> <span class="ot">FALSE</span>) <span class="op">+</span></a>
@@ -186,12 +188,12 @@
<div id="scale-and-themes" class="section level2">
<h2 class="hasAnchor">
<a href="#scale-and-themes" class="anchor"></a>Scale and themes</h2>
<p>There are 41 LEGO brick colors available in brickr. See <code><a href="../reference/build_colors.html">build_colors()</a></code> or <code><a href="https://www.rdocumentation.org/packages/utils/topics/View">View(lego_colors)</a></code> for the complete list. The easiest way to use theme colors with plots are the <code><a href="../reference/scale_fill_brick.html">scale_fill_brick()</a></code> and the <code><a href="../reference/theme_brick.html">theme_brick()</a></code> functions.</p>
<p>There are 41 LEGO brick colors available in brickr. See <code><a href="../reference/build_colors.html">build_colors()</a></code> or <code><a href="https://rdrr.io/r/utils/View.html">View(lego_colors)</a></code> for the complete list. The easiest way to use theme colors with plots are the <code><a href="../reference/scale_fill_brick.html">scale_fill_brick()</a></code> and the <code><a href="../reference/theme_brick.html">theme_brick()</a></code> functions.</p>
<p>These functions default to using the classic LEGO color theme, but can take any of the 21 themes included in brickr.</p>
<div id="scales" class="section level3">
<h3 class="hasAnchor">
<a href="#scales" class="anchor"></a>Scales</h3>
<div class="sourceCode" id="cb4"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb4-1" title="1">df &lt;-<span class="st"> </span><span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/data.frame">data.frame</a></span>(<span class="dt">x =</span> LETTERS[<span class="dv">1</span><span class="op">:</span><span class="dv">8</span>], <span class="dt">y =</span> <span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/sample">sample</a></span>(<span class="dv">2</span><span class="op">:</span><span class="dv">10</span>, <span class="dv">8</span>, <span class="dt">replace =</span> <span class="ot">TRUE</span>))</a>
<div class="sourceCode" id="cb4"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb4-1" title="1">df &lt;-<span class="st"> </span><span class="kw"><a href="https://rdrr.io/r/base/data.frame.html">data.frame</a></span>(<span class="dt">x =</span> LETTERS[<span class="dv">1</span><span class="op">:</span><span class="dv">8</span>], <span class="dt">y =</span> <span class="kw"><a href="https://rdrr.io/r/base/sample.html">sample</a></span>(<span class="dv">2</span><span class="op">:</span><span class="dv">10</span>, <span class="dv">8</span>, <span class="dt">replace =</span> <span class="ot">TRUE</span>))</a>
<a class="sourceLine" id="cb4-2" title="2"></a>
<a class="sourceLine" id="cb4-3" title="3">use_theme &lt;-<span class="st"> "hp"</span></a>
<a class="sourceLine" id="cb4-4" title="4"></a>
@@ -214,6 +216,7 @@
</div>
<div class="col-md-3 hidden-xs hidden-sm" id="sidebar">
<div id="tocnav">
<h2 class="hasAnchor">
<a href="#tocnav" class="anchor"></a>Contents</h2>
@@ -229,17 +232,20 @@
</div>
<footer><div class="copyright">
<p>Developed by Ryan Timpe.</p>
</div>
<div class="pkgdown">
<p>Site built with <a href="https://pkgdown.r-lib.org/">pkgdown</a> 1.3.0.</p>
<p>Site built with <a href="https://pkgdown.r-lib.org/">pkgdown</a> 1.4.1.</p>
</div>
</footer>
</div>
</body>
</html>
Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 63 KiB

After

Width:  |  Height:  |  Size: 74 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 36 KiB

After

Width:  |  Height:  |  Size: 33 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 98 KiB

After

Width:  |  Height:  |  Size: 100 KiB

+19 -9
View File
@@ -15,21 +15,25 @@
<link rel="apple-touch-icon" type="image/png" sizes="120x120" href="../apple-touch-icon-120x120.png" />
<link rel="apple-touch-icon" type="image/png" sizes="76x76" href="../apple-touch-icon-76x76.png" />
<link rel="apple-touch-icon" type="image/png" sizes="60x60" href="../apple-touch-icon-60x60.png" />
<!-- jquery -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js" integrity="sha256-FgpCb/KJQlLNfOu91ta32o/NMZxltwRo8QtmkMRdAu8=" crossorigin="anonymous"></script>
<!-- Bootstrap -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha256-916EbMg70RQy9LHiGkXzG8hSg9EdNy97GazNG/aiY1w=" crossorigin="anonymous" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha256-U5ZEeKfGNOja007MMD3YBI0A3OSZOQbeG6z2f2Y0hu8=" crossorigin="anonymous"></script>
<!-- Font Awesome icons -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css" integrity="sha256-eZrrJcwDc/3uDhsdt61sL2oOBY362qM3lon1gyExkL0=" crossorigin="anonymous" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.7.1/css/all.min.css" integrity="sha256-nAmazAk6vS34Xqo0BSrTb+abbtFlgsFK7NKSi6o7Y78=" crossorigin="anonymous" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.7.1/css/v4-shims.min.css" integrity="sha256-6qHlizsOWFskGlwVOKuns+D1nB6ssZrHQrNj1wGplHc=" crossorigin="anonymous" />
<!-- clipboard.js -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/clipboard.js/2.0.4/clipboard.min.js" integrity="sha256-FiZwavyI2V6+EXO1U+xzLG3IKldpiTFf3153ea9zikQ=" crossorigin="anonymous"></script>
<!-- sticky kit -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/sticky-kit/1.1.3/sticky-kit.min.js" integrity="sha256-c4Rlo1ZozqTPE2RLuvbusY3+SU1pQaJC0TjuhygMipw=" crossorigin="anonymous"></script>
<!-- headroom.js -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/headroom/0.9.4/headroom.min.js" integrity="sha256-DJFC1kqIhelURkuza0AvYal5RxMtpzLjFhsnVIeuk+U=" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/headroom/0.9.4/jQuery.headroom.min.js" integrity="sha256-ZX/yNShbjqsohH1k95liqY9Gd8uOiE1S4vZc+9KQ1K4=" crossorigin="anonymous"></script>
<!-- pkgdown -->
<link href="../pkgdown.css" rel="stylesheet">
@@ -39,13 +43,14 @@
<link href="../extra.css" rel="stylesheet">
<meta property="og:title" content="Articles" />
<meta property="og:title" content="Articles" />
<meta property="og:image" content="http://brickr.org/logo.png" />
<meta name="twitter:card" content="summary" />
<!-- mathjax -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/MathJax.js" integrity="sha256-nvJJv9wWKEm88qvoQl9ekL2J+k/RWIsaSScxxlsrv8k=" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/config/TeX-AMS-MML_HTMLorMML.js" integrity="sha256-84DKXVJXs0/F8OTMzX4UR909+jtl4G7SPypPavF+GfA=" crossorigin="anonymous"></script>
@@ -56,6 +61,7 @@
<![endif]-->
</head>
<body>
@@ -72,7 +78,7 @@
</button>
<span class="navbar-brand">
<a class="navbar-link" href="../index.html">brickr</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.1.0.9024</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.2.0</span>
</span>
</div>
@@ -80,7 +86,7 @@
<ul class="nav navbar-nav">
<li>
<a href="../index.html">
<span class="fa fa-home fa-lg"></span>
<span class="fas fa fas fa-home fa-lg"></span>
</a>
</li>
@@ -115,11 +121,10 @@
<a href="../news/index.html">Changelog</a>
</li>
</ul>
<ul class="nav navbar-nav navbar-right">
<li>
<a href="https://github.com/ryantimpe/brickr">
<span class="fa fa-github fa-lg"></span>
<span class="fab fa fab fa-github fa-lg"></span>
</a>
</li>
@@ -130,6 +135,7 @@
</div><!--/.navbar -->
</header>
<div class="row">
@@ -167,19 +173,23 @@
</div>
</div>
<footer>
<div class="copyright">
<p>Developed by Ryan Timpe.</p>
</div>
<div class="pkgdown">
<p>Site built with <a href="https://pkgdown.r-lib.org/">pkgdown</a> 1.3.0.</p>
<p>Site built with <a href="https://pkgdown.r-lib.org/">pkgdown</a> 1.4.1.</p>
</div>
</footer>
</div>
</body>
</html>
+38 -29
View File
@@ -13,8 +13,9 @@
<link rel="apple-touch-icon" type="image/png" sizes="76x76" href="../apple-touch-icon-76x76.png">
<link rel="apple-touch-icon" type="image/png" sizes="60x60" href="../apple-touch-icon-60x60.png">
<!-- jquery --><script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js" integrity="sha256-FgpCb/KJQlLNfOu91ta32o/NMZxltwRo8QtmkMRdAu8=" crossorigin="anonymous"></script><!-- Bootstrap --><link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha256-916EbMg70RQy9LHiGkXzG8hSg9EdNy97GazNG/aiY1w=" crossorigin="anonymous">
<script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha256-U5ZEeKfGNOja007MMD3YBI0A3OSZOQbeG6z2f2Y0hu8=" crossorigin="anonymous"></script><!-- Font Awesome icons --><link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css" integrity="sha256-eZrrJcwDc/3uDhsdt61sL2oOBY362qM3lon1gyExkL0=" crossorigin="anonymous">
<!-- clipboard.js --><script src="https://cdnjs.cloudflare.com/ajax/libs/clipboard.js/2.0.4/clipboard.min.js" integrity="sha256-FiZwavyI2V6+EXO1U+xzLG3IKldpiTFf3153ea9zikQ=" crossorigin="anonymous"></script><!-- sticky kit --><script src="https://cdnjs.cloudflare.com/ajax/libs/sticky-kit/1.1.3/sticky-kit.min.js" integrity="sha256-c4Rlo1ZozqTPE2RLuvbusY3+SU1pQaJC0TjuhygMipw=" crossorigin="anonymous"></script><!-- pkgdown --><link href="../pkgdown.css" rel="stylesheet">
<script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha256-U5ZEeKfGNOja007MMD3YBI0A3OSZOQbeG6z2f2Y0hu8=" crossorigin="anonymous"></script><!-- Font Awesome icons --><link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.7.1/css/all.min.css" integrity="sha256-nAmazAk6vS34Xqo0BSrTb+abbtFlgsFK7NKSi6o7Y78=" crossorigin="anonymous">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.7.1/css/v4-shims.min.css" integrity="sha256-6qHlizsOWFskGlwVOKuns+D1nB6ssZrHQrNj1wGplHc=" crossorigin="anonymous">
<!-- clipboard.js --><script src="https://cdnjs.cloudflare.com/ajax/libs/clipboard.js/2.0.4/clipboard.min.js" integrity="sha256-FiZwavyI2V6+EXO1U+xzLG3IKldpiTFf3153ea9zikQ=" crossorigin="anonymous"></script><!-- headroom.js --><script src="https://cdnjs.cloudflare.com/ajax/libs/headroom/0.9.4/headroom.min.js" integrity="sha256-DJFC1kqIhelURkuza0AvYal5RxMtpzLjFhsnVIeuk+U=" crossorigin="anonymous"></script><script src="https://cdnjs.cloudflare.com/ajax/libs/headroom/0.9.4/jQuery.headroom.min.js" integrity="sha256-ZX/yNShbjqsohH1k95liqY9Gd8uOiE1S4vZc+9KQ1K4=" crossorigin="anonymous"></script><!-- pkgdown --><link href="../pkgdown.css" rel="stylesheet">
<script src="../pkgdown.js"></script><link href="../extra.css" rel="stylesheet">
<meta property="og:title" content="3D Models from mosaics &amp; rayshader">
<meta property="og:description" content="">
@@ -38,7 +39,7 @@
</button>
<span class="navbar-brand">
<a class="navbar-link" href="../index.html">brickr</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.1.0.9024</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.2.0</span>
</span>
</div>
@@ -46,7 +47,7 @@
<ul class="nav navbar-nav">
<li>
<a href="../index.html">
<span class="fa fa-home fa-lg"></span>
<span class="fas fa fas fa-home fa-lg"></span>
</a>
</li>
@@ -84,7 +85,7 @@
<ul class="nav navbar-nav navbar-right">
<li>
<a href="https://github.com/ryantimpe/brickr">
<span class="fa fa-github fa-lg"></span>
<span class="fab fa fab fa-github fa-lg"></span>
</a>
</li>
@@ -97,6 +98,7 @@
<!--/.navbar -->
</header><div class="row">
<div class="col-md-9 contents">
<div class="page-header toc-ignore">
@@ -113,7 +115,7 @@
<div id="getting-started" class="section level2">
<h2 class="hasAnchor">
<a href="#getting-started" class="anchor"></a>Getting started</h2>
<p>The <code>bricks_from_*</code> series of functions creates 3D models of LEGO bricks from a variety of input formats. These models are rendered using <a href="https://twitter.com/tylermorganwall">Tyler Morgan-Wall</a>s <a href="https://www.rayshader.com/">rayshader</a> package. This package must be installed.</p>
<p>The <code>bricks_from_*</code> series of functions creates 3D models of LEGO bricks from a variety of input formats.</p>
</div>
<div id="d-mosaics" class="section level2">
<h2 class="hasAnchor">
@@ -125,21 +127,24 @@
<li>
<code>highest_el</code> specifies if light or dark color bricks should be the tallest in the model. The default is light.</li>
</ul>
<div class="sourceCode" id="cb1"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb1-1" title="1">demo_img =<span class="st"> </span><span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/tempfile">tempfile</a></span>() </a>
<a class="sourceLine" id="cb1-2" title="2"><span class="kw"><a href="https://www.rdocumentation.org/packages/utils/topics/download.file">download.file</a></span>(<span class="st">"http://ryantimpe.com/files/mf_unicorn.PNG"</span>, demo_img, <span class="dt">mode=</span><span class="st">"wb"</span>)</a>
<div class="sourceCode" id="cb1"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb1-1" title="1">demo_img =<span class="st"> </span><span class="kw"><a href="https://rdrr.io/r/base/tempfile.html">tempfile</a></span>() </a>
<a class="sourceLine" id="cb1-2" title="2"><span class="kw"><a href="https://rdrr.io/r/utils/download.file.html">download.file</a></span>(<span class="st">"http://ryantimpe.com/files/mf_unicorn.PNG"</span>, demo_img, <span class="dt">mode=</span><span class="st">"wb"</span>)</a>
<a class="sourceLine" id="cb1-3" title="3"></a>
<a class="sourceLine" id="cb1-4" title="4">mosaic &lt;-<span class="st"> </span>png<span class="op">::</span><span class="kw"><a href="https://www.rdocumentation.org/packages/png/topics/readPNG">readPNG</a></span>(demo_img) <span class="op">%&gt;%</span><span class="st"> </span></a>
<a class="sourceLine" id="cb1-4" title="4">mosaic &lt;-<span class="st"> </span>png<span class="op">::</span><span class="kw"><a href="https://rdrr.io/pkg/png/man/readPNG.html">readPNG</a></span>(demo_img) <span class="op">%&gt;%</span><span class="st"> </span></a>
<a class="sourceLine" id="cb1-5" title="5"><span class="st"> </span><span class="kw"><a href="../reference/image_to_mosaic.html">image_to_mosaic</a></span>()</a>
<a class="sourceLine" id="cb1-6" title="6"></a>
<a class="sourceLine" id="cb1-7" title="7">mosaic <span class="op">%&gt;%</span><span class="st"> </span><span class="kw"><a href="../reference/build_mosaic.html">build_mosaic</a></span>()</a></code></pre></div>
<p><img src="models-from-other_files/figure-html/bricks_6-1.png" width="384"></p>
<div class="sourceCode" id="cb2"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb2-1" title="1"></a>
<a class="sourceLine" id="cb2-2" title="2">mosaic <span class="op">%&gt;%</span><span class="st"> </span></a>
<a class="sourceLine" id="cb2-3" title="3"><span class="st"> </span><span class="kw"><a href="../reference/bricks_from_mosaic.html">bricks_from_mosaic</a></span>(<span class="dt">highest_el =</span> <span class="st">"dark"</span>) <span class="op">%&gt;%</span><span class="st"> </span></a>
<a class="sourceLine" id="cb2-4" title="4"><span class="st"> </span><span class="kw"><a href="../reference/build_bricks.html">build_bricks</a></span>(<span class="dt">phi =</span> <span class="dv">60</span>, <span class="dt">theta =</span> <span class="dv">15</span>)</a>
<a class="sourceLine" id="cb2-5" title="5"></a>
<a class="sourceLine" id="cb2-6" title="6">rayshader<span class="op">::</span><span class="kw"><a href="https://www.rdocumentation.org/packages/rayshader/topics/render_snapshot">render_snapshot</a></span>(<span class="dt">clear =</span> <span class="ot">TRUE</span>)</a></code></pre></div>
<p><img src="models-from-other_files/figure-html/bricks_6-2.png" width="384"></p>
<div class="sourceCode" id="cb2"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb2-1" title="1">mosaic <span class="op">%&gt;%</span><span class="st"> </span></a>
<a class="sourceLine" id="cb2-2" title="2"><span class="st"> </span><span class="kw"><a href="../reference/bricks_from_mosaic.html">bricks_from_mosaic</a></span>(<span class="dt">highest_el =</span> <span class="st">"dark"</span>) <span class="op">%&gt;%</span><span class="st"> </span></a>
<a class="sourceLine" id="cb2-3" title="3"><span class="st"> </span><span class="kw"><a href="../reference/build_bricks.html">build_bricks</a></span>()</a>
<a class="sourceLine" id="cb2-4" title="4"></a>
<a class="sourceLine" id="cb2-5" title="5"><span class="co">#From dput(round(rgl::par3d("userMatrix"),1)) after manual rotation</span></a>
<a class="sourceLine" id="cb2-6" title="6">custom_rotation &lt;-<span class="st"> </span><span class="kw"><a href="https://rdrr.io/r/base/structure.html">structure</a></span>(<span class="kw"><a href="https://rdrr.io/r/base/c.html">c</a></span>(<span class="fl">0.9</span>, <span class="fl">0.3</span>, <span class="fl">-0.3</span>, <span class="dv">0</span>, <span class="fl">-0.3</span>, <span class="fl">0.9</span>, <span class="fl">-0.3</span>, </a>
<a class="sourceLine" id="cb2-7" title="7"> <span class="dv">0</span>, <span class="fl">0.2</span>, <span class="fl">0.4</span>, <span class="fl">0.9</span>, <span class="dv">0</span>, <span class="dv">0</span>, <span class="dv">0</span>, <span class="dv">0</span>, <span class="dv">1</span>), <span class="dt">.Dim =</span> <span class="kw"><a href="https://rdrr.io/r/base/c.html">c</a></span>(4L, 4L))</a>
<a class="sourceLine" id="cb2-8" title="8"></a>
<a class="sourceLine" id="cb2-9" title="9">rgl<span class="op">::</span><span class="kw"><a href="https://rdrr.io/pkg/rgl/man/par3d.html">par3d</a></span>(<span class="dt">userMatrix =</span> rgl<span class="op">::</span><span class="kw"><a href="https://rdrr.io/pkg/rgl/man/matrices.html">rotate3d</a></span>(custom_rotation, <span class="dv">0</span>, <span class="dv">0</span>, pi<span class="op">/</span><span class="dv">4</span> ,<span class="dv">1</span>))</a></code></pre></div>
<p><img src="models-from-other_files/figure-html/bricks_6a-1.png" width="384"></p>
</div>
<div id="models-from-rayshader" class="section level2">
<h2 class="hasAnchor">
@@ -156,19 +161,19 @@
<li>
<code>img_size</code> is the number of bricks on each side of the model. The default is 48.</li>
</ul>
<div class="sourceCode" id="cb3"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb3-1" title="1"><span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/library">library</a></span>(rayshader)</a>
<div class="sourceCode" id="cb3"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb3-1" title="1"><span class="kw"><a href="https://rdrr.io/r/base/library.html">library</a></span>(rayshader)</a>
<a class="sourceLine" id="cb3-2" title="2"></a>
<a class="sourceLine" id="cb3-3" title="3"><span class="co">#Example from rayshader.com</span></a>
<a class="sourceLine" id="cb3-4" title="4"></a>
<a class="sourceLine" id="cb3-5" title="5"><span class="co">#Here, I load a map with the raster package.</span></a>
<a class="sourceLine" id="cb3-6" title="6">loadzip =<span class="st"> </span><span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/tempfile">tempfile</a></span>() </a>
<a class="sourceLine" id="cb3-7" title="7"><span class="kw"><a href="https://www.rdocumentation.org/packages/utils/topics/download.file">download.file</a></span>(<span class="st">"https://tylermw.com/data/dem_01.tif.zip"</span>, loadzip)</a>
<a class="sourceLine" id="cb3-8" title="8">localtif =<span class="st"> </span>raster<span class="op">::</span><span class="kw"><a href="https://www.rdocumentation.org/packages/raster/topics/raster">raster</a></span>(<span class="kw"><a href="https://www.rdocumentation.org/packages/utils/topics/unzip">unzip</a></span>(loadzip, <span class="st">"dem_01.tif"</span>))</a>
<a class="sourceLine" id="cb3-9" title="9"><span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/unlink">unlink</a></span>(loadzip)</a>
<a class="sourceLine" id="cb3-6" title="6">loadzip =<span class="st"> </span><span class="kw"><a href="https://rdrr.io/r/base/tempfile.html">tempfile</a></span>() </a>
<a class="sourceLine" id="cb3-7" title="7"><span class="kw"><a href="https://rdrr.io/r/utils/download.file.html">download.file</a></span>(<span class="st">"https://tylermw.com/data/dem_01.tif.zip"</span>, loadzip)</a>
<a class="sourceLine" id="cb3-8" title="8">localtif =<span class="st"> </span>raster<span class="op">::</span><span class="kw"><a href="https://rdrr.io/pkg/raster/man/raster.html">raster</a></span>(<span class="kw"><a href="https://rdrr.io/r/utils/unzip.html">unzip</a></span>(loadzip, <span class="st">"dem_01.tif"</span>))</a>
<a class="sourceLine" id="cb3-9" title="9"><span class="kw"><a href="https://rdrr.io/r/base/unlink.html">unlink</a></span>(loadzip)</a>
<a class="sourceLine" id="cb3-10" title="10"></a>
<a class="sourceLine" id="cb3-11" title="11"><span class="co">#And convert it to a matrix:</span></a>
<a class="sourceLine" id="cb3-12" title="12">elmat =<span class="st"> </span><span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/matrix">matrix</a></span>(raster<span class="op">::</span><span class="kw"><a href="https://www.rdocumentation.org/packages/raster/topics/extract">extract</a></span>(localtif, raster<span class="op">::</span><span class="kw"><a href="https://www.rdocumentation.org/packages/raster/topics/extent">extent</a></span>(localtif), <span class="dt">buffer =</span> <span class="dv">1000</span>),</a>
<a class="sourceLine" id="cb3-13" title="13"> <span class="dt">nrow =</span> <span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/nrow">ncol</a></span>(localtif), <span class="dt">ncol =</span> <span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/nrow">nrow</a></span>(localtif))</a>
<a class="sourceLine" id="cb3-12" title="12">elmat =<span class="st"> </span><span class="kw"><a href="https://rdrr.io/r/base/matrix.html">matrix</a></span>(raster<span class="op">::</span><span class="kw"><a href="https://rdrr.io/pkg/raster/man/extract.html">extract</a></span>(localtif, raster<span class="op">::</span><span class="kw"><a href="https://rdrr.io/pkg/raster/man/extent.html">extent</a></span>(localtif), <span class="dt">buffer =</span> <span class="dv">1000</span>),</a>
<a class="sourceLine" id="cb3-13" title="13"> <span class="dt">nrow =</span> <span class="kw"><a href="https://rdrr.io/r/base/nrow.html">ncol</a></span>(localtif), <span class="dt">ncol =</span> <span class="kw"><a href="https://rdrr.io/r/base/nrow.html">nrow</a></span>(localtif))</a>
<a class="sourceLine" id="cb3-14" title="14"></a>
<a class="sourceLine" id="cb3-15" title="15">rayshader_object &lt;-<span class="st"> </span>elmat <span class="op">%&gt;%</span></a>
<a class="sourceLine" id="cb3-16" title="16"><span class="st"> </span><span class="kw">sphere_shade</span>(<span class="dt">texture =</span> <span class="st">"desert"</span>) <span class="op">%&gt;%</span></a>
@@ -177,22 +182,23 @@
<a class="sourceLine" id="cb3-19" title="19"></a>
<a class="sourceLine" id="cb3-20" title="20"><span class="co">#Plot with rayshader</span></a>
<a class="sourceLine" id="cb3-21" title="21">rayshader_object <span class="op">%&gt;%</span></a>
<a class="sourceLine" id="cb3-22" title="22"><span class="st"> </span><span class="kw">plot_3d</span>(elmat, <span class="dt">zscale =</span> <span class="dv">10</span>, <span class="dt">fov =</span> <span class="dv">0</span>, <span class="dt">theta =</span> <span class="dv">135</span>, <span class="dt">zoom =</span> <span class="fl">0.75</span>, <span class="dt">phi =</span> <span class="dv">45</span>, <span class="dt">windowsize =</span> <span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/c">c</a></span>(<span class="dv">1000</span>, <span class="dv">800</span>))</a>
<a class="sourceLine" id="cb3-22" title="22"><span class="st"> </span><span class="kw">plot_3d</span>(elmat, <span class="dt">zscale =</span> <span class="dv">10</span>, <span class="dt">fov =</span> <span class="dv">0</span>, <span class="dt">theta =</span> <span class="dv">135</span>, <span class="dt">zoom =</span> <span class="fl">0.75</span>, <span class="dt">phi =</span> <span class="dv">45</span>, <span class="dt">windowsize =</span> <span class="kw"><a href="https://rdrr.io/r/base/c.html">c</a></span>(<span class="dv">1000</span>, <span class="dv">800</span>))</a>
<a class="sourceLine" id="cb3-23" title="23"></a>
<a class="sourceLine" id="cb3-24" title="24">rayshader<span class="op">::</span><span class="kw"><a href="https://www.rdocumentation.org/packages/rayshader/topics/render_snapshot">render_snapshot</a></span>(<span class="dt">clear =</span> <span class="ot">TRUE</span>)</a></code></pre></div>
<a class="sourceLine" id="cb3-24" title="24">rayshader<span class="op">::</span><span class="kw"><a href="https://rdrr.io/pkg/rayshader/man/render_snapshot.html">render_snapshot</a></span>(<span class="dt">clear =</span> <span class="ot">TRUE</span>)</a></code></pre></div>
<p><img src="models-from-other_files/figure-html/bricks_rayshader-1.png" width="384"></p>
<div class="sourceCode" id="cb4"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb4-1" title="1"></a>
<a class="sourceLine" id="cb4-2" title="2"><span class="co">#Plot as bricks</span></a>
<a class="sourceLine" id="cb4-3" title="3">rayshader_object <span class="op">%&gt;%</span><span class="st"> </span></a>
<a class="sourceLine" id="cb4-4" title="4"><span class="st"> </span><span class="kw"><a href="../reference/bricks_from_rayshader.html">bricks_from_rayshader</a></span>(elmat) <span class="op">%&gt;%</span><span class="st"> </span></a>
<a class="sourceLine" id="cb4-5" title="5"><span class="st"> </span><span class="kw"><a href="../reference/build_bricks.html">build_bricks</a></span>(<span class="dt">theta =</span> <span class="dv">135</span>, <span class="dt">phi =</span> <span class="dv">45</span>)</a>
<a class="sourceLine" id="cb4-5" title="5"><span class="st"> </span><span class="kw"><a href="../reference/build_bricks_rayshader.html">build_bricks_rayshader</a></span>(<span class="dt">theta =</span> <span class="dv">135</span>, <span class="dt">phi =</span> <span class="dv">45</span>)</a>
<a class="sourceLine" id="cb4-6" title="6"></a>
<a class="sourceLine" id="cb4-7" title="7">rayshader<span class="op">::</span><span class="kw"><a href="https://www.rdocumentation.org/packages/rayshader/topics/render_snapshot">render_snapshot</a></span>(<span class="dt">clear =</span> <span class="ot">TRUE</span>)</a></code></pre></div>
<p><img src="models-from-other_files/figure-html/bricks_rayshader-2.png" width="384"></p>
<a class="sourceLine" id="cb4-7" title="7">rayshader<span class="op">::</span><span class="kw"><a href="https://rdrr.io/pkg/rayshader/man/render_snapshot.html">render_snapshot</a></span>(<span class="dt">clear =</span> <span class="ot">TRUE</span>)</a></code></pre></div>
<p><img src="models-from-other_files/figure-html/bricks_rayshader-2.png" width="384"><img src="models-from-other_files/figure-html/bricks_rayshader-1.png" width="384"> This example is rendered using <code><a href="../reference/build_bricks_rayshader.html">build_bricks_rayshader()</a></code>, which a bit faster for very large sets.</p>
</div>
</div>
<div class="col-md-3 hidden-xs hidden-sm" id="sidebar">
<div id="tocnav">
<h2 class="hasAnchor">
<a href="#tocnav" class="anchor"></a>Contents</h2>
@@ -207,17 +213,20 @@
</div>
<footer><div class="copyright">
<p>Developed by Ryan Timpe.</p>
</div>
<div class="pkgdown">
<p>Site built with <a href="https://pkgdown.r-lib.org/">pkgdown</a> 1.3.0.</p>
<p>Site built with <a href="https://pkgdown.r-lib.org/">pkgdown</a> 1.4.1.</p>
</div>
</footer>
</div>
</body>
</html>
Binary file not shown.

After

Width:  |  Height:  |  Size: 173 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 337 KiB

After

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 290 KiB

After

Width:  |  Height:  |  Size: 288 KiB

+52 -45
View File
@@ -13,8 +13,9 @@
<link rel="apple-touch-icon" type="image/png" sizes="76x76" href="../apple-touch-icon-76x76.png">
<link rel="apple-touch-icon" type="image/png" sizes="60x60" href="../apple-touch-icon-60x60.png">
<!-- jquery --><script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js" integrity="sha256-FgpCb/KJQlLNfOu91ta32o/NMZxltwRo8QtmkMRdAu8=" crossorigin="anonymous"></script><!-- Bootstrap --><link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha256-916EbMg70RQy9LHiGkXzG8hSg9EdNy97GazNG/aiY1w=" crossorigin="anonymous">
<script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha256-U5ZEeKfGNOja007MMD3YBI0A3OSZOQbeG6z2f2Y0hu8=" crossorigin="anonymous"></script><!-- Font Awesome icons --><link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css" integrity="sha256-eZrrJcwDc/3uDhsdt61sL2oOBY362qM3lon1gyExkL0=" crossorigin="anonymous">
<!-- clipboard.js --><script src="https://cdnjs.cloudflare.com/ajax/libs/clipboard.js/2.0.4/clipboard.min.js" integrity="sha256-FiZwavyI2V6+EXO1U+xzLG3IKldpiTFf3153ea9zikQ=" crossorigin="anonymous"></script><!-- sticky kit --><script src="https://cdnjs.cloudflare.com/ajax/libs/sticky-kit/1.1.3/sticky-kit.min.js" integrity="sha256-c4Rlo1ZozqTPE2RLuvbusY3+SU1pQaJC0TjuhygMipw=" crossorigin="anonymous"></script><!-- pkgdown --><link href="../pkgdown.css" rel="stylesheet">
<script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha256-U5ZEeKfGNOja007MMD3YBI0A3OSZOQbeG6z2f2Y0hu8=" crossorigin="anonymous"></script><!-- Font Awesome icons --><link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.7.1/css/all.min.css" integrity="sha256-nAmazAk6vS34Xqo0BSrTb+abbtFlgsFK7NKSi6o7Y78=" crossorigin="anonymous">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.7.1/css/v4-shims.min.css" integrity="sha256-6qHlizsOWFskGlwVOKuns+D1nB6ssZrHQrNj1wGplHc=" crossorigin="anonymous">
<!-- clipboard.js --><script src="https://cdnjs.cloudflare.com/ajax/libs/clipboard.js/2.0.4/clipboard.min.js" integrity="sha256-FiZwavyI2V6+EXO1U+xzLG3IKldpiTFf3153ea9zikQ=" crossorigin="anonymous"></script><!-- headroom.js --><script src="https://cdnjs.cloudflare.com/ajax/libs/headroom/0.9.4/headroom.min.js" integrity="sha256-DJFC1kqIhelURkuza0AvYal5RxMtpzLjFhsnVIeuk+U=" crossorigin="anonymous"></script><script src="https://cdnjs.cloudflare.com/ajax/libs/headroom/0.9.4/jQuery.headroom.min.js" integrity="sha256-ZX/yNShbjqsohH1k95liqY9Gd8uOiE1S4vZc+9KQ1K4=" crossorigin="anonymous"></script><!-- pkgdown --><link href="../pkgdown.css" rel="stylesheet">
<script src="../pkgdown.js"></script><link href="../extra.css" rel="stylesheet">
<meta property="og:title" content="3D Models programmatically">
<meta property="og:description" content="">
@@ -38,7 +39,7 @@
</button>
<span class="navbar-brand">
<a class="navbar-link" href="../index.html">brickr</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.1.0.9024</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.2.0</span>
</span>
</div>
@@ -46,7 +47,7 @@
<ul class="nav navbar-nav">
<li>
<a href="../index.html">
<span class="fa fa-home fa-lg"></span>
<span class="fas fa fas fa-home fa-lg"></span>
</a>
</li>
@@ -84,7 +85,7 @@
<ul class="nav navbar-nav navbar-right">
<li>
<a href="https://github.com/ryantimpe/brickr">
<span class="fa fa-github fa-lg"></span>
<span class="fab fa fab fa-github fa-lg"></span>
</a>
</li>
@@ -97,6 +98,7 @@
<!--/.navbar -->
</header><div class="row">
<div class="col-md-9 contents">
<div class="page-header toc-ignore">
@@ -113,39 +115,39 @@
<div id="getting-started" class="section level2">
<h2 class="hasAnchor">
<a href="#getting-started" class="anchor"></a>Getting started</h2>
<p>The <code>bricks_from_*</code> series of functions creates 3D models of LEGO bricks from a variety of input formats. These models are rendered using <a href="https://twitter.com/tylermorganwall">Tyler Morgan-Wall</a>s <a href="https://www.rayshader.com/">rayshader</a> package. This package must be installed.</p>
<p>The <code>bricks_from_*</code> series of functions creates 3D models of LEGO bricks from a variety of input formats.</p>
<p>Use <code><a href="../reference/bricks_from_coords.html">bricks_from_coords()</a></code> to programmatically build 3D LEGO models rather than manually drawing them in a spreadsheet or table. Prove the function with a data frame with x, y, and z coordinates, along with an official LEGO color name for each point.</p>
</div>
<div id="a-simple-programmed-model" class="section level2">
<h2 class="hasAnchor">
<a href="#a-simple-programmed-model" class="anchor"></a>A simple programmed model</h2>
<p>Below, we create a 8x8x8 cube by expanding a data frame with the array 1:8 as the x-, y-, and z-coordinates. We then assign each row of that data frame one of three colors: Bright blue, Bright yellow, or Bright red.</p>
<div class="sourceCode" id="cb1"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb1-1" title="1">use_colors &lt;-<span class="st"> </span><span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/c">c</a></span>(<span class="st">"Bright blue"</span>, <span class="st">"Bright yellow"</span>, <span class="st">"Bright red"</span>)</a>
<div class="sourceCode" id="cb1"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb1-1" title="1">use_colors &lt;-<span class="st"> </span><span class="kw"><a href="https://rdrr.io/r/base/c.html">c</a></span>(<span class="st">"Bright blue"</span>, <span class="st">"Bright yellow"</span>, <span class="st">"Bright red"</span>)</a>
<a class="sourceLine" id="cb1-2" title="2"></a>
<a class="sourceLine" id="cb1-3" title="3">cube &lt;-<span class="st"> </span><span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/expand.grid">expand.grid</a></span>(</a>
<a class="sourceLine" id="cb1-3" title="3">cube &lt;-<span class="st"> </span><span class="kw"><a href="https://rdrr.io/r/base/expand.grid.html">expand.grid</a></span>(</a>
<a class="sourceLine" id="cb1-4" title="4"> <span class="dt">x =</span> <span class="dv">1</span><span class="op">:</span><span class="dv">8</span>,</a>
<a class="sourceLine" id="cb1-5" title="5"> <span class="dt">y =</span> <span class="dv">1</span><span class="op">:</span><span class="dv">8</span>,</a>
<a class="sourceLine" id="cb1-6" title="6"> <span class="dt">z =</span> <span class="dv">1</span><span class="op">:</span><span class="dv">8</span></a>
<a class="sourceLine" id="cb1-7" title="7">) </a>
<a class="sourceLine" id="cb1-8" title="8"></a>
<a class="sourceLine" id="cb1-9" title="9">cube<span class="op">$</span>Color &lt;-<span class="st"> </span><span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/sample">sample</a></span>(use_colors, <span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/nrow">nrow</a></span>(cube), <span class="dt">replace =</span> <span class="ot">TRUE</span>, <span class="dt">prob =</span> <span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/c">c</a></span>(<span class="dv">5</span>, <span class="dv">3</span>, <span class="dv">1</span>))</a>
<a class="sourceLine" id="cb1-9" title="9">cube<span class="op">$</span>Color &lt;-<span class="st"> </span><span class="kw"><a href="https://rdrr.io/r/base/sample.html">sample</a></span>(use_colors, <span class="kw"><a href="https://rdrr.io/r/base/nrow.html">nrow</a></span>(cube), <span class="dt">replace =</span> <span class="ot">TRUE</span>, <span class="dt">prob =</span> <span class="kw"><a href="https://rdrr.io/r/base/c.html">c</a></span>(<span class="dv">5</span>, <span class="dv">3</span>, <span class="dv">1</span>))</a>
<a class="sourceLine" id="cb1-10" title="10"></a>
<a class="sourceLine" id="cb1-11" title="11">cube <span class="op">%&gt;%</span><span class="st"> </span></a>
<a class="sourceLine" id="cb1-12" title="12"><span class="st"> </span><span class="kw"><a href="../reference/bricks_from_coords.html">bricks_from_coords</a></span>() <span class="op">%&gt;%</span><span class="st"> </span></a>
<a class="sourceLine" id="cb1-13" title="13"><span class="st"> </span><span class="kw"><a href="../reference/build_bricks.html">build_bricks</a></span>(<span class="dt">brick_res =</span> <span class="st">"uhd"</span>, <span class="dt">phi =</span> <span class="dv">30</span>, <span class="dt">theta =</span> <span class="dv">30</span>)</a>
<a class="sourceLine" id="cb1-13" title="13"><span class="st"> </span><span class="kw"><a href="../reference/build_bricks.html">build_bricks</a></span>()</a>
<a class="sourceLine" id="cb1-14" title="14"></a>
<a class="sourceLine" id="cb1-15" title="15">rayshader<span class="op">::</span><span class="kw"><a href="https://www.rdocumentation.org/packages/rayshader/topics/render_snapshot">render_snapshot</a></span>(<span class="dt">clear =</span> <span class="ot">TRUE</span>)</a></code></pre></div>
<a class="sourceLine" id="cb1-15" title="15">rgl<span class="op">::</span><span class="kw"><a href="https://rdrr.io/pkg/rgl/man/par3d.html">par3d</a></span>(<span class="dt">userMatrix =</span> rgl<span class="op">::</span><span class="kw"><a href="https://rdrr.io/pkg/rgl/man/matrices.html">rotate3d</a></span>(rgl<span class="op">::</span><span class="kw"><a href="https://rdrr.io/pkg/rgl/man/par3d.html">par3d</a></span>(<span class="st">"userMatrix"</span>), <span class="fl">1.1</span><span class="op">*</span>pi<span class="op">/</span><span class="dv">4</span>, <span class="dv">0</span>, <span class="dv">0</span> ,<span class="dv">1</span>))</a></code></pre></div>
<p><img src="models-from-program_files/figure-html/bricks_6-1.png" width="384"></p>
<p>Using the same logic, we can build a sphere with a specified radius, and then apply rules to color each brick based on its coordinates.</p>
<div class="sourceCode" id="cb2"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb2-1" title="1">radius &lt;-<span class="st"> </span><span class="dv">4</span></a>
<a class="sourceLine" id="cb2-2" title="2">sphere_coords &lt;-<span class="st"> </span><span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/expand.grid">expand.grid</a></span>(</a>
<a class="sourceLine" id="cb2-3" title="3"> <span class="dt">x =</span> <span class="dv">1</span><span class="op">:</span><span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/Round">round</a></span>((radius<span class="op">*</span><span class="fl">2.5</span>)),</a>
<a class="sourceLine" id="cb2-4" title="4"> <span class="dt">y =</span> <span class="dv">1</span><span class="op">:</span><span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/Round">round</a></span>((radius<span class="op">*</span><span class="fl">2.5</span>)),</a>
<a class="sourceLine" id="cb2-5" title="5"> <span class="dt">z =</span> <span class="dv">1</span><span class="op">:</span><span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/Round">round</a></span>((radius<span class="op">/</span>(<span class="dv">6</span><span class="op">/</span><span class="dv">5</span>)<span class="op">*</span><span class="fl">2.5</span>)) <span class="co">#A brick is 6/5 taller than it is wide/deep</span></a>
<a class="sourceLine" id="cb2-2" title="2">sphere_coords &lt;-<span class="st"> </span><span class="kw"><a href="https://rdrr.io/r/base/expand.grid.html">expand.grid</a></span>(</a>
<a class="sourceLine" id="cb2-3" title="3"> <span class="dt">x =</span> <span class="dv">1</span><span class="op">:</span><span class="kw"><a href="https://rdrr.io/r/base/Round.html">round</a></span>((radius<span class="op">*</span><span class="fl">2.5</span>)),</a>
<a class="sourceLine" id="cb2-4" title="4"> <span class="dt">y =</span> <span class="dv">1</span><span class="op">:</span><span class="kw"><a href="https://rdrr.io/r/base/Round.html">round</a></span>((radius<span class="op">*</span><span class="fl">2.5</span>)),</a>
<a class="sourceLine" id="cb2-5" title="5"> <span class="dt">z =</span> <span class="dv">1</span><span class="op">:</span><span class="kw"><a href="https://rdrr.io/r/base/Round.html">round</a></span>((radius<span class="op">/</span>(<span class="dv">6</span><span class="op">/</span><span class="dv">5</span>)<span class="op">*</span><span class="fl">2.5</span>)) <span class="co">#A brick is 6/5 taller than it is wide/deep</span></a>
<a class="sourceLine" id="cb2-6" title="6">) <span class="op">%&gt;%</span></a>
<a class="sourceLine" id="cb2-7" title="7"><span class="st"> </span>dplyr<span class="op">::</span><span class="kw"><a href="https://dplyr.tidyverse.org/reference/mutate.html">mutate</a></span>(</a>
<a class="sourceLine" id="cb2-8" title="8"> <span class="co">#Distance of each coordinate from center</span></a>
<a class="sourceLine" id="cb2-9" title="9"> <span class="dt">dist =</span> (((x<span class="op">-</span><span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/mean">mean</a></span>(x))<span class="op">^</span><span class="dv">2</span> <span class="op">+</span><span class="st"> </span>(y<span class="op">-</span><span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/mean">mean</a></span>(y))<span class="op">^</span><span class="dv">2</span> <span class="op">+</span><span class="st"> </span>(z<span class="op">-</span><span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/mean">mean</a></span>(z))<span class="op">^</span><span class="dv">2</span>)<span class="op">^</span>(<span class="dv">1</span><span class="op">/</span><span class="dv">2</span>)),</a>
<a class="sourceLine" id="cb2-9" title="9"> <span class="dt">dist =</span> (((x<span class="op">-</span><span class="kw"><a href="https://rdrr.io/r/base/mean.html">mean</a></span>(x))<span class="op">^</span><span class="dv">2</span> <span class="op">+</span><span class="st"> </span>(y<span class="op">-</span><span class="kw"><a href="https://rdrr.io/r/base/mean.html">mean</a></span>(y))<span class="op">^</span><span class="dv">2</span> <span class="op">+</span><span class="st"> </span>(z<span class="op">-</span><span class="kw"><a href="https://rdrr.io/r/base/mean.html">mean</a></span>(z))<span class="op">^</span><span class="dv">2</span>)<span class="op">^</span>(<span class="dv">1</span><span class="op">/</span><span class="dv">2</span>)),</a>
<a class="sourceLine" id="cb2-10" title="10"> <span class="dt">Color =</span> dplyr<span class="op">::</span><span class="kw"><a href="https://dplyr.tidyverse.org/reference/case_when.html">case_when</a></span>(</a>
<a class="sourceLine" id="cb2-11" title="11"> <span class="co">#Yellow stripes on the surface with a 2to4 thickness</span></a>
<a class="sourceLine" id="cb2-12" title="12"> dplyr<span class="op">::</span><span class="kw"><a href="https://dplyr.tidyverse.org/reference/between.html">between</a></span>(dist, (radius<span class="dv">-1</span>), radius) <span class="op">&amp;</span><span class="st"> </span>(x<span class="op">+</span>y<span class="op">+</span>z) <span class="op">%%</span><span class="st"> </span><span class="dv">6</span> <span class="op">%in%</span><span class="st"> </span><span class="dv">0</span><span class="op">:</span><span class="dv">1</span> <span class="op">~</span><span class="st"> "Bright yellow"</span>,</a>
@@ -155,55 +157,57 @@
<a class="sourceLine" id="cb2-16" title="16"></a>
<a class="sourceLine" id="cb2-17" title="17">sphere_coords <span class="op">%&gt;%</span><span class="st"> </span></a>
<a class="sourceLine" id="cb2-18" title="18"><span class="st"> </span><span class="kw"><a href="../reference/bricks_from_coords.html">bricks_from_coords</a></span>() <span class="op">%&gt;%</span><span class="st"> </span></a>
<a class="sourceLine" id="cb2-19" title="19"><span class="st"> </span><span class="kw"><a href="../reference/build_bricks.html">build_bricks</a></span>(<span class="dt">brick_res =</span> <span class="st">"uhd"</span>, <span class="dt">phi =</span> <span class="dv">30</span>, <span class="dt">theta =</span> <span class="dv">30</span>)</a>
<a class="sourceLine" id="cb2-19" title="19"><span class="st"> </span><span class="kw"><a href="../reference/build_bricks.html">build_bricks</a></span>(<span class="dt">rgl_lit =</span> <span class="ot">FALSE</span>, <span class="dt">outline_bricks =</span> <span class="ot">TRUE</span>)</a>
<a class="sourceLine" id="cb2-20" title="20"></a>
<a class="sourceLine" id="cb2-21" title="21">rayshader<span class="op">::</span><span class="kw"><a href="https://www.rdocumentation.org/packages/rayshader/topics/render_snapshot">render_snapshot</a></span>(<span class="dt">clear =</span> <span class="ot">TRUE</span>)</a></code></pre></div>
<a class="sourceLine" id="cb2-21" title="21">rgl<span class="op">::</span><span class="kw"><a href="https://rdrr.io/pkg/rgl/man/par3d.html">par3d</a></span>(<span class="dt">userMatrix =</span> rgl<span class="op">::</span><span class="kw"><a href="https://rdrr.io/pkg/rgl/man/matrices.html">rotate3d</a></span>(rgl<span class="op">::</span><span class="kw"><a href="https://rdrr.io/pkg/rgl/man/par3d.html">par3d</a></span>(<span class="st">"userMatrix"</span>), <span class="fl">1.1</span><span class="op">*</span>pi<span class="op">/</span><span class="dv">4</span>, <span class="dv">0</span>, <span class="dv">0</span> ,<span class="dv">1</span>))</a></code></pre></div>
<p><img src="models-from-program_files/figure-html/bricks_7-1.png" width="384"></p>
<p>The option <code>outline_bricks = TRUE</code> adds a black outline around the edges of the bricks. Setting <code>rgl_lit = FALSE</code> turns off automated lighting effects from rgl. Changing these two inputs together renders bricks in a more cartoon fashion.</p>
</div>
<div id="it-takes-a-village" class="section level2">
<h2 class="hasAnchor">
<a href="#it-takes-a-village" class="anchor"></a>It takes a village</h2>
<p>Rather than directly writing a data frame for a model, you can write a function that returns a data frame with x, y, z, and Color coordinates given initial starting parameters.</p>
<p>Below, the function <code>brick_house()</code> creates a LEGO house with randomized colors. The x- and y-coordinates and the size of the house are inputs to the functions.</p>
<div class="sourceCode" id="cb3"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb3-1" title="1">brick_house &lt;-<span class="st"> </span><span class="cf">function</span>(<span class="dt">x_coord =</span> <span class="dv">0</span>, <span class="dt">y_coord =</span> <span class="dv">0</span>, <span class="dt">width=</span><span class="dv">6</span>, <span class="dt">length=</span><span class="dv">5</span>, <span class="dt">height=</span><span class="dv">6</span>){</a>
<a class="sourceLine" id="cb3-2" title="2"> roof_colors &lt;-<span class="st"> </span><span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/c">c</a></span>(<span class="st">"Dark orange"</span>, <span class="st">"Dark brown"</span>, <span class="st">"Medium nougat"</span>, <span class="st">"Medium stone grey"</span>)</a>
<a class="sourceLine" id="cb3-3" title="3"> roof_col &lt;-<span class="st"> </span><span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/sample">sample</a></span>(roof_colors, <span class="dv">1</span>)</a>
<div class="sourceCode" id="cb3"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb3-1" title="1">brick_house &lt;-<span class="st"> </span><span class="cf">function</span>(<span class="dt">x_coord =</span> <span class="dv">0</span>, <span class="dt">y_coord =</span> <span class="dv">0</span>, <span class="dt">width=</span><span class="dv">6</span>, <span class="dt">length=</span><span class="dv">5</span>, <span class="dt">height=</span><span class="dv">7</span>){</a>
<a class="sourceLine" id="cb3-2" title="2"> roof_colors &lt;-<span class="st"> </span><span class="kw"><a href="https://rdrr.io/r/base/c.html">c</a></span>(<span class="st">"Dark orange"</span>, <span class="st">"Dark brown"</span>, <span class="st">"Medium nougat"</span>, <span class="st">"Medium stone grey"</span>)</a>
<a class="sourceLine" id="cb3-3" title="3"> roof_col &lt;-<span class="st"> </span><span class="kw"><a href="https://rdrr.io/r/base/sample.html">sample</a></span>(roof_colors, <span class="dv">1</span>)</a>
<a class="sourceLine" id="cb3-4" title="4"> </a>
<a class="sourceLine" id="cb3-5" title="5"> house_colors &lt;-<span class="st"> </span><span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/c">c</a></span>(<span class="st">"Bright blue"</span>, <span class="st">"Bright red"</span>, <span class="st">"Dark red"</span>, <span class="st">"Dark azur"</span>, <span class="st">"Nougat"</span>, <span class="st">"Bright reddish violet"</span>)</a>
<a class="sourceLine" id="cb3-6" title="6"> house_col &lt;-<span class="st"> </span><span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/sample">sample</a></span>(house_colors, <span class="dv">1</span>)</a>
<a class="sourceLine" id="cb3-5" title="5"> house_colors &lt;-<span class="st"> </span><span class="kw"><a href="https://rdrr.io/r/base/c.html">c</a></span>(<span class="st">"Bright blue"</span>, <span class="st">"Bright red"</span>, <span class="st">"Dark red"</span>, <span class="st">"Dark azur"</span>, <span class="st">"Nougat"</span>, <span class="st">"Bright reddish violet"</span>)</a>
<a class="sourceLine" id="cb3-6" title="6"> house_col &lt;-<span class="st"> </span><span class="kw"><a href="https://rdrr.io/r/base/sample.html">sample</a></span>(house_colors, <span class="dv">1</span>)</a>
<a class="sourceLine" id="cb3-7" title="7"> </a>
<a class="sourceLine" id="cb3-8" title="8"> house_coords &lt;-<span class="st"> </span><span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/expand.grid">expand.grid</a></span>(</a>
<a class="sourceLine" id="cb3-8" title="8"> house_coords &lt;-<span class="st"> </span><span class="kw"><a href="https://rdrr.io/r/base/expand.grid.html">expand.grid</a></span>(</a>
<a class="sourceLine" id="cb3-9" title="9"> <span class="dt">x =</span> <span class="dv">1</span><span class="op">:</span>width, <span class="dt">y =</span> <span class="dv">1</span><span class="op">:</span>length, <span class="dt">z =</span> (<span class="dv">1</span><span class="op">:</span>height)<span class="op">+</span><span class="dv">1</span></a>
<a class="sourceLine" id="cb3-10" title="10"> ) <span class="op">%&gt;%</span><span class="st"> </span></a>
<a class="sourceLine" id="cb3-11" title="11"><span class="st"> </span>dplyr<span class="op">::</span><span class="kw"><a href="https://dplyr.tidyverse.org/reference/mutate.html">mutate</a></span>(</a>
<a class="sourceLine" id="cb3-12" title="12"> <span class="dt">roof =</span> (z <span class="op">&gt;</span><span class="st"> </span><span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/Round">round</a></span>((<span class="dv">1</span><span class="op">/</span><span class="dv">2</span>)<span class="op">*</span>height)),</a>
<a class="sourceLine" id="cb3-12" title="12"> <span class="dt">roof =</span> (z <span class="op">&gt;</span><span class="st"> </span><span class="kw"><a href="https://rdrr.io/r/base/Round.html">round</a></span>((<span class="dv">1</span><span class="op">/</span><span class="dv">2</span>)<span class="op">*</span>height)),</a>
<a class="sourceLine" id="cb3-13" title="13"> <span class="dt">Color =</span> dplyr<span class="op">::</span><span class="kw"><a href="https://dplyr.tidyverse.org/reference/case_when.html">case_when</a></span>(</a>
<a class="sourceLine" id="cb3-14" title="14"> <span class="co">#Roof</span></a>
<a class="sourceLine" id="cb3-15" title="15"> roof <span class="op">&amp;</span><span class="st"> </span>(<span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/MathFun">abs</a></span>(y <span class="op">-</span><span class="st"> </span><span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/Round">floor</a></span>(length<span class="op">/</span><span class="dv">2</span>) <span class="dv">-1</span>) <span class="op">&lt;=</span><span class="st"> </span>(height<span class="op">-</span>z)) <span class="op">~</span><span class="st"> </span>roof_col,</a>
<a class="sourceLine" id="cb3-15" title="15"> roof <span class="op">&amp;</span><span class="st"> </span>(<span class="kw"><a href="https://rdrr.io/r/base/MathFun.html">abs</a></span>(y <span class="op">-</span><span class="st"> </span><span class="kw"><a href="https://rdrr.io/r/base/Round.html">floor</a></span>(length<span class="op">/</span><span class="dv">2</span>) <span class="dv">-1</span>) <span class="op">&lt;=</span><span class="st"> </span>(height<span class="op">-</span>z)) <span class="op">~</span><span class="st"> </span>roof_col,</a>
<a class="sourceLine" id="cb3-16" title="16"> roof <span class="op">~</span><span class="st"> </span><span class="ot">NA_character_</span>,</a>
<a class="sourceLine" id="cb3-17" title="17"> <span class="co">#Door and windows</span></a>
<a class="sourceLine" id="cb3-18" title="18"> x <span class="op">==</span><span class="st"> </span><span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/Round">round</a></span>(width<span class="op">/</span><span class="dv">2</span>) <span class="op">&amp;</span><span class="st"> </span>z <span class="op">==</span><span class="st"> </span><span class="dv">1</span> <span class="op">~</span><span class="st"> </span><span class="ot">NA_character_</span>,</a>
<a class="sourceLine" id="cb3-19" title="19"> dplyr<span class="op">::</span><span class="kw"><a href="https://dplyr.tidyverse.org/reference/between.html">between</a></span>(x, <span class="dv">2</span>, width<span class="dv">-1</span>) <span class="op">&amp;</span><span class="st"> </span>x <span class="op">%%</span><span class="st"> </span><span class="dv">2</span> <span class="op">==</span><span class="st"> </span><span class="dv">0</span> <span class="op">&amp;</span><span class="st"> </span>y <span class="op">&gt;</span><span class="st"> </span><span class="dv">1</span> <span class="op">&amp;</span><span class="st"> </span>z <span class="op">==</span><span class="st"> </span><span class="dv">2</span> <span class="op">~</span><span class="st"> </span><span class="ot">NA_character_</span>,</a>
<a class="sourceLine" id="cb3-20" title="20"> dplyr<span class="op">::</span><span class="kw"><a href="https://dplyr.tidyverse.org/reference/between.html">between</a></span>(y, <span class="dv">2</span>, length<span class="dv">-1</span>) <span class="op">&amp;</span><span class="st"> </span>y <span class="op">%%</span><span class="st"> </span><span class="dv">2</span> <span class="op">==</span><span class="st"> </span><span class="dv">0</span> <span class="op">&amp;</span><span class="st"> </span>z <span class="op">==</span><span class="st"> </span><span class="dv">2</span> <span class="op">~</span><span class="st"> </span><span class="ot">NA_character_</span>,</a>
<a class="sourceLine" id="cb3-21" title="21"> x <span class="op">%in%</span><span class="st"> </span><span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/c">c</a></span>(<span class="dv">1</span>, width) <span class="op">|</span><span class="st"> </span>y <span class="op">%in%</span><span class="st"> </span><span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/c">c</a></span>(<span class="dv">1</span>, length) <span class="op">~</span><span class="st"> </span>house_col),</a>
<a class="sourceLine" id="cb3-18" title="18"> x <span class="op">==</span><span class="st"> </span><span class="kw"><a href="https://rdrr.io/r/base/Round.html">round</a></span>(width<span class="op">/</span><span class="dv">2</span>) <span class="op">&amp;</span><span class="st"> </span>y<span class="op">==</span><span class="dv">1</span> <span class="op">&amp;</span><span class="st"> </span>z <span class="op">&lt;=</span><span class="st"> </span><span class="dv">3</span> <span class="op">~</span><span class="st"> </span><span class="ot">NA_character_</span>,</a>
<a class="sourceLine" id="cb3-19" title="19"> dplyr<span class="op">::</span><span class="kw"><a href="https://dplyr.tidyverse.org/reference/between.html">between</a></span>(x, <span class="dv">2</span>, width<span class="dv">-1</span>) <span class="op">&amp;</span><span class="st"> </span>x <span class="op">%%</span><span class="st"> </span><span class="dv">2</span> <span class="op">==</span><span class="st"> </span><span class="dv">0</span> <span class="op">&amp;</span><span class="st"> </span>y <span class="op">&gt;</span><span class="st"> </span><span class="dv">1</span> <span class="op">&amp;</span><span class="st"> </span>z <span class="op">==</span><span class="st"> </span><span class="dv">3</span> <span class="op">~</span><span class="st"> </span><span class="ot">NA_character_</span>,</a>
<a class="sourceLine" id="cb3-20" title="20"> dplyr<span class="op">::</span><span class="kw"><a href="https://dplyr.tidyverse.org/reference/between.html">between</a></span>(y, <span class="dv">2</span>, length<span class="dv">-1</span>) <span class="op">&amp;</span><span class="st"> </span>y <span class="op">%%</span><span class="st"> </span><span class="dv">2</span> <span class="op">==</span><span class="st"> </span><span class="dv">0</span> <span class="op">&amp;</span><span class="st"> </span>z <span class="op">==</span><span class="st"> </span><span class="dv">3</span> <span class="op">~</span><span class="st"> </span><span class="ot">NA_character_</span>,</a>
<a class="sourceLine" id="cb3-21" title="21"> x <span class="op">%in%</span><span class="st"> </span><span class="kw"><a href="https://rdrr.io/r/base/c.html">c</a></span>(<span class="dv">1</span>, width) <span class="op">|</span><span class="st"> </span>y <span class="op">%in%</span><span class="st"> </span><span class="kw"><a href="https://rdrr.io/r/base/c.html">c</a></span>(<span class="dv">1</span>, length) <span class="op">~</span><span class="st"> </span>house_col),</a>
<a class="sourceLine" id="cb3-22" title="22"> <span class="dt">x =</span> x<span class="op">+</span>x_coord, </a>
<a class="sourceLine" id="cb3-23" title="23"> <span class="dt">y =</span> y<span class="op">+</span>y_coord</a>
<a class="sourceLine" id="cb3-24" title="24"> )</a>
<a class="sourceLine" id="cb3-25" title="25"> <span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/function">return</a></span>(house_coords)</a>
<a class="sourceLine" id="cb3-25" title="25"> <span class="kw"><a href="https://rdrr.io/r/base/function.html">return</a></span>(house_coords)</a>
<a class="sourceLine" id="cb3-26" title="26">}</a>
<a class="sourceLine" id="cb3-27" title="27"></a>
<a class="sourceLine" id="cb3-28" title="28"><span class="co">#Build one house</span></a>
<a class="sourceLine" id="cb3-29" title="29"><span class="kw">brick_house</span>() <span class="op">%&gt;%</span><span class="st"> </span></a>
<a class="sourceLine" id="cb3-30" title="30"><span class="st"> </span><span class="kw"><a href="../reference/bricks_from_coords.html">bricks_from_coords</a></span>() <span class="op">%&gt;%</span><span class="st"> </span></a>
<a class="sourceLine" id="cb3-31" title="31"><span class="st"> </span><span class="kw"><a href="../reference/build_bricks.html">build_bricks</a></span>(<span class="dt">theta =</span> <span class="dv">225</span>)</a>
<a class="sourceLine" id="cb3-32" title="32">rayshader<span class="op">::</span><span class="kw"><a href="https://www.rdocumentation.org/packages/rayshader/topics/render_snapshot">render_snapshot</a></span>(<span class="dt">clear =</span> <span class="ot">TRUE</span>)</a></code></pre></div>
<a class="sourceLine" id="cb3-31" title="31"><span class="st"> </span><span class="kw"><a href="../reference/build_bricks.html">build_bricks</a></span>()</a>
<a class="sourceLine" id="cb3-32" title="32"></a>
<a class="sourceLine" id="cb3-33" title="33">rgl<span class="op">::</span><span class="kw"><a href="https://rdrr.io/pkg/rgl/man/par3d.html">par3d</a></span>(<span class="dt">userMatrix =</span> rgl<span class="op">::</span><span class="kw"><a href="https://rdrr.io/pkg/rgl/man/matrices.html">rotate3d</a></span>(rgl<span class="op">::</span><span class="kw"><a href="https://rdrr.io/pkg/rgl/man/par3d.html">par3d</a></span>(<span class="st">"userMatrix"</span>), <span class="fl">1.1</span><span class="op">*</span>pi<span class="op">/</span><span class="dv">4</span>, <span class="dv">0</span>, <span class="dv">0</span> ,<span class="dv">1</span>))</a></code></pre></div>
<p><img src="models-from-program_files/figure-html/bricks_8-1.png" width="384"></p>
<p>Next, we write one more function, <code>brick_street()</code> to build a road and grass foundation. The, for an arbitrary number of houses and neighborhood size, use <code><a href="https://purrr.tidyverse.org/reference/map2.html">purrr::pmap_df</a></code> to generate many houses and place them along the road.</p>
<div class="sourceCode" id="cb4"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb4-1" title="1">brick_street &lt;-<span class="st"> </span><span class="cf">function</span>(<span class="dt">width =</span> <span class="dv">100</span>, <span class="dt">length =</span> <span class="dv">40</span>){</a>
<a class="sourceLine" id="cb4-2" title="2"> <span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/expand.grid">expand.grid</a></span>(<span class="dt">x=</span><span class="dv">1</span><span class="op">:</span>width, <span class="dt">y=</span><span class="dv">1</span><span class="op">:</span>length, <span class="dt">z=</span><span class="dv">1</span>) <span class="op">%&gt;%</span><span class="st"> </span></a>
<a class="sourceLine" id="cb4-2" title="2"> <span class="kw"><a href="https://rdrr.io/r/base/expand.grid.html">expand.grid</a></span>(<span class="dt">x=</span><span class="dv">1</span><span class="op">:</span>width, <span class="dt">y=</span><span class="dv">1</span><span class="op">:</span>length, <span class="dt">z=</span><span class="dv">1</span>) <span class="op">%&gt;%</span><span class="st"> </span></a>
<a class="sourceLine" id="cb4-3" title="3"><span class="st"> </span>dplyr<span class="op">::</span><span class="kw"><a href="https://dplyr.tidyverse.org/reference/mutate.html">mutate</a></span>(</a>
<a class="sourceLine" id="cb4-4" title="4"> <span class="dt">Color =</span> dplyr<span class="op">::</span><span class="kw"><a href="https://dplyr.tidyverse.org/reference/case_when.html">case_when</a></span>(</a>
<a class="sourceLine" id="cb4-5" title="5"> y <span class="op">==</span><span class="st"> </span><span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/Round">round</a></span>(length<span class="op">/</span><span class="dv">2</span>) <span class="op">&amp;</span><span class="st"> </span>x <span class="op">%%</span><span class="st"> </span><span class="dv">4</span> <span class="op">%in%</span><span class="st"> </span><span class="dv">1</span><span class="op">:</span><span class="dv">4</span> <span class="op">~</span><span class="st"> "Bright yellow"</span>,</a>
<a class="sourceLine" id="cb4-5" title="5"> y <span class="op">==</span><span class="st"> </span><span class="kw"><a href="https://rdrr.io/r/base/Round.html">round</a></span>(length<span class="op">/</span><span class="dv">2</span>) <span class="op">&amp;</span><span class="st"> </span>x <span class="op">%%</span><span class="st"> </span><span class="dv">4</span> <span class="op">%in%</span><span class="st"> </span><span class="dv">1</span><span class="op">:</span><span class="dv">4</span> <span class="op">~</span><span class="st"> "Bright yellow"</span>,</a>
<a class="sourceLine" id="cb4-6" title="6"> dplyr<span class="op">::</span><span class="kw"><a href="https://dplyr.tidyverse.org/reference/between.html">between</a></span>(y, length<span class="op">/</span><span class="dv">2</span> <span class="dv">-5</span>, length<span class="op">/</span><span class="dv">2</span> <span class="op">+</span><span class="dv">5</span>) <span class="op">~</span><span class="st"> "Dark stone grey"</span>,</a>
<a class="sourceLine" id="cb4-7" title="7"> <span class="ot">TRUE</span> <span class="op">~</span><span class="st"> "Dark green"</span></a>
<a class="sourceLine" id="cb4-8" title="8"> ))</a>
@@ -211,27 +215,27 @@
<a class="sourceLine" id="cb4-10" title="10"></a>
<a class="sourceLine" id="cb4-11" title="11"><span class="co">#Build a village, houses on 2 sides of a street</span></a>
<a class="sourceLine" id="cb4-12" title="12">n_houses =<span class="st"> </span><span class="dv">14</span></a>
<a class="sourceLine" id="cb4-13" title="13">sz =<span class="st"> </span><span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/c">c</a></span>(<span class="dv">100</span>, <span class="dv">40</span>)</a>
<a class="sourceLine" id="cb4-13" title="13">sz =<span class="st"> </span><span class="kw"><a href="https://rdrr.io/r/base/c.html">c</a></span>(<span class="dv">100</span>, <span class="dv">40</span>)</a>
<a class="sourceLine" id="cb4-14" title="14"></a>
<a class="sourceLine" id="cb4-15" title="15"><span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/list">list</a></span>(<span class="dt">x_coord =</span> <span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/c">c</a></span>(<span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/sample">sample</a></span>(<span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/seq">seq</a></span>(<span class="dv">10</span>, sz[<span class="dv">1</span>]<span class="op">-</span><span class="dv">10</span>, <span class="dt">by =</span> <span class="dv">10</span>), n_houses<span class="op">/</span><span class="dv">2</span>),</a>
<a class="sourceLine" id="cb4-16" title="16"> <span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/sample">sample</a></span>(<span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/seq">seq</a></span>(<span class="dv">10</span>, sz[<span class="dv">1</span>]<span class="op">-</span><span class="dv">10</span>, <span class="dt">by =</span> <span class="dv">10</span>), n_houses<span class="op">/</span><span class="dv">2</span>)),</a>
<a class="sourceLine" id="cb4-17" title="17"> <span class="dt">y_coord =</span> <span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/c">c</a></span>(<span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/rep">rep</a></span>(sz[<span class="dv">2</span>]<span class="op">/</span><span class="dv">2-15</span>, n_houses<span class="op">/</span><span class="dv">2</span>), <span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/rep">rep</a></span>(sz[<span class="dv">2</span>]<span class="op">/</span><span class="dv">2</span><span class="op">+</span><span class="dv">10</span>, n_houses<span class="op">/</span><span class="dv">2</span>)),</a>
<a class="sourceLine" id="cb4-18" title="18"> <span class="dt">width =</span> <span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/sample">sample</a></span>(<span class="dv">4</span><span class="op">:</span><span class="dv">10</span>, n_houses, <span class="dt">replace =</span> <span class="ot">TRUE</span>),</a>
<a class="sourceLine" id="cb4-19" title="19"> <span class="dt">length =</span> <span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/sample">sample</a></span>(<span class="dv">4</span><span class="op">:</span><span class="dv">8</span>, n_houses, <span class="dt">replace =</span> <span class="ot">TRUE</span>),</a>
<a class="sourceLine" id="cb4-20" title="20"> <span class="dt">height =</span> <span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/sample">sample</a></span>(<span class="dv">5</span><span class="op">:</span><span class="dv">8</span>, n_houses, <span class="dt">replace =</span> <span class="ot">TRUE</span>)</a>
<a class="sourceLine" id="cb4-15" title="15"><span class="kw"><a href="https://rdrr.io/r/base/list.html">list</a></span>(<span class="dt">x_coord =</span> <span class="kw"><a href="https://rdrr.io/r/base/c.html">c</a></span>(<span class="kw"><a href="https://rdrr.io/r/base/sample.html">sample</a></span>(<span class="kw"><a href="https://rdrr.io/r/base/seq.html">seq</a></span>(<span class="dv">10</span>, sz[<span class="dv">1</span>]<span class="op">-</span><span class="dv">10</span>, <span class="dt">by =</span> <span class="dv">12</span>), n_houses<span class="op">/</span><span class="dv">2</span>),</a>
<a class="sourceLine" id="cb4-16" title="16"> <span class="kw"><a href="https://rdrr.io/r/base/sample.html">sample</a></span>(<span class="kw"><a href="https://rdrr.io/r/base/seq.html">seq</a></span>(<span class="dv">10</span>, sz[<span class="dv">1</span>]<span class="op">-</span><span class="dv">10</span>, <span class="dt">by =</span> <span class="dv">12</span>), n_houses<span class="op">/</span><span class="dv">2</span>)),</a>
<a class="sourceLine" id="cb4-17" title="17"> <span class="dt">y_coord =</span> <span class="kw"><a href="https://rdrr.io/r/base/c.html">c</a></span>(<span class="kw"><a href="https://rdrr.io/r/base/rep.html">rep</a></span>(sz[<span class="dv">2</span>]<span class="op">/</span><span class="dv">2-15</span>, n_houses<span class="op">/</span><span class="dv">2</span>), <span class="kw"><a href="https://rdrr.io/r/base/rep.html">rep</a></span>(sz[<span class="dv">2</span>]<span class="op">/</span><span class="dv">2</span><span class="op">+</span><span class="dv">10</span>, n_houses<span class="op">/</span><span class="dv">2</span>)),</a>
<a class="sourceLine" id="cb4-18" title="18"> <span class="dt">width =</span> <span class="kw"><a href="https://rdrr.io/r/base/sample.html">sample</a></span>(<span class="dv">4</span><span class="op">:</span><span class="dv">10</span>, n_houses, <span class="dt">replace =</span> <span class="ot">TRUE</span>),</a>
<a class="sourceLine" id="cb4-19" title="19"> <span class="dt">length =</span> <span class="kw"><a href="https://rdrr.io/r/base/sample.html">sample</a></span>(<span class="dv">5</span><span class="op">:</span><span class="dv">8</span>, n_houses, <span class="dt">replace =</span> <span class="ot">TRUE</span>),</a>
<a class="sourceLine" id="cb4-20" title="20"> <span class="dt">height =</span> <span class="kw"><a href="https://rdrr.io/r/base/sample.html">sample</a></span>(<span class="dv">7</span><span class="op">:</span><span class="dv">9</span>, n_houses, <span class="dt">replace =</span> <span class="ot">TRUE</span>)</a>
<a class="sourceLine" id="cb4-21" title="21"> ) <span class="op">%&gt;%</span><span class="st"> </span></a>
<a class="sourceLine" id="cb4-22" title="22"><span class="st"> </span>purrr<span class="op">::</span><span class="kw"><a href="https://purrr.tidyverse.org/reference/map2.html">pmap_df</a></span>(brick_house) <span class="op">%&gt;%</span><span class="st"> </span></a>
<a class="sourceLine" id="cb4-23" title="23"><span class="st"> </span>dplyr<span class="op">::</span><span class="kw"><a href="https://dplyr.tidyverse.org/reference/bind.html">bind_rows</a></span>(<span class="kw">brick_street</span>(sz[<span class="dv">1</span>], sz[<span class="dv">2</span>])) <span class="op">%&gt;%</span><span class="st"> </span></a>
<a class="sourceLine" id="cb4-24" title="24"><span class="st"> </span><span class="kw"><a href="../reference/bricks_from_coords.html">bricks_from_coords</a></span>() <span class="op">%&gt;%</span><span class="st"> </span></a>
<a class="sourceLine" id="cb4-25" title="25"><span class="st"> </span><span class="kw"><a href="../reference/build_bricks.html">build_bricks</a></span>()</a>
<a class="sourceLine" id="cb4-26" title="26"></a>
<a class="sourceLine" id="cb4-27" title="27">rayshader<span class="op">::</span><span class="kw"><a href="https://www.rdocumentation.org/packages/rayshader/topics/render_camera">render_camera</a></span>(<span class="dt">theta =</span> <span class="dv">60</span>, <span class="dt">phi =</span> <span class="dv">20</span>, <span class="dt">zoom =</span> <span class="fl">0.75</span>)</a>
<a class="sourceLine" id="cb4-28" title="28">rayshader<span class="op">::</span><span class="kw"><a href="https://www.rdocumentation.org/packages/rayshader/topics/render_snapshot">render_snapshot</a></span>(<span class="dt">clear =</span> <span class="ot">TRUE</span>)</a></code></pre></div>
<a class="sourceLine" id="cb4-27" title="27">rgl<span class="op">::</span><span class="kw"><a href="https://rdrr.io/pkg/rgl/man/par3d.html">par3d</a></span>(<span class="dt">userMatrix =</span> rgl<span class="op">::</span><span class="kw"><a href="https://rdrr.io/pkg/rgl/man/matrices.html">rotate3d</a></span>(rgl<span class="op">::</span><span class="kw"><a href="https://rdrr.io/pkg/rgl/man/par3d.html">par3d</a></span>(<span class="st">"userMatrix"</span>), <span class="fl">1.1</span><span class="op">*</span>pi<span class="op">/</span><span class="dv">4</span>, pi<span class="op">/</span><span class="dv">4</span>, <span class="dv">0</span> ,<span class="dv">1</span>))</a></code></pre></div>
<p><img src="models-from-program_files/figure-html/bricks_9-1.png" width="384"></p>
</div>
</div>
<div class="col-md-3 hidden-xs hidden-sm" id="sidebar">
<div id="tocnav">
<h2 class="hasAnchor">
<a href="#tocnav" class="anchor"></a>Contents</h2>
@@ -246,17 +250,20 @@
</div>
<footer><div class="copyright">
<p>Developed by Ryan Timpe.</p>
</div>
<div class="pkgdown">
<p>Site built with <a href="https://pkgdown.r-lib.org/">pkgdown</a> 1.3.0.</p>
<p>Site built with <a href="https://pkgdown.r-lib.org/">pkgdown</a> 1.4.1.</p>
</div>
</footer>
</div>
</body>
</html>
Binary file not shown.

Before

Width:  |  Height:  |  Size: 162 KiB

After

Width:  |  Height:  |  Size: 49 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 80 KiB

After

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 121 KiB

After

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 155 KiB

After

Width:  |  Height:  |  Size: 62 KiB

+26 -19
View File
@@ -13,8 +13,9 @@
<link rel="apple-touch-icon" type="image/png" sizes="76x76" href="../apple-touch-icon-76x76.png">
<link rel="apple-touch-icon" type="image/png" sizes="60x60" href="../apple-touch-icon-60x60.png">
<!-- jquery --><script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js" integrity="sha256-FgpCb/KJQlLNfOu91ta32o/NMZxltwRo8QtmkMRdAu8=" crossorigin="anonymous"></script><!-- Bootstrap --><link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha256-916EbMg70RQy9LHiGkXzG8hSg9EdNy97GazNG/aiY1w=" crossorigin="anonymous">
<script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha256-U5ZEeKfGNOja007MMD3YBI0A3OSZOQbeG6z2f2Y0hu8=" crossorigin="anonymous"></script><!-- Font Awesome icons --><link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css" integrity="sha256-eZrrJcwDc/3uDhsdt61sL2oOBY362qM3lon1gyExkL0=" crossorigin="anonymous">
<!-- clipboard.js --><script src="https://cdnjs.cloudflare.com/ajax/libs/clipboard.js/2.0.4/clipboard.min.js" integrity="sha256-FiZwavyI2V6+EXO1U+xzLG3IKldpiTFf3153ea9zikQ=" crossorigin="anonymous"></script><!-- sticky kit --><script src="https://cdnjs.cloudflare.com/ajax/libs/sticky-kit/1.1.3/sticky-kit.min.js" integrity="sha256-c4Rlo1ZozqTPE2RLuvbusY3+SU1pQaJC0TjuhygMipw=" crossorigin="anonymous"></script><!-- pkgdown --><link href="../pkgdown.css" rel="stylesheet">
<script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha256-U5ZEeKfGNOja007MMD3YBI0A3OSZOQbeG6z2f2Y0hu8=" crossorigin="anonymous"></script><!-- Font Awesome icons --><link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.7.1/css/all.min.css" integrity="sha256-nAmazAk6vS34Xqo0BSrTb+abbtFlgsFK7NKSi6o7Y78=" crossorigin="anonymous">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.7.1/css/v4-shims.min.css" integrity="sha256-6qHlizsOWFskGlwVOKuns+D1nB6ssZrHQrNj1wGplHc=" crossorigin="anonymous">
<!-- clipboard.js --><script src="https://cdnjs.cloudflare.com/ajax/libs/clipboard.js/2.0.4/clipboard.min.js" integrity="sha256-FiZwavyI2V6+EXO1U+xzLG3IKldpiTFf3153ea9zikQ=" crossorigin="anonymous"></script><!-- headroom.js --><script src="https://cdnjs.cloudflare.com/ajax/libs/headroom/0.9.4/headroom.min.js" integrity="sha256-DJFC1kqIhelURkuza0AvYal5RxMtpzLjFhsnVIeuk+U=" crossorigin="anonymous"></script><script src="https://cdnjs.cloudflare.com/ajax/libs/headroom/0.9.4/jQuery.headroom.min.js" integrity="sha256-ZX/yNShbjqsohH1k95liqY9Gd8uOiE1S4vZc+9KQ1K4=" crossorigin="anonymous"></script><!-- pkgdown --><link href="../pkgdown.css" rel="stylesheet">
<script src="../pkgdown.js"></script><link href="../extra.css" rel="stylesheet">
<meta property="og:title" content="3D models from tables">
<meta property="og:description" content="">
@@ -38,7 +39,7 @@
</button>
<span class="navbar-brand">
<a class="navbar-link" href="../index.html">brickr</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.1.0.9024</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.2.0</span>
</span>
</div>
@@ -46,7 +47,7 @@
<ul class="nav navbar-nav">
<li>
<a href="../index.html">
<span class="fa fa-home fa-lg"></span>
<span class="fas fa fas fa-home fa-lg"></span>
</a>
</li>
@@ -84,7 +85,7 @@
<ul class="nav navbar-nav navbar-right">
<li>
<a href="https://github.com/ryantimpe/brickr">
<span class="fa fa-github fa-lg"></span>
<span class="fab fa fab fa-github fa-lg"></span>
</a>
</li>
@@ -97,6 +98,7 @@
<!--/.navbar -->
</header><div class="row">
<div class="col-md-9 contents">
<div class="page-header toc-ignore">
@@ -113,8 +115,8 @@
<div id="getting-started" class="section level2">
<h2 class="hasAnchor">
<a href="#getting-started" class="anchor"></a>Getting started</h2>
<p>The <code>bricks_from_*</code> series of functions creates 3D models of LEGO bricks from a variety of input formats. These models are rendered using <a href="https://twitter.com/tylermorganwall">Tyler Morgan-Wall</a>s <a href="https://www.rayshader.com/">rayshader</a> package. This package must be installed.</p>
<p><code><a href="../reference/bricks_from_table.html">bricks_from_table()</a></code> converts a matrix-shaped table of integers into LEGO bricks, where most columns are x-coordinates, rows are y-coordinates, and a special <code>Level</code> column denotes the elevation of the row. For simple models, this table can be made manually using <code><a href="https://www.rdocumentation.org/packages/base/topics/data.frame">data.frame()</a></code> or <code><a href="https://tibble.tidyverse.org/reference/tribble.html">tibble::tribble()</a></code>.</p>
<p>The <code>bricks_from_*</code> series of functions creates 3D models of LEGO bricks from a variety of input formats.</p>
<p><code><a href="../reference/bricks_from_table.html">bricks_from_table()</a></code> converts a matrix-shaped table of integers into LEGO bricks, where most columns are x-coordinates, rows are y-coordinates, and a special <code>Level</code> column denotes the elevation of the row. For simple models, this table can be made manually using <code><a href="https://rdrr.io/r/base/data.frame.html">data.frame()</a></code> or <code><a href="https://tibble.tidyverse.org/reference/tribble.html">tibble::tribble()</a></code>.</p>
<p>For more advanced models, its recommended you use MS Excel or a .csv file. <code><a href="../reference/bricks_from_excel.html">bricks_from_excel()</a></code> is a wrapper function to more easily build models designed using a Microsoft Excel template. Please see this repo: <a href="https://github.com/ryantimpe/brickr_toybox">brickr toybox</a>.</p>
<p>Pass the output of any <code>bricks_from_*()</code> function to <code><a href="../reference/build_bricks.html">build_bricks()</a></code> to render it as a 3D model.</p>
</div>
@@ -123,10 +125,10 @@
<a href="#individual-bricks" class="anchor"></a>Individual bricks</h2>
<p>Create a single 2x4 brick with a 2x4 data frame, with an additional column to specify the Level. These can be letters or numbers.</p>
<div class="sourceCode" id="cb1"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb1-1" title="1"><span class="co">#This is a 2 (columns) x 4 (rows) brick</span></a>
<a class="sourceLine" id="cb1-2" title="2">(brick &lt;-<span class="st"> </span><span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/data.frame">data.frame</a></span>(</a>
<a class="sourceLine" id="cb1-2" title="2">(brick &lt;-<span class="st"> </span><span class="kw"><a href="https://rdrr.io/r/base/data.frame.html">data.frame</a></span>(</a>
<a class="sourceLine" id="cb1-3" title="3"> <span class="dt">Level=</span><span class="st">"A"</span>,</a>
<a class="sourceLine" id="cb1-4" title="4"> <span class="dt">X1 =</span> <span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/rep">rep</a></span>(<span class="dv">3</span>,<span class="dv">4</span>), <span class="co">#The number 3 is the brickrID for 'bright red'</span></a>
<a class="sourceLine" id="cb1-5" title="5"> <span class="dt">X2 =</span> <span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/rep">rep</a></span>(<span class="dv">3</span>,<span class="dv">4</span>)</a>
<a class="sourceLine" id="cb1-4" title="4"> <span class="dt">X1 =</span> <span class="kw"><a href="https://rdrr.io/r/base/rep.html">rep</a></span>(<span class="dv">3</span>,<span class="dv">4</span>), <span class="co">#The number 3 is the brickrID for 'bright red'</span></a>
<a class="sourceLine" id="cb1-5" title="5"> <span class="dt">X2 =</span> <span class="kw"><a href="https://rdrr.io/r/base/rep.html">rep</a></span>(<span class="dv">3</span>,<span class="dv">4</span>)</a>
<a class="sourceLine" id="cb1-6" title="6">))</a>
<a class="sourceLine" id="cb1-7" title="7"><span class="co">#&gt; Level X1 X2</span></a>
<a class="sourceLine" id="cb1-8" title="8"><span class="co">#&gt; 1 A 3 3</span></a>
@@ -136,9 +138,9 @@
<a class="sourceLine" id="cb1-12" title="12"></a>
<a class="sourceLine" id="cb1-13" title="13">brick <span class="op">%&gt;%</span><span class="st"> </span></a>
<a class="sourceLine" id="cb1-14" title="14"><span class="st"> </span><span class="kw"><a href="../reference/bricks_from_table.html">bricks_from_table</a></span>() <span class="op">%&gt;%</span><span class="st"> </span></a>
<a class="sourceLine" id="cb1-15" title="15"><span class="st"> </span><span class="kw"><a href="../reference/build_bricks.html">build_bricks</a></span>(<span class="dt">brick_res =</span> <span class="st">"hd"</span>) <span class="co">#Bricks available in standard def, high def, and ultra hd. </span></a>
<a class="sourceLine" id="cb1-15" title="15"><span class="st"> </span><span class="kw"><a href="../reference/build_bricks.html">build_bricks</a></span>() </a>
<a class="sourceLine" id="cb1-16" title="16"></a>
<a class="sourceLine" id="cb1-17" title="17">rayshader<span class="op">::</span><span class="kw"><a href="https://www.rdocumentation.org/packages/rayshader/topics/render_snapshot">render_snapshot</a></span>( <span class="dt">clear =</span> <span class="ot">TRUE</span>)</a></code></pre></div>
<a class="sourceLine" id="cb1-17" title="17">rgl<span class="op">::</span><span class="kw"><a href="https://rdrr.io/pkg/rgl/man/par3d.html">par3d</a></span>(<span class="dt">userMatrix =</span> rgl<span class="op">::</span><span class="kw"><a href="https://rdrr.io/pkg/rgl/man/matrices.html">rotate3d</a></span>(rgl<span class="op">::</span><span class="kw"><a href="https://rdrr.io/pkg/rgl/man/par3d.html">par3d</a></span>(<span class="st">"userMatrix"</span>), <span class="fl">1.1</span><span class="op">*</span>pi<span class="op">/</span><span class="dv">4</span>, <span class="dv">0</span>, <span class="dv">0</span> ,<span class="dv">1</span>))</a></code></pre></div>
<p><img src="models-from-tables_files/figure-html/bricks_1-1.png" width="288"></p>
<p>Stack many bricks by changing the Level value in the data frame. The script below uses <code><a href="https://purrr.tidyverse.org/reference/map.html">purrr::map_df()</a></code> to avoid copying and pasting. Changing the numeric values inside the data frame for each level creates different colors.</p>
<div class="sourceCode" id="cb2"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb2-1" title="1"><span class="dv">1</span><span class="op">:</span><span class="dv">10</span> <span class="op">%&gt;%</span><span class="st"> </span></a>
@@ -147,9 +149,9 @@
<a class="sourceLine" id="cb2-4" title="4"> <span class="dt">X1 =</span> .x,</a>
<a class="sourceLine" id="cb2-5" title="5"> <span class="dt">X2 =</span> .x)) <span class="op">%&gt;%</span><span class="st"> </span></a>
<a class="sourceLine" id="cb2-6" title="6"><span class="st"> </span><span class="kw"><a href="../reference/bricks_from_table.html">bricks_from_table</a></span>() <span class="op">%&gt;%</span><span class="st"> </span></a>
<a class="sourceLine" id="cb2-7" title="7"><span class="st"> </span><span class="kw"><a href="../reference/build_bricks.html">build_bricks</a></span>(<span class="dt">brick_res =</span> <span class="st">"hd"</span>)</a>
<a class="sourceLine" id="cb2-7" title="7"><span class="st"> </span><span class="kw"><a href="../reference/build_bricks.html">build_bricks</a></span>(<span class="dt">rgl_lit=</span><span class="ot">FALSE</span>, <span class="dt">outline_bricks =</span> <span class="ot">TRUE</span>)</a>
<a class="sourceLine" id="cb2-8" title="8"></a>
<a class="sourceLine" id="cb2-9" title="9">rayshader<span class="op">::</span><span class="kw"><a href="https://www.rdocumentation.org/packages/rayshader/topics/render_snapshot">render_snapshot</a></span>( <span class="dt">clear =</span> <span class="ot">TRUE</span>)</a></code></pre></div>
<a class="sourceLine" id="cb2-9" title="9">rgl<span class="op">::</span><span class="kw"><a href="https://rdrr.io/pkg/rgl/man/par3d.html">par3d</a></span>(<span class="dt">userMatrix =</span> rgl<span class="op">::</span><span class="kw"><a href="https://rdrr.io/pkg/rgl/man/matrices.html">rotate3d</a></span>(rgl<span class="op">::</span><span class="kw"><a href="https://rdrr.io/pkg/rgl/man/par3d.html">par3d</a></span>(<span class="st">"userMatrix"</span>), <span class="fl">1.1</span><span class="op">*</span>pi<span class="op">/</span><span class="dv">4</span>, <span class="dv">0</span>, <span class="dv">0</span> ,<span class="dv">1</span>))</a></code></pre></div>
<p><img src="models-from-tables_files/figure-html/bricks_2-1.png" width="288"></p>
</div>
<div id="full-models" class="section level2">
@@ -198,13 +200,14 @@
<a class="sourceLine" id="cb3-39" title="39"> </a>
<a class="sourceLine" id="cb3-40" title="40">tree_or_mushroom <span class="op">%&gt;%</span><span class="st"> </span></a>
<a class="sourceLine" id="cb3-41" title="41"><span class="st"> </span><span class="kw"><a href="../reference/bricks_from_table.html">bricks_from_table</a></span>(brick_colors) <span class="op">%&gt;%</span><span class="st"> </span></a>
<a class="sourceLine" id="cb3-42" title="42"><span class="st"> </span><span class="kw"><a href="../reference/build_bricks.html">build_bricks</a></span>(<span class="dt">theta =</span> <span class="dv">210</span>, <span class="dt">phi =</span> <span class="dv">20</span>, <span class="dt">brick_res =</span> <span class="st">"hd"</span>)</a>
<a class="sourceLine" id="cb3-42" title="42"><span class="st"> </span><span class="kw"><a href="../reference/build_bricks.html">build_bricks</a></span>()</a>
<a class="sourceLine" id="cb3-43" title="43"></a>
<a class="sourceLine" id="cb3-44" title="44">rayshader<span class="op">::</span><span class="kw"><a href="https://www.rdocumentation.org/packages/rayshader/topics/render_snapshot">render_snapshot</a></span>(<span class="dt">clear =</span> <span class="ot">TRUE</span>)</a></code></pre></div>
<a class="sourceLine" id="cb3-44" title="44">rgl<span class="op">::</span><span class="kw"><a href="https://rdrr.io/pkg/rgl/man/par3d.html">par3d</a></span>(<span class="dt">userMatrix =</span> rgl<span class="op">::</span><span class="kw"><a href="https://rdrr.io/pkg/rgl/man/matrices.html">rotate3d</a></span>(rgl<span class="op">::</span><span class="kw"><a href="https://rdrr.io/pkg/rgl/man/par3d.html">par3d</a></span>(<span class="st">"userMatrix"</span>), <span class="fl">1.1</span><span class="op">*</span>pi<span class="op">/</span><span class="dv">4</span>, <span class="dv">0</span>, <span class="dv">0</span> ,<span class="dv">1</span>))</a></code></pre></div>
<p><img src="models-from-tables_files/figure-html/bricks_5-1.png" width="384"></p>
<div id="plates-instead-of-bricks" class="section level3">
<h3 class="hasAnchor">
<a href="#plates-instead-of-bricks" class="anchor"></a>Plates instead of bricks</h3>
<p><strong>Currently unavailable in <code><a href="../reference/build_bricks.html">build_bricks()</a></code>. Use <code><a href="../reference/build_bricks_rayshader.html">build_bricks_rayshader()</a></code></strong></p>
<p>Thats clearly a tree, right? Why is the data frame called tree_or_mushroom?</p>
<p>Use the input brick_type=“plate”’ to render the 3D model using LEGO plates rather than bricks, which are 1/3 as tall.</p>
<div class="sourceCode" id="cb4"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb4-1" title="1">brick_colors &lt;-<span class="st"> </span>tibble<span class="op">::</span><span class="kw"><a href="https://tibble.tidyverse.org/reference/tribble.html">tribble</a></span>(</a>
@@ -216,9 +219,9 @@
<a class="sourceLine" id="cb4-7" title="7"> </a>
<a class="sourceLine" id="cb4-8" title="8">tree_or_mushroom <span class="op">%&gt;%</span><span class="st"> </span></a>
<a class="sourceLine" id="cb4-9" title="9"><span class="st"> </span><span class="kw"><a href="../reference/bricks_from_table.html">bricks_from_table</a></span>(brick_colors) <span class="op">%&gt;%</span><span class="st"> </span></a>
<a class="sourceLine" id="cb4-10" title="10"><span class="st"> </span><span class="kw"><a href="../reference/build_bricks.html">build_bricks</a></span>(<span class="dt">theta =</span> <span class="dv">210</span>, <span class="dt">phi =</span> <span class="dv">10</span>, <span class="dt">brick_res =</span> <span class="st">"hd"</span>, <span class="dt">brick_type=</span><span class="st">"plate"</span>)</a>
<a class="sourceLine" id="cb4-10" title="10"><span class="st"> </span><span class="kw"><a href="../reference/build_bricks_rayshader.html">build_bricks_rayshader</a></span>(<span class="dt">theta =</span> <span class="dv">210</span>, <span class="dt">phi =</span> <span class="dv">10</span>, <span class="dt">brick_res =</span> <span class="st">"hd"</span>, <span class="dt">brick_type=</span><span class="st">"plate"</span>)</a>
<a class="sourceLine" id="cb4-11" title="11"></a>
<a class="sourceLine" id="cb4-12" title="12">rayshader<span class="op">::</span><span class="kw"><a href="https://www.rdocumentation.org/packages/rayshader/topics/render_snapshot">render_snapshot</a></span>(<span class="dt">clear =</span> <span class="ot">TRUE</span>)</a></code></pre></div>
<a class="sourceLine" id="cb4-12" title="12">rayshader<span class="op">::</span><span class="kw"><a href="https://rdrr.io/pkg/rayshader/man/render_snapshot.html">render_snapshot</a></span>(<span class="dt">clear =</span> <span class="ot">TRUE</span>)</a></code></pre></div>
<p><img src="models-from-tables_files/figure-html/bricks_5a-1.png" width="384"></p>
</div>
</div>
@@ -231,6 +234,7 @@
</div>
<div class="col-md-3 hidden-xs hidden-sm" id="sidebar">
<div id="tocnav">
<h2 class="hasAnchor">
<a href="#tocnav" class="anchor"></a>Contents</h2>
@@ -246,17 +250,20 @@
</div>
<footer><div class="copyright">
<p>Developed by Ryan Timpe.</p>
</div>
<div class="pkgdown">
<p>Site built with <a href="https://pkgdown.r-lib.org/">pkgdown</a> 1.3.0.</p>
<p>Site built with <a href="https://pkgdown.r-lib.org/">pkgdown</a> 1.4.1.</p>
</div>
</footer>
</div>
</body>
</html>
Binary file not shown.

Before

Width:  |  Height:  |  Size: 26 KiB

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 48 KiB

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 72 KiB

After

Width:  |  Height:  |  Size: 27 KiB

+40 -31
View File
@@ -13,8 +13,9 @@
<link rel="apple-touch-icon" type="image/png" sizes="76x76" href="../apple-touch-icon-76x76.png">
<link rel="apple-touch-icon" type="image/png" sizes="60x60" href="../apple-touch-icon-60x60.png">
<!-- jquery --><script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js" integrity="sha256-FgpCb/KJQlLNfOu91ta32o/NMZxltwRo8QtmkMRdAu8=" crossorigin="anonymous"></script><!-- Bootstrap --><link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha256-916EbMg70RQy9LHiGkXzG8hSg9EdNy97GazNG/aiY1w=" crossorigin="anonymous">
<script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha256-U5ZEeKfGNOja007MMD3YBI0A3OSZOQbeG6z2f2Y0hu8=" crossorigin="anonymous"></script><!-- Font Awesome icons --><link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css" integrity="sha256-eZrrJcwDc/3uDhsdt61sL2oOBY362qM3lon1gyExkL0=" crossorigin="anonymous">
<!-- clipboard.js --><script src="https://cdnjs.cloudflare.com/ajax/libs/clipboard.js/2.0.4/clipboard.min.js" integrity="sha256-FiZwavyI2V6+EXO1U+xzLG3IKldpiTFf3153ea9zikQ=" crossorigin="anonymous"></script><!-- sticky kit --><script src="https://cdnjs.cloudflare.com/ajax/libs/sticky-kit/1.1.3/sticky-kit.min.js" integrity="sha256-c4Rlo1ZozqTPE2RLuvbusY3+SU1pQaJC0TjuhygMipw=" crossorigin="anonymous"></script><!-- pkgdown --><link href="../pkgdown.css" rel="stylesheet">
<script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha256-U5ZEeKfGNOja007MMD3YBI0A3OSZOQbeG6z2f2Y0hu8=" crossorigin="anonymous"></script><!-- Font Awesome icons --><link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.7.1/css/all.min.css" integrity="sha256-nAmazAk6vS34Xqo0BSrTb+abbtFlgsFK7NKSi6o7Y78=" crossorigin="anonymous">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.7.1/css/v4-shims.min.css" integrity="sha256-6qHlizsOWFskGlwVOKuns+D1nB6ssZrHQrNj1wGplHc=" crossorigin="anonymous">
<!-- clipboard.js --><script src="https://cdnjs.cloudflare.com/ajax/libs/clipboard.js/2.0.4/clipboard.min.js" integrity="sha256-FiZwavyI2V6+EXO1U+xzLG3IKldpiTFf3153ea9zikQ=" crossorigin="anonymous"></script><!-- headroom.js --><script src="https://cdnjs.cloudflare.com/ajax/libs/headroom/0.9.4/headroom.min.js" integrity="sha256-DJFC1kqIhelURkuza0AvYal5RxMtpzLjFhsnVIeuk+U=" crossorigin="anonymous"></script><script src="https://cdnjs.cloudflare.com/ajax/libs/headroom/0.9.4/jQuery.headroom.min.js" integrity="sha256-ZX/yNShbjqsohH1k95liqY9Gd8uOiE1S4vZc+9KQ1K4=" crossorigin="anonymous"></script><!-- pkgdown --><link href="../pkgdown.css" rel="stylesheet">
<script src="../pkgdown.js"></script><link href="../extra.css" rel="stylesheet">
<meta property="og:title" content="Mosaics with brickr">
<meta property="og:description" content="">
@@ -38,7 +39,7 @@
</button>
<span class="navbar-brand">
<a class="navbar-link" href="../index.html">brickr</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.1.0.9024</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.2.0</span>
</span>
</div>
@@ -46,7 +47,7 @@
<ul class="nav navbar-nav">
<li>
<a href="../index.html">
<span class="fa fa-home fa-lg"></span>
<span class="fas fa fas fa-home fa-lg"></span>
</a>
</li>
@@ -84,7 +85,7 @@
<ul class="nav navbar-nav navbar-right">
<li>
<a href="https://github.com/ryantimpe/brickr">
<span class="fa fa-github fa-lg"></span>
<span class="fab fa fab fa-github fa-lg"></span>
</a>
</li>
@@ -97,6 +98,7 @@
<!--/.navbar -->
</header><div class="row">
<div class="col-md-9 contents">
<div class="page-header toc-ignore">
@@ -115,16 +117,16 @@
<a href="#getting-started" class="anchor"></a>Getting started</h2>
<p>You can generate a brickr mosaic object from an image using <code><a href="../reference/image_to_mosaic.html">brickr::image_to_mosaic()</a></code>. Pass this object to <code><a href="../reference/build_mosaic.html">build_mosaic()</a></code> to construct a visualization of the mosaic.</p>
<p><img src="http://ryantimpe.com/files/mf_unicorn.PNG" width="250"></p>
<div class="sourceCode" id="cb1"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb1-1" title="1">demo_img =<span class="st"> </span><span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/tempfile">tempfile</a></span>() </a>
<a class="sourceLine" id="cb1-2" title="2"><span class="kw"><a href="https://www.rdocumentation.org/packages/utils/topics/download.file">download.file</a></span>(<span class="st">"http://ryantimpe.com/files/mf_unicorn.PNG"</span>, demo_img, <span class="dt">mode=</span><span class="st">"wb"</span>)</a>
<div class="sourceCode" id="cb1"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb1-1" title="1">demo_img =<span class="st"> </span><span class="kw"><a href="https://rdrr.io/r/base/tempfile.html">tempfile</a></span>() </a>
<a class="sourceLine" id="cb1-2" title="2"><span class="kw"><a href="https://rdrr.io/r/utils/download.file.html">download.file</a></span>(<span class="st">"http://ryantimpe.com/files/mf_unicorn.PNG"</span>, demo_img, <span class="dt">mode=</span><span class="st">"wb"</span>)</a>
<a class="sourceLine" id="cb1-3" title="3"></a>
<a class="sourceLine" id="cb1-4" title="4">mosaic &lt;-<span class="st"> </span>png<span class="op">::</span><span class="kw"><a href="https://www.rdocumentation.org/packages/png/topics/readPNG">readPNG</a></span>(demo_img) <span class="op">%&gt;%</span><span class="st"> </span></a>
<a class="sourceLine" id="cb1-4" title="4">mosaic &lt;-<span class="st"> </span>png<span class="op">::</span><span class="kw"><a href="https://rdrr.io/pkg/png/man/readPNG.html">readPNG</a></span>(demo_img) <span class="op">%&gt;%</span><span class="st"> </span></a>
<a class="sourceLine" id="cb1-5" title="5"><span class="st"> </span><span class="kw"><a href="../reference/image_to_mosaic.html">image_to_mosaic</a></span>()</a>
<a class="sourceLine" id="cb1-6" title="6"></a>
<a class="sourceLine" id="cb1-7" title="7">mosaic <span class="op">%&gt;%</span><span class="st"> </span><span class="kw"><a href="../reference/build_mosaic.html">build_mosaic</a></span>()</a></code></pre></div>
<p><img src="mosaics_files/figure-html/g1-1.png" width="700"></p>
<p>The default is to create a mosaic with 48 knobs (brick studs) on each side. Change this using the <code>img_size</code> input. A single value will create a square mosaic, while an array of two values represent the width and length.</p>
<div class="sourceCode" id="cb2"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb2-1" title="1">png<span class="op">::</span><span class="kw"><a href="https://www.rdocumentation.org/packages/png/topics/readPNG">readPNG</a></span>(demo_img) <span class="op">%&gt;%</span><span class="st"> </span></a>
<div class="sourceCode" id="cb2"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb2-1" title="1">png<span class="op">::</span><span class="kw"><a href="https://rdrr.io/pkg/png/man/readPNG.html">readPNG</a></span>(demo_img) <span class="op">%&gt;%</span><span class="st"> </span></a>
<a class="sourceLine" id="cb2-2" title="2"><span class="st"> </span><span class="kw"><a href="../reference/image_to_mosaic.html">image_to_mosaic</a></span>(<span class="dt">img_size =</span> <span class="dv">32</span>) <span class="op">%&gt;%</span><span class="st"> </span></a>
<a class="sourceLine" id="cb2-3" title="3"><span class="st"> </span><span class="kw"><a href="../reference/build_mosaic.html">build_mosaic</a></span>()</a></code></pre></div>
<p><img src="mosaics_files/figure-html/g2-1.png" width="700"></p>
@@ -151,22 +153,22 @@
<li>special colors are typically reserved for certain products and its likely that bricks might not be actively produced in these colors.</li>
</ul>
<p>Use the <code>color_palette</code> input in the <code><a href="../reference/image_to_mosaic.html">image_to_mosaic()</a></code> function to limit the bricks used to any combination of these three categories.</p>
<div class="sourceCode" id="cb3"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb3-1" title="1">p1 &lt;-<span class="st"> </span>png<span class="op">::</span><span class="kw"><a href="https://www.rdocumentation.org/packages/png/topics/readPNG">readPNG</a></span>(demo_img) <span class="op">%&gt;%</span><span class="st"> </span></a>
<a class="sourceLine" id="cb3-2" title="2"><span class="st"> </span><span class="kw"><a href="../reference/image_to_mosaic.html">image_to_mosaic</a></span>(<span class="dv">32</span>, <span class="dt">color_palette =</span> <span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/c">c</a></span>(<span class="st">'universal'</span>, <span class="st">'generic'</span>)) <span class="op">%&gt;%</span><span class="st"> </span></a>
<div class="sourceCode" id="cb3"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb3-1" title="1">p1 &lt;-<span class="st"> </span>png<span class="op">::</span><span class="kw"><a href="https://rdrr.io/pkg/png/man/readPNG.html">readPNG</a></span>(demo_img) <span class="op">%&gt;%</span><span class="st"> </span></a>
<a class="sourceLine" id="cb3-2" title="2"><span class="st"> </span><span class="kw"><a href="../reference/image_to_mosaic.html">image_to_mosaic</a></span>(<span class="dv">32</span>, <span class="dt">color_palette =</span> <span class="kw"><a href="https://rdrr.io/r/base/c.html">c</a></span>(<span class="st">'universal'</span>, <span class="st">'generic'</span>)) <span class="op">%&gt;%</span><span class="st"> </span></a>
<a class="sourceLine" id="cb3-3" title="3"><span class="st"> </span><span class="kw"><a href="../reference/build_mosaic.html">build_mosaic</a></span>(<span class="dt">title =</span> <span class="st">"universal &amp; generic"</span>)</a>
<a class="sourceLine" id="cb3-4" title="4"></a>
<a class="sourceLine" id="cb3-5" title="5">p2 &lt;-<span class="st"> </span>png<span class="op">::</span><span class="kw"><a href="https://www.rdocumentation.org/packages/png/topics/readPNG">readPNG</a></span>(demo_img) <span class="op">%&gt;%</span><span class="st"> </span></a>
<a class="sourceLine" id="cb3-6" title="6"><span class="st"> </span><span class="kw"><a href="../reference/image_to_mosaic.html">image_to_mosaic</a></span>(<span class="dv">32</span>, <span class="dt">color_palette =</span> <span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/c">c</a></span>(<span class="st">'universal'</span>)) <span class="op">%&gt;%</span><span class="st"> </span></a>
<a class="sourceLine" id="cb3-5" title="5">p2 &lt;-<span class="st"> </span>png<span class="op">::</span><span class="kw"><a href="https://rdrr.io/pkg/png/man/readPNG.html">readPNG</a></span>(demo_img) <span class="op">%&gt;%</span><span class="st"> </span></a>
<a class="sourceLine" id="cb3-6" title="6"><span class="st"> </span><span class="kw"><a href="../reference/image_to_mosaic.html">image_to_mosaic</a></span>(<span class="dv">32</span>, <span class="dt">color_palette =</span> <span class="kw"><a href="https://rdrr.io/r/base/c.html">c</a></span>(<span class="st">'universal'</span>)) <span class="op">%&gt;%</span><span class="st"> </span></a>
<a class="sourceLine" id="cb3-7" title="7"><span class="st"> </span><span class="kw"><a href="../reference/build_mosaic.html">build_mosaic</a></span>(<span class="dt">title =</span> <span class="st">"universal"</span>)</a>
<a class="sourceLine" id="cb3-8" title="8"></a>
<a class="sourceLine" id="cb3-9" title="9">gridExtra<span class="op">::</span><span class="kw"><a href="https://www.rdocumentation.org/packages/gridExtra/topics/arrangeGrob">grid.arrange</a></span>(p1, p2, <span class="dt">layout_matrix =</span> <span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/matrix">matrix</a></span>(<span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/c">c</a></span>(<span class="dv">1</span>,<span class="dv">2</span>), <span class="dt">ncol=</span><span class="dv">2</span>))</a></code></pre></div>
<a class="sourceLine" id="cb3-9" title="9">gridExtra<span class="op">::</span><span class="kw"><a href="https://rdrr.io/pkg/gridExtra/man/arrangeGrob.html">grid.arrange</a></span>(p1, p2, <span class="dt">layout_matrix =</span> <span class="kw"><a href="https://rdrr.io/r/base/matrix.html">matrix</a></span>(<span class="kw"><a href="https://rdrr.io/r/base/c.html">c</a></span>(<span class="dv">1</span>,<span class="dv">2</span>), <span class="dt">ncol=</span><span class="dv">2</span>))</a></code></pre></div>
<p><img src="mosaics_files/figure-html/c_palettes-1.png" width="576"></p>
</div>
<div id="grayscale" class="section level4">
<h4 class="hasAnchor">
<a href="#grayscale" class="anchor"></a>Grayscale</h4>
<p>For grayscale or black and white mosaics, use <code>color_palette = 'bw'</code>. This creates the mosaic by measuring the brightness of each pixel in the image and mapping it one of the four shades of gray. Use the contrast input to adjust the relative brightness of the pixels.</p>
<div class="sourceCode" id="cb4"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb4-1" title="1">png<span class="op">::</span><span class="kw"><a href="https://www.rdocumentation.org/packages/png/topics/readPNG">readPNG</a></span>(demo_img) <span class="op">%&gt;%</span><span class="st"> </span></a>
<div class="sourceCode" id="cb4"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb4-1" title="1">png<span class="op">::</span><span class="kw"><a href="https://rdrr.io/pkg/png/man/readPNG.html">readPNG</a></span>(demo_img) <span class="op">%&gt;%</span><span class="st"> </span></a>
<a class="sourceLine" id="cb4-2" title="2"><span class="st"> </span><span class="kw"><a href="../reference/image_to_mosaic.html">image_to_mosaic</a></span>(<span class="dv">32</span>, <span class="dt">color_palette =</span> <span class="st">'bw'</span>, <span class="dt">contrast =</span> <span class="fl">1.1</span>)<span class="op">%&gt;%</span><span class="st"> </span></a>
<a class="sourceLine" id="cb4-3" title="3"><span class="st"> </span><span class="kw"><a href="../reference/build_mosaic.html">build_mosaic</a></span>()</a></code></pre></div>
<p><img src="mosaics_files/figure-html/c_bw-1.png" width="700"></p>
@@ -177,9 +179,9 @@
<p>With the <code>color_table</code> input, it is possible to restrict the colors in the mosaic to a custom palette.</p>
<div class="sourceCode" id="cb5"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb5-1" title="1"><span class="co">#Remove blue and azure colors from lego_colors</span></a>
<a class="sourceLine" id="cb5-2" title="2">lego_colors_wo_blue &lt;-<span class="st"> </span>lego_colors <span class="op">%&gt;%</span><span class="st"> </span></a>
<a class="sourceLine" id="cb5-3" title="3"><span class="st"> </span>dplyr<span class="op">::</span><span class="kw"><a href="https://dplyr.tidyverse.org/reference/filter.html">filter</a></span>(<span class="op">!</span><span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/grep">grepl</a></span>(<span class="st">"blue|azur"</span>, <span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/chartr">tolower</a></span>(Color)))</a>
<a class="sourceLine" id="cb5-3" title="3"><span class="st"> </span>dplyr<span class="op">::</span><span class="kw"><a href="https://dplyr.tidyverse.org/reference/filter.html">filter</a></span>(<span class="op">!</span><span class="kw"><a href="https://rdrr.io/r/base/grep.html">grepl</a></span>(<span class="st">"blue|azur"</span>, <span class="kw"><a href="https://rdrr.io/r/base/chartr.html">tolower</a></span>(Color)))</a>
<a class="sourceLine" id="cb5-4" title="4"></a>
<a class="sourceLine" id="cb5-5" title="5">png<span class="op">::</span><span class="kw"><a href="https://www.rdocumentation.org/packages/png/topics/readPNG">readPNG</a></span>(demo_img) <span class="op">%&gt;%</span><span class="st"> </span></a>
<a class="sourceLine" id="cb5-5" title="5">png<span class="op">::</span><span class="kw"><a href="https://rdrr.io/pkg/png/man/readPNG.html">readPNG</a></span>(demo_img) <span class="op">%&gt;%</span><span class="st"> </span></a>
<a class="sourceLine" id="cb5-6" title="6"><span class="st"> </span><span class="kw"><a href="../reference/image_to_mosaic.html">image_to_mosaic</a></span>(<span class="dv">32</span>, <span class="dt">color_table =</span> lego_colors_wo_blue)<span class="op">%&gt;%</span><span class="st"> </span></a>
<a class="sourceLine" id="cb5-7" title="7"><span class="st"> </span><span class="kw"><a href="../reference/build_mosaic.html">build_mosaic</a></span>(<span class="dt">title =</span> <span class="st">"Mosaic without blue or azur"</span>)</a></code></pre></div>
<p><img src="mosaics_files/figure-html/c_custom-1.png" width="700"></p>
@@ -190,27 +192,27 @@
<a href="#color-matching" class="anchor"></a>Color matching</h3>
<p>brickr uses the <a href="https://cran.r-project.org/web/packages/farver/index.html"><code>farver</code></a> package to match image colors to the subset of LEGO colors. Technical details of the different algorithms can be found on <a href="https://en.wikipedia.org/wiki/Color_difference">Wikipedia</a>.</p>
<p>The default algorithm is cie94, though the other farver options are available using the <code>method</code> input. The farver euclidean is not very accurate, so brickr_classic returns a manually calculated version for Euclidean RGB distance matching.</p>
<div class="sourceCode" id="cb6"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb6-1" title="1"><span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/c">c</a></span>(<span class="st">"cie94"</span>, <span class="st">"cie2000"</span>, <span class="st">"euclidean"</span>, <span class="st">"brickr_classic"</span>) <span class="op">%&gt;%</span><span class="st"> </span></a>
<a class="sourceLine" id="cb6-2" title="2"><span class="st"> </span>purrr<span class="op">::</span><span class="kw"><a href="https://purrr.tidyverse.org/reference/map.html">map</a></span>(<span class="op">~</span>png<span class="op">::</span><span class="kw"><a href="https://www.rdocumentation.org/packages/png/topics/readPNG">readPNG</a></span>(demo_img) <span class="op">%&gt;%</span><span class="st"> </span></a>
<div class="sourceCode" id="cb6"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb6-1" title="1"><span class="kw"><a href="https://rdrr.io/r/base/c.html">c</a></span>(<span class="st">"cie94"</span>, <span class="st">"cie2000"</span>, <span class="st">"euclidean"</span>, <span class="st">"brickr_classic"</span>) <span class="op">%&gt;%</span><span class="st"> </span></a>
<a class="sourceLine" id="cb6-2" title="2"><span class="st"> </span>purrr<span class="op">::</span><span class="kw"><a href="https://purrr.tidyverse.org/reference/map.html">map</a></span>(<span class="op">~</span>png<span class="op">::</span><span class="kw"><a href="https://rdrr.io/pkg/png/man/readPNG.html">readPNG</a></span>(demo_img) <span class="op">%&gt;%</span><span class="st"> </span></a>
<a class="sourceLine" id="cb6-3" title="3"><span class="st"> </span><span class="kw"><a href="../reference/image_to_mosaic.html">image_to_mosaic</a></span>(<span class="dv">24</span>, <span class="dt">method =</span>.x) <span class="op">%&gt;%</span><span class="st"> </span></a>
<a class="sourceLine" id="cb6-4" title="4"><span class="st"> </span><span class="kw"><a href="../reference/build_mosaic.html">build_mosaic</a></span>(<span class="dt">title =</span> .x )) -&gt;<span class="st"> </span>mosaics_by_method</a>
<a class="sourceLine" id="cb6-5" title="5"></a>
<a class="sourceLine" id="cb6-6" title="6">gridExtra<span class="op">::</span><span class="kw"><a href="https://www.rdocumentation.org/packages/gridExtra/topics/arrangeGrob">grid.arrange</a></span>(<span class="dt">grobs =</span> mosaics_by_method, <span class="dt">layout_matrix =</span><span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/cbind">rbind</a></span>(<span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/c">c</a></span>(<span class="dv">1</span>,<span class="dv">2</span>),<span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/c">c</a></span>(<span class="dv">3</span>,<span class="dv">4</span>)))</a></code></pre></div>
<a class="sourceLine" id="cb6-6" title="6">gridExtra<span class="op">::</span><span class="kw"><a href="https://rdrr.io/pkg/gridExtra/man/arrangeGrob.html">grid.arrange</a></span>(<span class="dt">grobs =</span> mosaics_by_method, <span class="dt">layout_matrix =</span><span class="kw"><a href="https://rdrr.io/r/base/cbind.html">rbind</a></span>(<span class="kw"><a href="https://rdrr.io/r/base/c.html">c</a></span>(<span class="dv">1</span>,<span class="dv">2</span>),<span class="kw"><a href="https://rdrr.io/r/base/c.html">c</a></span>(<span class="dv">3</span>,<span class="dv">4</span>)))</a></code></pre></div>
<p><img src="mosaics_files/figure-html/c_methods-1.png" width="480"></p>
</div>
<div id="dithering" class="section level3">
<h3 class="hasAnchor">
<a href="#dithering" class="anchor"></a>Dithering</h3>
<p>When rendering a mosaic from a photographic with many shades of similar colors, using <a href="https://en.wikipedia.org/wiki/Floyd%E2%80%93Steinberg_dithering">dithering</a> by setting <code>dithering = TRUE</code> will help to add texture to the mosaic and avoid large areas of the same color. This works particularly well for large mosaics, but is purely a stylist preference.</p>
<div class="sourceCode" id="cb7"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb7-1" title="1">gg_img =<span class="st"> </span><span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/tempfile">tempfile</a></span>() </a>
<a class="sourceLine" id="cb7-2" title="2"><span class="kw"><a href="https://www.rdocumentation.org/packages/utils/topics/download.file">download.file</a></span>(<span class="st">"http://ryantimpe.com/files/goldengirls.JPG"</span>, gg_img, <span class="dt">mode=</span><span class="st">"wb"</span>)</a>
<div class="sourceCode" id="cb7"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb7-1" title="1">gg_img =<span class="st"> </span><span class="kw"><a href="https://rdrr.io/r/base/tempfile.html">tempfile</a></span>() </a>
<a class="sourceLine" id="cb7-2" title="2"><span class="kw"><a href="https://rdrr.io/r/utils/download.file.html">download.file</a></span>(<span class="st">"http://ryantimpe.com/files/goldengirls.JPG"</span>, gg_img, <span class="dt">mode=</span><span class="st">"wb"</span>)</a>
<a class="sourceLine" id="cb7-3" title="3"></a>
<a class="sourceLine" id="cb7-4" title="4"><span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/c">c</a></span>(<span class="ot">FALSE</span>, <span class="ot">TRUE</span>) <span class="op">%&gt;%</span><span class="st"> </span></a>
<a class="sourceLine" id="cb7-5" title="5"><span class="st"> </span>purrr<span class="op">::</span><span class="kw"><a href="https://purrr.tidyverse.org/reference/map.html">map</a></span>(<span class="op">~</span>jpeg<span class="op">::</span><span class="kw"><a href="https://www.rdocumentation.org/packages/jpeg/topics/readJPEG">readJPEG</a></span>(gg_img) <span class="op">%&gt;%</span><span class="st"> </span></a>
<a class="sourceLine" id="cb7-4" title="4"><span class="kw"><a href="https://rdrr.io/r/base/c.html">c</a></span>(<span class="ot">FALSE</span>, <span class="ot">TRUE</span>) <span class="op">%&gt;%</span><span class="st"> </span></a>
<a class="sourceLine" id="cb7-5" title="5"><span class="st"> </span>purrr<span class="op">::</span><span class="kw"><a href="https://purrr.tidyverse.org/reference/map.html">map</a></span>(<span class="op">~</span>jpeg<span class="op">::</span><span class="kw"><a href="https://rdrr.io/pkg/jpeg/man/readJPEG.html">readJPEG</a></span>(gg_img) <span class="op">%&gt;%</span><span class="st"> </span></a>
<a class="sourceLine" id="cb7-6" title="6"><span class="st"> </span><span class="kw"><a href="../reference/image_to_mosaic.html">image_to_mosaic</a></span>(<span class="dt">dithering =</span> .x) <span class="op">%&gt;%</span><span class="st"> </span></a>
<a class="sourceLine" id="cb7-7" title="7"><span class="st"> </span><span class="kw"><a href="../reference/build_mosaic.html">build_mosaic</a></span>(<span class="dt">title =</span> <span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/paste">paste</a></span>(<span class="st">"dithering ="</span>, .x))) -&gt;<span class="st"> </span>mosaics_by_dither</a>
<a class="sourceLine" id="cb7-7" title="7"><span class="st"> </span><span class="kw"><a href="../reference/build_mosaic.html">build_mosaic</a></span>(<span class="dt">title =</span> <span class="kw"><a href="https://rdrr.io/r/base/paste.html">paste</a></span>(<span class="st">"dithering ="</span>, .x))) -&gt;<span class="st"> </span>mosaics_by_dither</a>
<a class="sourceLine" id="cb7-8" title="8"></a>
<a class="sourceLine" id="cb7-9" title="9">gridExtra<span class="op">::</span><span class="kw"><a href="https://www.rdocumentation.org/packages/gridExtra/topics/arrangeGrob">grid.arrange</a></span>(<span class="dt">grobs =</span> mosaics_by_dither, <span class="dt">layout_matrix =</span> <span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/matrix">matrix</a></span>(<span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/c">c</a></span>(<span class="dv">1</span>,<span class="dv">2</span>), <span class="dt">ncol=</span><span class="dv">2</span>))</a></code></pre></div>
<a class="sourceLine" id="cb7-9" title="9">gridExtra<span class="op">::</span><span class="kw"><a href="https://rdrr.io/pkg/gridExtra/man/arrangeGrob.html">grid.arrange</a></span>(<span class="dt">grobs =</span> mosaics_by_dither, <span class="dt">layout_matrix =</span> <span class="kw"><a href="https://rdrr.io/r/base/matrix.html">matrix</a></span>(<span class="kw"><a href="https://rdrr.io/r/base/c.html">c</a></span>(<span class="dv">1</span>,<span class="dv">2</span>), <span class="dt">ncol=</span><span class="dv">2</span>))</a></code></pre></div>
<p><img src="mosaics_files/figure-html/c_dither-1.png" width="576"></p>
</div>
<div id="other-color-options" class="section level3">
@@ -223,18 +225,22 @@
<h2 class="hasAnchor">
<a href="#d-mosaics" class="anchor"></a>3D Mosaics</h2>
<p>With <a href="https://www.rayshader.com/">rayshader</a> installed, passing the mosaic object to <code><a href="../reference/bricks_from_mosaic.html">bricks_from_mosaic()</a></code> will render a 3D object, stacking layers of bricks on each other to create an elevated mosaic. By default, the lightest color bricks will be on top, but this can be changed using the <code>highest_el = 'dark'</code> option.</p>
<div class="sourceCode" id="cb8"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb8-1" title="1">png<span class="op">::</span><span class="kw"><a href="https://www.rdocumentation.org/packages/png/topics/readPNG">readPNG</a></span>(demo_img) <span class="op">%&gt;%</span><span class="st"> </span></a>
<div class="sourceCode" id="cb8"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb8-1" title="1">png<span class="op">::</span><span class="kw"><a href="https://rdrr.io/pkg/png/man/readPNG.html">readPNG</a></span>(demo_img) <span class="op">%&gt;%</span><span class="st"> </span></a>
<a class="sourceLine" id="cb8-2" title="2"><span class="st"> </span><span class="kw"><a href="../reference/image_to_mosaic.html">image_to_mosaic</a></span>(<span class="dv">32</span>) <span class="op">%&gt;%</span><span class="st"> </span></a>
<a class="sourceLine" id="cb8-3" title="3"><span class="st"> </span><span class="kw"><a href="../reference/bricks_from_mosaic.html">bricks_from_mosaic</a></span>(<span class="dt">highest_el =</span> <span class="st">"dark"</span>) <span class="op">%&gt;%</span><span class="st"> </span></a>
<a class="sourceLine" id="cb8-4" title="4"><span class="st"> </span><span class="kw"><a href="../reference/build_bricks.html">build_bricks</a></span>(<span class="dt">brick_type =</span> <span class="st">"plate"</span>)</a>
<a class="sourceLine" id="cb8-4" title="4"><span class="st"> </span><span class="kw"><a href="../reference/build_bricks.html">build_bricks</a></span>()</a>
<a class="sourceLine" id="cb8-5" title="5"></a>
<a class="sourceLine" id="cb8-6" title="6">rayshader<span class="op">::</span><span class="kw"><a href="https://www.rdocumentation.org/packages/rayshader/topics/render_camera">render_camera</a></span>(<span class="dt">theta =</span> <span class="dv">15</span>)</a>
<a class="sourceLine" id="cb8-7" title="7">rayshader<span class="op">::</span><span class="kw"><a href="https://www.rdocumentation.org/packages/rayshader/topics/render_snapshot">render_snapshot</a></span>(<span class="dt">clear =</span> <span class="ot">TRUE</span>)</a></code></pre></div>
<a class="sourceLine" id="cb8-6" title="6"><span class="co">#From dput(round(rgl::par3d("userMatrix"),1)) after manual rotation</span></a>
<a class="sourceLine" id="cb8-7" title="7">custom_rotation &lt;-<span class="st"> </span><span class="kw"><a href="https://rdrr.io/r/base/structure.html">structure</a></span>(<span class="kw"><a href="https://rdrr.io/r/base/c.html">c</a></span>(<span class="fl">0.9</span>, <span class="fl">0.3</span>, <span class="fl">-0.3</span>, <span class="dv">0</span>, <span class="fl">-0.3</span>, <span class="fl">0.9</span>, <span class="fl">-0.3</span>, </a>
<a class="sourceLine" id="cb8-8" title="8"> <span class="dv">0</span>, <span class="fl">0.2</span>, <span class="fl">0.4</span>, <span class="fl">0.9</span>, <span class="dv">0</span>, <span class="dv">0</span>, <span class="dv">0</span>, <span class="dv">0</span>, <span class="dv">1</span>), <span class="dt">.Dim =</span> <span class="kw"><a href="https://rdrr.io/r/base/c.html">c</a></span>(4L, 4L))</a>
<a class="sourceLine" id="cb8-9" title="9"></a>
<a class="sourceLine" id="cb8-10" title="10">rgl<span class="op">::</span><span class="kw"><a href="https://rdrr.io/pkg/rgl/man/par3d.html">par3d</a></span>(<span class="dt">userMatrix =</span> rgl<span class="op">::</span><span class="kw"><a href="https://rdrr.io/pkg/rgl/man/matrices.html">rotate3d</a></span>(custom_rotation, <span class="dv">0</span>, <span class="dv">0</span>, pi<span class="op">/</span><span class="dv">4</span> ,<span class="dv">1</span>))</a></code></pre></div>
<p><img src="mosaics_files/figure-html/c_threed-1.png" width="700"></p>
</div>
</div>
<div class="col-md-3 hidden-xs hidden-sm" id="sidebar">
<div id="tocnav">
<h2 class="hasAnchor">
<a href="#tocnav" class="anchor"></a>Contents</h2>
@@ -249,17 +255,20 @@
</div>
<footer><div class="copyright">
<p>Developed by Ryan Timpe.</p>
</div>
<div class="pkgdown">
<p>Site built with <a href="https://pkgdown.r-lib.org/">pkgdown</a> 1.3.0.</p>
<p>Site built with <a href="https://pkgdown.r-lib.org/">pkgdown</a> 1.4.1.</p>
</div>
</footer>
</div>
</body>
</html>
Binary file not shown.

Before

Width:  |  Height:  |  Size: 53 KiB

After

Width:  |  Height:  |  Size: 53 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 174 KiB

After

Width:  |  Height:  |  Size: 171 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 229 KiB

After

Width:  |  Height:  |  Size: 171 KiB

+19 -9
View File
@@ -15,21 +15,25 @@
<link rel="apple-touch-icon" type="image/png" sizes="120x120" href="apple-touch-icon-120x120.png" />
<link rel="apple-touch-icon" type="image/png" sizes="76x76" href="apple-touch-icon-76x76.png" />
<link rel="apple-touch-icon" type="image/png" sizes="60x60" href="apple-touch-icon-60x60.png" />
<!-- jquery -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js" integrity="sha256-FgpCb/KJQlLNfOu91ta32o/NMZxltwRo8QtmkMRdAu8=" crossorigin="anonymous"></script>
<!-- Bootstrap -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha256-916EbMg70RQy9LHiGkXzG8hSg9EdNy97GazNG/aiY1w=" crossorigin="anonymous" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha256-U5ZEeKfGNOja007MMD3YBI0A3OSZOQbeG6z2f2Y0hu8=" crossorigin="anonymous"></script>
<!-- Font Awesome icons -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css" integrity="sha256-eZrrJcwDc/3uDhsdt61sL2oOBY362qM3lon1gyExkL0=" crossorigin="anonymous" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.7.1/css/all.min.css" integrity="sha256-nAmazAk6vS34Xqo0BSrTb+abbtFlgsFK7NKSi6o7Y78=" crossorigin="anonymous" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.7.1/css/v4-shims.min.css" integrity="sha256-6qHlizsOWFskGlwVOKuns+D1nB6ssZrHQrNj1wGplHc=" crossorigin="anonymous" />
<!-- clipboard.js -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/clipboard.js/2.0.4/clipboard.min.js" integrity="sha256-FiZwavyI2V6+EXO1U+xzLG3IKldpiTFf3153ea9zikQ=" crossorigin="anonymous"></script>
<!-- sticky kit -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/sticky-kit/1.1.3/sticky-kit.min.js" integrity="sha256-c4Rlo1ZozqTPE2RLuvbusY3+SU1pQaJC0TjuhygMipw=" crossorigin="anonymous"></script>
<!-- headroom.js -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/headroom/0.9.4/headroom.min.js" integrity="sha256-DJFC1kqIhelURkuza0AvYal5RxMtpzLjFhsnVIeuk+U=" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/headroom/0.9.4/jQuery.headroom.min.js" integrity="sha256-ZX/yNShbjqsohH1k95liqY9Gd8uOiE1S4vZc+9KQ1K4=" crossorigin="anonymous"></script>
<!-- pkgdown -->
<link href="pkgdown.css" rel="stylesheet">
@@ -39,13 +43,14 @@
<link href="extra.css" rel="stylesheet">
<meta property="og:title" content="Authors" />
<meta property="og:title" content="Authors" />
<meta property="og:image" content="http://brickr.org/logo.png" />
<meta name="twitter:card" content="summary" />
<!-- mathjax -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/MathJax.js" integrity="sha256-nvJJv9wWKEm88qvoQl9ekL2J+k/RWIsaSScxxlsrv8k=" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/config/TeX-AMS-MML_HTMLorMML.js" integrity="sha256-84DKXVJXs0/F8OTMzX4UR909+jtl4G7SPypPavF+GfA=" crossorigin="anonymous"></script>
@@ -56,6 +61,7 @@
<![endif]-->
</head>
<body>
@@ -72,7 +78,7 @@
</button>
<span class="navbar-brand">
<a class="navbar-link" href="index.html">brickr</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.1.0.9024</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.2.0</span>
</span>
</div>
@@ -80,7 +86,7 @@
<ul class="nav navbar-nav">
<li>
<a href="index.html">
<span class="fa fa-home fa-lg"></span>
<span class="fas fa fas fa-home fa-lg"></span>
</a>
</li>
@@ -115,11 +121,10 @@
<a href="news/index.html">Changelog</a>
</li>
</ul>
<ul class="nav navbar-nav navbar-right">
<li>
<a href="https://github.com/ryantimpe/brickr">
<span class="fa fa-github fa-lg"></span>
<span class="fab fa fab fa-github fa-lg"></span>
</a>
</li>
@@ -130,6 +135,7 @@
</div><!--/.navbar -->
</header>
<div class="row">
@@ -150,19 +156,23 @@
</div>
<footer>
<div class="copyright">
<p>Developed by Ryan Timpe.</p>
</div>
<div class="pkgdown">
<p>Site built with <a href="https://pkgdown.r-lib.org/">pkgdown</a> 1.3.0.</p>
<p>Site built with <a href="https://pkgdown.r-lib.org/">pkgdown</a> 1.4.1.</p>
</div>
</footer>
</div>
</body>
</html>
+67 -58
View File
@@ -13,13 +13,14 @@
<link rel="apple-touch-icon" type="image/png" sizes="76x76" href="apple-touch-icon-76x76.png">
<link rel="apple-touch-icon" type="image/png" sizes="60x60" href="apple-touch-icon-60x60.png">
<!-- jquery --><script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js" integrity="sha256-FgpCb/KJQlLNfOu91ta32o/NMZxltwRo8QtmkMRdAu8=" crossorigin="anonymous"></script><!-- Bootstrap --><link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha256-916EbMg70RQy9LHiGkXzG8hSg9EdNy97GazNG/aiY1w=" crossorigin="anonymous">
<script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha256-U5ZEeKfGNOja007MMD3YBI0A3OSZOQbeG6z2f2Y0hu8=" crossorigin="anonymous"></script><!-- Font Awesome icons --><link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css" integrity="sha256-eZrrJcwDc/3uDhsdt61sL2oOBY362qM3lon1gyExkL0=" crossorigin="anonymous">
<!-- clipboard.js --><script src="https://cdnjs.cloudflare.com/ajax/libs/clipboard.js/2.0.4/clipboard.min.js" integrity="sha256-FiZwavyI2V6+EXO1U+xzLG3IKldpiTFf3153ea9zikQ=" crossorigin="anonymous"></script><!-- sticky kit --><script src="https://cdnjs.cloudflare.com/ajax/libs/sticky-kit/1.1.3/sticky-kit.min.js" integrity="sha256-c4Rlo1ZozqTPE2RLuvbusY3+SU1pQaJC0TjuhygMipw=" crossorigin="anonymous"></script><!-- pkgdown --><link href="pkgdown.css" rel="stylesheet">
<script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha256-U5ZEeKfGNOja007MMD3YBI0A3OSZOQbeG6z2f2Y0hu8=" crossorigin="anonymous"></script><!-- Font Awesome icons --><link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.7.1/css/all.min.css" integrity="sha256-nAmazAk6vS34Xqo0BSrTb+abbtFlgsFK7NKSi6o7Y78=" crossorigin="anonymous">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.7.1/css/v4-shims.min.css" integrity="sha256-6qHlizsOWFskGlwVOKuns+D1nB6ssZrHQrNj1wGplHc=" crossorigin="anonymous">
<!-- clipboard.js --><script src="https://cdnjs.cloudflare.com/ajax/libs/clipboard.js/2.0.4/clipboard.min.js" integrity="sha256-FiZwavyI2V6+EXO1U+xzLG3IKldpiTFf3153ea9zikQ=" crossorigin="anonymous"></script><!-- headroom.js --><script src="https://cdnjs.cloudflare.com/ajax/libs/headroom/0.9.4/headroom.min.js" integrity="sha256-DJFC1kqIhelURkuza0AvYal5RxMtpzLjFhsnVIeuk+U=" crossorigin="anonymous"></script><script src="https://cdnjs.cloudflare.com/ajax/libs/headroom/0.9.4/jQuery.headroom.min.js" integrity="sha256-ZX/yNShbjqsohH1k95liqY9Gd8uOiE1S4vZc+9KQ1K4=" crossorigin="anonymous"></script><!-- pkgdown --><link href="pkgdown.css" rel="stylesheet">
<script src="pkgdown.js"></script><link href="extra.css" rel="stylesheet">
<meta property="og:title" content="Tools to emulate the LEGO® System in R">
<meta property="og:description" content="
Generate digital LEGO-esque models using tidyverse functions. Convert image files into 2D and 3D mosaics, along with piece counts and instructions.
Build 3D models using data frames with rayshader. Create brick bar charts with ggplot2.">
Build 3D models using data frames with rgl. Create brick bar charts with ggplot2.">
<meta property="og:image" content="http://brickr.org/logo.png">
<meta name="twitter:card" content="summary">
<!-- mathjax --><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/MathJax.js" integrity="sha256-nvJJv9wWKEm88qvoQl9ekL2J+k/RWIsaSScxxlsrv8k=" crossorigin="anonymous"></script><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/config/TeX-AMS-MML_HTMLorMML.js" integrity="sha256-84DKXVJXs0/F8OTMzX4UR909+jtl4G7SPypPavF+GfA=" crossorigin="anonymous"></script><!--[if lt IE 9]>
@@ -28,7 +29,7 @@
<![endif]-->
</head>
<body>
<div class="container template-article">
<div class="container template-home">
<header><div class="navbar navbar-default navbar-fixed-top" role="navigation">
<div class="container">
<div class="navbar-header">
@@ -40,7 +41,7 @@
</button>
<span class="navbar-brand">
<a class="navbar-link" href="index.html">brickr</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.1.0.9024</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.2.0</span>
</span>
</div>
@@ -48,7 +49,7 @@
<ul class="nav navbar-nav">
<li>
<a href="index.html">
<span class="fa fa-home fa-lg"></span>
<span class="fas fa fas fa-home fa-lg"></span>
</a>
</li>
@@ -86,7 +87,7 @@
<ul class="nav navbar-nav navbar-right">
<li>
<a href="https://github.com/ryantimpe/brickr">
<span class="fa fa-github fa-lg"></span>
<span class="fab fa fab fa-github fa-lg"></span>
</a>
</li>
@@ -99,16 +100,18 @@
<!--/.navbar -->
</header><div class="row">
<div class="col-md-9 contents">
<div id="brickr" class="section level1">
</header><div class="row">
<div class="contents col-md-9">
<div id="the-lego-system-in-r" class="section level1">
<div class="page-header"><h1 class="hasAnchor">
<a href="#brickr" class="anchor"></a>brickr <img src="reference/figures/logo.png" align="right" height="138">
</h1></div>
<a href="#the-lego-system-in-r" class="anchor"></a>The LEGO® System in R</h1></div>
</div>
<div id="brickr-" class="section level1">
<h1 class="hasAnchor">
<a href="#brickr-" class="anchor"></a>brickr <img src="reference/figures/logo.png" align="right" height="138">
</h1>
<!-- <!-- badges: start -->
<div id="overview" class="section level2">
@@ -120,7 +123,7 @@
<li>
<a href="#mosaics"><strong>Mosaics</strong></a>: Convert image files into mosaics that could be built using LEGO® bricks.</li>
<li>
<a href="#3d-models"><strong>3D Models</strong></a>: Build 3D LEGO® models from simple data formats &amp; <a href="https://www.rayshader.com/">rayshader</a>.</li>
<a href="#3d-models"><strong>3D Models</strong></a>: Build 3D LEGO® models from data tables using <a href="https://cran.r-project.org/web/packages/rgl/index.html">rgl</a>.</li>
<li>
<a href="#charts"><strong>Charts</strong></a>: A <a href="https://ggplot2.tidyverse.org/">ggplot2</a> extension to generate plots that resemble LEGO® bricks.</li>
</ul>
@@ -135,7 +138,7 @@
<li>Generating interest in R and coding for new audiences with easy-to-create 3D models.</li>
<li>or just embracing pure novelty.</li>
</ul>
<p><em>brickr is developed using publicly available information about LEGO® products and is not officially affiliated with The LEGO Group</em></p>
<p><em>brickr is developed under the <a href="https://www.lego.com/en-us/legal/notices-and-policies/fair-play/">Fair Play</a> policy using publicly available information about LEGO® products. brickr is not affiliated with The LEGO Group.</em></p>
</div>
</div>
<div id="installation" class="section level2">
@@ -143,61 +146,62 @@
<a href="#installation" class="anchor"></a>Installation</h2>
<div class="sourceCode" id="cb1"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb1-1" title="1"><span class="co"># To install the latest version from Github:</span></a>
<a class="sourceLine" id="cb1-2" title="2"><span class="co"># install.packages("devtools")</span></a>
<a class="sourceLine" id="cb1-3" title="3">devtools<span class="op">::</span><span class="kw"><a href="https://www.rdocumentation.org/packages/devtools/topics/reexports">install_github</a></span>(<span class="st">"ryantimpe/brickr"</span>)</a>
<a class="sourceLine" id="cb1-3" title="3">devtools<span class="op">::</span><span class="kw"><a href="https://rdrr.io/pkg/devtools/man/remote-reexports.html">install_github</a></span>(<span class="st">"ryantimpe/brickr"</span>)</a>
<a class="sourceLine" id="cb1-4" title="4"></a>
<a class="sourceLine" id="cb1-5" title="5"><span class="co">#For 3D features, rayshader is also required.</span></a>
<a class="sourceLine" id="cb1-6" title="6"><span class="kw"><a href="https://www.rdocumentation.org/packages/utils/topics/install.packages">install.packages</a></span>(<span class="st">"rayshader"</span>)</a></code></pre></div>
<a class="sourceLine" id="cb1-6" title="6"><span class="kw"><a href="https://rdrr.io/r/utils/install.packages.html">install.packages</a></span>(<span class="st">"rayshader"</span>)</a></code></pre></div>
</div>
<div id="mosaics" class="section level2">
<h2 class="hasAnchor">
<a href="#mosaics" class="anchor"></a>Mosaics</h2>
<p>The mosaic functions renders an imported JPG or PNG file using LEGO colors and bricks.</p>
<div class="sourceCode" id="cb2"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb2-1" title="1">demo_img =<span class="st"> </span><span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/tempfile">tempfile</a></span>() </a>
<a class="sourceLine" id="cb2-2" title="2"><span class="kw"><a href="https://www.rdocumentation.org/packages/utils/topics/download.file">download.file</a></span>(<span class="st">"http://ryantimpe.com/files/mf_unicorn.PNG"</span>, demo_img, <span class="dt">mode=</span><span class="st">"wb"</span>)</a>
<div class="sourceCode" id="cb2"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb2-1" title="1">demo_img =<span class="st"> </span><span class="kw"><a href="https://rdrr.io/r/base/tempfile.html">tempfile</a></span>() </a>
<a class="sourceLine" id="cb2-2" title="2"><span class="kw"><a href="https://rdrr.io/r/utils/download.file.html">download.file</a></span>(<span class="st">"http://ryantimpe.com/files/mf_unicorn.PNG"</span>, demo_img, <span class="dt">mode=</span><span class="st">"wb"</span>)</a>
<a class="sourceLine" id="cb2-3" title="3"></a>
<a class="sourceLine" id="cb2-4" title="4">mosaic1 &lt;-<span class="st"> </span>png<span class="op">::</span><span class="kw"><a href="https://www.rdocumentation.org/packages/png/topics/readPNG">readPNG</a></span>(demo_img) <span class="op">%&gt;%</span><span class="st"> </span></a>
<a class="sourceLine" id="cb2-4" title="4">mosaic1 &lt;-<span class="st"> </span>png<span class="op">::</span><span class="kw"><a href="https://rdrr.io/pkg/png/man/readPNG.html">readPNG</a></span>(demo_img) <span class="op">%&gt;%</span><span class="st"> </span></a>
<a class="sourceLine" id="cb2-5" title="5"><span class="st"> </span><span class="kw"><a href="reference/image_to_mosaic.html">image_to_mosaic</a></span>(<span class="dt">img_size =</span> <span class="dv">36</span>) <span class="co">#Length of each side of mosaic in "bricks"</span></a>
<a class="sourceLine" id="cb2-6" title="6"></a>
<a class="sourceLine" id="cb2-7" title="7"><span class="co">#Plot 2D mosaic</span></a>
<a class="sourceLine" id="cb2-8" title="8">mosaic1 <span class="op">%&gt;%</span><span class="st"> </span><span class="kw"><a href="reference/build_mosaic.html">build_mosaic</a></span>()</a></code></pre></div>
<p><img src="index_files/figure-html/m1_set-1.png" width="288"></p>
<p><img src="README_files/figure-gfm/m1_set-1.png"><!-- --></p>
<p>In general, any <strong>brickr</strong> function that begins with <code>build_</code> generates a graphical output from a <strong>brickr</strong> list object, generated from other functions.</p>
<div id="customization" class="section level3">
<h3 class="hasAnchor">
<a href="#customization" class="anchor"></a>Customization</h3>
<p><code><a href="reference/image_to_mosaic.html">image_to_mosaic()</a></code> can take a few important arguments. See <code>?image_to_mosaic()</code> for full detail.</p>
<ul>
<li><p><code>img_size</code> Providing a single value, such as <code>48</code>, crops the image to a square. Inputting a 2-element array, <code><a href="https://www.rdocumentation.org/packages/base/topics/c">c(56, 48)</a></code>, will output a rectangular image of <code><a href="https://www.rdocumentation.org/packages/base/topics/c">c(width, height)</a></code>.</p></li>
<li><p><code>color_table</code> &amp; <code>color_palette</code> Options to limit the color of bricks used in mosaics, as not all colors produced by LEGO are readily available. Set <code>color_palette</code> to universal or <code><a href="https://www.rdocumentation.org/packages/base/topics/c">c('universal', 'generic')</a></code> to limit colors to the most common ones. Use a subset of the data frame <code>lego_colors</code> as the <code>color_table</code> to specify a custom palette.</p></li>
<li><p><code>img_size</code> Providing a single value, such as <code>48</code>, crops the image to a square. Inputting a 2-element array, <code><a href="https://rdrr.io/r/base/c.html">c(56, 48)</a></code>, will output a rectangular image of <code><a href="https://rdrr.io/r/base/c.html">c(width, height)</a></code>.</p></li>
<li><p><code>color_table</code> &amp; <code>color_palette</code> Options to limit the color of bricks used in mosaics, as not all colors produced by LEGO are readily available. Set <code>color_palette</code> to universal or <code><a href="https://rdrr.io/r/base/c.html">c('universal', 'generic')</a></code> to limit colors to the most common ones. Use a subset of the data frame <code>lego_colors</code> as the <code>color_table</code> to specify a custom palette.</p></li>
<li><p><code>method</code> Technique used to map image colors into the allowed brick colors. Defaults to cie94`, but other options include cie2000 and euclidean. Also includes the option brickr_classic, used in previous version of the package.</p></li>
</ul>
</div>
</div>
<div id="d-models" class="section level2">
<div id="3d-models" class="section level2">
<h2 class="hasAnchor">
<a href="#d-models" class="anchor"></a>3D Models</h2>
<p>The <code>bricks_from_*</code> series of functions creates 3D models of LEGO bricks from a variety of input formats. These models are rendered using <a href="https://twitter.com/tylermorganwall">Tyler Morgan-Wall</a>s <a href="https://www.rayshader.com/">rayshader</a> package.</p>
<a href="#3d-models" class="anchor"></a>3D Models</h2>
<p>The <code>bricks_from_*</code> series of functions creates 3D models of LEGO bricks from a variety of input formats.</p>
<ul>
<li><p><code><a href="reference/bricks_from_table.html">bricks_from_table()</a></code> &amp; <code><a href="reference/bricks_from_excel.html">bricks_from_excel()</a></code> convert a matrix-shaped table of integers into LEGO bricks. For simple models, this table can be made manually using <code><a href="https://www.rdocumentation.org/packages/base/topics/data.frame">data.frame()</a></code> or <code><a href="https://tibble.tidyverse.org/reference/tribble.html">tibble::tribble()</a></code>. For more advanced models, its recommended you use MS Excel or a .csv file. The left-most column in the table is associated with the Level or z-axis of the model. <code><a href="reference/bricks_from_excel.html">bricks_from_excel()</a></code> is a wrapper function to more easily build models designed using a Microsoft Excel template. Please see this repo: <a href="https://github.com/ryantimpe/brickr_toybox">brickr toybox</a>.</p></li>
<li><p><code><a href="reference/bricks_from_table.html">bricks_from_table()</a></code> &amp; <code><a href="reference/bricks_from_excel.html">bricks_from_excel()</a></code> convert a matrix-shaped table of integers into LEGO bricks. For simple models, this table can be made manually using <code><a href="https://rdrr.io/r/base/data.frame.html">data.frame()</a></code> or <code><a href="https://tibble.tidyverse.org/reference/tribble.html">tibble::tribble()</a></code>. For more advanced models, its recommended you use MS Excel or a .csv file. The left-most column in the table is associated with the Level or z-axis of the model. <code><a href="reference/bricks_from_excel.html">bricks_from_excel()</a></code> is a wrapper function to more easily build models designed using a Microsoft Excel template. Please see this repo: <a href="https://github.com/ryantimpe/brickr_toybox">brickr toybox</a>.</p></li>
<li><p><code><a href="reference/bricks_from_coords.html">bricks_from_coords()</a></code> takes a data frame with <code>x</code>, <code>y</code>, &amp; <code>z</code> integer values, and <code>Color</code> columns, where each combination of x, y, &amp; z is a point in 3-dimensional space. Color must be an official LEGO color name from <code><a href="reference/build_colors.html">build_colors()</a></code>. This format is much more flexible than <code><a href="reference/bricks_from_table.html">bricks_from_table()</a></code> and allows the programmatic development of 3D models.</p></li>
<li><p><code><a href="reference/bricks_from_mosaic.html">bricks_from_mosaic()</a></code> converts a 2D <a href="#mosaics">mosaic</a> object from an image into 3D LEGO models, respectively. <code><a href="reference/bricks_from_rayshader.html">bricks_from_rayshader()</a></code> creates a LEGO model from the same input as <code><a href="https://www.rdocumentation.org/packages/rayshader/topics/plot_3d">rayshader::plot_3d()</a></code>.</p></li>
<li><p><code><a href="reference/bricks_from_mosaic.html">bricks_from_mosaic()</a></code> converts a 2D <a href="#mosaics">mosaic</a> object from an image into 3D LEGO models, respectively. <code><a href="reference/bricks_from_rayshader.html">bricks_from_rayshader()</a></code> creates a LEGO model from the same input as <code><a href="https://rdrr.io/pkg/rayshader/man/plot_3d.html">rayshader::plot_3d()</a></code>.</p></li>
</ul>
<p>Pass the output from any <code>bricks_from_*()</code> function to <code><a href="reference/build_bricks.html">build_bricks()</a></code> to see the 3D model. The <code>brick_res</code> option allows for higher resolution bricks in hd or uhd, which will take longer to render.</p>
<div class="sourceCode" id="cb3"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb3-1" title="1"><span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/library">library</a></span>(brickr)</a>
<p>Pass the output from any <code>bricks_from_*()</code> function to <code><a href="reference/build_bricks.html">build_bricks()</a></code> to see the 3D model. Models are currently rendered in <strong>rgl</strong>. Previous versions of brickr use <a href="https://twitter.com/tylermorganwall">Tyler Morgan-Wall</a>s <a href="https://www.rayshader.com/">rayshader</a> package. This option is still available by passing the output from any <code>bricks_from_*()</code> function to <code><a href="reference/build_bricks_rayshader.html">build_bricks_rayshader()</a></code>. Rayshader can still be used for saving snapshots and creating animations.</p>
<div class="sourceCode" id="cb3"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb3-1" title="1"><span class="kw"><a href="https://rdrr.io/r/base/library.html">library</a></span>(brickr)</a>
<a class="sourceLine" id="cb3-2" title="2"></a>
<a class="sourceLine" id="cb3-3" title="3"><span class="co">#This is a brick</span></a>
<a class="sourceLine" id="cb3-4" title="4">brick &lt;-<span class="st"> </span><span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/data.frame">data.frame</a></span>(</a>
<a class="sourceLine" id="cb3-4" title="4">brick &lt;-<span class="st"> </span><span class="kw"><a href="https://rdrr.io/r/base/data.frame.html">data.frame</a></span>(</a>
<a class="sourceLine" id="cb3-5" title="5"> <span class="dt">Level=</span><span class="st">"A"</span>,</a>
<a class="sourceLine" id="cb3-6" title="6"> <span class="dt">X1 =</span> <span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/rep">rep</a></span>(<span class="dv">3</span>,<span class="dv">4</span>), <span class="co">#The number 3 is the brickrID for 'bright red'</span></a>
<a class="sourceLine" id="cb3-7" title="7"> <span class="dt">X2 =</span> <span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/rep">rep</a></span>(<span class="dv">3</span>,<span class="dv">4</span>)</a>
<a class="sourceLine" id="cb3-6" title="6"> <span class="dt">X1 =</span> <span class="kw"><a href="https://rdrr.io/r/base/rep.html">rep</a></span>(<span class="dv">3</span>,<span class="dv">4</span>), <span class="co">#The number 3 is the brickrID for 'bright red'</span></a>
<a class="sourceLine" id="cb3-7" title="7"> <span class="dt">X2 =</span> <span class="kw"><a href="https://rdrr.io/r/base/rep.html">rep</a></span>(<span class="dv">3</span>,<span class="dv">4</span>)</a>
<a class="sourceLine" id="cb3-8" title="8">)</a>
<a class="sourceLine" id="cb3-9" title="9"></a>
<a class="sourceLine" id="cb3-10" title="10">brick <span class="op">%&gt;%</span><span class="st"> </span></a>
<a class="sourceLine" id="cb3-11" title="11"><span class="st"> </span><span class="kw"><a href="reference/bricks_from_table.html">bricks_from_table</a></span>() <span class="op">%&gt;%</span><span class="st"> </span></a>
<a class="sourceLine" id="cb3-12" title="12"><span class="st"> </span><span class="kw"><a href="reference/build_bricks.html">build_bricks</a></span>(<span class="dt">brick_res =</span> <span class="st">"uhd"</span>)</a>
<a class="sourceLine" id="cb3-12" title="12"><span class="st"> </span><span class="kw"><a href="reference/build_bricks.html">build_bricks</a></span>()</a>
<a class="sourceLine" id="cb3-13" title="13"></a>
<a class="sourceLine" id="cb3-14" title="14">rayshader<span class="op">::</span><span class="kw"><a href="https://www.rdocumentation.org/packages/rayshader/topics/render_snapshot">render_snapshot</a></span>( <span class="dt">clear =</span> <span class="ot">TRUE</span>)</a></code></pre></div>
<p><img src="index_files/figure-html/bricks_1-1.png" width="288"></p>
<a class="sourceLine" id="cb3-14" title="14"><span class="co">#Rotate the default view for a better snapshot</span></a>
<a class="sourceLine" id="cb3-15" title="15">rgl<span class="op">::</span><span class="kw"><a href="https://rdrr.io/pkg/rgl/man/par3d.html">par3d</a></span>(<span class="dt">userMatrix =</span> rgl<span class="op">::</span><span class="kw"><a href="https://rdrr.io/pkg/rgl/man/matrices.html">rotate3d</a></span>(rgl<span class="op">::</span><span class="kw"><a href="https://rdrr.io/pkg/rgl/man/par3d.html">par3d</a></span>(<span class="st">"userMatrix"</span>), <span class="fl">0.75</span><span class="op">*</span>pi, <span class="dv">0</span>, <span class="dv">0</span> ,<span class="dv">1</span>))</a></code></pre></div>
<p><img src="README_files/figure-gfm/bricks_1-1.png"><!-- --></p>
<div id="stacking-bricks" class="section level3">
<h3 class="hasAnchor">
<a href="#stacking-bricks" class="anchor"></a>Stacking bricks</h3>
@@ -235,24 +239,25 @@
<a class="sourceLine" id="cb4-30" title="30"> </a>
<a class="sourceLine" id="cb4-31" title="31">my_first_model <span class="op">%&gt;%</span><span class="st"> </span></a>
<a class="sourceLine" id="cb4-32" title="32"><span class="st"> </span><span class="kw"><a href="reference/bricks_from_table.html">bricks_from_table</a></span>(brick_colors) <span class="op">%&gt;%</span><span class="st"> </span></a>
<a class="sourceLine" id="cb4-33" title="33"><span class="st"> </span><span class="kw"><a href="reference/build_bricks.html">build_bricks</a></span>(<span class="dt">theta =</span> <span class="dv">210</span>, <span class="dt">brick_res =</span> <span class="st">"uhd"</span>)</a>
<a class="sourceLine" id="cb4-33" title="33"><span class="st"> </span><span class="kw"><a href="reference/build_bricks.html">build_bricks</a></span>()</a>
<a class="sourceLine" id="cb4-34" title="34"></a>
<a class="sourceLine" id="cb4-35" title="35">rayshader<span class="op">::</span><span class="kw"><a href="https://www.rdocumentation.org/packages/rayshader/topics/render_snapshot">render_snapshot</a></span>(<span class="dt">clear =</span> <span class="ot">TRUE</span>)</a></code></pre></div>
<p><img src="index_files/figure-html/bricks_5-1.png" width="384"></p>
<a class="sourceLine" id="cb4-35" title="35"><span class="co">#Rotate the default view for a better snapshot</span></a>
<a class="sourceLine" id="cb4-36" title="36">rgl<span class="op">::</span><span class="kw"><a href="https://rdrr.io/pkg/rgl/man/par3d.html">par3d</a></span>(<span class="dt">userMatrix =</span> rgl<span class="op">::</span><span class="kw"><a href="https://rdrr.io/pkg/rgl/man/matrices.html">rotate3d</a></span>(rgl<span class="op">::</span><span class="kw"><a href="https://rdrr.io/pkg/rgl/man/par3d.html">par3d</a></span>(<span class="st">"userMatrix"</span>), <span class="fl">1.1</span><span class="op">*</span>pi, <span class="dv">0</span>, <span class="dv">0</span> ,<span class="dv">1</span>))</a></code></pre></div>
<p><img src="README_files/figure-gfm/bricks_5-1.png"><!-- --></p>
</div>
<div id="programmatically-build-models" class="section level3">
<h3 class="hasAnchor">
<a href="#programmatically-build-models" class="anchor"></a>Programmatically build models</h3>
<p>Use <code><a href="reference/bricks_from_coords.html">bricks_from_coords()</a></code> to programmatically build 3D LEGO models instead of manually drawing them in a spreadsheet or table. Here you must provide whole number coordinates for x, y, and z, along with an official LEGO color name for each point.</p>
<div class="sourceCode" id="cb5"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb5-1" title="1">radius &lt;-<span class="st"> </span><span class="dv">4</span></a>
<a class="sourceLine" id="cb5-2" title="2">sphere_coords &lt;-<span class="st"> </span><span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/expand.grid">expand.grid</a></span>(</a>
<a class="sourceLine" id="cb5-3" title="3"> <span class="dt">x =</span> <span class="dv">1</span><span class="op">:</span><span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/Round">round</a></span>((radius<span class="op">*</span><span class="fl">2.5</span>)),</a>
<a class="sourceLine" id="cb5-4" title="4"> <span class="dt">y =</span> <span class="dv">1</span><span class="op">:</span><span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/Round">round</a></span>((radius<span class="op">*</span><span class="fl">2.5</span>)),</a>
<a class="sourceLine" id="cb5-5" title="5"> <span class="dt">z =</span> <span class="dv">1</span><span class="op">:</span><span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/Round">round</a></span>((radius<span class="op">/</span>(<span class="dv">6</span><span class="op">/</span><span class="dv">5</span>)<span class="op">*</span><span class="fl">2.5</span>)) <span class="co">#A brick is 6/5 taller than it is wide/deep</span></a>
<a class="sourceLine" id="cb5-2" title="2">sphere_coords &lt;-<span class="st"> </span><span class="kw"><a href="https://rdrr.io/r/base/expand.grid.html">expand.grid</a></span>(</a>
<a class="sourceLine" id="cb5-3" title="3"> <span class="dt">x =</span> <span class="dv">1</span><span class="op">:</span><span class="kw"><a href="https://rdrr.io/r/base/Round.html">round</a></span>((radius<span class="op">*</span><span class="fl">2.5</span>)),</a>
<a class="sourceLine" id="cb5-4" title="4"> <span class="dt">y =</span> <span class="dv">1</span><span class="op">:</span><span class="kw"><a href="https://rdrr.io/r/base/Round.html">round</a></span>((radius<span class="op">*</span><span class="fl">2.5</span>)),</a>
<a class="sourceLine" id="cb5-5" title="5"> <span class="dt">z =</span> <span class="dv">1</span><span class="op">:</span><span class="kw"><a href="https://rdrr.io/r/base/Round.html">round</a></span>((radius<span class="op">/</span>(<span class="dv">6</span><span class="op">/</span><span class="dv">5</span>)<span class="op">*</span><span class="fl">2.5</span>)) <span class="co">#A brick is 6/5 taller than it is wide/deep</span></a>
<a class="sourceLine" id="cb5-6" title="6">) <span class="op">%&gt;%</span></a>
<a class="sourceLine" id="cb5-7" title="7"><span class="st"> </span><span class="kw">mutate</span>(</a>
<a class="sourceLine" id="cb5-8" title="8"> <span class="co">#Distance of each coordinate from center</span></a>
<a class="sourceLine" id="cb5-9" title="9"> <span class="dt">dist =</span> (((x<span class="op">-</span><span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/mean">mean</a></span>(x))<span class="op">^</span><span class="dv">2</span> <span class="op">+</span><span class="st"> </span>(y<span class="op">-</span><span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/mean">mean</a></span>(y))<span class="op">^</span><span class="dv">2</span> <span class="op">+</span><span class="st"> </span>(z<span class="op">-</span><span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/mean">mean</a></span>(z))<span class="op">^</span><span class="dv">2</span>)<span class="op">^</span>(<span class="dv">1</span><span class="op">/</span><span class="dv">2</span>)),</a>
<a class="sourceLine" id="cb5-9" title="9"> <span class="dt">dist =</span> (((x<span class="op">-</span><span class="kw"><a href="https://rdrr.io/r/base/mean.html">mean</a></span>(x))<span class="op">^</span><span class="dv">2</span> <span class="op">+</span><span class="st"> </span>(y<span class="op">-</span><span class="kw"><a href="https://rdrr.io/r/base/mean.html">mean</a></span>(y))<span class="op">^</span><span class="dv">2</span> <span class="op">+</span><span class="st"> </span>(z<span class="op">-</span><span class="kw"><a href="https://rdrr.io/r/base/mean.html">mean</a></span>(z))<span class="op">^</span><span class="dv">2</span>)<span class="op">^</span>(<span class="dv">1</span><span class="op">/</span><span class="dv">2</span>)),</a>
<a class="sourceLine" id="cb5-10" title="10"> <span class="dt">Color =</span> <span class="kw">case_when</span>(</a>
<a class="sourceLine" id="cb5-11" title="11"> <span class="co">#Yellow stripes on the surface with a 2to4 thickness</span></a>
<a class="sourceLine" id="cb5-12" title="12"> <span class="kw">between</span>(dist, (radius<span class="dv">-1</span>), radius) <span class="op">&amp;</span><span class="st"> </span>(x<span class="op">+</span>y<span class="op">+</span>z) <span class="op">%%</span><span class="st"> </span><span class="dv">6</span> <span class="op">%in%</span><span class="st"> </span><span class="dv">0</span><span class="op">:</span><span class="dv">1</span> <span class="op">~</span><span class="st"> "Bright yellow"</span>,</a>
@@ -262,10 +267,12 @@
<a class="sourceLine" id="cb5-16" title="16"></a>
<a class="sourceLine" id="cb5-17" title="17">sphere_coords <span class="op">%&gt;%</span><span class="st"> </span></a>
<a class="sourceLine" id="cb5-18" title="18"><span class="st"> </span><span class="kw"><a href="reference/bricks_from_coords.html">bricks_from_coords</a></span>() <span class="op">%&gt;%</span><span class="st"> </span></a>
<a class="sourceLine" id="cb5-19" title="19"><span class="st"> </span><span class="kw"><a href="reference/build_bricks.html">build_bricks</a></span>(<span class="dt">brick_res =</span> <span class="st">"uhd"</span>, <span class="dt">phi =</span> <span class="dv">30</span>, <span class="dt">theta =</span> <span class="dv">30</span>)</a>
<a class="sourceLine" id="cb5-19" title="19"><span class="st"> </span><span class="kw"><a href="reference/build_bricks.html">build_bricks</a></span>(<span class="dt">outline_bricks =</span> <span class="ot">TRUE</span>, <span class="dt">rgl_lit =</span> <span class="ot">FALSE</span>)</a>
<a class="sourceLine" id="cb5-20" title="20"></a>
<a class="sourceLine" id="cb5-21" title="21">rayshader<span class="op">::</span><span class="kw"><a href="https://www.rdocumentation.org/packages/rayshader/topics/render_snapshot">render_snapshot</a></span>(<span class="dt">clear =</span> <span class="ot">TRUE</span>)</a></code></pre></div>
<p><img src="index_files/figure-html/bricks_6-1.png" width="480"></p>
<a class="sourceLine" id="cb5-21" title="21"></a>
<a class="sourceLine" id="cb5-22" title="22">rgl<span class="op">::</span><span class="kw"><a href="https://rdrr.io/pkg/rgl/man/par3d.html">par3d</a></span>(<span class="dt">userMatrix =</span> rgl<span class="op">::</span><span class="kw"><a href="https://rdrr.io/pkg/rgl/man/matrices.html">rotate3d</a></span>(rgl<span class="op">::</span><span class="kw"><a href="https://rdrr.io/pkg/rgl/man/par3d.html">par3d</a></span>(<span class="st">"userMatrix"</span>), <span class="fl">1.1</span><span class="op">*</span>pi<span class="op">/</span><span class="dv">4</span>, <span class="dv">0</span>, <span class="dv">0</span> ,<span class="dv">1</span>))</a></code></pre></div>
<p><img src="README_files/figure-gfm/bricks_6-1.png"><!-- --></p>
<p>The option <code>outline_bricks = TRUE</code> adds a black outline around the edges of the bricks. Setting <code>rgl_lit = FALSE</code> turns off automated lighting effects from rgl. Changing these two inputs together renders bricks in a more cartoon fashion.</p>
</div>
<div id="examples" class="section level3">
<h3 class="hasAnchor">
@@ -286,7 +293,7 @@
<h2 class="hasAnchor">
<a href="#charts" class="anchor"></a>Charts</h2>
<p>brickr includes functions to render <a href="https://ggplot2.tidyverse.org/">ggplot2</a> bar charts as bricks with LEGO color themes. The main function is <code><a href="reference/geom_brick_col.html">geom_brick_col()</a></code>, which is the brickr equivalent of <code>geom_col()</code>. Additional functions are highly recommended to ensure that proper the chart is rendered in the proper functions and proportions.</p>
<div class="sourceCode" id="cb6"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb6-1" title="1">df &lt;-<span class="st"> </span><span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/data.frame">data.frame</a></span>(<span class="dt">trt =</span> <span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/c">c</a></span>(<span class="st">"a"</span>, <span class="st">"b"</span>, <span class="st">"c"</span>), <span class="dt">outcome =</span> <span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/c">c</a></span>(<span class="fl">2.3</span>, <span class="fl">1.9</span>, <span class="fl">3.2</span>))</a>
<div class="sourceCode" id="cb6"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb6-1" title="1">df &lt;-<span class="st"> </span><span class="kw"><a href="https://rdrr.io/r/base/data.frame.html">data.frame</a></span>(<span class="dt">trt =</span> <span class="kw"><a href="https://rdrr.io/r/base/c.html">c</a></span>(<span class="st">"a"</span>, <span class="st">"b"</span>, <span class="st">"c"</span>), <span class="dt">outcome =</span> <span class="kw"><a href="https://rdrr.io/r/base/c.html">c</a></span>(<span class="fl">2.3</span>, <span class="fl">1.9</span>, <span class="fl">3.2</span>))</a>
<a class="sourceLine" id="cb6-2" title="2"></a>
<a class="sourceLine" id="cb6-3" title="3"><span class="co">#For official LEGO colors, use with scale_fill_brick and theme_brick.</span></a>
<a class="sourceLine" id="cb6-4" title="4"><span class="kw">ggplot</span>(df, <span class="kw">aes</span>(trt, outcome)) <span class="op">+</span></a>
@@ -294,9 +301,9 @@
<a class="sourceLine" id="cb6-6" title="6"><span class="st"> </span><span class="kw"><a href="reference/scale_fill_brick.html">scale_fill_brick</a></span>() <span class="op">+</span></a>
<a class="sourceLine" id="cb6-7" title="7"><span class="st"> </span><span class="kw"><a href="reference/coord-brick.html">coord_brick</a></span>() <span class="op">+</span></a>
<a class="sourceLine" id="cb6-8" title="8"><span class="st"> </span><span class="kw"><a href="reference/theme_brick.html">theme_brick</a></span>()</a></code></pre></div>
<p><img src="index_files/figure-html/geom_brick-1.png" width="384"></p>
<p><img src="README_files/figure-gfm/geom_brick-1.png"><!-- --></p>
<p>Both <code><a href="reference/scale_fill_brick.html">scale_fill_brick()</a></code> and <code><a href="reference/theme_brick.html">theme_brick()</a></code> take an input brick_theme, which ensures all colors match official LEGO brick colors. See <code><a href="reference/build_themes.html">build_themes()</a></code> for a sample of all available brick theme.</p>
<div class="sourceCode" id="cb7"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb7-1" title="1">df &lt;-<span class="st"> </span><span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/data.frame">data.frame</a></span>(<span class="dt">trt =</span> letters[<span class="dv">1</span><span class="op">:</span><span class="dv">6</span>], <span class="dt">outcome =</span> <span class="kw"><a href="https://www.rdocumentation.org/packages/stats/topics/Normal">rnorm</a></span>(<span class="dv">6</span>, <span class="dt">mean =</span> <span class="dv">5</span>, <span class="dt">sd =</span> <span class="dv">2</span>))</a>
<div class="sourceCode" id="cb7"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb7-1" title="1">df &lt;-<span class="st"> </span><span class="kw"><a href="https://rdrr.io/r/base/data.frame.html">data.frame</a></span>(<span class="dt">trt =</span> letters[<span class="dv">1</span><span class="op">:</span><span class="dv">6</span>], <span class="dt">outcome =</span> <span class="kw"><a href="https://rdrr.io/r/stats/Normal.html">rnorm</a></span>(<span class="dv">6</span>, <span class="dt">mean =</span> <span class="dv">5</span>, <span class="dt">sd =</span> <span class="dv">2</span>))</a>
<a class="sourceLine" id="cb7-2" title="2"></a>
<a class="sourceLine" id="cb7-3" title="3">use_theme &lt;-<span class="st"> "hp"</span></a>
<a class="sourceLine" id="cb7-4" title="4"></a>
@@ -306,7 +313,7 @@
<a class="sourceLine" id="cb7-8" title="8"><span class="st"> </span><span class="kw"><a href="reference/coord-brick.html">coord_brick_flip</a></span>() <span class="op">+</span></a>
<a class="sourceLine" id="cb7-9" title="9"><span class="st"> </span><span class="kw"><a href="reference/theme_brick.html">theme_brick</a></span>(use_theme) <span class="op">+</span></a>
<a class="sourceLine" id="cb7-10" title="10"><span class="st"> </span><span class="kw">theme</span>(<span class="dt">legend.position =</span> <span class="st">"none"</span>)</a></code></pre></div>
<p><img src="index_files/figure-html/geom_brick2-1.png" width="384"></p>
<p><img src="README_files/figure-gfm/geom_brick2-1.png"><!-- --></p>
</div>
<div id="irl" class="section level2">
<h2 class="hasAnchor">
@@ -317,17 +324,18 @@
<a href="#instructions" class="anchor"></a>Instructions</h3>
<p>Use <code><a href="reference/build_instructions.html">build_instructions()</a></code> to break the mosaics and 3D models into easier-to-read steps for building the set. This defaults to 6 steps, but passing any integer value will generate that many steps.</p>
<div class="sourceCode" id="cb8"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb8-1" title="1">mosaic1 <span class="op">%&gt;%</span><span class="st"> </span><span class="kw"><a href="reference/build_instructions.html">build_instructions</a></span>(<span class="dv">9</span>)</a></code></pre></div>
<p><img src="index_files/figure-html/m1_instructions-1.png" width="768"></p>
<p><img src="README_files/figure-gfm/m1_instructions-1.png"><!-- --></p>
</div>
<div id="piece-list-and-count" class="section level3">
<h3 class="hasAnchor">
<a href="#piece-list-and-count" class="anchor"></a>Piece list and count</h3>
<p>Use <code><a href="reference/build_pieces.html">build_pieces()</a></code> to generate a graphic and count of all required plates or bricks (for stacked mosaics). These are sorted by color and size for easy purchase on LEGO.coms <a href="https://shop.lego.com/en-US/Pick-a-Brick">Pick-a-Brick</a> section using the advanced search option. Alternatively, use <code>table_pieces()</code> to produce a data frame table of all required bricks.</p>
<div class="sourceCode" id="cb9"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb9-1" title="1">mosaic1 <span class="op">%&gt;%</span><span class="st"> </span><span class="kw"><a href="reference/build_pieces.html">build_pieces</a></span>()</a></code></pre></div>
<p><img src="index_files/figure-html/m1_pieces-1.png" width="768"></p>
<p><img src="README_files/figure-gfm/m1_pieces-1.png"><!-- --></p>
</div>
</div>
</div>
</div>
<div class="col-md-3 hidden-xs hidden-sm" id="sidebar">
@@ -354,7 +362,7 @@
</ul>
</div>
<div class="dev-status">
<div class="dev-status">
<h2>Dev status</h2>
<ul class="list-unstyled">
<li><a href="https://www.tidyverse.org/lifecycle/#maturing"><img src="https://img.shields.io/badge/lifecycle-maturing-blue.svg" alt="Lifecycle: maturing"></a></li>
@@ -362,7 +370,6 @@
</ul>
</div>
</div>
</div>
@@ -371,12 +378,14 @@
</div>
<div class="pkgdown">
<p>Site built with <a href="https://pkgdown.r-lib.org/">pkgdown</a> 1.3.0.</p>
<p>Site built with <a href="https://pkgdown.r-lib.org/">pkgdown</a> 1.4.1.</p>
</div>
</footer>
</div>
</body>
</html>
+50 -35
View File
@@ -15,21 +15,25 @@
<link rel="apple-touch-icon" type="image/png" sizes="120x120" href="../apple-touch-icon-120x120.png" />
<link rel="apple-touch-icon" type="image/png" sizes="76x76" href="../apple-touch-icon-76x76.png" />
<link rel="apple-touch-icon" type="image/png" sizes="60x60" href="../apple-touch-icon-60x60.png" />
<!-- jquery -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js" integrity="sha256-FgpCb/KJQlLNfOu91ta32o/NMZxltwRo8QtmkMRdAu8=" crossorigin="anonymous"></script>
<!-- Bootstrap -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha256-916EbMg70RQy9LHiGkXzG8hSg9EdNy97GazNG/aiY1w=" crossorigin="anonymous" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha256-U5ZEeKfGNOja007MMD3YBI0A3OSZOQbeG6z2f2Y0hu8=" crossorigin="anonymous"></script>
<!-- Font Awesome icons -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css" integrity="sha256-eZrrJcwDc/3uDhsdt61sL2oOBY362qM3lon1gyExkL0=" crossorigin="anonymous" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.7.1/css/all.min.css" integrity="sha256-nAmazAk6vS34Xqo0BSrTb+abbtFlgsFK7NKSi6o7Y78=" crossorigin="anonymous" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.7.1/css/v4-shims.min.css" integrity="sha256-6qHlizsOWFskGlwVOKuns+D1nB6ssZrHQrNj1wGplHc=" crossorigin="anonymous" />
<!-- clipboard.js -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/clipboard.js/2.0.4/clipboard.min.js" integrity="sha256-FiZwavyI2V6+EXO1U+xzLG3IKldpiTFf3153ea9zikQ=" crossorigin="anonymous"></script>
<!-- sticky kit -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/sticky-kit/1.1.3/sticky-kit.min.js" integrity="sha256-c4Rlo1ZozqTPE2RLuvbusY3+SU1pQaJC0TjuhygMipw=" crossorigin="anonymous"></script>
<!-- headroom.js -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/headroom/0.9.4/headroom.min.js" integrity="sha256-DJFC1kqIhelURkuza0AvYal5RxMtpzLjFhsnVIeuk+U=" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/headroom/0.9.4/jQuery.headroom.min.js" integrity="sha256-ZX/yNShbjqsohH1k95liqY9Gd8uOiE1S4vZc+9KQ1K4=" crossorigin="anonymous"></script>
<!-- pkgdown -->
<link href="../pkgdown.css" rel="stylesheet">
@@ -39,13 +43,14 @@
<link href="../extra.css" rel="stylesheet">
<meta property="og:title" content="Changelog" />
<meta property="og:title" content="Changelog" />
<meta property="og:image" content="http://brickr.org/logo.png" />
<meta name="twitter:card" content="summary" />
<!-- mathjax -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/MathJax.js" integrity="sha256-nvJJv9wWKEm88qvoQl9ekL2J+k/RWIsaSScxxlsrv8k=" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/config/TeX-AMS-MML_HTMLorMML.js" integrity="sha256-84DKXVJXs0/F8OTMzX4UR909+jtl4G7SPypPavF+GfA=" crossorigin="anonymous"></script>
@@ -56,6 +61,7 @@
<![endif]-->
</head>
<body>
@@ -72,7 +78,7 @@
</button>
<span class="navbar-brand">
<a class="navbar-link" href="../index.html">brickr</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.1.0.9024</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.2.0</span>
</span>
</div>
@@ -80,7 +86,7 @@
<ul class="nav navbar-nav">
<li>
<a href="../index.html">
<span class="fa fa-home fa-lg"></span>
<span class="fas fa fas fa-home fa-lg"></span>
</a>
</li>
@@ -115,11 +121,10 @@
<a href="../news/index.html">Changelog</a>
</li>
</ul>
<ul class="nav navbar-nav navbar-right">
<li>
<a href="https://github.com/ryantimpe/brickr">
<span class="fa fa-github fa-lg"></span>
<span class="fab fa fab fa-github fa-lg"></span>
</a>
</li>
@@ -130,6 +135,7 @@
</div><!--/.navbar -->
</header>
<div class="row">
@@ -139,17 +145,40 @@
<small>Source: <a href='https://github.com/ryantimpe/brickr/blob/master/NEWS.md'><code>NEWS.md</code></a></small>
</div>
<div id="brickr-0110000" class="section level1">
<div id="brickr-020" class="section level1">
<h1 class="page-header">
<a href="#brickr-0110000" class="anchor"></a>brickr 0.1.1.0000</h1>
<a href="#brickr-020" class="anchor"></a>brickr 0.2.0</h1>
<ul>
<li><p><strong>Breaking:</strong> Pretty much <em>EVERY</em> function. Seriously, check out the README and start fresh.</p></li>
<li><p><strong>Breaking:</strong> Data “lego_colors.rda” has been updated with more accurate RGB values and new <code>brickrID</code> numbers. This will impact previously created mosaics and 3D models.</p></li>
<li>Lots of bug fixes. More to come.</li>
</ul>
<div id="documentation" class="section level2">
<h2 class="hasAnchor">
<a href="#documentation" class="anchor"></a>Documentation</h2>
<ul>
<li>Issues and bugs are now actively tracked on <a href="https://github.com/ryantimpe/brickr/issues">GitHub Issues</a>.</li>
</ul>
</div>
<div id="3d-models" class="section level2">
<h2 class="hasAnchor">
<a href="<a href='https://github.com/ryantimpe/brickr/issues/3'>#3</a>d-models" class="anchor"></a>3D Models</h2>
<ul>
<li>
<code><a href="../reference/build_bricks.html">build_bricks()</a></code> now renders models in {rgl}, rather than {rayshader}. Most options for the rendering have changed. Use <code>build_brick_rayshader()</code> for previous output.</li>
</ul>
<hr>
</div>
</div>
<div id="brickr-011" class="section level1">
<h1 class="page-header">
<a href="#brickr-011" class="anchor"></a>brickr 0.1.1</h1>
<ul>
<li><p><strong>Breaking:</strong> Pretty much <em>EVERY</em> function. Seriously, check out the README and start fresh.</p></li>
<li><p><strong>Breaking:</strong> Data “lego_colors.rda” has been updated with more accurate RGB values and new <code>brickrID</code> numbers. This will impact previously created mosaics and 3D models.</p></li>
</ul>
<div id="documentation-1" class="section level2">
<h2 class="hasAnchor">
<a href="#documentation-1" class="anchor"></a>Documentation</h2>
<ul>
<li>pkgdown site</li>
<li>Vignettes</li>
</ul>
@@ -166,9 +195,9 @@
<li>3D mosaics have been rewritten as 3D models using plates with <code><a href="../reference/bricks_from_mosaic.html">bricks_from_mosaic()</a></code>.</li>
</ul>
</div>
<div id="3d-models" class="section level2">
<div id="3d-models-1" class="section level2">
<h2 class="hasAnchor">
<a href="<a href='https://github.com/ryantimpe/brickr/issues/3'>#3</a>d-models" class="anchor"></a>3D Models</h2>
<a href="<a href='https://github.com/ryantimpe/brickr/issues/3'>#3</a>d-models-1" class="anchor"></a>3D Models</h2>
<ul>
<li>
<code>brick_res</code> input options to render models in higher definition (sd, hd, uhd)</li>
@@ -192,25 +221,6 @@
<li>
<code>scale_fill_brick</code> and <code>theme_brick</code> for different LEGO color options.</li>
</ul>
</div>
<div id="to-do" class="section level2">
<h2 class="hasAnchor">
<a href="#to-do" class="anchor"></a>TO DO</h2>
<ul>
<li>ggplot - continuous scale</li>
<li>Vignettes
<ul>
<li>IRL</li>
</ul>
</li>
<li>Check() passing</li>
</ul>
<p>** Lower Priority**</p>
<ul>
<li>Negative bricks are “underside”</li>
<li>bricks_from_models</li>
<li>ggplot plays nicely with rayshader::plot_gg()</li>
</ul>
<hr>
</div>
</div>
@@ -239,7 +249,8 @@
<div id="tocnav">
<h2>Contents</h2>
<ul class="nav nav-pills nav-stacked">
<li><a href="#brickr-0110000">0.1.1.0000</a></li>
<li><a href="#brickr-020">0.2.0</a></li>
<li><a href="#brickr-011">0.1.1</a></li>
<li><a href="#brickr-0009200">0.0.0.9200</a></li>
<li><a href="#brickr-0009150">0.0.0.9150</a></li>
</ul>
@@ -248,19 +259,23 @@
</div>
<footer>
<div class="copyright">
<p>Developed by Ryan Timpe.</p>
</div>
<div class="pkgdown">
<p>Site built with <a href="https://pkgdown.r-lib.org/">pkgdown</a> 1.3.0.</p>
<p>Site built with <a href="https://pkgdown.r-lib.org/">pkgdown</a> 1.4.1.</p>
</div>
</footer>
</div>
</body>
</html>
+33 -13
View File
@@ -21,8 +21,6 @@ body > .container {
display: flex;
height: 100%;
flex-direction: column;
padding-top: 60px;
}
body > .container .row {
@@ -102,21 +100,13 @@ a.anchor {
margin-top: -40px;
}
/* Static header placement on mobile devices */
@media (max-width: 767px) {
.navbar-fixed-top {
position: absolute;
}
.navbar {
padding: 0;
}
}
/* Sidebar --------------------------*/
#sidebar {
margin-top: 30px;
position: -webkit-sticky;
position: sticky;
top: 70px;
}
#sidebar h2 {
font-size: 1.5em;
@@ -133,6 +123,9 @@ a.anchor {
.orcid {
height: 16px;
/* margins are required by official ORCID trademark and display guidelines */
margin-left:4px;
margin-right:4px;
vertical-align: middle;
}
@@ -222,6 +215,19 @@ a.sourceLine:hover {
visibility: visible;
}
/* headroom.js ------------------------ */
.headroom {
will-change: transform;
transition: transform 200ms linear;
}
.headroom--pinned {
transform: translateY(0%);
}
.headroom--unpinned {
transform: translateY(-100%);
}
/* mark.js ----------------------------*/
mark {
@@ -234,3 +240,17 @@ mark {
.html-widget {
margin-bottom: 10px;
}
/* fontawesome ------------------------ */
.fab {
font-family: "Font Awesome 5 Brands" !important;
}
/* don't display links in code chunks when printing */
/* source: https://stackoverflow.com/a/10781533 */
@media print {
code a:link:after, code a:visited:after {
content: "";
}
}
+6 -8
View File
@@ -2,14 +2,12 @@
(function($) {
$(function() {
$("#sidebar")
.stick_in_parent({offset_top: 40})
.on('sticky_kit:bottom', function(e) {
$(this).parent().css('position', 'static');
})
.on('sticky_kit:unbottom', function(e) {
$(this).parent().css('position', 'relative');
});
$('.navbar-fixed-top').headroom();
$('body').css('padding-top', $('.navbar').height() + 10);
$(window).resize(function(){
$('body').css('padding-top', $('.navbar').height() + 10);
});
$('body').scrollspy({
target: '#sidebar',
+1 -1
View File
@@ -1,5 +1,5 @@
pandoc: '2.7'
pkgdown: 1.3.0
pkgdown: 1.4.1
pkgdown_sha: ~
articles:
graphs: graphs.html
+22 -14
View File
@@ -15,21 +15,25 @@
<link rel="apple-touch-icon" type="image/png" sizes="120x120" href="../apple-touch-icon-120x120.png" />
<link rel="apple-touch-icon" type="image/png" sizes="76x76" href="../apple-touch-icon-76x76.png" />
<link rel="apple-touch-icon" type="image/png" sizes="60x60" href="../apple-touch-icon-60x60.png" />
<!-- jquery -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js" integrity="sha256-FgpCb/KJQlLNfOu91ta32o/NMZxltwRo8QtmkMRdAu8=" crossorigin="anonymous"></script>
<!-- Bootstrap -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha256-916EbMg70RQy9LHiGkXzG8hSg9EdNy97GazNG/aiY1w=" crossorigin="anonymous" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha256-U5ZEeKfGNOja007MMD3YBI0A3OSZOQbeG6z2f2Y0hu8=" crossorigin="anonymous"></script>
<!-- Font Awesome icons -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css" integrity="sha256-eZrrJcwDc/3uDhsdt61sL2oOBY362qM3lon1gyExkL0=" crossorigin="anonymous" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.7.1/css/all.min.css" integrity="sha256-nAmazAk6vS34Xqo0BSrTb+abbtFlgsFK7NKSi6o7Y78=" crossorigin="anonymous" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.7.1/css/v4-shims.min.css" integrity="sha256-6qHlizsOWFskGlwVOKuns+D1nB6ssZrHQrNj1wGplHc=" crossorigin="anonymous" />
<!-- clipboard.js -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/clipboard.js/2.0.4/clipboard.min.js" integrity="sha256-FiZwavyI2V6+EXO1U+xzLG3IKldpiTFf3153ea9zikQ=" crossorigin="anonymous"></script>
<!-- sticky kit -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/sticky-kit/1.1.3/sticky-kit.min.js" integrity="sha256-c4Rlo1ZozqTPE2RLuvbusY3+SU1pQaJC0TjuhygMipw=" crossorigin="anonymous"></script>
<!-- headroom.js -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/headroom/0.9.4/headroom.min.js" integrity="sha256-DJFC1kqIhelURkuza0AvYal5RxMtpzLjFhsnVIeuk+U=" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/headroom/0.9.4/jQuery.headroom.min.js" integrity="sha256-ZX/yNShbjqsohH1k95liqY9Gd8uOiE1S4vZc+9KQ1K4=" crossorigin="anonymous"></script>
<!-- pkgdown -->
<link href="../pkgdown.css" rel="stylesheet">
@@ -39,15 +43,15 @@
<link href="../extra.css" rel="stylesheet">
<meta property="og:title" content="GeomBrick — CoordBrick" />
<meta property="og:description" content="ggproto for brickr geoms" />
<meta property="og:image" content="http://brickr.org/logo.png" />
<meta name="twitter:card" content="summary" />
<!-- mathjax -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/MathJax.js" integrity="sha256-nvJJv9wWKEm88qvoQl9ekL2J+k/RWIsaSScxxlsrv8k=" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/config/TeX-AMS-MML_HTMLorMML.js" integrity="sha256-84DKXVJXs0/F8OTMzX4UR909+jtl4G7SPypPavF+GfA=" crossorigin="anonymous"></script>
@@ -58,6 +62,7 @@
<![endif]-->
</head>
<body>
@@ -74,7 +79,7 @@
</button>
<span class="navbar-brand">
<a class="navbar-link" href="../index.html">brickr</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.1.0.9024</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.2.0</span>
</span>
</div>
@@ -82,7 +87,7 @@
<ul class="nav navbar-nav">
<li>
<a href="../index.html">
<span class="fa fa-home fa-lg"></span>
<span class="fas fa fas fa-home fa-lg"></span>
</a>
</li>
@@ -117,11 +122,10 @@
<a href="../news/index.html">Changelog</a>
</li>
</ul>
<ul class="nav navbar-nav navbar-right">
<li>
<a href="https://github.com/ryantimpe/brickr">
<span class="fa fa-github fa-lg"></span>
<span class="fab fa fab fa-github fa-lg"></span>
</a>
</li>
@@ -132,6 +136,7 @@
</div><!--/.navbar -->
</header>
<div class="row">
@@ -143,36 +148,39 @@
</div>
<div class="ref-description">
<p>ggproto for brickr geoms</p>
</div>
<pre class="usage"><span class='fu'>draw_key_brick</span>(<span class='no'>data</span>, <span class='no'>params</span>, <span class='no'>size</span>)</pre>
</div>
<div class="col-md-3 hidden-xs hidden-sm" id="sidebar">
<h2>Contents</h2>
<ul class="nav nav-pills nav-stacked">
</ul>
</ul>
</div>
</div>
<footer>
<div class="copyright">
<p>Developed by Ryan Timpe.</p>
</div>
<div class="pkgdown">
<p>Site built with <a href="https://pkgdown.r-lib.org/">pkgdown</a> 1.3.0.</p>
<p>Site built with <a href="https://pkgdown.r-lib.org/">pkgdown</a> 1.4.1.</p>
</div>
</footer>
</div>
</body>
</html>
+22 -14
View File
@@ -15,21 +15,25 @@
<link rel="apple-touch-icon" type="image/png" sizes="120x120" href="../apple-touch-icon-120x120.png" />
<link rel="apple-touch-icon" type="image/png" sizes="76x76" href="../apple-touch-icon-76x76.png" />
<link rel="apple-touch-icon" type="image/png" sizes="60x60" href="../apple-touch-icon-60x60.png" />
<!-- jquery -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js" integrity="sha256-FgpCb/KJQlLNfOu91ta32o/NMZxltwRo8QtmkMRdAu8=" crossorigin="anonymous"></script>
<!-- Bootstrap -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha256-916EbMg70RQy9LHiGkXzG8hSg9EdNy97GazNG/aiY1w=" crossorigin="anonymous" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha256-U5ZEeKfGNOja007MMD3YBI0A3OSZOQbeG6z2f2Y0hu8=" crossorigin="anonymous"></script>
<!-- Font Awesome icons -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css" integrity="sha256-eZrrJcwDc/3uDhsdt61sL2oOBY362qM3lon1gyExkL0=" crossorigin="anonymous" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.7.1/css/all.min.css" integrity="sha256-nAmazAk6vS34Xqo0BSrTb+abbtFlgsFK7NKSi6o7Y78=" crossorigin="anonymous" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.7.1/css/v4-shims.min.css" integrity="sha256-6qHlizsOWFskGlwVOKuns+D1nB6ssZrHQrNj1wGplHc=" crossorigin="anonymous" />
<!-- clipboard.js -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/clipboard.js/2.0.4/clipboard.min.js" integrity="sha256-FiZwavyI2V6+EXO1U+xzLG3IKldpiTFf3153ea9zikQ=" crossorigin="anonymous"></script>
<!-- sticky kit -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/sticky-kit/1.1.3/sticky-kit.min.js" integrity="sha256-c4Rlo1ZozqTPE2RLuvbusY3+SU1pQaJC0TjuhygMipw=" crossorigin="anonymous"></script>
<!-- headroom.js -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/headroom/0.9.4/headroom.min.js" integrity="sha256-DJFC1kqIhelURkuza0AvYal5RxMtpzLjFhsnVIeuk+U=" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/headroom/0.9.4/jQuery.headroom.min.js" integrity="sha256-ZX/yNShbjqsohH1k95liqY9Gd8uOiE1S4vZc+9KQ1K4=" crossorigin="anonymous"></script>
<!-- pkgdown -->
<link href="../pkgdown.css" rel="stylesheet">
@@ -39,15 +43,15 @@
<link href="../extra.css" rel="stylesheet">
<meta property="og:title" content="<code>brickr</code> package — brickr" />
<meta property="og:description" content="Google spreadsheets R API" />
<meta property="og:image" content="http://brickr.org/logo.png" />
<meta name="twitter:card" content="summary" />
<!-- mathjax -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/MathJax.js" integrity="sha256-nvJJv9wWKEm88qvoQl9ekL2J+k/RWIsaSScxxlsrv8k=" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/config/TeX-AMS-MML_HTMLorMML.js" integrity="sha256-84DKXVJXs0/F8OTMzX4UR909+jtl4G7SPypPavF+GfA=" crossorigin="anonymous"></script>
@@ -58,6 +62,7 @@
<![endif]-->
</head>
<body>
@@ -74,7 +79,7 @@
</button>
<span class="navbar-brand">
<a class="navbar-link" href="../index.html">brickr</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.1.0.9024</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.2.0</span>
</span>
</div>
@@ -82,7 +87,7 @@
<ul class="nav navbar-nav">
<li>
<a href="../index.html">
<span class="fa fa-home fa-lg"></span>
<span class="fas fa fas fa-home fa-lg"></span>
</a>
</li>
@@ -117,11 +122,10 @@
<a href="../news/index.html">Changelog</a>
</li>
</ul>
<ul class="nav navbar-nav navbar-right">
<li>
<a href="https://github.com/ryantimpe/brickr">
<span class="fa fa-github fa-lg"></span>
<span class="fab fa fab fa-github fa-lg"></span>
</a>
</li>
@@ -132,6 +136,7 @@
</div><!--/.navbar -->
</header>
<div class="row">
@@ -143,35 +148,38 @@
</div>
<div class="ref-description">
<p>Google spreadsheets R API</p>
</div>
</div>
<div class="col-md-3 hidden-xs hidden-sm" id="sidebar">
<h2>Contents</h2>
<ul class="nav nav-pills nav-stacked">
</ul>
</ul>
</div>
</div>
<footer>
<div class="copyright">
<p>Developed by Ryan Timpe.</p>
</div>
<div class="pkgdown">
<p>Site built with <a href="https://pkgdown.r-lib.org/">pkgdown</a> 1.3.0.</p>
<p>Site built with <a href="https://pkgdown.r-lib.org/">pkgdown</a> 1.4.1.</p>
</div>
</footer>
</div>
</body>
</html>
+23 -19
View File
@@ -15,21 +15,25 @@
<link rel="apple-touch-icon" type="image/png" sizes="120x120" href="../apple-touch-icon-120x120.png" />
<link rel="apple-touch-icon" type="image/png" sizes="76x76" href="../apple-touch-icon-76x76.png" />
<link rel="apple-touch-icon" type="image/png" sizes="60x60" href="../apple-touch-icon-60x60.png" />
<!-- jquery -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js" integrity="sha256-FgpCb/KJQlLNfOu91ta32o/NMZxltwRo8QtmkMRdAu8=" crossorigin="anonymous"></script>
<!-- Bootstrap -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha256-916EbMg70RQy9LHiGkXzG8hSg9EdNy97GazNG/aiY1w=" crossorigin="anonymous" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha256-U5ZEeKfGNOja007MMD3YBI0A3OSZOQbeG6z2f2Y0hu8=" crossorigin="anonymous"></script>
<!-- Font Awesome icons -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css" integrity="sha256-eZrrJcwDc/3uDhsdt61sL2oOBY362qM3lon1gyExkL0=" crossorigin="anonymous" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.7.1/css/all.min.css" integrity="sha256-nAmazAk6vS34Xqo0BSrTb+abbtFlgsFK7NKSi6o7Y78=" crossorigin="anonymous" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.7.1/css/v4-shims.min.css" integrity="sha256-6qHlizsOWFskGlwVOKuns+D1nB6ssZrHQrNj1wGplHc=" crossorigin="anonymous" />
<!-- clipboard.js -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/clipboard.js/2.0.4/clipboard.min.js" integrity="sha256-FiZwavyI2V6+EXO1U+xzLG3IKldpiTFf3153ea9zikQ=" crossorigin="anonymous"></script>
<!-- sticky kit -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/sticky-kit/1.1.3/sticky-kit.min.js" integrity="sha256-c4Rlo1ZozqTPE2RLuvbusY3+SU1pQaJC0TjuhygMipw=" crossorigin="anonymous"></script>
<!-- headroom.js -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/headroom/0.9.4/headroom.min.js" integrity="sha256-DJFC1kqIhelURkuza0AvYal5RxMtpzLjFhsnVIeuk+U=" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/headroom/0.9.4/jQuery.headroom.min.js" integrity="sha256-ZX/yNShbjqsohH1k95liqY9Gd8uOiE1S4vZc+9KQ1K4=" crossorigin="anonymous"></script>
<!-- pkgdown -->
<link href="../pkgdown.css" rel="stylesheet">
@@ -39,15 +43,15 @@
<link href="../extra.css" rel="stylesheet">
<meta property="og:title" content="Convert a data frame with x, y, z &amp; Color columns into a brickr 3D object — bricks_from_coords" />
<meta property="og:description" content="Convert a data frame with x, y, z &amp;amp; Color columns into a brickr 3D object" />
<meta property="og:image" content="http://brickr.org/logo.png" />
<meta name="twitter:card" content="summary" />
<!-- mathjax -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/MathJax.js" integrity="sha256-nvJJv9wWKEm88qvoQl9ekL2J+k/RWIsaSScxxlsrv8k=" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/config/TeX-AMS-MML_HTMLorMML.js" integrity="sha256-84DKXVJXs0/F8OTMzX4UR909+jtl4G7SPypPavF+GfA=" crossorigin="anonymous"></script>
@@ -58,6 +62,7 @@
<![endif]-->
</head>
<body>
@@ -74,7 +79,7 @@
</button>
<span class="navbar-brand">
<a class="navbar-link" href="../index.html">brickr</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.1.0.9024</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.2.0</span>
</span>
</div>
@@ -82,7 +87,7 @@
<ul class="nav navbar-nav">
<li>
<a href="../index.html">
<span class="fa fa-home fa-lg"></span>
<span class="fas fa fas fa-home fa-lg"></span>
</a>
</li>
@@ -117,11 +122,10 @@
<a href="../news/index.html">Changelog</a>
</li>
</ul>
<ul class="nav navbar-nav navbar-right">
<li>
<a href="https://github.com/ryantimpe/brickr">
<span class="fa fa-github fa-lg"></span>
<span class="fab fa fab fa-github fa-lg"></span>
</a>
</li>
@@ -132,6 +136,7 @@
</div><!--/.navbar -->
</header>
<div class="row">
@@ -143,15 +148,13 @@
</div>
<div class="ref-description">
<p>Convert a data frame with x, y, z &amp; Color columns into a brickr 3D object</p>
</div>
<pre class="usage"><span class='fu'>bricks_from_coords</span>(<span class='no'>coord_table</span>, <span class='kw'>increment_level</span> <span class='kw'>=</span> <span class='fl'>0</span>, <span class='kw'>max_level</span> <span class='kw'>=</span> <span class='fl'>Inf</span>,
<span class='kw'>increment_x</span> <span class='kw'>=</span> <span class='fl'>0</span>, <span class='kw'>max_x</span> <span class='kw'>=</span> <span class='fl'>Inf</span>, <span class='kw'>increment_y</span> <span class='kw'>=</span> <span class='fl'>0</span>, <span class='kw'>max_y</span> <span class='kw'>=</span> <span class='fl'>Inf</span>,
<span class='kw'>exclude_color</span> <span class='kw'>=</span> <span class='kw'>NULL</span>, <span class='kw'>exclude_level</span> <span class='kw'>=</span> <span class='kw'>NULL</span>)</pre>
<h2 class="hasAnchor" id="arguments"><a class="anchor" href="#arguments"></a>Arguments</h2>
<table class="ref-arguments">
<colgroup><col class="name" /><col class="desc" /></colgroup>
@@ -192,47 +195,48 @@
<td><p>Numeric array of Level/z dimensions to exclude.</p></td>
</tr>
</table>
<h2 class="hasAnchor" id="value"><a class="anchor" href="#value"></a>Value</h2>
<p>A list with elements <code>Img_lego</code> to pass to <code><a href='collect_bricks.html'>collect_bricks()</a></code>.</p>
<h2 class="hasAnchor" id="see-also"><a class="anchor" href="#see-also"></a>See also</h2>
<div class='dont-index'><p>Other 3D Models: <code><a href='bricks_from_excel.html'>bricks_from_excel</a></code>,
<code><a href='bricks_from_mosaic.html'>bricks_from_mosaic</a></code>,
<code><a href='bricks_from_rayshader.html'>bricks_from_rayshader</a></code>,
<code><a href='bricks_from_table.html'>bricks_from_table</a></code>,
<code><a href='build_bricks_rayshader.html'>build_bricks_rayshader</a></code>,
<code><a href='build_bricks.html'>build_bricks</a></code></p></div>
</div>
<div class="col-md-3 hidden-xs hidden-sm" id="sidebar">
<h2>Contents</h2>
<ul class="nav nav-pills nav-stacked">
<li><a href="#arguments">Arguments</a></li>
<li><a href="#value">Value</a></li>
<li><a href="#see-also">See also</a></li>
</ul>
</ul>
</div>
</div>
<footer>
<div class="copyright">
<p>Developed by Ryan Timpe.</p>
</div>
<div class="pkgdown">
<p>Site built with <a href="https://pkgdown.r-lib.org/">pkgdown</a> 1.3.0.</p>
<p>Site built with <a href="https://pkgdown.r-lib.org/">pkgdown</a> 1.4.1.</p>
</div>
</footer>
</div>
</body>
</html>
+23 -19
View File
@@ -15,21 +15,25 @@
<link rel="apple-touch-icon" type="image/png" sizes="120x120" href="../apple-touch-icon-120x120.png" />
<link rel="apple-touch-icon" type="image/png" sizes="76x76" href="../apple-touch-icon-76x76.png" />
<link rel="apple-touch-icon" type="image/png" sizes="60x60" href="../apple-touch-icon-60x60.png" />
<!-- jquery -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js" integrity="sha256-FgpCb/KJQlLNfOu91ta32o/NMZxltwRo8QtmkMRdAu8=" crossorigin="anonymous"></script>
<!-- Bootstrap -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha256-916EbMg70RQy9LHiGkXzG8hSg9EdNy97GazNG/aiY1w=" crossorigin="anonymous" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha256-U5ZEeKfGNOja007MMD3YBI0A3OSZOQbeG6z2f2Y0hu8=" crossorigin="anonymous"></script>
<!-- Font Awesome icons -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css" integrity="sha256-eZrrJcwDc/3uDhsdt61sL2oOBY362qM3lon1gyExkL0=" crossorigin="anonymous" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.7.1/css/all.min.css" integrity="sha256-nAmazAk6vS34Xqo0BSrTb+abbtFlgsFK7NKSi6o7Y78=" crossorigin="anonymous" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.7.1/css/v4-shims.min.css" integrity="sha256-6qHlizsOWFskGlwVOKuns+D1nB6ssZrHQrNj1wGplHc=" crossorigin="anonymous" />
<!-- clipboard.js -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/clipboard.js/2.0.4/clipboard.min.js" integrity="sha256-FiZwavyI2V6+EXO1U+xzLG3IKldpiTFf3153ea9zikQ=" crossorigin="anonymous"></script>
<!-- sticky kit -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/sticky-kit/1.1.3/sticky-kit.min.js" integrity="sha256-c4Rlo1ZozqTPE2RLuvbusY3+SU1pQaJC0TjuhygMipw=" crossorigin="anonymous"></script>
<!-- headroom.js -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/headroom/0.9.4/headroom.min.js" integrity="sha256-DJFC1kqIhelURkuza0AvYal5RxMtpzLjFhsnVIeuk+U=" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/headroom/0.9.4/jQuery.headroom.min.js" integrity="sha256-ZX/yNShbjqsohH1k95liqY9Gd8uOiE1S4vZc+9KQ1K4=" crossorigin="anonymous"></script>
<!-- pkgdown -->
<link href="../pkgdown.css" rel="stylesheet">
@@ -39,15 +43,15 @@
<link href="../extra.css" rel="stylesheet">
<meta property="og:title" content="Convert an Excel brickr template into a brickr 3D object — bricks_from_excel" />
<meta property="og:description" content="Convert an Excel brickr template into a brickr 3D object" />
<meta property="og:image" content="http://brickr.org/logo.png" />
<meta name="twitter:card" content="summary" />
<!-- mathjax -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/MathJax.js" integrity="sha256-nvJJv9wWKEm88qvoQl9ekL2J+k/RWIsaSScxxlsrv8k=" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/config/TeX-AMS-MML_HTMLorMML.js" integrity="sha256-84DKXVJXs0/F8OTMzX4UR909+jtl4G7SPypPavF+GfA=" crossorigin="anonymous"></script>
@@ -58,6 +62,7 @@
<![endif]-->
</head>
<body>
@@ -74,7 +79,7 @@
</button>
<span class="navbar-brand">
<a class="navbar-link" href="../index.html">brickr</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.1.0.9024</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.2.0</span>
</span>
</div>
@@ -82,7 +87,7 @@
<ul class="nav navbar-nav">
<li>
<a href="../index.html">
<span class="fa fa-home fa-lg"></span>
<span class="fas fa fas fa-home fa-lg"></span>
</a>
</li>
@@ -117,11 +122,10 @@
<a href="../news/index.html">Changelog</a>
</li>
</ul>
<ul class="nav navbar-nav navbar-right">
<li>
<a href="https://github.com/ryantimpe/brickr">
<span class="fa fa-github fa-lg"></span>
<span class="fab fa fab fa-github fa-lg"></span>
</a>
</li>
@@ -132,6 +136,7 @@
</div><!--/.navbar -->
</header>
<div class="row">
@@ -143,15 +148,13 @@
</div>
<div class="ref-description">
<p>Convert an Excel brickr template into a brickr 3D object</p>
</div>
<pre class="usage"><span class='fu'>bricks_from_excel</span>(<span class='no'>excel_table</span>, <span class='kw'>repeat_levels</span> <span class='kw'>=</span> <span class='fl'>1</span>, <span class='kw'>increment_level</span> <span class='kw'>=</span> <span class='fl'>0</span>,
<span class='kw'>max_level</span> <span class='kw'>=</span> <span class='fl'>Inf</span>, <span class='kw'>increment_x</span> <span class='kw'>=</span> <span class='fl'>0</span>, <span class='kw'>max_x</span> <span class='kw'>=</span> <span class='fl'>Inf</span>, <span class='kw'>increment_y</span> <span class='kw'>=</span> <span class='fl'>0</span>,
<span class='kw'>max_y</span> <span class='kw'>=</span> <span class='fl'>Inf</span>, <span class='kw'>exclude_color</span> <span class='kw'>=</span> <span class='kw'>NULL</span>, <span class='kw'>exclude_level</span> <span class='kw'>=</span> <span class='kw'>NULL</span>)</pre>
<h2 class="hasAnchor" id="arguments"><a class="anchor" href="#arguments"></a>Arguments</h2>
<table class="ref-arguments">
<colgroup><col class="name" /><col class="desc" /></colgroup>
@@ -196,47 +199,48 @@
<td><p>Numeric array of Level/z dimensions to exclude.</p></td>
</tr>
</table>
<h2 class="hasAnchor" id="value"><a class="anchor" href="#value"></a>Value</h2>
<p>A list with elements <code>Img_lego</code> to pass to <code><a href='collect_bricks.html'>collect_bricks()</a></code>.</p>
<h2 class="hasAnchor" id="see-also"><a class="anchor" href="#see-also"></a>See also</h2>
<div class='dont-index'><p>Other 3D Models: <code><a href='bricks_from_coords.html'>bricks_from_coords</a></code>,
<code><a href='bricks_from_mosaic.html'>bricks_from_mosaic</a></code>,
<code><a href='bricks_from_rayshader.html'>bricks_from_rayshader</a></code>,
<code><a href='bricks_from_table.html'>bricks_from_table</a></code>,
<code><a href='build_bricks_rayshader.html'>build_bricks_rayshader</a></code>,
<code><a href='build_bricks.html'>build_bricks</a></code></p></div>
</div>
<div class="col-md-3 hidden-xs hidden-sm" id="sidebar">
<h2>Contents</h2>
<ul class="nav nav-pills nav-stacked">
<li><a href="#arguments">Arguments</a></li>
<li><a href="#value">Value</a></li>
<li><a href="#see-also">See also</a></li>
</ul>
</ul>
</div>
</div>
<footer>
<div class="copyright">
<p>Developed by Ryan Timpe.</p>
</div>
<div class="pkgdown">
<p>Site built with <a href="https://pkgdown.r-lib.org/">pkgdown</a> 1.3.0.</p>
<p>Site built with <a href="https://pkgdown.r-lib.org/">pkgdown</a> 1.4.1.</p>
</div>
</footer>
</div>
</body>
</html>
+23 -19
View File
@@ -15,21 +15,25 @@
<link rel="apple-touch-icon" type="image/png" sizes="120x120" href="../apple-touch-icon-120x120.png" />
<link rel="apple-touch-icon" type="image/png" sizes="76x76" href="../apple-touch-icon-76x76.png" />
<link rel="apple-touch-icon" type="image/png" sizes="60x60" href="../apple-touch-icon-60x60.png" />
<!-- jquery -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js" integrity="sha256-FgpCb/KJQlLNfOu91ta32o/NMZxltwRo8QtmkMRdAu8=" crossorigin="anonymous"></script>
<!-- Bootstrap -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha256-916EbMg70RQy9LHiGkXzG8hSg9EdNy97GazNG/aiY1w=" crossorigin="anonymous" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha256-U5ZEeKfGNOja007MMD3YBI0A3OSZOQbeG6z2f2Y0hu8=" crossorigin="anonymous"></script>
<!-- Font Awesome icons -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css" integrity="sha256-eZrrJcwDc/3uDhsdt61sL2oOBY362qM3lon1gyExkL0=" crossorigin="anonymous" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.7.1/css/all.min.css" integrity="sha256-nAmazAk6vS34Xqo0BSrTb+abbtFlgsFK7NKSi6o7Y78=" crossorigin="anonymous" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.7.1/css/v4-shims.min.css" integrity="sha256-6qHlizsOWFskGlwVOKuns+D1nB6ssZrHQrNj1wGplHc=" crossorigin="anonymous" />
<!-- clipboard.js -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/clipboard.js/2.0.4/clipboard.min.js" integrity="sha256-FiZwavyI2V6+EXO1U+xzLG3IKldpiTFf3153ea9zikQ=" crossorigin="anonymous"></script>
<!-- sticky kit -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/sticky-kit/1.1.3/sticky-kit.min.js" integrity="sha256-c4Rlo1ZozqTPE2RLuvbusY3+SU1pQaJC0TjuhygMipw=" crossorigin="anonymous"></script>
<!-- headroom.js -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/headroom/0.9.4/headroom.min.js" integrity="sha256-DJFC1kqIhelURkuza0AvYal5RxMtpzLjFhsnVIeuk+U=" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/headroom/0.9.4/jQuery.headroom.min.js" integrity="sha256-ZX/yNShbjqsohH1k95liqY9Gd8uOiE1S4vZc+9KQ1K4=" crossorigin="anonymous"></script>
<!-- pkgdown -->
<link href="../pkgdown.css" rel="stylesheet">
@@ -39,15 +43,15 @@
<link href="../extra.css" rel="stylesheet">
<meta property="og:title" content="Convert a 2D LEGO mosaic into a brickr 3D object — bricks_from_mosaic" />
<meta property="og:description" content="Convert a 2D LEGO mosaic into a brickr 3D object" />
<meta property="og:image" content="http://brickr.org/logo.png" />
<meta name="twitter:card" content="summary" />
<!-- mathjax -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/MathJax.js" integrity="sha256-nvJJv9wWKEm88qvoQl9ekL2J+k/RWIsaSScxxlsrv8k=" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/config/TeX-AMS-MML_HTMLorMML.js" integrity="sha256-84DKXVJXs0/F8OTMzX4UR909+jtl4G7SPypPavF+GfA=" crossorigin="anonymous"></script>
@@ -58,6 +62,7 @@
<![endif]-->
</head>
<body>
@@ -74,7 +79,7 @@
</button>
<span class="navbar-brand">
<a class="navbar-link" href="../index.html">brickr</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.1.0.9024</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.2.0</span>
</span>
</div>
@@ -82,7 +87,7 @@
<ul class="nav navbar-nav">
<li>
<a href="../index.html">
<span class="fa fa-home fa-lg"></span>
<span class="fas fa fas fa-home fa-lg"></span>
</a>
</li>
@@ -117,11 +122,10 @@
<a href="../news/index.html">Changelog</a>
</li>
</ul>
<ul class="nav navbar-nav navbar-right">
<li>
<a href="https://github.com/ryantimpe/brickr">
<span class="fa fa-github fa-lg"></span>
<span class="fab fa fab fa-github fa-lg"></span>
</a>
</li>
@@ -132,6 +136,7 @@
</div><!--/.navbar -->
</header>
<div class="row">
@@ -143,14 +148,12 @@
</div>
<div class="ref-description">
<p>Convert a 2D LEGO mosaic into a brickr 3D object</p>
</div>
<pre class="usage"><span class='fu'>bricks_from_mosaic</span>(<span class='no'>mosaic_list</span>, <span class='kw'>mosaic_height</span> <span class='kw'>=</span> <span class='fl'>6</span>,
<span class='kw'>highest_el</span> <span class='kw'>=</span> <span class='st'>"light"</span>)</pre>
<h2 class="hasAnchor" id="arguments"><a class="anchor" href="#arguments"></a>Arguments</h2>
<table class="ref-arguments">
<colgroup><col class="name" /><col class="desc" /></colgroup>
@@ -167,47 +170,48 @@
<td><p>Brick height is determined by brightness of color. Use <code>highest_el = 'dark'</code> for darkest bricks to have <code>mosaic_height</code>.</p></td>
</tr>
</table>
<h2 class="hasAnchor" id="value"><a class="anchor" href="#value"></a>Value</h2>
<p>A list with elements <code>threed_elevation</code> and <code>threed_hillshade</code> to created 3D mosiacs with the <code>rayshader</code> package.</p>
<h2 class="hasAnchor" id="see-also"><a class="anchor" href="#see-also"></a>See also</h2>
<div class='dont-index'><p>Other 3D Models: <code><a href='bricks_from_coords.html'>bricks_from_coords</a></code>,
<code><a href='bricks_from_excel.html'>bricks_from_excel</a></code>,
<code><a href='bricks_from_rayshader.html'>bricks_from_rayshader</a></code>,
<code><a href='bricks_from_table.html'>bricks_from_table</a></code>,
<code><a href='build_bricks_rayshader.html'>build_bricks_rayshader</a></code>,
<code><a href='build_bricks.html'>build_bricks</a></code></p></div>
</div>
<div class="col-md-3 hidden-xs hidden-sm" id="sidebar">
<h2>Contents</h2>
<ul class="nav nav-pills nav-stacked">
<li><a href="#arguments">Arguments</a></li>
<li><a href="#value">Value</a></li>
<li><a href="#see-also">See also</a></li>
</ul>
</ul>
</div>
</div>
<footer>
<div class="copyright">
<p>Developed by Ryan Timpe.</p>
</div>
<div class="pkgdown">
<p>Site built with <a href="https://pkgdown.r-lib.org/">pkgdown</a> 1.3.0.</p>
<p>Site built with <a href="https://pkgdown.r-lib.org/">pkgdown</a> 1.4.1.</p>
</div>
</footer>
</div>
</body>
</html>
+26 -22
View File
@@ -15,21 +15,25 @@
<link rel="apple-touch-icon" type="image/png" sizes="120x120" href="../apple-touch-icon-120x120.png" />
<link rel="apple-touch-icon" type="image/png" sizes="76x76" href="../apple-touch-icon-76x76.png" />
<link rel="apple-touch-icon" type="image/png" sizes="60x60" href="../apple-touch-icon-60x60.png" />
<!-- jquery -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js" integrity="sha256-FgpCb/KJQlLNfOu91ta32o/NMZxltwRo8QtmkMRdAu8=" crossorigin="anonymous"></script>
<!-- Bootstrap -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha256-916EbMg70RQy9LHiGkXzG8hSg9EdNy97GazNG/aiY1w=" crossorigin="anonymous" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha256-U5ZEeKfGNOja007MMD3YBI0A3OSZOQbeG6z2f2Y0hu8=" crossorigin="anonymous"></script>
<!-- Font Awesome icons -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css" integrity="sha256-eZrrJcwDc/3uDhsdt61sL2oOBY362qM3lon1gyExkL0=" crossorigin="anonymous" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.7.1/css/all.min.css" integrity="sha256-nAmazAk6vS34Xqo0BSrTb+abbtFlgsFK7NKSi6o7Y78=" crossorigin="anonymous" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.7.1/css/v4-shims.min.css" integrity="sha256-6qHlizsOWFskGlwVOKuns+D1nB6ssZrHQrNj1wGplHc=" crossorigin="anonymous" />
<!-- clipboard.js -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/clipboard.js/2.0.4/clipboard.min.js" integrity="sha256-FiZwavyI2V6+EXO1U+xzLG3IKldpiTFf3153ea9zikQ=" crossorigin="anonymous"></script>
<!-- sticky kit -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/sticky-kit/1.1.3/sticky-kit.min.js" integrity="sha256-c4Rlo1ZozqTPE2RLuvbusY3+SU1pQaJC0TjuhygMipw=" crossorigin="anonymous"></script>
<!-- headroom.js -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/headroom/0.9.4/headroom.min.js" integrity="sha256-DJFC1kqIhelURkuza0AvYal5RxMtpzLjFhsnVIeuk+U=" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/headroom/0.9.4/jQuery.headroom.min.js" integrity="sha256-ZX/yNShbjqsohH1k95liqY9Gd8uOiE1S4vZc+9KQ1K4=" crossorigin="anonymous"></script>
<!-- pkgdown -->
<link href="../pkgdown.css" rel="stylesheet">
@@ -39,15 +43,15 @@
<link href="../extra.css" rel="stylesheet">
<meta property="og:title" content="Build a brickr 3D object from rayshader hillshade &amp; heightmap matrices — bricks_from_rayshader" />
<meta property="og:description" content="Build a brickr 3D object from rayshader hillshade &amp;amp; heightmap matrices" />
<meta property="og:image" content="http://brickr.org/logo.png" />
<meta name="twitter:card" content="summary" />
<!-- mathjax -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/MathJax.js" integrity="sha256-nvJJv9wWKEm88qvoQl9ekL2J+k/RWIsaSScxxlsrv8k=" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/config/TeX-AMS-MML_HTMLorMML.js" integrity="sha256-84DKXVJXs0/F8OTMzX4UR909+jtl4G7SPypPavF+GfA=" crossorigin="anonymous"></script>
@@ -58,6 +62,7 @@
<![endif]-->
</head>
<body>
@@ -74,7 +79,7 @@
</button>
<span class="navbar-brand">
<a class="navbar-link" href="../index.html">brickr</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.1.0.9024</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.2.0</span>
</span>
</div>
@@ -82,7 +87,7 @@
<ul class="nav navbar-nav">
<li>
<a href="../index.html">
<span class="fa fa-home fa-lg"></span>
<span class="fas fa fas fa-home fa-lg"></span>
</a>
</li>
@@ -117,11 +122,10 @@
<a href="../news/index.html">Changelog</a>
</li>
</ul>
<ul class="nav navbar-nav navbar-right">
<li>
<a href="https://github.com/ryantimpe/brickr">
<span class="fa fa-github fa-lg"></span>
<span class="fab fa fab fa-github fa-lg"></span>
</a>
</li>
@@ -132,6 +136,7 @@
</div><!--/.navbar -->
</header>
<div class="row">
@@ -143,24 +148,22 @@
</div>
<div class="ref-description">
<p>Build a brickr 3D object from rayshader hillshade &amp; heightmap matrices</p>
</div>
<pre class="usage"><span class='fu'>bricks_from_rayshader</span>(<span class='no'>hillshade</span>, <span class='no'>heightmap</span>, <span class='kw'>max_height</span> <span class='kw'>=</span> <span class='fl'>12</span>,
<span class='kw'>img_size</span> <span class='kw'>=</span> <span class='fl'>48</span>)</pre>
<h2 class="hasAnchor" id="arguments"><a class="anchor" href="#arguments"></a>Arguments</h2>
<table class="ref-arguments">
<colgroup><col class="name" /><col class="desc" /></colgroup>
<tr>
<th>hillshade</th>
<td><p>Same as <code><a href='https://www.rdocumentation.org/packages/rayshader/topics/plot_3d'>rayshader::plot_3d()</a></code>. Hillshade/image to be added to 3D surface map.</p></td>
<td><p>Same as <code><a href='https://rdrr.io/pkg/rayshader/man/plot_3d.html'>rayshader::plot_3d()</a></code>. Hillshade/image to be added to 3D surface map.</p></td>
</tr>
<tr>
<th>heightmap</th>
<td><p>Same as <code><a href='https://www.rdocumentation.org/packages/rayshader/topics/plot_3d'>rayshader::plot_3d()</a></code>. A two-dimensional matrix, where each entry in the matrix is the elevation at that point. All points are assumed to be evenly spaced.</p></td>
<td><p>Same as <code><a href='https://rdrr.io/pkg/rayshader/man/plot_3d.html'>rayshader::plot_3d()</a></code>. A two-dimensional matrix, where each entry in the matrix is the elevation at that point. All points are assumed to be evenly spaced.</p></td>
</tr>
<tr>
<th>max_height</th>
@@ -169,50 +172,51 @@
<tr>
<th>img_size</th>
<td><p>Size of output image in pixel, where one pixel = one 'brick'. Use a single value (e.g. <code>48</code>) for a square image with 48 pixels on each side.
Use an array of two values for a rectangular image <code><a href='https://www.rdocumentation.org/packages/base/topics/c'>c(width, height)</a></code>.</p></td>
Use an array of two values for a rectangular image <code><a href='https://rdrr.io/r/base/c.html'>c(width, height)</a></code>.</p></td>
</tr>
</table>
<h2 class="hasAnchor" id="value"><a class="anchor" href="#value"></a>Value</h2>
<p>A list with elements <code>threed_elevation</code> and <code>threed_hillshade</code> to created 3D mosiacs with the <code>rayshader</code> package.</p>
<h2 class="hasAnchor" id="see-also"><a class="anchor" href="#see-also"></a>See also</h2>
<div class='dont-index'><p>Other 3D Models: <code><a href='bricks_from_coords.html'>bricks_from_coords</a></code>,
<code><a href='bricks_from_excel.html'>bricks_from_excel</a></code>,
<code><a href='bricks_from_mosaic.html'>bricks_from_mosaic</a></code>,
<code><a href='bricks_from_table.html'>bricks_from_table</a></code>,
<code><a href='build_bricks_rayshader.html'>build_bricks_rayshader</a></code>,
<code><a href='build_bricks.html'>build_bricks</a></code></p></div>
</div>
<div class="col-md-3 hidden-xs hidden-sm" id="sidebar">
<h2>Contents</h2>
<ul class="nav nav-pills nav-stacked">
<li><a href="#arguments">Arguments</a></li>
<li><a href="#value">Value</a></li>
<li><a href="#see-also">See also</a></li>
</ul>
</ul>
</div>
</div>
<footer>
<div class="copyright">
<p>Developed by Ryan Timpe.</p>
</div>
<div class="pkgdown">
<p>Site built with <a href="https://pkgdown.r-lib.org/">pkgdown</a> 1.3.0.</p>
<p>Site built with <a href="https://pkgdown.r-lib.org/">pkgdown</a> 1.4.1.</p>
</div>
</footer>
</div>
</body>
</html>
+24 -20
View File
@@ -15,21 +15,25 @@
<link rel="apple-touch-icon" type="image/png" sizes="120x120" href="../apple-touch-icon-120x120.png" />
<link rel="apple-touch-icon" type="image/png" sizes="76x76" href="../apple-touch-icon-76x76.png" />
<link rel="apple-touch-icon" type="image/png" sizes="60x60" href="../apple-touch-icon-60x60.png" />
<!-- jquery -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js" integrity="sha256-FgpCb/KJQlLNfOu91ta32o/NMZxltwRo8QtmkMRdAu8=" crossorigin="anonymous"></script>
<!-- Bootstrap -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha256-916EbMg70RQy9LHiGkXzG8hSg9EdNy97GazNG/aiY1w=" crossorigin="anonymous" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha256-U5ZEeKfGNOja007MMD3YBI0A3OSZOQbeG6z2f2Y0hu8=" crossorigin="anonymous"></script>
<!-- Font Awesome icons -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css" integrity="sha256-eZrrJcwDc/3uDhsdt61sL2oOBY362qM3lon1gyExkL0=" crossorigin="anonymous" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.7.1/css/all.min.css" integrity="sha256-nAmazAk6vS34Xqo0BSrTb+abbtFlgsFK7NKSi6o7Y78=" crossorigin="anonymous" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.7.1/css/v4-shims.min.css" integrity="sha256-6qHlizsOWFskGlwVOKuns+D1nB6ssZrHQrNj1wGplHc=" crossorigin="anonymous" />
<!-- clipboard.js -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/clipboard.js/2.0.4/clipboard.min.js" integrity="sha256-FiZwavyI2V6+EXO1U+xzLG3IKldpiTFf3153ea9zikQ=" crossorigin="anonymous"></script>
<!-- sticky kit -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/sticky-kit/1.1.3/sticky-kit.min.js" integrity="sha256-c4Rlo1ZozqTPE2RLuvbusY3+SU1pQaJC0TjuhygMipw=" crossorigin="anonymous"></script>
<!-- headroom.js -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/headroom/0.9.4/headroom.min.js" integrity="sha256-DJFC1kqIhelURkuza0AvYal5RxMtpzLjFhsnVIeuk+U=" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/headroom/0.9.4/jQuery.headroom.min.js" integrity="sha256-ZX/yNShbjqsohH1k95liqY9Gd8uOiE1S4vZc+9KQ1K4=" crossorigin="anonymous"></script>
<!-- pkgdown -->
<link href="../pkgdown.css" rel="stylesheet">
@@ -39,15 +43,15 @@
<link href="../extra.css" rel="stylesheet">
<meta property="og:title" content="Convert a matrix table into a brickr 3D object — bricks_from_table" />
<meta property="og:description" content="Convert a matrix table into a brickr 3D object" />
<meta property="og:image" content="http://brickr.org/logo.png" />
<meta name="twitter:card" content="summary" />
<!-- mathjax -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/MathJax.js" integrity="sha256-nvJJv9wWKEm88qvoQl9ekL2J+k/RWIsaSScxxlsrv8k=" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/config/TeX-AMS-MML_HTMLorMML.js" integrity="sha256-84DKXVJXs0/F8OTMzX4UR909+jtl4G7SPypPavF+GfA=" crossorigin="anonymous"></script>
@@ -58,6 +62,7 @@
<![endif]-->
</head>
<body>
@@ -74,7 +79,7 @@
</button>
<span class="navbar-brand">
<a class="navbar-link" href="../index.html">brickr</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.1.0.9024</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.2.0</span>
</span>
</div>
@@ -82,7 +87,7 @@
<ul class="nav navbar-nav">
<li>
<a href="../index.html">
<span class="fa fa-home fa-lg"></span>
<span class="fas fa fas fa-home fa-lg"></span>
</a>
</li>
@@ -117,11 +122,10 @@
<a href="../news/index.html">Changelog</a>
</li>
</ul>
<ul class="nav navbar-nav navbar-right">
<li>
<a href="https://github.com/ryantimpe/brickr">
<span class="fa fa-github fa-lg"></span>
<span class="fab fa fab fa-github fa-lg"></span>
</a>
</li>
@@ -132,6 +136,7 @@
</div><!--/.navbar -->
</header>
<div class="row">
@@ -143,16 +148,14 @@
</div>
<div class="ref-description">
<p>Convert a matrix table into a brickr 3D object</p>
</div>
<pre class="usage"><span class='fu'>bricks_from_table</span>(<span class='no'>matrix_table</span>, <span class='kw'>color_guide</span> <span class='kw'>=</span> <span class='no'>lego_colors</span>,
<pre class="usage"><span class='fu'>bricks_from_table</span>(<span class='no'>matrix_table</span>, <span class='kw'>color_guide</span> <span class='kw'>=</span> <span class='kw pkg'>brickr</span><span class='kw ns'>::</span><span class='no'>lego_colors</span>,
<span class='kw'>.re_level</span> <span class='kw'>=</span> <span class='fl'>TRUE</span>, <span class='kw'>increment_level</span> <span class='kw'>=</span> <span class='fl'>0</span>, <span class='kw'>max_level</span> <span class='kw'>=</span> <span class='fl'>Inf</span>,
<span class='kw'>increment_x</span> <span class='kw'>=</span> <span class='fl'>0</span>, <span class='kw'>max_x</span> <span class='kw'>=</span> <span class='fl'>Inf</span>, <span class='kw'>increment_y</span> <span class='kw'>=</span> <span class='fl'>0</span>, <span class='kw'>max_y</span> <span class='kw'>=</span> <span class='fl'>Inf</span>,
<span class='kw'>exclude_color</span> <span class='kw'>=</span> <span class='kw'>NULL</span>, <span class='kw'>exclude_level</span> <span class='kw'>=</span> <span class='kw'>NULL</span>)</pre>
<h2 class="hasAnchor" id="arguments"><a class="anchor" href="#arguments"></a>Arguments</h2>
<table class="ref-arguments">
<colgroup><col class="name" /><col class="desc" /></colgroup>
@@ -201,47 +204,48 @@
<td><p>Numeric array of Level/z dimensions to exclude.</p></td>
</tr>
</table>
<h2 class="hasAnchor" id="value"><a class="anchor" href="#value"></a>Value</h2>
<p>A list with elements <code>Img_lego</code> to pass to <code><a href='collect_bricks.html'>collect_bricks()</a></code>.</p>
<h2 class="hasAnchor" id="see-also"><a class="anchor" href="#see-also"></a>See also</h2>
<div class='dont-index'><p>Other 3D Models: <code><a href='bricks_from_coords.html'>bricks_from_coords</a></code>,
<code><a href='bricks_from_excel.html'>bricks_from_excel</a></code>,
<code><a href='bricks_from_mosaic.html'>bricks_from_mosaic</a></code>,
<code><a href='bricks_from_rayshader.html'>bricks_from_rayshader</a></code>,
<code><a href='build_bricks_rayshader.html'>build_bricks_rayshader</a></code>,
<code><a href='build_bricks.html'>build_bricks</a></code></p></div>
</div>
<div class="col-md-3 hidden-xs hidden-sm" id="sidebar">
<h2>Contents</h2>
<ul class="nav nav-pills nav-stacked">
<li><a href="#arguments">Arguments</a></li>
<li><a href="#value">Value</a></li>
<li><a href="#see-also">See also</a></li>
</ul>
</ul>
</div>
</div>
<footer>
<div class="copyright">
<p>Developed by Ryan Timpe.</p>
</div>
<div class="pkgdown">
<p>Site built with <a href="https://pkgdown.r-lib.org/">pkgdown</a> 1.3.0.</p>
<p>Site built with <a href="https://pkgdown.r-lib.org/">pkgdown</a> 1.4.1.</p>
</div>
</footer>
</div>
</body>
</html>
+47 -48
View File
@@ -6,7 +6,7 @@
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Build 3D brick model with rayshader. — build_bricks • brickr</title>
<title>Build 3D brick model with rgl — build_bricks • brickr</title>
<!-- favicons -->
<link rel="icon" type="image/png" sizes="16x16" href="../favicon-16x16.png">
@@ -15,21 +15,25 @@
<link rel="apple-touch-icon" type="image/png" sizes="120x120" href="../apple-touch-icon-120x120.png" />
<link rel="apple-touch-icon" type="image/png" sizes="76x76" href="../apple-touch-icon-76x76.png" />
<link rel="apple-touch-icon" type="image/png" sizes="60x60" href="../apple-touch-icon-60x60.png" />
<!-- jquery -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js" integrity="sha256-FgpCb/KJQlLNfOu91ta32o/NMZxltwRo8QtmkMRdAu8=" crossorigin="anonymous"></script>
<!-- Bootstrap -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha256-916EbMg70RQy9LHiGkXzG8hSg9EdNy97GazNG/aiY1w=" crossorigin="anonymous" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha256-U5ZEeKfGNOja007MMD3YBI0A3OSZOQbeG6z2f2Y0hu8=" crossorigin="anonymous"></script>
<!-- Font Awesome icons -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css" integrity="sha256-eZrrJcwDc/3uDhsdt61sL2oOBY362qM3lon1gyExkL0=" crossorigin="anonymous" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.7.1/css/all.min.css" integrity="sha256-nAmazAk6vS34Xqo0BSrTb+abbtFlgsFK7NKSi6o7Y78=" crossorigin="anonymous" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.7.1/css/v4-shims.min.css" integrity="sha256-6qHlizsOWFskGlwVOKuns+D1nB6ssZrHQrNj1wGplHc=" crossorigin="anonymous" />
<!-- clipboard.js -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/clipboard.js/2.0.4/clipboard.min.js" integrity="sha256-FiZwavyI2V6+EXO1U+xzLG3IKldpiTFf3153ea9zikQ=" crossorigin="anonymous"></script>
<!-- sticky kit -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/sticky-kit/1.1.3/sticky-kit.min.js" integrity="sha256-c4Rlo1ZozqTPE2RLuvbusY3+SU1pQaJC0TjuhygMipw=" crossorigin="anonymous"></script>
<!-- headroom.js -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/headroom/0.9.4/headroom.min.js" integrity="sha256-DJFC1kqIhelURkuza0AvYal5RxMtpzLjFhsnVIeuk+U=" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/headroom/0.9.4/jQuery.headroom.min.js" integrity="sha256-ZX/yNShbjqsohH1k95liqY9Gd8uOiE1S4vZc+9KQ1K4=" crossorigin="anonymous"></script>
<!-- pkgdown -->
<link href="../pkgdown.css" rel="stylesheet">
@@ -39,15 +43,15 @@
<link href="../extra.css" rel="stylesheet">
<meta property="og:title" content="Build 3D brick model with rayshader. — build_bricks" />
<meta property="og:description" content="Build 3D brick model with rayshader." />
<meta property="og:title" content="Build 3D brick model with rgl — build_bricks" />
<meta property="og:description" content="Build 3D brick model with rgl" />
<meta property="og:image" content="http://brickr.org/logo.png" />
<meta name="twitter:card" content="summary" />
<!-- mathjax -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/MathJax.js" integrity="sha256-nvJJv9wWKEm88qvoQl9ekL2J+k/RWIsaSScxxlsrv8k=" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/config/TeX-AMS-MML_HTMLorMML.js" integrity="sha256-84DKXVJXs0/F8OTMzX4UR909+jtl4G7SPypPavF+GfA=" crossorigin="anonymous"></script>
@@ -58,6 +62,7 @@
<![endif]-->
</head>
<body>
@@ -74,7 +79,7 @@
</button>
<span class="navbar-brand">
<a class="navbar-link" href="../index.html">brickr</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.1.0.9024</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.2.0</span>
</span>
</div>
@@ -82,7 +87,7 @@
<ul class="nav navbar-nav">
<li>
<a href="../index.html">
<span class="fa fa-home fa-lg"></span>
<span class="fas fa fas fa-home fa-lg"></span>
</a>
</li>
@@ -117,11 +122,10 @@
<a href="../news/index.html">Changelog</a>
</li>
</ul>
<ul class="nav navbar-nav navbar-right">
<li>
<a href="https://github.com/ryantimpe/brickr">
<span class="fa fa-github fa-lg"></span>
<span class="fab fa fab fa-github fa-lg"></span>
</a>
</li>
@@ -132,26 +136,24 @@
</div><!--/.navbar -->
</header>
<div class="row">
<div class="col-md-9 contents">
<div class="page-header">
<h1>Build 3D brick model with rayshader.</h1>
<small class="dont-index">Source: <a href='https://github.com/ryantimpe/brickr/blob/master/R/build-bricks.R'><code>R/build-bricks.R</code></a></small>
<h1>Build 3D brick model with rgl</h1>
<small class="dont-index">Source: <a href='https://github.com/ryantimpe/brickr/blob/master/R/build-bricks-rgl.R'><code>R/build-bricks-rgl.R</code></a></small>
<div class="hidden name"><code>build_bricks.Rd</code></div>
</div>
<div class="ref-description">
<p>Build 3D brick model with rayshader.</p>
<p>Build 3D brick model with rgl</p>
</div>
<pre class="usage"><span class='fu'>build_bricks</span>(<span class='no'>brick_list</span>, <span class='kw'>brick_type</span> <span class='kw'>=</span> <span class='st'>"brick"</span>, <span class='kw'>brick_res</span> <span class='kw'>=</span> <span class='st'>"sd"</span>,
<span class='kw'>view_levels</span> <span class='kw'>=</span> <span class='kw'>NULL</span>, <span class='kw'>solidcolor</span> <span class='kw'>=</span> <span class='st'>"#a3a2a4"</span>, <span class='kw'>water</span> <span class='kw'>=</span> <span class='fl'>FALSE</span>,
<span class='kw'>waterdepth</span> <span class='kw'>=</span> <span class='fl'>0</span>, <span class='no'>...</span>)</pre>
<pre class="usage"><span class='fu'>build_bricks</span>(<span class='no'>brick_list</span>, <span class='kw'>background_color</span> <span class='kw'>=</span> <span class='st'>"white"</span>, <span class='kw'>rgl_lit</span> <span class='kw'>=</span> <span class='fl'>TRUE</span>,
<span class='kw'>outline_bricks</span> <span class='kw'>=</span> <span class='fl'>FALSE</span>, <span class='kw'>trans_alpha</span> <span class='kw'>=</span> <span class='fl'>0.5</span>, <span class='kw'>view_levels</span> <span class='kw'>=</span> <span class='kw'>NULL</span>)</pre>
<h2 class="hasAnchor" id="arguments"><a class="anchor" href="#arguments"></a>Arguments</h2>
<table class="ref-arguments">
<colgroup><col class="name" /><col class="desc" /></colgroup>
@@ -160,76 +162,73 @@
<td><p>List output from collect_bricks(). Contains an element <code>Img_lego</code>.</p></td>
</tr>
<tr>
<th>brick_type</th>
<td><p>Type of brick to use. Default is 'brick'. Other option is 'plate', which is 1/3 the height of a brick.</p></td>
<th>background_color</th>
<td><p>Default 'white'. Color of the background.</p></td>
</tr>
<tr>
<th>brick_res</th>
<td><p>Resolution, expressed at number of pixels on one side of a 1x1 brick. Defaults to 'sd' (15px). Use 'hd' for 30px per brick, and 'uhd' for 60px.
Enter a value for a custom resolution. High resolutions take longer to render.</p></td>
<th>rgl_lit</th>
<td><p>Default 'TRUE'. Include RGL lighting features in rendering.</p></td>
</tr>
<tr>
<th>outline_bricks</th>
<td><p>Default 'FALSE'. Include black outlines around brick edges.
Set to 'TRUE' and rgl_lit='FALSE' for cartoon-looking bricks.</p></td>
</tr>
<tr>
<th>trans_alpha</th>
<td><p>Default 0.5. Alpha level for transparent bricks.</p></td>
</tr>
<tr>
<th>view_levels</th>
<td><p>Numeric array of Levels/z values to display. Leave as <code>NULL</code> to include all.</p></td>
<td><p>Numeric array of Levels/z values to display. Leave as 'NULL' to include all.</p></td>
</tr>
<tr>
<th>solidcolor</th>
<td><p>Hex color of mosaic base. Only renders on bottom.</p></td>
</tr>
<tr>
<th>water</th>
<td><p>Default 'FALSE'. If 'TRUE', a water layer is rendered.</p></td>
</tr>
<tr>
<th>waterdepth</th>
<td><p>Default '0'. Water level.</p></td>
</tr>
<tr>
<th>...</th>
<td><p>All other inputs from rayshader::plot_3d() EXCEPT <code>hillshade</code>, <code>soliddepth</code>, <code>zscale</code>, and <code>shadow</code>.</p></td>
<th>brick_type</th>
<td><p>Type of brick to use. Default is 'brick'. Other option is 'plate', which is 1/3 the height of a brick.</p></td>
</tr>
</table>
<h2 class="hasAnchor" id="value"><a class="anchor" href="#value"></a>Value</h2>
<p>3D brick model rendered in the 'rgl' package.</p>
<h2 class="hasAnchor" id="see-also"><a class="anchor" href="#see-also"></a>See also</h2>
<div class='dont-index'><p>Other 3D Models: <code><a href='bricks_from_coords.html'>bricks_from_coords</a></code>,
<code><a href='bricks_from_excel.html'>bricks_from_excel</a></code>,
<code><a href='bricks_from_mosaic.html'>bricks_from_mosaic</a></code>,
<code><a href='bricks_from_rayshader.html'>bricks_from_rayshader</a></code>,
<code><a href='bricks_from_table.html'>bricks_from_table</a></code></p></div>
<code><a href='bricks_from_table.html'>bricks_from_table</a></code>,
<code><a href='build_bricks_rayshader.html'>build_bricks_rayshader</a></code></p></div>
</div>
<div class="col-md-3 hidden-xs hidden-sm" id="sidebar">
<h2>Contents</h2>
<ul class="nav nav-pills nav-stacked">
<li><a href="#arguments">Arguments</a></li>
<li><a href="#value">Value</a></li>
<li><a href="#see-also">See also</a></li>
</ul>
</ul>
</div>
</div>
<footer>
<div class="copyright">
<p>Developed by Ryan Timpe.</p>
</div>
<div class="pkgdown">
<p>Site built with <a href="https://pkgdown.r-lib.org/">pkgdown</a> 1.3.0.</p>
<p>Site built with <a href="https://pkgdown.r-lib.org/">pkgdown</a> 1.4.1.</p>
</div>
</footer>
</div>
</body>
</html>
+239
View File
@@ -0,0 +1,239 @@
<!-- Generated by pkgdown: do not edit by hand -->
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Build 3D brick model with rayshader. — build_bricks_rayshader • brickr</title>
<!-- favicons -->
<link rel="icon" type="image/png" sizes="16x16" href="../favicon-16x16.png">
<link rel="icon" type="image/png" sizes="32x32" href="../favicon-32x32.png">
<link rel="apple-touch-icon" type="image/png" sizes="180x180" href="../apple-touch-icon.png" />
<link rel="apple-touch-icon" type="image/png" sizes="120x120" href="../apple-touch-icon-120x120.png" />
<link rel="apple-touch-icon" type="image/png" sizes="76x76" href="../apple-touch-icon-76x76.png" />
<link rel="apple-touch-icon" type="image/png" sizes="60x60" href="../apple-touch-icon-60x60.png" />
<!-- jquery -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js" integrity="sha256-FgpCb/KJQlLNfOu91ta32o/NMZxltwRo8QtmkMRdAu8=" crossorigin="anonymous"></script>
<!-- Bootstrap -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha256-916EbMg70RQy9LHiGkXzG8hSg9EdNy97GazNG/aiY1w=" crossorigin="anonymous" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha256-U5ZEeKfGNOja007MMD3YBI0A3OSZOQbeG6z2f2Y0hu8=" crossorigin="anonymous"></script>
<!-- Font Awesome icons -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.7.1/css/all.min.css" integrity="sha256-nAmazAk6vS34Xqo0BSrTb+abbtFlgsFK7NKSi6o7Y78=" crossorigin="anonymous" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.7.1/css/v4-shims.min.css" integrity="sha256-6qHlizsOWFskGlwVOKuns+D1nB6ssZrHQrNj1wGplHc=" crossorigin="anonymous" />
<!-- clipboard.js -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/clipboard.js/2.0.4/clipboard.min.js" integrity="sha256-FiZwavyI2V6+EXO1U+xzLG3IKldpiTFf3153ea9zikQ=" crossorigin="anonymous"></script>
<!-- headroom.js -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/headroom/0.9.4/headroom.min.js" integrity="sha256-DJFC1kqIhelURkuza0AvYal5RxMtpzLjFhsnVIeuk+U=" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/headroom/0.9.4/jQuery.headroom.min.js" integrity="sha256-ZX/yNShbjqsohH1k95liqY9Gd8uOiE1S4vZc+9KQ1K4=" crossorigin="anonymous"></script>
<!-- pkgdown -->
<link href="../pkgdown.css" rel="stylesheet">
<script src="../pkgdown.js"></script>
<link href="../extra.css" rel="stylesheet">
<meta property="og:title" content="Build 3D brick model with rayshader. — build_bricks_rayshader" />
<meta property="og:description" content="Build 3D brick model with rayshader." />
<meta property="og:image" content="http://brickr.org/logo.png" />
<meta name="twitter:card" content="summary" />
<!-- mathjax -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/MathJax.js" integrity="sha256-nvJJv9wWKEm88qvoQl9ekL2J+k/RWIsaSScxxlsrv8k=" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/config/TeX-AMS-MML_HTMLorMML.js" integrity="sha256-84DKXVJXs0/F8OTMzX4UR909+jtl4G7SPypPavF+GfA=" crossorigin="anonymous"></script>
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
</head>
<body>
<div class="container template-reference-topic">
<header>
<div class="navbar navbar-default navbar-fixed-top" role="navigation">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<span class="navbar-brand">
<a class="navbar-link" href="../index.html">brickr</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.2.0</span>
</span>
</div>
<div id="navbar" class="navbar-collapse collapse">
<ul class="nav navbar-nav">
<li>
<a href="../index.html">
<span class="fas fa fas fa-home fa-lg"></span>
</a>
</li>
<li>
<a href="../reference/index.html">Reference</a>
</li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">
Articles
<span class="caret"></span>
</a>
<ul class="dropdown-menu" role="menu">
<li>
<a href="../articles/graphs.html">ggplot with brickr</a>
</li>
<li>
<a href="../articles/models-from-other.html">3D Models from mosaics &amp; rayshader</a>
</li>
<li>
<a href="../articles/models-from-program.html">3D Models programmatically</a>
</li>
<li>
<a href="../articles/models-from-tables.html">3D models from tables</a>
</li>
<li>
<a href="../articles/mosaics.html">Mosaics with brickr</a>
</li>
</ul>
</li>
<li>
<a href="../news/index.html">Changelog</a>
</li>
</ul>
<ul class="nav navbar-nav navbar-right">
<li>
<a href="https://github.com/ryantimpe/brickr">
<span class="fab fa fab fa-github fa-lg"></span>
</a>
</li>
</ul>
</div><!--/.nav-collapse -->
</div><!--/.container -->
</div><!--/.navbar -->
</header>
<div class="row">
<div class="col-md-9 contents">
<div class="page-header">
<h1>Build 3D brick model with rayshader.</h1>
<small class="dont-index">Source: <a href='https://github.com/ryantimpe/brickr/blob/master/R/build-bricks.R'><code>R/build-bricks.R</code></a></small>
<div class="hidden name"><code>build_bricks_rayshader.Rd</code></div>
</div>
<div class="ref-description">
<p>Build 3D brick model with rayshader.</p>
</div>
<pre class="usage"><span class='fu'>build_bricks_rayshader</span>(<span class='no'>brick_list</span>, <span class='kw'>brick_type</span> <span class='kw'>=</span> <span class='st'>"brick"</span>,
<span class='kw'>brick_res</span> <span class='kw'>=</span> <span class='st'>"sd"</span>, <span class='kw'>view_levels</span> <span class='kw'>=</span> <span class='kw'>NULL</span>, <span class='kw'>solidcolor</span> <span class='kw'>=</span> <span class='st'>"#a3a2a4"</span>,
<span class='kw'>water</span> <span class='kw'>=</span> <span class='fl'>FALSE</span>, <span class='kw'>waterdepth</span> <span class='kw'>=</span> <span class='fl'>0</span>, <span class='no'>...</span>)</pre>
<h2 class="hasAnchor" id="arguments"><a class="anchor" href="#arguments"></a>Arguments</h2>
<table class="ref-arguments">
<colgroup><col class="name" /><col class="desc" /></colgroup>
<tr>
<th>brick_list</th>
<td><p>List output from collect_bricks(). Contains an element <code>Img_lego</code>.</p></td>
</tr>
<tr>
<th>brick_type</th>
<td><p>Type of brick to use. Default is 'brick'. Other option is 'plate', which is 1/3 the height of a brick.</p></td>
</tr>
<tr>
<th>brick_res</th>
<td><p>Resolution, expressed at number of pixels on one side of a 1x1 brick. Defaults to 'sd' (15px). Use 'hd' for 30px per brick, and 'uhd' for 60px.
Enter a value for a custom resolution. High resolutions take longer to render.</p></td>
</tr>
<tr>
<th>view_levels</th>
<td><p>Numeric array of Levels/z values to display. Leave as <code>NULL</code> to include all.</p></td>
</tr>
<tr>
<th>solidcolor</th>
<td><p>Hex color of mosaic base. Only renders on bottom.</p></td>
</tr>
<tr>
<th>water</th>
<td><p>Default 'FALSE'. If 'TRUE', a water layer is rendered.</p></td>
</tr>
<tr>
<th>waterdepth</th>
<td><p>Default '0'. Water level.</p></td>
</tr>
<tr>
<th>...</th>
<td><p>All other inputs from rayshader::plot_3d() EXCEPT <code>hillshade</code>, <code>soliddepth</code>, <code>zscale</code>, and <code>shadow</code>.</p></td>
</tr>
</table>
<h2 class="hasAnchor" id="value"><a class="anchor" href="#value"></a>Value</h2>
<p>3D brick model rendered in the 'rgl' package.</p>
<h2 class="hasAnchor" id="see-also"><a class="anchor" href="#see-also"></a>See also</h2>
<div class='dont-index'><p>Other 3D Models: <code><a href='bricks_from_coords.html'>bricks_from_coords</a></code>,
<code><a href='bricks_from_excel.html'>bricks_from_excel</a></code>,
<code><a href='bricks_from_mosaic.html'>bricks_from_mosaic</a></code>,
<code><a href='bricks_from_rayshader.html'>bricks_from_rayshader</a></code>,
<code><a href='bricks_from_table.html'>bricks_from_table</a></code>,
<code><a href='build_bricks.html'>build_bricks</a></code></p></div>
</div>
<div class="col-md-3 hidden-xs hidden-sm" id="sidebar">
<h2>Contents</h2>
<ul class="nav nav-pills nav-stacked">
<li><a href="#arguments">Arguments</a></li>
<li><a href="#value">Value</a></li>
<li><a href="#see-also">See also</a></li>
</ul>
</div>
</div>
<footer>
<div class="copyright">
<p>Developed by Ryan Timpe.</p>
</div>
<div class="pkgdown">
<p>Site built with <a href="https://pkgdown.r-lib.org/">pkgdown</a> 1.4.1.</p>
</div>
</footer>
</div>
</body>
</html>
Binary file not shown.

Before

Width:  |  Height:  |  Size: 94 KiB

After

Width:  |  Height:  |  Size: 106 KiB

+33 -23
View File
@@ -15,21 +15,25 @@
<link rel="apple-touch-icon" type="image/png" sizes="120x120" href="../apple-touch-icon-120x120.png" />
<link rel="apple-touch-icon" type="image/png" sizes="76x76" href="../apple-touch-icon-76x76.png" />
<link rel="apple-touch-icon" type="image/png" sizes="60x60" href="../apple-touch-icon-60x60.png" />
<!-- jquery -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js" integrity="sha256-FgpCb/KJQlLNfOu91ta32o/NMZxltwRo8QtmkMRdAu8=" crossorigin="anonymous"></script>
<!-- Bootstrap -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha256-916EbMg70RQy9LHiGkXzG8hSg9EdNy97GazNG/aiY1w=" crossorigin="anonymous" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha256-U5ZEeKfGNOja007MMD3YBI0A3OSZOQbeG6z2f2Y0hu8=" crossorigin="anonymous"></script>
<!-- Font Awesome icons -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css" integrity="sha256-eZrrJcwDc/3uDhsdt61sL2oOBY362qM3lon1gyExkL0=" crossorigin="anonymous" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.7.1/css/all.min.css" integrity="sha256-nAmazAk6vS34Xqo0BSrTb+abbtFlgsFK7NKSi6o7Y78=" crossorigin="anonymous" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.7.1/css/v4-shims.min.css" integrity="sha256-6qHlizsOWFskGlwVOKuns+D1nB6ssZrHQrNj1wGplHc=" crossorigin="anonymous" />
<!-- clipboard.js -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/clipboard.js/2.0.4/clipboard.min.js" integrity="sha256-FiZwavyI2V6+EXO1U+xzLG3IKldpiTFf3153ea9zikQ=" crossorigin="anonymous"></script>
<!-- sticky kit -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/sticky-kit/1.1.3/sticky-kit.min.js" integrity="sha256-c4Rlo1ZozqTPE2RLuvbusY3+SU1pQaJC0TjuhygMipw=" crossorigin="anonymous"></script>
<!-- headroom.js -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/headroom/0.9.4/headroom.min.js" integrity="sha256-DJFC1kqIhelURkuza0AvYal5RxMtpzLjFhsnVIeuk+U=" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/headroom/0.9.4/jQuery.headroom.min.js" integrity="sha256-ZX/yNShbjqsohH1k95liqY9Gd8uOiE1S4vZc+9KQ1K4=" crossorigin="anonymous"></script>
<!-- pkgdown -->
<link href="../pkgdown.css" rel="stylesheet">
@@ -39,15 +43,15 @@
<link href="../extra.css" rel="stylesheet">
<meta property="og:title" content="Display available brick colors — build_colors" />
<meta property="og:description" content="Generates a plot of available brick colors. Use .names_only = TRUE to get a list of color names." />
<meta property="og:image" content="http://brickr.org/logo.png" />
<meta name="twitter:card" content="summary" />
<!-- mathjax -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/MathJax.js" integrity="sha256-nvJJv9wWKEm88qvoQl9ekL2J+k/RWIsaSScxxlsrv8k=" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/config/TeX-AMS-MML_HTMLorMML.js" integrity="sha256-84DKXVJXs0/F8OTMzX4UR909+jtl4G7SPypPavF+GfA=" crossorigin="anonymous"></script>
@@ -58,6 +62,7 @@
<![endif]-->
</head>
<body>
@@ -74,7 +79,7 @@
</button>
<span class="navbar-brand">
<a class="navbar-link" href="../index.html">brickr</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.1.0.9024</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.2.0</span>
</span>
</div>
@@ -82,7 +87,7 @@
<ul class="nav navbar-nav">
<li>
<a href="../index.html">
<span class="fa fa-home fa-lg"></span>
<span class="fas fa fas fa-home fa-lg"></span>
</a>
</li>
@@ -117,11 +122,10 @@
<a href="../news/index.html">Changelog</a>
</li>
</ul>
<ul class="nav navbar-nav navbar-right">
<li>
<a href="https://github.com/ryantimpe/brickr">
<span class="fa fa-github fa-lg"></span>
<span class="fab fa fab fa-github fa-lg"></span>
</a>
</li>
@@ -132,6 +136,7 @@
</div><!--/.navbar -->
</header>
<div class="row">
@@ -143,36 +148,36 @@
</div>
<div class="ref-description">
<p>Generates a plot of available brick colors. Use .names_only = TRUE to get a list of color names.</p>
</div>
<pre class="usage"><span class='fu'>build_colors</span>(<span class='kw'>.names_only</span> <span class='kw'>=</span> <span class='fl'>FALSE</span>)</pre>
<pre class="usage"><span class='fu'>build_colors</span>(<span class='kw'>.names_only</span> <span class='kw'>=</span> <span class='fl'>FALSE</span>, <span class='kw'>include_transparent</span> <span class='kw'>=</span> <span class='fl'>TRUE</span>)</pre>
<h2 class="hasAnchor" id="arguments"><a class="anchor" href="#arguments"></a>Arguments</h2>
<table class="ref-arguments">
<colgroup><col class="name" /><col class="desc" /></colgroup>
<tr>
<th>.names_only</th>
<td><p>Return an array of the 41 brick color names. Does not plot.</p></td>
<td><p>Return an array of the 41 solid brick color names and 13 transparent colors. Does not plot.</p></td>
</tr>
<tr>
<th>include_transparent</th>
<td><p>Include transparent colors in the plot output.</p></td>
</tr>
</table>
<h2 class="hasAnchor" id="value"><a class="anchor" href="#value"></a>Value</h2>
<p>A table and ggplot of brick colors &amp; ID numbers.</p>
<h2 class="hasAnchor" id="see-also"><a class="anchor" href="#see-also"></a>See also</h2>
<div class='dont-index'><p>Other Resources: <code><a href='build_instructions.html'>build_instructions</a></code>,
<code><a href='build_pieces_table.html'>build_pieces_table</a></code>,
<code><a href='build_pieces.html'>build_pieces</a></code>, <code><a href='build_themes.html'>build_themes</a></code></p></div>
<h2 class="hasAnchor" id="examples"><a class="anchor" href="#examples"></a>Examples</h2>
<pre class="examples"><div class='input'><span class='co'>#Generate plot of colors</span>
<span class='fu'>build_colors</span>()</div><div class='output co'>#&gt; <span class='message'>Use View(lego_colors) to see these in a table format.</span></div><div class='img'><img src='build_colors-1.png' alt='' width='700' height='433' /></div><div class='input'>
<span class='fu'>build_colors</span>()</div><div class='output co'>#&gt; <span class='message'>Use View(lego_colors) to see these in a table format.</span></div><div class='output co'>#&gt; <span class='message'>Transparent colors are only used for 3D models, not color matching in mosaics or ggplot.</span></div><div class='img'><img src='build_colors-1.png' alt='' width='700' height='433' /></div><div class='input'>
<span class='co'>#Print list of colors</span>
<span class='fu'>build_colors</span>(<span class='fl'>TRUE</span>)</div><div class='output co'>#&gt; [1] "White" "Brick yellow" "Bright red"
#&gt; [4] "Bright blue" "Bright yellow" "Black"
@@ -187,36 +192,41 @@
#&gt; [31] "Cool yellow" "Medium lilac" "Light nougat"
#&gt; [34] "Dark brown" "Medium nougat" "Dark azur"
#&gt; [37] "Aqua" "Lavender" "Spring yellowish green"
#&gt; [40] "Olive green" "Vibrant coral" </div></pre>
#&gt; [40] "Olive green" "Vibrant coral" "Transparent"
#&gt; [43] "Tr. red" "Tr. light blue" "Tr. blue"
#&gt; [46] "Tr. yellow" "Tr. green" "Tr. fl green"
#&gt; [49] "Tr. brown" "Tr. bright orange" "Tr. fl red orange"
#&gt; [52] "Tr. medium violet" "Tr. bright violet" "Tr. bright green" </div></pre>
</div>
<div class="col-md-3 hidden-xs hidden-sm" id="sidebar">
<h2>Contents</h2>
<ul class="nav nav-pills nav-stacked">
<li><a href="#arguments">Arguments</a></li>
<li><a href="#value">Value</a></li>
<li><a href="#see-also">See also</a></li>
<li><a href="#examples">Examples</a></li>
</ul>
</div>
</div>
<footer>
<div class="copyright">
<p>Developed by Ryan Timpe.</p>
</div>
<div class="pkgdown">
<p>Site built with <a href="https://pkgdown.r-lib.org/">pkgdown</a> 1.3.0.</p>
<p>Site built with <a href="https://pkgdown.r-lib.org/">pkgdown</a> 1.4.1.</p>
</div>
</footer>
</div>
</body>
</html>
+22 -17
View File
@@ -15,21 +15,25 @@
<link rel="apple-touch-icon" type="image/png" sizes="120x120" href="../apple-touch-icon-120x120.png" />
<link rel="apple-touch-icon" type="image/png" sizes="76x76" href="../apple-touch-icon-76x76.png" />
<link rel="apple-touch-icon" type="image/png" sizes="60x60" href="../apple-touch-icon-60x60.png" />
<!-- jquery -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js" integrity="sha256-FgpCb/KJQlLNfOu91ta32o/NMZxltwRo8QtmkMRdAu8=" crossorigin="anonymous"></script>
<!-- Bootstrap -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha256-916EbMg70RQy9LHiGkXzG8hSg9EdNy97GazNG/aiY1w=" crossorigin="anonymous" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha256-U5ZEeKfGNOja007MMD3YBI0A3OSZOQbeG6z2f2Y0hu8=" crossorigin="anonymous"></script>
<!-- Font Awesome icons -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css" integrity="sha256-eZrrJcwDc/3uDhsdt61sL2oOBY362qM3lon1gyExkL0=" crossorigin="anonymous" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.7.1/css/all.min.css" integrity="sha256-nAmazAk6vS34Xqo0BSrTb+abbtFlgsFK7NKSi6o7Y78=" crossorigin="anonymous" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.7.1/css/v4-shims.min.css" integrity="sha256-6qHlizsOWFskGlwVOKuns+D1nB6ssZrHQrNj1wGplHc=" crossorigin="anonymous" />
<!-- clipboard.js -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/clipboard.js/2.0.4/clipboard.min.js" integrity="sha256-FiZwavyI2V6+EXO1U+xzLG3IKldpiTFf3153ea9zikQ=" crossorigin="anonymous"></script>
<!-- sticky kit -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/sticky-kit/1.1.3/sticky-kit.min.js" integrity="sha256-c4Rlo1ZozqTPE2RLuvbusY3+SU1pQaJC0TjuhygMipw=" crossorigin="anonymous"></script>
<!-- headroom.js -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/headroom/0.9.4/headroom.min.js" integrity="sha256-DJFC1kqIhelURkuza0AvYal5RxMtpzLjFhsnVIeuk+U=" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/headroom/0.9.4/jQuery.headroom.min.js" integrity="sha256-ZX/yNShbjqsohH1k95liqY9Gd8uOiE1S4vZc+9KQ1K4=" crossorigin="anonymous"></script>
<!-- pkgdown -->
<link href="../pkgdown.css" rel="stylesheet">
@@ -39,15 +43,15 @@
<link href="../extra.css" rel="stylesheet">
<meta property="og:title" content="Create instruction manual for 2D image mosaics — build_instructions" />
<meta property="og:description" content="Create instruction manual for 2D image mosaics" />
<meta property="og:image" content="http://brickr.org/logo.png" />
<meta name="twitter:card" content="summary" />
<!-- mathjax -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/MathJax.js" integrity="sha256-nvJJv9wWKEm88qvoQl9ekL2J+k/RWIsaSScxxlsrv8k=" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/config/TeX-AMS-MML_HTMLorMML.js" integrity="sha256-84DKXVJXs0/F8OTMzX4UR909+jtl4G7SPypPavF+GfA=" crossorigin="anonymous"></script>
@@ -58,6 +62,7 @@
<![endif]-->
</head>
<body>
@@ -74,7 +79,7 @@
</button>
<span class="navbar-brand">
<a class="navbar-link" href="../index.html">brickr</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.1.0.9024</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.2.0</span>
</span>
</div>
@@ -82,7 +87,7 @@
<ul class="nav navbar-nav">
<li>
<a href="../index.html">
<span class="fa fa-home fa-lg"></span>
<span class="fas fa fas fa-home fa-lg"></span>
</a>
</li>
@@ -117,11 +122,10 @@
<a href="../news/index.html">Changelog</a>
</li>
</ul>
<ul class="nav navbar-nav navbar-right">
<li>
<a href="https://github.com/ryantimpe/brickr">
<span class="fa fa-github fa-lg"></span>
<span class="fab fa fab fa-github fa-lg"></span>
</a>
</li>
@@ -132,6 +136,7 @@
</div><!--/.navbar -->
</header>
<div class="row">
@@ -143,13 +148,11 @@
</div>
<div class="ref-description">
<p>Create instruction manual for 2D image mosaics</p>
</div>
<pre class="usage"><span class='fu'>build_instructions</span>(<span class='no'>brickr_obj</span>, <span class='kw'>num_steps</span> <span class='kw'>=</span> <span class='fl'>6</span>)</pre>
<h2 class="hasAnchor" id="arguments"><a class="anchor" href="#arguments"></a>Arguments</h2>
<table class="ref-arguments">
<colgroup><col class="name" /><col class="desc" /></colgroup>
@@ -162,39 +165,41 @@
<td><p>Number of discrete steps in instruction manual, for mosaics only</p></td>
</tr>
</table>
<h2 class="hasAnchor" id="see-also"><a class="anchor" href="#see-also"></a>See also</h2>
<div class='dont-index'><p>Other Resources: <code><a href='build_colors.html'>build_colors</a></code>,
<code><a href='build_pieces_table.html'>build_pieces_table</a></code>,
<code><a href='build_pieces.html'>build_pieces</a></code>, <code><a href='build_themes.html'>build_themes</a></code></p></div>
</div>
<div class="col-md-3 hidden-xs hidden-sm" id="sidebar">
<h2>Contents</h2>
<ul class="nav nav-pills nav-stacked">
<li><a href="#arguments">Arguments</a></li>
<li><a href="#see-also">See also</a></li>
</ul>
</ul>
</div>
</div>
<footer>
<div class="copyright">
<p>Developed by Ryan Timpe.</p>
</div>
<div class="pkgdown">
<p>Site built with <a href="https://pkgdown.r-lib.org/">pkgdown</a> 1.3.0.</p>
<p>Site built with <a href="https://pkgdown.r-lib.org/">pkgdown</a> 1.4.1.</p>
</div>
</footer>
</div>
</body>
</html>
+22 -17
View File
@@ -15,21 +15,25 @@
<link rel="apple-touch-icon" type="image/png" sizes="120x120" href="../apple-touch-icon-120x120.png" />
<link rel="apple-touch-icon" type="image/png" sizes="76x76" href="../apple-touch-icon-76x76.png" />
<link rel="apple-touch-icon" type="image/png" sizes="60x60" href="../apple-touch-icon-60x60.png" />
<!-- jquery -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js" integrity="sha256-FgpCb/KJQlLNfOu91ta32o/NMZxltwRo8QtmkMRdAu8=" crossorigin="anonymous"></script>
<!-- Bootstrap -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha256-916EbMg70RQy9LHiGkXzG8hSg9EdNy97GazNG/aiY1w=" crossorigin="anonymous" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha256-U5ZEeKfGNOja007MMD3YBI0A3OSZOQbeG6z2f2Y0hu8=" crossorigin="anonymous"></script>
<!-- Font Awesome icons -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css" integrity="sha256-eZrrJcwDc/3uDhsdt61sL2oOBY362qM3lon1gyExkL0=" crossorigin="anonymous" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.7.1/css/all.min.css" integrity="sha256-nAmazAk6vS34Xqo0BSrTb+abbtFlgsFK7NKSi6o7Y78=" crossorigin="anonymous" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.7.1/css/v4-shims.min.css" integrity="sha256-6qHlizsOWFskGlwVOKuns+D1nB6ssZrHQrNj1wGplHc=" crossorigin="anonymous" />
<!-- clipboard.js -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/clipboard.js/2.0.4/clipboard.min.js" integrity="sha256-FiZwavyI2V6+EXO1U+xzLG3IKldpiTFf3153ea9zikQ=" crossorigin="anonymous"></script>
<!-- sticky kit -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/sticky-kit/1.1.3/sticky-kit.min.js" integrity="sha256-c4Rlo1ZozqTPE2RLuvbusY3+SU1pQaJC0TjuhygMipw=" crossorigin="anonymous"></script>
<!-- headroom.js -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/headroom/0.9.4/headroom.min.js" integrity="sha256-DJFC1kqIhelURkuza0AvYal5RxMtpzLjFhsnVIeuk+U=" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/headroom/0.9.4/jQuery.headroom.min.js" integrity="sha256-ZX/yNShbjqsohH1k95liqY9Gd8uOiE1S4vZc+9KQ1K4=" crossorigin="anonymous"></script>
<!-- pkgdown -->
<link href="../pkgdown.css" rel="stylesheet">
@@ -39,15 +43,15 @@
<link href="../extra.css" rel="stylesheet">
<meta property="og:title" content="Display 2D LEGO mosaic as a plot image — build_mosaic" />
<meta property="og:description" content="Display 2D LEGO mosaic as a plot image" />
<meta property="og:image" content="http://brickr.org/logo.png" />
<meta name="twitter:card" content="summary" />
<!-- mathjax -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/MathJax.js" integrity="sha256-nvJJv9wWKEm88qvoQl9ekL2J+k/RWIsaSScxxlsrv8k=" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/config/TeX-AMS-MML_HTMLorMML.js" integrity="sha256-84DKXVJXs0/F8OTMzX4UR909+jtl4G7SPypPavF+GfA=" crossorigin="anonymous"></script>
@@ -58,6 +62,7 @@
<![endif]-->
</head>
<body>
@@ -74,7 +79,7 @@
</button>
<span class="navbar-brand">
<a class="navbar-link" href="../index.html">brickr</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.1.0.9024</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.2.0</span>
</span>
</div>
@@ -82,7 +87,7 @@
<ul class="nav navbar-nav">
<li>
<a href="../index.html">
<span class="fa fa-home fa-lg"></span>
<span class="fas fa fas fa-home fa-lg"></span>
</a>
</li>
@@ -117,11 +122,10 @@
<a href="../news/index.html">Changelog</a>
</li>
</ul>
<ul class="nav navbar-nav navbar-right">
<li>
<a href="https://github.com/ryantimpe/brickr">
<span class="fa fa-github fa-lg"></span>
<span class="fab fa fab fa-github fa-lg"></span>
</a>
</li>
@@ -132,6 +136,7 @@
</div><!--/.navbar -->
</header>
<div class="row">
@@ -143,13 +148,11 @@
</div>
<div class="ref-description">
<p>Display 2D LEGO mosaic as a plot image</p>
</div>
<pre class="usage"><span class='fu'>build_mosaic</span>(<span class='no'>brick_obj</span>, <span class='kw'>title</span> <span class='kw'>=</span> <span class='kw'>NULL</span>)</pre>
<h2 class="hasAnchor" id="arguments"><a class="anchor" href="#arguments"></a>Arguments</h2>
<table class="ref-arguments">
<colgroup><col class="name" /><col class="desc" /></colgroup>
@@ -162,37 +165,39 @@
<td><p>Optional title to include above plotted mosaic.</p></td>
</tr>
</table>
<h2 class="hasAnchor" id="see-also"><a class="anchor" href="#see-also"></a>See also</h2>
<div class='dont-index'><p>Other Mosaics: <code><a href='image_to_mosaic.html'>image_to_mosaic</a></code></p></div>
</div>
<div class="col-md-3 hidden-xs hidden-sm" id="sidebar">
<h2>Contents</h2>
<ul class="nav nav-pills nav-stacked">
<li><a href="#arguments">Arguments</a></li>
<li><a href="#see-also">See also</a></li>
</ul>
</ul>
</div>
</div>
<footer>
<div class="copyright">
<p>Developed by Ryan Timpe.</p>
</div>
<div class="pkgdown">
<p>Site built with <a href="https://pkgdown.r-lib.org/">pkgdown</a> 1.3.0.</p>
<p>Site built with <a href="https://pkgdown.r-lib.org/">pkgdown</a> 1.4.1.</p>
</div>
</footer>
</div>
</body>
</html>
+22 -19
View File
@@ -15,21 +15,25 @@
<link rel="apple-touch-icon" type="image/png" sizes="120x120" href="../apple-touch-icon-120x120.png" />
<link rel="apple-touch-icon" type="image/png" sizes="76x76" href="../apple-touch-icon-76x76.png" />
<link rel="apple-touch-icon" type="image/png" sizes="60x60" href="../apple-touch-icon-60x60.png" />
<!-- jquery -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js" integrity="sha256-FgpCb/KJQlLNfOu91ta32o/NMZxltwRo8QtmkMRdAu8=" crossorigin="anonymous"></script>
<!-- Bootstrap -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha256-916EbMg70RQy9LHiGkXzG8hSg9EdNy97GazNG/aiY1w=" crossorigin="anonymous" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha256-U5ZEeKfGNOja007MMD3YBI0A3OSZOQbeG6z2f2Y0hu8=" crossorigin="anonymous"></script>
<!-- Font Awesome icons -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css" integrity="sha256-eZrrJcwDc/3uDhsdt61sL2oOBY362qM3lon1gyExkL0=" crossorigin="anonymous" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.7.1/css/all.min.css" integrity="sha256-nAmazAk6vS34Xqo0BSrTb+abbtFlgsFK7NKSi6o7Y78=" crossorigin="anonymous" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.7.1/css/v4-shims.min.css" integrity="sha256-6qHlizsOWFskGlwVOKuns+D1nB6ssZrHQrNj1wGplHc=" crossorigin="anonymous" />
<!-- clipboard.js -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/clipboard.js/2.0.4/clipboard.min.js" integrity="sha256-FiZwavyI2V6+EXO1U+xzLG3IKldpiTFf3153ea9zikQ=" crossorigin="anonymous"></script>
<!-- sticky kit -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/sticky-kit/1.1.3/sticky-kit.min.js" integrity="sha256-c4Rlo1ZozqTPE2RLuvbusY3+SU1pQaJC0TjuhygMipw=" crossorigin="anonymous"></script>
<!-- headroom.js -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/headroom/0.9.4/headroom.min.js" integrity="sha256-DJFC1kqIhelURkuza0AvYal5RxMtpzLjFhsnVIeuk+U=" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/headroom/0.9.4/jQuery.headroom.min.js" integrity="sha256-ZX/yNShbjqsohH1k95liqY9Gd8uOiE1S4vZc+9KQ1K4=" crossorigin="anonymous"></script>
<!-- pkgdown -->
<link href="../pkgdown.css" rel="stylesheet">
@@ -39,15 +43,15 @@
<link href="../extra.css" rel="stylesheet">
<meta property="og:title" content="Display bricks required to build model or mosaic. — build_pieces" />
<meta property="og:description" content="Display bricks required to build model or mosaic." />
<meta property="og:image" content="http://brickr.org/logo.png" />
<meta name="twitter:card" content="summary" />
<!-- mathjax -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/MathJax.js" integrity="sha256-nvJJv9wWKEm88qvoQl9ekL2J+k/RWIsaSScxxlsrv8k=" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/config/TeX-AMS-MML_HTMLorMML.js" integrity="sha256-84DKXVJXs0/F8OTMzX4UR909+jtl4G7SPypPavF+GfA=" crossorigin="anonymous"></script>
@@ -58,6 +62,7 @@
<![endif]-->
</head>
<body>
@@ -74,7 +79,7 @@
</button>
<span class="navbar-brand">
<a class="navbar-link" href="../index.html">brickr</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.1.0.9024</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.2.0</span>
</span>
</div>
@@ -82,7 +87,7 @@
<ul class="nav navbar-nav">
<li>
<a href="../index.html">
<span class="fa fa-home fa-lg"></span>
<span class="fas fa fas fa-home fa-lg"></span>
</a>
</li>
@@ -117,11 +122,10 @@
<a href="../news/index.html">Changelog</a>
</li>
</ul>
<ul class="nav navbar-nav navbar-right">
<li>
<a href="https://github.com/ryantimpe/brickr">
<span class="fa fa-github fa-lg"></span>
<span class="fab fa fab fa-github fa-lg"></span>
</a>
</li>
@@ -132,6 +136,7 @@
</div><!--/.navbar -->
</header>
<div class="row">
@@ -143,13 +148,11 @@
</div>
<div class="ref-description">
<p>Display bricks required to build model or mosaic.</p>
</div>
<pre class="usage"><span class='fu'>build_pieces</span>(<span class='no'>brick_obj</span>)</pre>
<h2 class="hasAnchor" id="arguments"><a class="anchor" href="#arguments"></a>Arguments</h2>
<table class="ref-arguments">
<colgroup><col class="name" /><col class="desc" /></colgroup>
@@ -158,46 +161,46 @@
<td><p>brickr mosaic or 3D model object.</p></td>
</tr>
</table>
<h2 class="hasAnchor" id="value"><a class="anchor" href="#value"></a>Value</h2>
<p>Plot object of required bricks by color and size.</p>
<h2 class="hasAnchor" id="see-also"><a class="anchor" href="#see-also"></a>See also</h2>
<div class='dont-index'><p>Other Resources: <code><a href='build_colors.html'>build_colors</a></code>,
<code><a href='build_instructions.html'>build_instructions</a></code>,
<code><a href='build_pieces_table.html'>build_pieces_table</a></code>,
<code><a href='build_themes.html'>build_themes</a></code></p></div>
</div>
<div class="col-md-3 hidden-xs hidden-sm" id="sidebar">
<h2>Contents</h2>
<ul class="nav nav-pills nav-stacked">
<li><a href="#arguments">Arguments</a></li>
<li><a href="#value">Value</a></li>
<li><a href="#see-also">See also</a></li>
</ul>
</ul>
</div>
</div>
<footer>
<div class="copyright">
<p>Developed by Ryan Timpe.</p>
</div>
<div class="pkgdown">
<p>Site built with <a href="https://pkgdown.r-lib.org/">pkgdown</a> 1.3.0.</p>
<p>Site built with <a href="https://pkgdown.r-lib.org/">pkgdown</a> 1.4.1.</p>
</div>
</footer>
</div>
</body>
</html>
+22 -19
View File
@@ -15,21 +15,25 @@
<link rel="apple-touch-icon" type="image/png" sizes="120x120" href="../apple-touch-icon-120x120.png" />
<link rel="apple-touch-icon" type="image/png" sizes="76x76" href="../apple-touch-icon-76x76.png" />
<link rel="apple-touch-icon" type="image/png" sizes="60x60" href="../apple-touch-icon-60x60.png" />
<!-- jquery -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js" integrity="sha256-FgpCb/KJQlLNfOu91ta32o/NMZxltwRo8QtmkMRdAu8=" crossorigin="anonymous"></script>
<!-- Bootstrap -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha256-916EbMg70RQy9LHiGkXzG8hSg9EdNy97GazNG/aiY1w=" crossorigin="anonymous" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha256-U5ZEeKfGNOja007MMD3YBI0A3OSZOQbeG6z2f2Y0hu8=" crossorigin="anonymous"></script>
<!-- Font Awesome icons -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css" integrity="sha256-eZrrJcwDc/3uDhsdt61sL2oOBY362qM3lon1gyExkL0=" crossorigin="anonymous" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.7.1/css/all.min.css" integrity="sha256-nAmazAk6vS34Xqo0BSrTb+abbtFlgsFK7NKSi6o7Y78=" crossorigin="anonymous" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.7.1/css/v4-shims.min.css" integrity="sha256-6qHlizsOWFskGlwVOKuns+D1nB6ssZrHQrNj1wGplHc=" crossorigin="anonymous" />
<!-- clipboard.js -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/clipboard.js/2.0.4/clipboard.min.js" integrity="sha256-FiZwavyI2V6+EXO1U+xzLG3IKldpiTFf3153ea9zikQ=" crossorigin="anonymous"></script>
<!-- sticky kit -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/sticky-kit/1.1.3/sticky-kit.min.js" integrity="sha256-c4Rlo1ZozqTPE2RLuvbusY3+SU1pQaJC0TjuhygMipw=" crossorigin="anonymous"></script>
<!-- headroom.js -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/headroom/0.9.4/headroom.min.js" integrity="sha256-DJFC1kqIhelURkuza0AvYal5RxMtpzLjFhsnVIeuk+U=" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/headroom/0.9.4/jQuery.headroom.min.js" integrity="sha256-ZX/yNShbjqsohH1k95liqY9Gd8uOiE1S4vZc+9KQ1K4=" crossorigin="anonymous"></script>
<!-- pkgdown -->
<link href="../pkgdown.css" rel="stylesheet">
@@ -39,15 +43,15 @@
<link href="../extra.css" rel="stylesheet">
<meta property="og:title" content="Generate required bricks as a data frame. — build_pieces_table" />
<meta property="og:description" content="Generate required bricks as a data frame." />
<meta property="og:image" content="http://brickr.org/logo.png" />
<meta name="twitter:card" content="summary" />
<!-- mathjax -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/MathJax.js" integrity="sha256-nvJJv9wWKEm88qvoQl9ekL2J+k/RWIsaSScxxlsrv8k=" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/config/TeX-AMS-MML_HTMLorMML.js" integrity="sha256-84DKXVJXs0/F8OTMzX4UR909+jtl4G7SPypPavF+GfA=" crossorigin="anonymous"></script>
@@ -58,6 +62,7 @@
<![endif]-->
</head>
<body>
@@ -74,7 +79,7 @@
</button>
<span class="navbar-brand">
<a class="navbar-link" href="../index.html">brickr</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.1.0.9024</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.2.0</span>
</span>
</div>
@@ -82,7 +87,7 @@
<ul class="nav navbar-nav">
<li>
<a href="../index.html">
<span class="fa fa-home fa-lg"></span>
<span class="fas fa fas fa-home fa-lg"></span>
</a>
</li>
@@ -117,11 +122,10 @@
<a href="../news/index.html">Changelog</a>
</li>
</ul>
<ul class="nav navbar-nav navbar-right">
<li>
<a href="https://github.com/ryantimpe/brickr">
<span class="fa fa-github fa-lg"></span>
<span class="fab fa fab fa-github fa-lg"></span>
</a>
</li>
@@ -132,6 +136,7 @@
</div><!--/.navbar -->
</header>
<div class="row">
@@ -143,13 +148,11 @@
</div>
<div class="ref-description">
<p>Generate required bricks as a data frame.</p>
</div>
<pre class="usage"><span class='fu'>build_pieces_table</span>(<span class='no'>brick_obj</span>)</pre>
<h2 class="hasAnchor" id="arguments"><a class="anchor" href="#arguments"></a>Arguments</h2>
<table class="ref-arguments">
<colgroup><col class="name" /><col class="desc" /></colgroup>
@@ -158,45 +161,45 @@
<td><p>brickr mosaic or 3D model object.</p></td>
</tr>
</table>
<h2 class="hasAnchor" id="value"><a class="anchor" href="#value"></a>Value</h2>
<p>Data frame of piece counts by LEGO color name and size.</p>
<h2 class="hasAnchor" id="see-also"><a class="anchor" href="#see-also"></a>See also</h2>
<div class='dont-index'><p>Other Resources: <code><a href='build_colors.html'>build_colors</a></code>,
<code><a href='build_instructions.html'>build_instructions</a></code>,
<code><a href='build_pieces.html'>build_pieces</a></code>, <code><a href='build_themes.html'>build_themes</a></code></p></div>
</div>
<div class="col-md-3 hidden-xs hidden-sm" id="sidebar">
<h2>Contents</h2>
<ul class="nav nav-pills nav-stacked">
<li><a href="#arguments">Arguments</a></li>
<li><a href="#value">Value</a></li>
<li><a href="#see-also">See also</a></li>
</ul>
</ul>
</div>
</div>
<footer>
<div class="copyright">
<p>Developed by Ryan Timpe.</p>
</div>
<div class="pkgdown">
<p>Site built with <a href="https://pkgdown.r-lib.org/">pkgdown</a> 1.3.0.</p>
<p>Site built with <a href="https://pkgdown.r-lib.org/">pkgdown</a> 1.4.1.</p>
</div>
</footer>
</div>
</body>
</html>
+22 -20
View File
@@ -15,21 +15,25 @@
<link rel="apple-touch-icon" type="image/png" sizes="120x120" href="../apple-touch-icon-120x120.png" />
<link rel="apple-touch-icon" type="image/png" sizes="76x76" href="../apple-touch-icon-76x76.png" />
<link rel="apple-touch-icon" type="image/png" sizes="60x60" href="../apple-touch-icon-60x60.png" />
<!-- jquery -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js" integrity="sha256-FgpCb/KJQlLNfOu91ta32o/NMZxltwRo8QtmkMRdAu8=" crossorigin="anonymous"></script>
<!-- Bootstrap -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha256-916EbMg70RQy9LHiGkXzG8hSg9EdNy97GazNG/aiY1w=" crossorigin="anonymous" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha256-U5ZEeKfGNOja007MMD3YBI0A3OSZOQbeG6z2f2Y0hu8=" crossorigin="anonymous"></script>
<!-- Font Awesome icons -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css" integrity="sha256-eZrrJcwDc/3uDhsdt61sL2oOBY362qM3lon1gyExkL0=" crossorigin="anonymous" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.7.1/css/all.min.css" integrity="sha256-nAmazAk6vS34Xqo0BSrTb+abbtFlgsFK7NKSi6o7Y78=" crossorigin="anonymous" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.7.1/css/v4-shims.min.css" integrity="sha256-6qHlizsOWFskGlwVOKuns+D1nB6ssZrHQrNj1wGplHc=" crossorigin="anonymous" />
<!-- clipboard.js -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/clipboard.js/2.0.4/clipboard.min.js" integrity="sha256-FiZwavyI2V6+EXO1U+xzLG3IKldpiTFf3153ea9zikQ=" crossorigin="anonymous"></script>
<!-- sticky kit -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/sticky-kit/1.1.3/sticky-kit.min.js" integrity="sha256-c4Rlo1ZozqTPE2RLuvbusY3+SU1pQaJC0TjuhygMipw=" crossorigin="anonymous"></script>
<!-- headroom.js -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/headroom/0.9.4/headroom.min.js" integrity="sha256-DJFC1kqIhelURkuza0AvYal5RxMtpzLjFhsnVIeuk+U=" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/headroom/0.9.4/jQuery.headroom.min.js" integrity="sha256-ZX/yNShbjqsohH1k95liqY9Gd8uOiE1S4vZc+9KQ1K4=" crossorigin="anonymous"></script>
<!-- pkgdown -->
<link href="../pkgdown.css" rel="stylesheet">
@@ -39,15 +43,15 @@
<link href="../extra.css" rel="stylesheet">
<meta property="og:title" content="Display available brick themes for ggplot feature scale_fill_brick() — build_themes" />
<meta property="og:description" content="Generates a plot of available brick themes." />
<meta property="og:image" content="http://brickr.org/logo.png" />
<meta name="twitter:card" content="summary" />
<!-- mathjax -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/MathJax.js" integrity="sha256-nvJJv9wWKEm88qvoQl9ekL2J+k/RWIsaSScxxlsrv8k=" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/config/TeX-AMS-MML_HTMLorMML.js" integrity="sha256-84DKXVJXs0/F8OTMzX4UR909+jtl4G7SPypPavF+GfA=" crossorigin="anonymous"></script>
@@ -58,6 +62,7 @@
<![endif]-->
</head>
<body>
@@ -74,7 +79,7 @@
</button>
<span class="navbar-brand">
<a class="navbar-link" href="../index.html">brickr</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.1.0.9024</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.2.0</span>
</span>
</div>
@@ -82,7 +87,7 @@
<ul class="nav navbar-nav">
<li>
<a href="../index.html">
<span class="fa fa-home fa-lg"></span>
<span class="fas fa fas fa-home fa-lg"></span>
</a>
</li>
@@ -117,11 +122,10 @@
<a href="../news/index.html">Changelog</a>
</li>
</ul>
<ul class="nav navbar-nav navbar-right">
<li>
<a href="https://github.com/ryantimpe/brickr">
<span class="fa fa-github fa-lg"></span>
<span class="fab fa fab fa-github fa-lg"></span>
</a>
</li>
@@ -132,6 +136,7 @@
</div><!--/.navbar -->
</header>
<div class="row">
@@ -143,13 +148,11 @@
</div>
<div class="ref-description">
<p>Generates a plot of available brick themes.</p>
</div>
<pre class="usage"><span class='fu'>build_themes</span>(<span class='kw'>show_themes</span> <span class='kw'>=</span> <span class='st'>"all"</span>, <span class='kw'>.names_only</span> <span class='kw'>=</span> <span class='fl'>FALSE</span>)</pre>
<h2 class="hasAnchor" id="arguments"><a class="anchor" href="#arguments"></a>Arguments</h2>
<table class="ref-arguments">
<colgroup><col class="name" /><col class="desc" /></colgroup>
@@ -162,22 +165,20 @@
<td><p>Logical. Return an array of the theme names. Does not plot.</p></td>
</tr>
</table>
<h2 class="hasAnchor" id="value"><a class="anchor" href="#value"></a>Value</h2>
<p>A table and ggplot of brick colors &amp; ID numbers.</p>
<h2 class="hasAnchor" id="see-also"><a class="anchor" href="#see-also"></a>See also</h2>
<div class='dont-index'><p>Other Resources: <code><a href='build_colors.html'>build_colors</a></code>,
<code><a href='build_instructions.html'>build_instructions</a></code>,
<code><a href='build_pieces_table.html'>build_pieces_table</a></code>,
<code><a href='build_pieces.html'>build_pieces</a></code></p></div>
<h2 class="hasAnchor" id="examples"><a class="anchor" href="#examples"></a>Examples</h2>
<pre class="examples"><div class='input'><span class='co'>#Generate plot of themes</span>
<span class='fu'>build_themes</span>()</div><div class='img'><img src='build_themes-1.png' alt='' width='700' height='433' /></div><div class='input'><span class='fu'>build_themes</span>(<span class='fu'><a href='https://www.rdocumentation.org/packages/base/topics/c'>c</a></span>(<span class='st'>"ducks"</span>, <span class='st'>"ocean"</span>, <span class='st'>"space"</span>))</div><div class='img'><img src='build_themes-2.png' alt='' width='700' height='433' /></div><div class='input'>
<span class='fu'>build_themes</span>()</div><div class='img'><img src='build_themes-1.png' alt='' width='700' height='433' /></div><div class='input'><span class='fu'>build_themes</span>(<span class='fu'><a href='https://rdrr.io/r/base/c.html'>c</a></span>(<span class='st'>"ducks"</span>, <span class='st'>"ocean"</span>, <span class='st'>"space"</span>))</div><div class='img'><img src='build_themes-2.png' alt='' width='700' height='433' /></div><div class='input'>
<span class='co'>#Print list of themes</span>
<span class='fu'>build_themes</span>(<span class='kw'>.names_only</span> <span class='kw'>=</span> <span class='fl'>TRUE</span>)</div><div class='output co'>#&gt; [1] "classic" "city" "duplo" "elves"
#&gt; [5] "friends" "hp" "jurassic" "movie"
@@ -190,30 +191,31 @@
<h2>Contents</h2>
<ul class="nav nav-pills nav-stacked">
<li><a href="#arguments">Arguments</a></li>
<li><a href="#value">Value</a></li>
<li><a href="#see-also">See also</a></li>
<li><a href="#examples">Examples</a></li>
</ul>
</div>
</div>
<footer>
<div class="copyright">
<p>Developed by Ryan Timpe.</p>
</div>
<div class="pkgdown">
<p>Site built with <a href="https://pkgdown.r-lib.org/">pkgdown</a> 1.3.0.</p>
<p>Site built with <a href="https://pkgdown.r-lib.org/">pkgdown</a> 1.4.1.</p>
</div>
</footer>
</div>
</body>
</html>
+23 -18
View File
@@ -15,21 +15,25 @@
<link rel="apple-touch-icon" type="image/png" sizes="120x120" href="../apple-touch-icon-120x120.png" />
<link rel="apple-touch-icon" type="image/png" sizes="76x76" href="../apple-touch-icon-76x76.png" />
<link rel="apple-touch-icon" type="image/png" sizes="60x60" href="../apple-touch-icon-60x60.png" />
<!-- jquery -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js" integrity="sha256-FgpCb/KJQlLNfOu91ta32o/NMZxltwRo8QtmkMRdAu8=" crossorigin="anonymous"></script>
<!-- Bootstrap -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha256-916EbMg70RQy9LHiGkXzG8hSg9EdNy97GazNG/aiY1w=" crossorigin="anonymous" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha256-U5ZEeKfGNOja007MMD3YBI0A3OSZOQbeG6z2f2Y0hu8=" crossorigin="anonymous"></script>
<!-- Font Awesome icons -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css" integrity="sha256-eZrrJcwDc/3uDhsdt61sL2oOBY362qM3lon1gyExkL0=" crossorigin="anonymous" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.7.1/css/all.min.css" integrity="sha256-nAmazAk6vS34Xqo0BSrTb+abbtFlgsFK7NKSi6o7Y78=" crossorigin="anonymous" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.7.1/css/v4-shims.min.css" integrity="sha256-6qHlizsOWFskGlwVOKuns+D1nB6ssZrHQrNj1wGplHc=" crossorigin="anonymous" />
<!-- clipboard.js -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/clipboard.js/2.0.4/clipboard.min.js" integrity="sha256-FiZwavyI2V6+EXO1U+xzLG3IKldpiTFf3153ea9zikQ=" crossorigin="anonymous"></script>
<!-- sticky kit -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/sticky-kit/1.1.3/sticky-kit.min.js" integrity="sha256-c4Rlo1ZozqTPE2RLuvbusY3+SU1pQaJC0TjuhygMipw=" crossorigin="anonymous"></script>
<!-- headroom.js -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/headroom/0.9.4/headroom.min.js" integrity="sha256-DJFC1kqIhelURkuza0AvYal5RxMtpzLjFhsnVIeuk+U=" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/headroom/0.9.4/jQuery.headroom.min.js" integrity="sha256-ZX/yNShbjqsohH1k95liqY9Gd8uOiE1S4vZc+9KQ1K4=" crossorigin="anonymous"></script>
<!-- pkgdown -->
<link href="../pkgdown.css" rel="stylesheet">
@@ -39,15 +43,15 @@
<link href="../extra.css" rel="stylesheet">
<meta property="og:title" content="Consolidate 1x1 bricks into larger ones of the same color. Internal function. — collect_bricks" />
<meta property="og:description" content="Consolidate 1x1 bricks into larger ones of the same color. Internal function." />
<meta property="og:image" content="http://brickr.org/logo.png" />
<meta name="twitter:card" content="summary" />
<!-- mathjax -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/MathJax.js" integrity="sha256-nvJJv9wWKEm88qvoQl9ekL2J+k/RWIsaSScxxlsrv8k=" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/config/TeX-AMS-MML_HTMLorMML.js" integrity="sha256-84DKXVJXs0/F8OTMzX4UR909+jtl4G7SPypPavF+GfA=" crossorigin="anonymous"></script>
@@ -58,6 +62,7 @@
<![endif]-->
</head>
<body>
@@ -74,7 +79,7 @@
</button>
<span class="navbar-brand">
<a class="navbar-link" href="../index.html">brickr</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.1.0.9024</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.2.0</span>
</span>
</div>
@@ -82,7 +87,7 @@
<ul class="nav navbar-nav">
<li>
<a href="../index.html">
<span class="fa fa-home fa-lg"></span>
<span class="fas fa fas fa-home fa-lg"></span>
</a>
</li>
@@ -117,11 +122,10 @@
<a href="../news/index.html">Changelog</a>
</li>
</ul>
<ul class="nav navbar-nav navbar-right">
<li>
<a href="https://github.com/ryantimpe/brickr">
<span class="fa fa-github fa-lg"></span>
<span class="fab fa fab fa-github fa-lg"></span>
</a>
</li>
@@ -132,6 +136,7 @@
</div><!--/.navbar -->
</header>
<div class="row">
@@ -143,13 +148,11 @@
</div>
<div class="ref-description">
<p>Consolidate 1x1 bricks into larger ones of the same color. Internal function.</p>
</div>
<pre class="usage"><span class='fu'>collect_bricks</span>(<span class='no'>image_list</span>, <span class='kw'>use_bricks</span> <span class='kw'>=</span> <span class='kw'>NULL</span>)</pre>
<h2 class="hasAnchor" id="arguments"><a class="anchor" href="#arguments"></a>Arguments</h2>
<table class="ref-arguments">
<colgroup><col class="name" /><col class="desc" /></colgroup>
@@ -159,40 +162,42 @@
</tr>
<tr>
<th>use_bricks</th>
<td><p>Array of brick sizes to use in mosaic. Defaults to <code><a href='https://www.rdocumentation.org/packages/base/topics/c'>c('4x2', '2x2', '3x1', '2x1', '1x1')</a></code>`.</p></td>
<td><p>Array of brick sizes to use in mosaic. Defaults to <code><a href='https://rdrr.io/r/base/c.html'>c('4x2', '2x2', '3x1', '2x1', '1x1')</a></code>`.</p></td>
</tr>
</table>
<h2 class="hasAnchor" id="value"><a class="anchor" href="#value"></a>Value</h2>
<p>A list with element <code>Img_bricks</code> containing a data frame of the x- &amp; y-coordinates, R, G, B channels, and brick ID. Other helper elements.</p>
</div>
<div class="col-md-3 hidden-xs hidden-sm" id="sidebar">
<h2>Contents</h2>
<ul class="nav nav-pills nav-stacked">
<li><a href="#arguments">Arguments</a></li>
<li><a href="#value">Value</a></li>
</ul>
</ul>
</div>
</div>
<footer>
<div class="copyright">
<p>Developed by Ryan Timpe.</p>
</div>
<div class="pkgdown">
<p>Site built with <a href="https://pkgdown.r-lib.org/">pkgdown</a> 1.3.0.</p>
<p>Site built with <a href="https://pkgdown.r-lib.org/">pkgdown</a> 1.4.1.</p>
</div>
</footer>
</div>
</body>
</html>
+22 -18
View File
@@ -15,21 +15,25 @@
<link rel="apple-touch-icon" type="image/png" sizes="120x120" href="../apple-touch-icon-120x120.png" />
<link rel="apple-touch-icon" type="image/png" sizes="76x76" href="../apple-touch-icon-76x76.png" />
<link rel="apple-touch-icon" type="image/png" sizes="60x60" href="../apple-touch-icon-60x60.png" />
<!-- jquery -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js" integrity="sha256-FgpCb/KJQlLNfOu91ta32o/NMZxltwRo8QtmkMRdAu8=" crossorigin="anonymous"></script>
<!-- Bootstrap -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha256-916EbMg70RQy9LHiGkXzG8hSg9EdNy97GazNG/aiY1w=" crossorigin="anonymous" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha256-U5ZEeKfGNOja007MMD3YBI0A3OSZOQbeG6z2f2Y0hu8=" crossorigin="anonymous"></script>
<!-- Font Awesome icons -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css" integrity="sha256-eZrrJcwDc/3uDhsdt61sL2oOBY362qM3lon1gyExkL0=" crossorigin="anonymous" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.7.1/css/all.min.css" integrity="sha256-nAmazAk6vS34Xqo0BSrTb+abbtFlgsFK7NKSi6o7Y78=" crossorigin="anonymous" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.7.1/css/v4-shims.min.css" integrity="sha256-6qHlizsOWFskGlwVOKuns+D1nB6ssZrHQrNj1wGplHc=" crossorigin="anonymous" />
<!-- clipboard.js -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/clipboard.js/2.0.4/clipboard.min.js" integrity="sha256-FiZwavyI2V6+EXO1U+xzLG3IKldpiTFf3153ea9zikQ=" crossorigin="anonymous"></script>
<!-- sticky kit -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/sticky-kit/1.1.3/sticky-kit.min.js" integrity="sha256-c4Rlo1ZozqTPE2RLuvbusY3+SU1pQaJC0TjuhygMipw=" crossorigin="anonymous"></script>
<!-- headroom.js -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/headroom/0.9.4/headroom.min.js" integrity="sha256-DJFC1kqIhelURkuza0AvYal5RxMtpzLjFhsnVIeuk+U=" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/headroom/0.9.4/jQuery.headroom.min.js" integrity="sha256-ZX/yNShbjqsohH1k95liqY9Gd8uOiE1S4vZc+9KQ1K4=" crossorigin="anonymous"></script>
<!-- pkgdown -->
<link href="../pkgdown.css" rel="stylesheet">
@@ -39,16 +43,16 @@
<link href="../extra.css" rel="stylesheet">
<meta property="og:title" content="Cartesian coordinates for bricks - ggplot2 extension — coord_brick" />
<meta property="og:title" content="Cartesian coordinates for bricks - ggplot2 extension — coord_brick" />
<meta property="og:description" content="A fixed scale coordinate system that ensures correct brick proportions are maintained regardless of device size.
Use coord_brick_flip() for horizontal bars." />
<meta property="og:image" content="http://brickr.org/logo.png" />
<meta name="twitter:card" content="summary" />
<!-- mathjax -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/MathJax.js" integrity="sha256-nvJJv9wWKEm88qvoQl9ekL2J+k/RWIsaSScxxlsrv8k=" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/config/TeX-AMS-MML_HTMLorMML.js" integrity="sha256-84DKXVJXs0/F8OTMzX4UR909+jtl4G7SPypPavF+GfA=" crossorigin="anonymous"></script>
@@ -59,6 +63,7 @@ Use coord_brick_flip() for horizontal bars." />
<![endif]-->
</head>
<body>
@@ -75,7 +80,7 @@ Use coord_brick_flip() for horizontal bars." />
</button>
<span class="navbar-brand">
<a class="navbar-link" href="../index.html">brickr</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.1.0.9024</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.2.0</span>
</span>
</div>
@@ -83,7 +88,7 @@ Use coord_brick_flip() for horizontal bars." />
<ul class="nav navbar-nav">
<li>
<a href="../index.html">
<span class="fa fa-home fa-lg"></span>
<span class="fas fa fas fa-home fa-lg"></span>
</a>
</li>
@@ -118,11 +123,10 @@ Use coord_brick_flip() for horizontal bars." />
<a href="../news/index.html">Changelog</a>
</li>
</ul>
<ul class="nav navbar-nav navbar-right">
<li>
<a href="https://github.com/ryantimpe/brickr">
<span class="fa fa-github fa-lg"></span>
<span class="fab fa fab fa-github fa-lg"></span>
</a>
</li>
@@ -133,6 +137,7 @@ Use coord_brick_flip() for horizontal bars." />
</div><!--/.navbar -->
</header>
<div class="row">
@@ -144,17 +149,15 @@ Use coord_brick_flip() for horizontal bars." />
</div>
<div class="ref-description">
<p>A fixed scale coordinate system that ensures correct brick proportions are maintained regardless of device size.
Use <code>coord_brick_flip()</code> for horizontal bars.</p>
</div>
<pre class="usage"><span class='fu'>coord_brick</span>(<span class='kw'>xlim</span> <span class='kw'>=</span> <span class='kw'>NULL</span>, <span class='kw'>ylim</span> <span class='kw'>=</span> <span class='kw'>NULL</span>, <span class='kw'>expand</span> <span class='kw'>=</span> <span class='fl'>TRUE</span>, <span class='kw'>clip</span> <span class='kw'>=</span> <span class='st'>"on"</span>)
<span class='fu'>coord_brick_flip</span>(<span class='kw'>xlim</span> <span class='kw'>=</span> <span class='kw'>NULL</span>, <span class='kw'>ylim</span> <span class='kw'>=</span> <span class='kw'>NULL</span>, <span class='kw'>expand</span> <span class='kw'>=</span> <span class='fl'>TRUE</span>,
<span class='kw'>clip</span> <span class='kw'>=</span> <span class='st'>"on"</span>)</pre>
<h2 class="hasAnchor" id="arguments"><a class="anchor" href="#arguments"></a>Arguments</h2>
<table class="ref-arguments">
<colgroup><col class="name" /><col class="desc" /></colgroup>
@@ -184,18 +187,17 @@ limits, then those data points may show up in places such as the axes, the
legend, the plot title, or the plot margins.</p></td>
</tr>
</table>
<h2 class="hasAnchor" id="see-also"><a class="anchor" href="#see-also"></a>See also</h2>
<div class='dont-index'><p>Other Graphs: <code><a href='geom_brick_col.html'>geom_brick_col</a></code>,
<code><a href='geom_brick_rect.html'>geom_brick_rect</a></code>,
<code><a href='scale_fill_brick.html'>scale_fill_brick</a></code>, <code><a href='theme_brick.html'>theme_brick</a></code></p></div>
<h2 class="hasAnchor" id="examples"><a class="anchor" href="#examples"></a>Examples</h2>
<pre class="examples"><div class='input'><span class='co'>#geom_brick_col should be used in conjunction with other brickr charting </span>
<span class='co'>#functions, especially coord_brick.</span>
<span class='no'>df</span> <span class='kw'>&lt;-</span> <span class='fu'><a href='https://www.rdocumentation.org/packages/base/topics/data.frame'>data.frame</a></span>(<span class='kw'>trt</span> <span class='kw'>=</span> <span class='fu'><a href='https://www.rdocumentation.org/packages/base/topics/c'>c</a></span>(<span class='st'>"a"</span>, <span class='st'>"b"</span>, <span class='st'>"c"</span>), <span class='kw'>outcome</span> <span class='kw'>=</span> <span class='fu'><a href='https://www.rdocumentation.org/packages/base/topics/c'>c</a></span>(<span class='fl'>2.3</span>, <span class='fl'>1.9</span>, <span class='fl'>3.2</span>))
<span class='no'>df</span> <span class='kw'>&lt;-</span> <span class='fu'><a href='https://rdrr.io/r/base/data.frame.html'>data.frame</a></span>(<span class='kw'>trt</span> <span class='kw'>=</span> <span class='fu'><a href='https://rdrr.io/r/base/c.html'>c</a></span>(<span class='st'>"a"</span>, <span class='st'>"b"</span>, <span class='st'>"c"</span>), <span class='kw'>outcome</span> <span class='kw'>=</span> <span class='fu'><a href='https://rdrr.io/r/base/c.html'>c</a></span>(<span class='fl'>2.3</span>, <span class='fl'>1.9</span>, <span class='fl'>3.2</span>))
<span class='fu'>ggplot</span>(<span class='no'>df</span>, <span class='fu'>aes</span>(<span class='no'>trt</span>, <span class='no'>outcome</span>)) +
<span class='fu'><a href='geom_brick_col.html'>geom_brick_col</a></span>(<span class='fu'>aes</span>(<span class='kw'>fill</span> <span class='kw'>=</span> <span class='no'>trt</span>)) +
<span class='fu'>coord_brick</span>()</div><div class='img'><img src='coord-brick-1.png' alt='' width='700' height='433' /></div><div class='input'>
@@ -208,28 +210,30 @@ legend, the plot title, or the plot margins.</p></td>
<h2>Contents</h2>
<ul class="nav nav-pills nav-stacked">
<li><a href="#arguments">Arguments</a></li>
<li><a href="#see-also">See also</a></li>
<li><a href="#examples">Examples</a></li>
</ul>
</div>
</div>
<footer>
<div class="copyright">
<p>Developed by Ryan Timpe.</p>
</div>
<div class="pkgdown">
<p>Site built with <a href="https://pkgdown.r-lib.org/">pkgdown</a> 1.3.0.</p>
<p>Site built with <a href="https://pkgdown.r-lib.org/">pkgdown</a> 1.4.1.</p>
</div>
</footer>
</div>
</body>
</html>
+22 -18
View File
@@ -15,21 +15,25 @@
<link rel="apple-touch-icon" type="image/png" sizes="120x120" href="../apple-touch-icon-120x120.png" />
<link rel="apple-touch-icon" type="image/png" sizes="76x76" href="../apple-touch-icon-76x76.png" />
<link rel="apple-touch-icon" type="image/png" sizes="60x60" href="../apple-touch-icon-60x60.png" />
<!-- jquery -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js" integrity="sha256-FgpCb/KJQlLNfOu91ta32o/NMZxltwRo8QtmkMRdAu8=" crossorigin="anonymous"></script>
<!-- Bootstrap -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha256-916EbMg70RQy9LHiGkXzG8hSg9EdNy97GazNG/aiY1w=" crossorigin="anonymous" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha256-U5ZEeKfGNOja007MMD3YBI0A3OSZOQbeG6z2f2Y0hu8=" crossorigin="anonymous"></script>
<!-- Font Awesome icons -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css" integrity="sha256-eZrrJcwDc/3uDhsdt61sL2oOBY362qM3lon1gyExkL0=" crossorigin="anonymous" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.7.1/css/all.min.css" integrity="sha256-nAmazAk6vS34Xqo0BSrTb+abbtFlgsFK7NKSi6o7Y78=" crossorigin="anonymous" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.7.1/css/v4-shims.min.css" integrity="sha256-6qHlizsOWFskGlwVOKuns+D1nB6ssZrHQrNj1wGplHc=" crossorigin="anonymous" />
<!-- clipboard.js -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/clipboard.js/2.0.4/clipboard.min.js" integrity="sha256-FiZwavyI2V6+EXO1U+xzLG3IKldpiTFf3153ea9zikQ=" crossorigin="anonymous"></script>
<!-- sticky kit -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/sticky-kit/1.1.3/sticky-kit.min.js" integrity="sha256-c4Rlo1ZozqTPE2RLuvbusY3+SU1pQaJC0TjuhygMipw=" crossorigin="anonymous"></script>
<!-- headroom.js -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/headroom/0.9.4/headroom.min.js" integrity="sha256-DJFC1kqIhelURkuza0AvYal5RxMtpzLjFhsnVIeuk+U=" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/headroom/0.9.4/jQuery.headroom.min.js" integrity="sha256-ZX/yNShbjqsohH1k95liqY9Gd8uOiE1S4vZc+9KQ1K4=" crossorigin="anonymous"></script>
<!-- pkgdown -->
<link href="../pkgdown.css" rel="stylesheet">
@@ -39,16 +43,16 @@
<link href="../extra.css" rel="stylesheet">
<meta property="og:title" content="Bar charts with bricks - ggplot2 extension — geom_brick_col" />
<meta property="og:title" content="Bar charts with bricks - ggplot2 extension — geom_brick_col" />
<meta property="og:description" content="geom_brick_col() is the brickr version of ggplot2::geom_col().
Bar height is determined by values in the data using the y aesthetic. With the exception of fill, aesthetics available in ggplot2::geom_col() are generally not enabled here." />
<meta property="og:image" content="http://brickr.org/logo.png" />
<meta name="twitter:card" content="summary" />
<!-- mathjax -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/MathJax.js" integrity="sha256-nvJJv9wWKEm88qvoQl9ekL2J+k/RWIsaSScxxlsrv8k=" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/config/TeX-AMS-MML_HTMLorMML.js" integrity="sha256-84DKXVJXs0/F8OTMzX4UR909+jtl4G7SPypPavF+GfA=" crossorigin="anonymous"></script>
@@ -59,6 +63,7 @@ Bar height is determined by values in the data using the y aesthetic. With the e
<![endif]-->
</head>
<body>
@@ -75,7 +80,7 @@ Bar height is determined by values in the data using the y aesthetic. With the e
</button>
<span class="navbar-brand">
<a class="navbar-link" href="../index.html">brickr</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.1.0.9024</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.2.0</span>
</span>
</div>
@@ -83,7 +88,7 @@ Bar height is determined by values in the data using the y aesthetic. With the e
<ul class="nav navbar-nav">
<li>
<a href="../index.html">
<span class="fa fa-home fa-lg"></span>
<span class="fas fa fas fa-home fa-lg"></span>
</a>
</li>
@@ -118,11 +123,10 @@ Bar height is determined by values in the data using the y aesthetic. With the e
<a href="../news/index.html">Changelog</a>
</li>
</ul>
<ul class="nav navbar-nav navbar-right">
<li>
<a href="https://github.com/ryantimpe/brickr">
<span class="fa fa-github fa-lg"></span>
<span class="fab fa fab fa-github fa-lg"></span>
</a>
</li>
@@ -133,6 +137,7 @@ Bar height is determined by values in the data using the y aesthetic. With the e
</div><!--/.navbar -->
</header>
<div class="row">
@@ -144,17 +149,15 @@ Bar height is determined by values in the data using the y aesthetic. With the e
</div>
<div class="ref-description">
<p><code>geom_brick_col()</code> is the <code>brickr</code> version of <code><a href='https://ggplot2.tidyverse.org/reference/geom_bar.html'>ggplot2::geom_col()</a></code>.
Bar height is determined by values in the data using the <code>y</code> aesthetic. With the exception of <code>fill</code>, aesthetics available in <code><a href='https://ggplot2.tidyverse.org/reference/geom_bar.html'>ggplot2::geom_col()</a></code> are generally not enabled here.</p>
</div>
<pre class="usage"><span class='fu'>geom_brick_col</span>(<span class='kw'>mapping</span> <span class='kw'>=</span> <span class='kw'>NULL</span>, <span class='kw'>data</span> <span class='kw'>=</span> <span class='kw'>NULL</span>, <span class='kw'>position</span> <span class='kw'>=</span> <span class='st'>"dodge"</span>,
<span class='kw'>two_knob</span> <span class='kw'>=</span> <span class='fl'>TRUE</span>, <span class='kw'>split_bricks</span> <span class='kw'>=</span> <span class='fl'>TRUE</span>, <span class='kw'>min_radius_for_text</span> <span class='kw'>=</span> <span class='fl'>0.02</span>,
<span class='kw'>label</span> <span class='kw'>=</span> <span class='st'>"brickr"</span>, <span class='kw'>label_scale</span> <span class='kw'>=</span> <span class='fl'>1</span>, <span class='no'>...</span>, <span class='kw'>width</span> <span class='kw'>=</span> <span class='kw'>NULL</span>,
<span class='kw'>na.rm</span> <span class='kw'>=</span> <span class='fl'>FALSE</span>, <span class='kw'>show.legend</span> <span class='kw'>=</span> <span class='fl'>NA</span>, <span class='kw'>inherit.aes</span> <span class='kw'>=</span> <span class='fl'>TRUE</span>)</pre>
<h2 class="hasAnchor" id="arguments"><a class="anchor" href="#arguments"></a>Arguments</h2>
<table class="ref-arguments">
<colgroup><col class="name" /><col class="desc" /></colgroup>
@@ -237,18 +240,17 @@ that define both data and aesthetics and shouldn't inherit behaviour from
the default plot specification, e.g. <code>borders()</code>.</p></td>
</tr>
</table>
<h2 class="hasAnchor" id="see-also"><a class="anchor" href="#see-also"></a>See also</h2>
<div class='dont-index'><p>Other Graphs: <code><a href='coord-brick.html'>coord_brick</a></code>,
<code><a href='geom_brick_rect.html'>geom_brick_rect</a></code>,
<code><a href='scale_fill_brick.html'>scale_fill_brick</a></code>, <code><a href='theme_brick.html'>theme_brick</a></code></p></div>
<h2 class="hasAnchor" id="examples"><a class="anchor" href="#examples"></a>Examples</h2>
<pre class="examples"><div class='input'><span class='co'>#geom_brick_col should be used in conjunction with other brickr charting </span>
<span class='co'>#functions, especially coord_brick.</span>
<span class='no'>df</span> <span class='kw'>&lt;-</span> <span class='fu'><a href='https://www.rdocumentation.org/packages/base/topics/data.frame'>data.frame</a></span>(<span class='kw'>trt</span> <span class='kw'>=</span> <span class='fu'><a href='https://www.rdocumentation.org/packages/base/topics/c'>c</a></span>(<span class='st'>"a"</span>, <span class='st'>"b"</span>, <span class='st'>"c"</span>), <span class='kw'>outcome</span> <span class='kw'>=</span> <span class='fu'><a href='https://www.rdocumentation.org/packages/base/topics/c'>c</a></span>(<span class='fl'>2.3</span>, <span class='fl'>1.9</span>, <span class='fl'>3.2</span>))
<span class='no'>df</span> <span class='kw'>&lt;-</span> <span class='fu'><a href='https://rdrr.io/r/base/data.frame.html'>data.frame</a></span>(<span class='kw'>trt</span> <span class='kw'>=</span> <span class='fu'><a href='https://rdrr.io/r/base/c.html'>c</a></span>(<span class='st'>"a"</span>, <span class='st'>"b"</span>, <span class='st'>"c"</span>), <span class='kw'>outcome</span> <span class='kw'>=</span> <span class='fu'><a href='https://rdrr.io/r/base/c.html'>c</a></span>(<span class='fl'>2.3</span>, <span class='fl'>1.9</span>, <span class='fl'>3.2</span>))
<span class='fu'>ggplot</span>(<span class='no'>df</span>, <span class='fu'>aes</span>(<span class='no'>trt</span>, <span class='no'>outcome</span>)) +
<span class='fu'>geom_brick_col</span>() +
<span class='fu'><a href='coord-brick.html'>coord_brick</a></span>()</div><div class='img'><img src='geom_brick_col-1.png' alt='' width='700' height='433' /></div><div class='input'>
@@ -263,28 +265,30 @@ the default plot specification, e.g. <code>borders()</code>.</p></td>
<h2>Contents</h2>
<ul class="nav nav-pills nav-stacked">
<li><a href="#arguments">Arguments</a></li>
<li><a href="#see-also">See also</a></li>
<li><a href="#examples">Examples</a></li>
</ul>
</div>
</div>
<footer>
<div class="copyright">
<p>Developed by Ryan Timpe.</p>
</div>
<div class="pkgdown">
<p>Site built with <a href="https://pkgdown.r-lib.org/">pkgdown</a> 1.3.0.</p>
<p>Site built with <a href="https://pkgdown.r-lib.org/">pkgdown</a> 1.4.1.</p>
</div>
</footer>
</div>
</body>
</html>
+23 -18
View File
@@ -15,21 +15,25 @@
<link rel="apple-touch-icon" type="image/png" sizes="120x120" href="../apple-touch-icon-120x120.png" />
<link rel="apple-touch-icon" type="image/png" sizes="76x76" href="../apple-touch-icon-76x76.png" />
<link rel="apple-touch-icon" type="image/png" sizes="60x60" href="../apple-touch-icon-60x60.png" />
<!-- jquery -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js" integrity="sha256-FgpCb/KJQlLNfOu91ta32o/NMZxltwRo8QtmkMRdAu8=" crossorigin="anonymous"></script>
<!-- Bootstrap -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha256-916EbMg70RQy9LHiGkXzG8hSg9EdNy97GazNG/aiY1w=" crossorigin="anonymous" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha256-U5ZEeKfGNOja007MMD3YBI0A3OSZOQbeG6z2f2Y0hu8=" crossorigin="anonymous"></script>
<!-- Font Awesome icons -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css" integrity="sha256-eZrrJcwDc/3uDhsdt61sL2oOBY362qM3lon1gyExkL0=" crossorigin="anonymous" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.7.1/css/all.min.css" integrity="sha256-nAmazAk6vS34Xqo0BSrTb+abbtFlgsFK7NKSi6o7Y78=" crossorigin="anonymous" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.7.1/css/v4-shims.min.css" integrity="sha256-6qHlizsOWFskGlwVOKuns+D1nB6ssZrHQrNj1wGplHc=" crossorigin="anonymous" />
<!-- clipboard.js -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/clipboard.js/2.0.4/clipboard.min.js" integrity="sha256-FiZwavyI2V6+EXO1U+xzLG3IKldpiTFf3153ea9zikQ=" crossorigin="anonymous"></script>
<!-- sticky kit -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/sticky-kit/1.1.3/sticky-kit.min.js" integrity="sha256-c4Rlo1ZozqTPE2RLuvbusY3+SU1pQaJC0TjuhygMipw=" crossorigin="anonymous"></script>
<!-- headroom.js -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/headroom/0.9.4/headroom.min.js" integrity="sha256-DJFC1kqIhelURkuza0AvYal5RxMtpzLjFhsnVIeuk+U=" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/headroom/0.9.4/jQuery.headroom.min.js" integrity="sha256-ZX/yNShbjqsohH1k95liqY9Gd8uOiE1S4vZc+9KQ1K4=" crossorigin="anonymous"></script>
<!-- pkgdown -->
<link href="../pkgdown.css" rel="stylesheet">
@@ -39,15 +43,15 @@
<link href="../extra.css" rel="stylesheet">
<meta property="og:title" content="Tile charts as Bricks - ggplot2 extension — geom_brick_rect" />
<meta property="og:description" content="geom_rect, except bars look like LEGO(R) bricks." />
<meta property="og:image" content="http://brickr.org/logo.png" />
<meta name="twitter:card" content="summary" />
<!-- mathjax -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/MathJax.js" integrity="sha256-nvJJv9wWKEm88qvoQl9ekL2J+k/RWIsaSScxxlsrv8k=" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/config/TeX-AMS-MML_HTMLorMML.js" integrity="sha256-84DKXVJXs0/F8OTMzX4UR909+jtl4G7SPypPavF+GfA=" crossorigin="anonymous"></script>
@@ -58,6 +62,7 @@
<![endif]-->
</head>
<body>
@@ -74,7 +79,7 @@
</button>
<span class="navbar-brand">
<a class="navbar-link" href="../index.html">brickr</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.1.0.9024</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.2.0</span>
</span>
</div>
@@ -82,7 +87,7 @@
<ul class="nav navbar-nav">
<li>
<a href="../index.html">
<span class="fa fa-home fa-lg"></span>
<span class="fas fa fas fa-home fa-lg"></span>
</a>
</li>
@@ -117,11 +122,10 @@
<a href="../news/index.html">Changelog</a>
</li>
</ul>
<ul class="nav navbar-nav navbar-right">
<li>
<a href="https://github.com/ryantimpe/brickr">
<span class="fa fa-github fa-lg"></span>
<span class="fab fa fab fa-github fa-lg"></span>
</a>
</li>
@@ -132,6 +136,7 @@
</div><!--/.navbar -->
</header>
<div class="row">
@@ -143,9 +148,7 @@
</div>
<div class="ref-description">
<p><code>geom_rect</code>, except bars look like LEGO(R) bricks.</p>
</div>
<pre class="usage"><span class='fu'>geom_brick_rect</span>(<span class='kw'>mapping</span> <span class='kw'>=</span> <span class='kw'>NULL</span>, <span class='kw'>data</span> <span class='kw'>=</span> <span class='kw'>NULL</span>, <span class='kw'>stat</span> <span class='kw'>=</span> <span class='st'>"identity"</span>,
@@ -153,7 +156,7 @@
<span class='kw'>simplified_threshold</span> <span class='kw'>=</span> <span class='fl'>24</span> * <span class='fl'>24</span>, <span class='kw'>label_scale</span> <span class='kw'>=</span> <span class='fl'>1</span>, <span class='kw'>use_bricks</span> <span class='kw'>=</span> <span class='kw'>NULL</span>,
<span class='kw'>linejoin</span> <span class='kw'>=</span> <span class='st'>"mitre"</span>, <span class='kw'>na.rm</span> <span class='kw'>=</span> <span class='fl'>FALSE</span>, <span class='kw'>show.legend</span> <span class='kw'>=</span> <span class='fl'>NA</span>,
<span class='kw'>inherit.aes</span> <span class='kw'>=</span> <span class='fl'>TRUE</span>)</pre>
<h2 class="hasAnchor" id="arguments"><a class="anchor" href="#arguments"></a>Arguments</h2>
<table class="ref-arguments">
<colgroup><col class="name" /><col class="desc" /></colgroup>
@@ -209,7 +212,7 @@ to the paired geom/stat.</p></td>
</tr>
<tr>
<th>use_bricks</th>
<td><p>Array of brick sizes to use in mosaic. Defaults to <code><a href='https://www.rdocumentation.org/packages/base/topics/c'>c('4x2', '2x2', '3x1', '2x1', '1x1')</a></code>`.</p></td>
<td><p>Array of brick sizes to use in mosaic. Defaults to <code><a href='https://rdrr.io/r/base/c.html'>c('4x2', '2x2', '3x1', '2x1', '1x1')</a></code>`.</p></td>
</tr>
<tr>
<th>linejoin</th>
@@ -236,39 +239,41 @@ that define both data and aesthetics and shouldn't inherit behaviour from
the default plot specification, e.g. <code>borders()</code>.</p></td>
</tr>
</table>
<h2 class="hasAnchor" id="see-also"><a class="anchor" href="#see-also"></a>See also</h2>
<div class='dont-index'><p>Other Graphs: <code><a href='coord-brick.html'>coord_brick</a></code>,
<code><a href='geom_brick_col.html'>geom_brick_col</a></code>,
<code><a href='scale_fill_brick.html'>scale_fill_brick</a></code>, <code><a href='theme_brick.html'>theme_brick</a></code></p></div>
</div>
<div class="col-md-3 hidden-xs hidden-sm" id="sidebar">
<h2>Contents</h2>
<ul class="nav nav-pills nav-stacked">
<li><a href="#arguments">Arguments</a></li>
<li><a href="#see-also">See also</a></li>
</ul>
</ul>
</div>
</div>
<footer>
<div class="copyright">
<p>Developed by Ryan Timpe.</p>
</div>
<div class="pkgdown">
<p>Site built with <a href="https://pkgdown.r-lib.org/">pkgdown</a> 1.3.0.</p>
<p>Site built with <a href="https://pkgdown.r-lib.org/">pkgdown</a> 1.4.1.</p>
</div>
</footer>
</div>
</body>
</html>
+28 -25
View File
@@ -15,21 +15,25 @@
<link rel="apple-touch-icon" type="image/png" sizes="120x120" href="../apple-touch-icon-120x120.png" />
<link rel="apple-touch-icon" type="image/png" sizes="76x76" href="../apple-touch-icon-76x76.png" />
<link rel="apple-touch-icon" type="image/png" sizes="60x60" href="../apple-touch-icon-60x60.png" />
<!-- jquery -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js" integrity="sha256-FgpCb/KJQlLNfOu91ta32o/NMZxltwRo8QtmkMRdAu8=" crossorigin="anonymous"></script>
<!-- Bootstrap -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha256-916EbMg70RQy9LHiGkXzG8hSg9EdNy97GazNG/aiY1w=" crossorigin="anonymous" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha256-U5ZEeKfGNOja007MMD3YBI0A3OSZOQbeG6z2f2Y0hu8=" crossorigin="anonymous"></script>
<!-- Font Awesome icons -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css" integrity="sha256-eZrrJcwDc/3uDhsdt61sL2oOBY362qM3lon1gyExkL0=" crossorigin="anonymous" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.7.1/css/all.min.css" integrity="sha256-nAmazAk6vS34Xqo0BSrTb+abbtFlgsFK7NKSi6o7Y78=" crossorigin="anonymous" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.7.1/css/v4-shims.min.css" integrity="sha256-6qHlizsOWFskGlwVOKuns+D1nB6ssZrHQrNj1wGplHc=" crossorigin="anonymous" />
<!-- clipboard.js -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/clipboard.js/2.0.4/clipboard.min.js" integrity="sha256-FiZwavyI2V6+EXO1U+xzLG3IKldpiTFf3153ea9zikQ=" crossorigin="anonymous"></script>
<!-- sticky kit -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/sticky-kit/1.1.3/sticky-kit.min.js" integrity="sha256-c4Rlo1ZozqTPE2RLuvbusY3+SU1pQaJC0TjuhygMipw=" crossorigin="anonymous"></script>
<!-- headroom.js -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/headroom/0.9.4/headroom.min.js" integrity="sha256-DJFC1kqIhelURkuza0AvYal5RxMtpzLjFhsnVIeuk+U=" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/headroom/0.9.4/jQuery.headroom.min.js" integrity="sha256-ZX/yNShbjqsohH1k95liqY9Gd8uOiE1S4vZc+9KQ1K4=" crossorigin="anonymous"></script>
<!-- pkgdown -->
<link href="../pkgdown.css" rel="stylesheet">
@@ -39,15 +43,15 @@
<link href="../extra.css" rel="stylesheet">
<meta property="og:title" content="Create a 2D LEGO mosaic from an image array — image_to_mosaic" />
<meta property="og:description" content="Create a 2D LEGO mosaic from an image array" />
<meta property="og:image" content="http://brickr.org/logo.png" />
<meta name="twitter:card" content="summary" />
<!-- mathjax -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/MathJax.js" integrity="sha256-nvJJv9wWKEm88qvoQl9ekL2J+k/RWIsaSScxxlsrv8k=" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/config/TeX-AMS-MML_HTMLorMML.js" integrity="sha256-84DKXVJXs0/F8OTMzX4UR909+jtl4G7SPypPavF+GfA=" crossorigin="anonymous"></script>
@@ -58,6 +62,7 @@
<![endif]-->
</head>
<body>
@@ -74,7 +79,7 @@
</button>
<span class="navbar-brand">
<a class="navbar-link" href="../index.html">brickr</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.1.0.9024</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.2.0</span>
</span>
</div>
@@ -82,7 +87,7 @@
<ul class="nav navbar-nav">
<li>
<a href="../index.html">
<span class="fa fa-home fa-lg"></span>
<span class="fas fa fas fa-home fa-lg"></span>
</a>
</li>
@@ -117,11 +122,10 @@
<a href="../news/index.html">Changelog</a>
</li>
</ul>
<ul class="nav navbar-nav navbar-right">
<li>
<a href="https://github.com/ryantimpe/brickr">
<span class="fa fa-github fa-lg"></span>
<span class="fab fa fab fa-github fa-lg"></span>
</a>
</li>
@@ -132,6 +136,7 @@
</div><!--/.navbar -->
</header>
<div class="row">
@@ -143,27 +148,25 @@
</div>
<div class="ref-description">
<p>Create a 2D LEGO mosaic from an image array</p>
</div>
<pre class="usage"><span class='fu'>image_to_mosaic</span>(<span class='no'>img</span>, <span class='kw'>img_size</span> <span class='kw'>=</span> <span class='fl'>48</span>, <span class='kw'>color_table</span> <span class='kw'>=</span> <span class='kw'>NULL</span>,
<span class='kw'>method</span> <span class='kw'>=</span> <span class='st'>"cie94"</span>, <span class='kw'>color_palette</span> <span class='kw'>=</span> <span class='fu'><a href='https://www.rdocumentation.org/packages/base/topics/c'>c</a></span>(<span class='st'>"universal"</span>, <span class='st'>"generic"</span>,
<span class='kw'>method</span> <span class='kw'>=</span> <span class='st'>"cie94"</span>, <span class='kw'>color_palette</span> <span class='kw'>=</span> <span class='fu'><a href='https://rdrr.io/r/base/c.html'>c</a></span>(<span class='st'>"universal"</span>, <span class='st'>"generic"</span>,
<span class='st'>"special"</span>), <span class='kw'>dithering</span> <span class='kw'>=</span> <span class='fl'>FALSE</span>, <span class='kw'>contrast</span> <span class='kw'>=</span> <span class='fl'>1</span>, <span class='kw'>use_bricks</span> <span class='kw'>=</span> <span class='kw'>NULL</span>,
<span class='kw'>brightness</span> <span class='kw'>=</span> <span class='fl'>1</span>, <span class='kw'>warhol</span> <span class='kw'>=</span> <span class='fl'>1</span>:<span class='fl'>3</span>)</pre>
<h2 class="hasAnchor" id="arguments"><a class="anchor" href="#arguments"></a>Arguments</h2>
<table class="ref-arguments">
<colgroup><col class="name" /><col class="desc" /></colgroup>
<tr>
<th>img</th>
<td><p>Image to convert into mosaic. Usually from <code><a href='https://www.rdocumentation.org/packages/jpeg/topics/readJPEG'>jpeg::readJPEG()</a></code> or <code><a href='https://www.rdocumentation.org/packages/png/topics/readPNG'>png::readPNG()</a></code>.</p></td>
<td><p>Image to convert into mosaic. Usually from <code><a href='https://rdrr.io/pkg/jpeg/man/readJPEG.html'>jpeg::readJPEG()</a></code> or <code><a href='https://rdrr.io/pkg/png/man/readPNG.html'>png::readPNG()</a></code>.</p></td>
</tr>
<tr>
<th>img_size</th>
<td><p>Size of output image in pixel, where one pixel = one 'brick'. Use a single value (e.g. <code>48</code>) for a square image with 48 pixels on each side.
Use an array of two values for a rectangular image <code><a href='https://www.rdocumentation.org/packages/base/topics/c'>c(width, height)</a></code>.</p></td>
Use an array of two values for a rectangular image <code><a href='https://rdrr.io/r/base/c.html'>c(width, height)</a></code>.</p></td>
</tr>
<tr>
<th>color_table</th>
@@ -174,7 +177,7 @@ See attached data <code>lego_colors</code> as examples.</p></td>
<th>method</th>
<td><p>The method to use for comparison. Either 'brickr_classic', 'euclidean', 'cie1976', 'cie94', 'cie2000', or 'cmc'.
'brickr_classic' is an explicit euclidean distance formula, but yield different results than 'euclidean' in farver.
See <code><a href='https://www.rdocumentation.org/packages/farver/topics/compare_colour'>farver::compare_colour</a></code>.</p></td>
See <code><a href='https://rdrr.io/pkg/farver/man/compare_colour.html'>farver::compare_colour</a></code>.</p></td>
</tr>
<tr>
<th>color_palette</th>
@@ -191,7 +194,7 @@ Use "bw" for only grayscale bricks. Ignored if a <code>color_table</code> is sup
</tr>
<tr>
<th>use_bricks</th>
<td><p>Array of brick sizes to use in mosaic. Defaults to <code><a href='https://www.rdocumentation.org/packages/base/topics/c'>c('4x2', '2x2', '3x1', '2x1', '1x1')</a></code>`.</p></td>
<td><p>Array of brick sizes to use in mosaic. Defaults to <code><a href='https://rdrr.io/r/base/c.html'>c('4x2', '2x2', '3x1', '2x1', '1x1')</a></code>`.</p></td>
</tr>
<tr>
<th>brightness</th>
@@ -199,46 +202,46 @@ Use "bw" for only grayscale bricks. Ignored if a <code>color_table</code> is sup
</tr>
<tr>
<th>warhol</th>
<td><p>Array of values <code><a href='https://www.rdocumentation.org/packages/base/topics/c'>c(1, 2, 3)</a></code> associated with R, G, B color channels. Swap values in array to swap color channels for a fun visual effect.</p></td>
<td><p>Array of values <code><a href='https://rdrr.io/r/base/c.html'>c(1, 2, 3)</a></code> associated with R, G, B color channels. Swap values in array to swap color channels for a fun visual effect.</p></td>
</tr>
</table>
<h2 class="hasAnchor" id="value"><a class="anchor" href="#value"></a>Value</h2>
<p>A list with element <code>Img_lego</code> containing a data frame of the x- &amp; y-coordinates, R, G, B channels, and mapped color of each brick (pixel).</p>
<h2 class="hasAnchor" id="see-also"><a class="anchor" href="#see-also"></a>See also</h2>
<div class='dont-index'><p>Other Mosaics: <code><a href='build_mosaic.html'>build_mosaic</a></code></p></div>
</div>
<div class="col-md-3 hidden-xs hidden-sm" id="sidebar">
<h2>Contents</h2>
<ul class="nav nav-pills nav-stacked">
<li><a href="#arguments">Arguments</a></li>
<li><a href="#value">Value</a></li>
<li><a href="#see-also">See also</a></li>
</ul>
</ul>
</div>
</div>
<footer>
<div class="copyright">
<p>Developed by Ryan Timpe.</p>
</div>
<div class="pkgdown">
<p>Site built with <a href="https://pkgdown.r-lib.org/">pkgdown</a> 1.3.0.</p>
<p>Site built with <a href="https://pkgdown.r-lib.org/">pkgdown</a> 1.4.1.</p>
</div>
</footer>
</div>
</body>
</html>
+24 -19
View File
@@ -15,21 +15,25 @@
<link rel="apple-touch-icon" type="image/png" sizes="120x120" href="../apple-touch-icon-120x120.png" />
<link rel="apple-touch-icon" type="image/png" sizes="76x76" href="../apple-touch-icon-76x76.png" />
<link rel="apple-touch-icon" type="image/png" sizes="60x60" href="../apple-touch-icon-60x60.png" />
<!-- jquery -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js" integrity="sha256-FgpCb/KJQlLNfOu91ta32o/NMZxltwRo8QtmkMRdAu8=" crossorigin="anonymous"></script>
<!-- Bootstrap -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha256-916EbMg70RQy9LHiGkXzG8hSg9EdNy97GazNG/aiY1w=" crossorigin="anonymous" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha256-U5ZEeKfGNOja007MMD3YBI0A3OSZOQbeG6z2f2Y0hu8=" crossorigin="anonymous"></script>
<!-- Font Awesome icons -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css" integrity="sha256-eZrrJcwDc/3uDhsdt61sL2oOBY362qM3lon1gyExkL0=" crossorigin="anonymous" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.7.1/css/all.min.css" integrity="sha256-nAmazAk6vS34Xqo0BSrTb+abbtFlgsFK7NKSi6o7Y78=" crossorigin="anonymous" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.7.1/css/v4-shims.min.css" integrity="sha256-6qHlizsOWFskGlwVOKuns+D1nB6ssZrHQrNj1wGplHc=" crossorigin="anonymous" />
<!-- clipboard.js -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/clipboard.js/2.0.4/clipboard.min.js" integrity="sha256-FiZwavyI2V6+EXO1U+xzLG3IKldpiTFf3153ea9zikQ=" crossorigin="anonymous"></script>
<!-- sticky kit -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/sticky-kit/1.1.3/sticky-kit.min.js" integrity="sha256-c4Rlo1ZozqTPE2RLuvbusY3+SU1pQaJC0TjuhygMipw=" crossorigin="anonymous"></script>
<!-- headroom.js -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/headroom/0.9.4/headroom.min.js" integrity="sha256-DJFC1kqIhelURkuza0AvYal5RxMtpzLjFhsnVIeuk+U=" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/headroom/0.9.4/jQuery.headroom.min.js" integrity="sha256-ZX/yNShbjqsohH1k95liqY9Gd8uOiE1S4vZc+9KQ1K4=" crossorigin="anonymous"></script>
<!-- pkgdown -->
<link href="../pkgdown.css" rel="stylesheet">
@@ -39,15 +43,15 @@
<link href="../extra.css" rel="stylesheet">
<meta property="og:title" content="Scale an image raster array to a small number of pixels. Process into a data frame. Internal function. — image_to_scaled" />
<meta property="og:description" content="Scale an image raster array to a small number of pixels. Process into a data frame. Internal function." />
<meta property="og:image" content="http://brickr.org/logo.png" />
<meta name="twitter:card" content="summary" />
<!-- mathjax -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/MathJax.js" integrity="sha256-nvJJv9wWKEm88qvoQl9ekL2J+k/RWIsaSScxxlsrv8k=" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/config/TeX-AMS-MML_HTMLorMML.js" integrity="sha256-84DKXVJXs0/F8OTMzX4UR909+jtl4G7SPypPavF+GfA=" crossorigin="anonymous"></script>
@@ -58,6 +62,7 @@
<![endif]-->
</head>
<body>
@@ -74,7 +79,7 @@
</button>
<span class="navbar-brand">
<a class="navbar-link" href="../index.html">brickr</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.1.0.9024</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.2.0</span>
</span>
</div>
@@ -82,7 +87,7 @@
<ul class="nav navbar-nav">
<li>
<a href="../index.html">
<span class="fa fa-home fa-lg"></span>
<span class="fas fa fas fa-home fa-lg"></span>
</a>
</li>
@@ -117,11 +122,10 @@
<a href="../news/index.html">Changelog</a>
</li>
</ul>
<ul class="nav navbar-nav navbar-right">
<li>
<a href="https://github.com/ryantimpe/brickr">
<span class="fa fa-github fa-lg"></span>
<span class="fab fa fab fa-github fa-lg"></span>
</a>
</li>
@@ -132,6 +136,7 @@
</div><!--/.navbar -->
</header>
<div class="row">
@@ -143,12 +148,10 @@
</div>
<div class="ref-description">
<p>Scale an image raster array to a small number of pixels. Process into a data frame. Internal function.</p>
</div>
<h2 class="hasAnchor" id="arguments"><a class="anchor" href="#arguments"></a>Arguments</h2>
<table class="ref-arguments">
<colgroup><col class="name" /><col class="desc" /></colgroup>
@@ -159,7 +162,7 @@
<tr>
<th>img_size</th>
<td><p>Size of output image in pixel, where one pixel = one 'brick'. Use a single value (e.g. <code>48</code>) for a square image with 48 pixels on each side.
Use an array of two values for a rectangular image <code><a href='https://www.rdocumentation.org/packages/base/topics/c'>c(width, height)</a></code>.</p></td>
Use an array of two values for a rectangular image <code><a href='https://rdrr.io/r/base/c.html'>c(width, height)</a></code>.</p></td>
</tr>
<tr>
<th>brightness</th>
@@ -167,40 +170,42 @@ Use an array of two values for a rectangular image <code><a href='https://www.rd
</tr>
<tr>
<th>warhol</th>
<td><p>Array of values <code><a href='https://www.rdocumentation.org/packages/base/topics/c'>c(1, 2, 3)</a></code> associated with R, G, B color channels. Swap values in array to swap color channels for a fun visual effect.</p></td>
<td><p>Array of values <code><a href='https://rdrr.io/r/base/c.html'>c(1, 2, 3)</a></code> associated with R, G, B color channels. Swap values in array to swap color channels for a fun visual effect.</p></td>
</tr>
</table>
<h2 class="hasAnchor" id="value"><a class="anchor" href="#value"></a>Value</h2>
<p>A list with element <code>Img_scaled</code> containing a data frame of the x- &amp; y-coordinates, R, G, B channels, and hex color of each brick (pixel).</p>
</div>
<div class="col-md-3 hidden-xs hidden-sm" id="sidebar">
<h2>Contents</h2>
<ul class="nav nav-pills nav-stacked">
<li><a href="#arguments">Arguments</a></li>
<li><a href="#value">Value</a></li>
</ul>
</ul>
</div>
</div>
<footer>
<div class="copyright">
<p>Developed by Ryan Timpe.</p>
</div>
<div class="pkgdown">
<p>Site built with <a href="https://pkgdown.r-lib.org/">pkgdown</a> 1.3.0.</p>
<p>Site built with <a href="https://pkgdown.r-lib.org/">pkgdown</a> 1.4.1.</p>
</div>
</footer>
</div>
</body>
</html>
+20 -10
View File
@@ -15,21 +15,25 @@
<link rel="apple-touch-icon" type="image/png" sizes="120x120" href="../apple-touch-icon-120x120.png" />
<link rel="apple-touch-icon" type="image/png" sizes="76x76" href="../apple-touch-icon-76x76.png" />
<link rel="apple-touch-icon" type="image/png" sizes="60x60" href="../apple-touch-icon-60x60.png" />
<!-- jquery -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js" integrity="sha256-FgpCb/KJQlLNfOu91ta32o/NMZxltwRo8QtmkMRdAu8=" crossorigin="anonymous"></script>
<!-- Bootstrap -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha256-916EbMg70RQy9LHiGkXzG8hSg9EdNy97GazNG/aiY1w=" crossorigin="anonymous" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha256-U5ZEeKfGNOja007MMD3YBI0A3OSZOQbeG6z2f2Y0hu8=" crossorigin="anonymous"></script>
<!-- Font Awesome icons -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css" integrity="sha256-eZrrJcwDc/3uDhsdt61sL2oOBY362qM3lon1gyExkL0=" crossorigin="anonymous" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.7.1/css/all.min.css" integrity="sha256-nAmazAk6vS34Xqo0BSrTb+abbtFlgsFK7NKSi6o7Y78=" crossorigin="anonymous" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.7.1/css/v4-shims.min.css" integrity="sha256-6qHlizsOWFskGlwVOKuns+D1nB6ssZrHQrNj1wGplHc=" crossorigin="anonymous" />
<!-- clipboard.js -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/clipboard.js/2.0.4/clipboard.min.js" integrity="sha256-FiZwavyI2V6+EXO1U+xzLG3IKldpiTFf3153ea9zikQ=" crossorigin="anonymous"></script>
<!-- sticky kit -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/sticky-kit/1.1.3/sticky-kit.min.js" integrity="sha256-c4Rlo1ZozqTPE2RLuvbusY3+SU1pQaJC0TjuhygMipw=" crossorigin="anonymous"></script>
<!-- headroom.js -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/headroom/0.9.4/headroom.min.js" integrity="sha256-DJFC1kqIhelURkuza0AvYal5RxMtpzLjFhsnVIeuk+U=" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/headroom/0.9.4/jQuery.headroom.min.js" integrity="sha256-ZX/yNShbjqsohH1k95liqY9Gd8uOiE1S4vZc+9KQ1K4=" crossorigin="anonymous"></script>
<!-- pkgdown -->
<link href="../pkgdown.css" rel="stylesheet">
@@ -39,13 +43,14 @@
<link href="../extra.css" rel="stylesheet">
<meta property="og:title" content="Function reference" />
<meta property="og:title" content="Function reference" />
<meta property="og:image" content="http://brickr.org/logo.png" />
<meta name="twitter:card" content="summary" />
<!-- mathjax -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/MathJax.js" integrity="sha256-nvJJv9wWKEm88qvoQl9ekL2J+k/RWIsaSScxxlsrv8k=" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/config/TeX-AMS-MML_HTMLorMML.js" integrity="sha256-84DKXVJXs0/F8OTMzX4UR909+jtl4G7SPypPavF+GfA=" crossorigin="anonymous"></script>
@@ -56,6 +61,7 @@
<![endif]-->
</head>
<body>
@@ -72,7 +78,7 @@
</button>
<span class="navbar-brand">
<a class="navbar-link" href="../index.html">brickr</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.1.0.9024</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.2.0</span>
</span>
</div>
@@ -80,7 +86,7 @@
<ul class="nav navbar-nav">
<li>
<a href="../index.html">
<span class="fa fa-home fa-lg"></span>
<span class="fas fa fas fa-home fa-lg"></span>
</a>
</li>
@@ -115,11 +121,10 @@
<a href="../news/index.html">Changelog</a>
</li>
</ul>
<ul class="nav navbar-nav navbar-right">
<li>
<a href="https://github.com/ryantimpe/brickr">
<span class="fa fa-github fa-lg"></span>
<span class="fab fa fab fa-github fa-lg"></span>
</a>
</li>
@@ -130,6 +135,7 @@
</div><!--/.navbar -->
</header>
<div class="row">
@@ -208,7 +214,7 @@
<td>
<p><code><a href="build_bricks.html">build_bricks()</a></code> </p>
</td>
<td><p>Build 3D brick model with rayshader.</p></td>
<td><p>Build 3D brick model with rgl</p></td>
</tr>
</tbody><tbody>
<tr>
@@ -301,19 +307,23 @@
</div>
</div>
<footer>
<div class="copyright">
<p>Developed by Ryan Timpe.</p>
</div>
<div class="pkgdown">
<p>Site built with <a href="https://pkgdown.r-lib.org/">pkgdown</a> 1.3.0.</p>
<p>Site built with <a href="https://pkgdown.r-lib.org/">pkgdown</a> 1.4.1.</p>
</div>
</footer>
</div>
</body>
</html>
+22 -17
View File
@@ -15,21 +15,25 @@
<link rel="apple-touch-icon" type="image/png" sizes="120x120" href="../apple-touch-icon-120x120.png" />
<link rel="apple-touch-icon" type="image/png" sizes="76x76" href="../apple-touch-icon-76x76.png" />
<link rel="apple-touch-icon" type="image/png" sizes="60x60" href="../apple-touch-icon-60x60.png" />
<!-- jquery -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js" integrity="sha256-FgpCb/KJQlLNfOu91ta32o/NMZxltwRo8QtmkMRdAu8=" crossorigin="anonymous"></script>
<!-- Bootstrap -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha256-916EbMg70RQy9LHiGkXzG8hSg9EdNy97GazNG/aiY1w=" crossorigin="anonymous" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha256-U5ZEeKfGNOja007MMD3YBI0A3OSZOQbeG6z2f2Y0hu8=" crossorigin="anonymous"></script>
<!-- Font Awesome icons -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css" integrity="sha256-eZrrJcwDc/3uDhsdt61sL2oOBY362qM3lon1gyExkL0=" crossorigin="anonymous" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.7.1/css/all.min.css" integrity="sha256-nAmazAk6vS34Xqo0BSrTb+abbtFlgsFK7NKSi6o7Y78=" crossorigin="anonymous" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.7.1/css/v4-shims.min.css" integrity="sha256-6qHlizsOWFskGlwVOKuns+D1nB6ssZrHQrNj1wGplHc=" crossorigin="anonymous" />
<!-- clipboard.js -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/clipboard.js/2.0.4/clipboard.min.js" integrity="sha256-FiZwavyI2V6+EXO1U+xzLG3IKldpiTFf3153ea9zikQ=" crossorigin="anonymous"></script>
<!-- sticky kit -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/sticky-kit/1.1.3/sticky-kit.min.js" integrity="sha256-c4Rlo1ZozqTPE2RLuvbusY3+SU1pQaJC0TjuhygMipw=" crossorigin="anonymous"></script>
<!-- headroom.js -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/headroom/0.9.4/headroom.min.js" integrity="sha256-DJFC1kqIhelURkuza0AvYal5RxMtpzLjFhsnVIeuk+U=" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/headroom/0.9.4/jQuery.headroom.min.js" integrity="sha256-ZX/yNShbjqsohH1k95liqY9Gd8uOiE1S4vZc+9KQ1K4=" crossorigin="anonymous"></script>
<!-- pkgdown -->
<link href="../pkgdown.css" rel="stylesheet">
@@ -39,15 +43,15 @@
<link href="../extra.css" rel="stylesheet">
<meta property="og:title" content="Display a brickr object as a 3D model — layer_from_bricks" />
<meta property="og:description" content="Display a brickr object as a 3D model" />
<meta property="og:image" content="http://brickr.org/logo.png" />
<meta name="twitter:card" content="summary" />
<!-- mathjax -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/MathJax.js" integrity="sha256-nvJJv9wWKEm88qvoQl9ekL2J+k/RWIsaSScxxlsrv8k=" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/config/TeX-AMS-MML_HTMLorMML.js" integrity="sha256-84DKXVJXs0/F8OTMzX4UR909+jtl4G7SPypPavF+GfA=" crossorigin="anonymous"></script>
@@ -58,6 +62,7 @@
<![endif]-->
</head>
<body>
@@ -74,7 +79,7 @@
</button>
<span class="navbar-brand">
<a class="navbar-link" href="../index.html">brickr</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.1.0.9024</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.2.0</span>
</span>
</div>
@@ -82,7 +87,7 @@
<ul class="nav navbar-nav">
<li>
<a href="../index.html">
<span class="fa fa-home fa-lg"></span>
<span class="fas fa fas fa-home fa-lg"></span>
</a>
</li>
@@ -117,11 +122,10 @@
<a href="../news/index.html">Changelog</a>
</li>
</ul>
<ul class="nav navbar-nav navbar-right">
<li>
<a href="https://github.com/ryantimpe/brickr">
<span class="fa fa-github fa-lg"></span>
<span class="fab fa fab fa-github fa-lg"></span>
</a>
</li>
@@ -132,6 +136,7 @@
</div><!--/.navbar -->
</header>
<div class="row">
@@ -143,14 +148,12 @@
</div>
<div class="ref-description">
<p>Display a brickr object as a 3D model</p>
</div>
<pre class="usage"><span class='fu'>layer_from_bricks</span>(<span class='no'>brick_list</span>, <span class='kw'>brick_type</span> <span class='kw'>=</span> <span class='st'>"brick"</span>, <span class='kw'>lev</span> <span class='kw'>=</span> <span class='fl'>1</span>,
<span class='kw'>brick_res</span> <span class='kw'>=</span> <span class='st'>"sd"</span>)</pre>
<h2 class="hasAnchor" id="arguments"><a class="anchor" href="#arguments"></a>Arguments</h2>
<table class="ref-arguments">
<colgroup><col class="name" /><col class="desc" /></colgroup>
@@ -175,39 +178,41 @@ for 60px. Enter a value for a custom resolution. High resolutions take
longer to render.</p></td>
</tr>
</table>
<h2 class="hasAnchor" id="value"><a class="anchor" href="#value"></a>Value</h2>
<p>A list with elements <code>threed_elevation</code> and
<code>threed_hillshade</code> to created 3D mosiacs with the <code>rayshader</code>
package.</p>
</div>
<div class="col-md-3 hidden-xs hidden-sm" id="sidebar">
<h2>Contents</h2>
<ul class="nav nav-pills nav-stacked">
<li><a href="#arguments">Arguments</a></li>
<li><a href="#value">Value</a></li>
</ul>
</ul>
</div>
</div>
<footer>
<div class="copyright">
<p>Developed by Ryan Timpe.</p>
</div>
<div class="pkgdown">
<p>Site built with <a href="https://pkgdown.r-lib.org/">pkgdown</a> 1.3.0.</p>
<p>Site built with <a href="https://pkgdown.r-lib.org/">pkgdown</a> 1.4.1.</p>
</div>
</footer>
</div>
</body>
</html>
+22 -14
View File
@@ -15,21 +15,25 @@
<link rel="apple-touch-icon" type="image/png" sizes="120x120" href="../apple-touch-icon-120x120.png" />
<link rel="apple-touch-icon" type="image/png" sizes="76x76" href="../apple-touch-icon-76x76.png" />
<link rel="apple-touch-icon" type="image/png" sizes="60x60" href="../apple-touch-icon-60x60.png" />
<!-- jquery -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js" integrity="sha256-FgpCb/KJQlLNfOu91ta32o/NMZxltwRo8QtmkMRdAu8=" crossorigin="anonymous"></script>
<!-- Bootstrap -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha256-916EbMg70RQy9LHiGkXzG8hSg9EdNy97GazNG/aiY1w=" crossorigin="anonymous" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha256-U5ZEeKfGNOja007MMD3YBI0A3OSZOQbeG6z2f2Y0hu8=" crossorigin="anonymous"></script>
<!-- Font Awesome icons -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css" integrity="sha256-eZrrJcwDc/3uDhsdt61sL2oOBY362qM3lon1gyExkL0=" crossorigin="anonymous" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.7.1/css/all.min.css" integrity="sha256-nAmazAk6vS34Xqo0BSrTb+abbtFlgsFK7NKSi6o7Y78=" crossorigin="anonymous" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.7.1/css/v4-shims.min.css" integrity="sha256-6qHlizsOWFskGlwVOKuns+D1nB6ssZrHQrNj1wGplHc=" crossorigin="anonymous" />
<!-- clipboard.js -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/clipboard.js/2.0.4/clipboard.min.js" integrity="sha256-FiZwavyI2V6+EXO1U+xzLG3IKldpiTFf3153ea9zikQ=" crossorigin="anonymous"></script>
<!-- sticky kit -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/sticky-kit/1.1.3/sticky-kit.min.js" integrity="sha256-c4Rlo1ZozqTPE2RLuvbusY3+SU1pQaJC0TjuhygMipw=" crossorigin="anonymous"></script>
<!-- headroom.js -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/headroom/0.9.4/headroom.min.js" integrity="sha256-DJFC1kqIhelURkuza0AvYal5RxMtpzLjFhsnVIeuk+U=" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/headroom/0.9.4/jQuery.headroom.min.js" integrity="sha256-ZX/yNShbjqsohH1k95liqY9Gd8uOiE1S4vZc+9KQ1K4=" crossorigin="anonymous"></script>
<!-- pkgdown -->
<link href="../pkgdown.css" rel="stylesheet">
@@ -39,15 +43,15 @@
<link href="../extra.css" rel="stylesheet">
<meta property="og:title" content="Pipe operator — %&gt;%" />
<meta property="og:description" content="See magrittr::%&amp;gt;% for details." />
<meta property="og:image" content="http://brickr.org/logo.png" />
<meta name="twitter:card" content="summary" />
<!-- mathjax -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/MathJax.js" integrity="sha256-nvJJv9wWKEm88qvoQl9ekL2J+k/RWIsaSScxxlsrv8k=" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/config/TeX-AMS-MML_HTMLorMML.js" integrity="sha256-84DKXVJXs0/F8OTMzX4UR909+jtl4G7SPypPavF+GfA=" crossorigin="anonymous"></script>
@@ -58,6 +62,7 @@
<![endif]-->
</head>
<body>
@@ -74,7 +79,7 @@
</button>
<span class="navbar-brand">
<a class="navbar-link" href="../index.html">brickr</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.1.0.9024</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.2.0</span>
</span>
</div>
@@ -82,7 +87,7 @@
<ul class="nav navbar-nav">
<li>
<a href="../index.html">
<span class="fa fa-home fa-lg"></span>
<span class="fas fa fas fa-home fa-lg"></span>
</a>
</li>
@@ -117,11 +122,10 @@
<a href="../news/index.html">Changelog</a>
</li>
</ul>
<ul class="nav navbar-nav navbar-right">
<li>
<a href="https://github.com/ryantimpe/brickr">
<span class="fa fa-github fa-lg"></span>
<span class="fab fa fab fa-github fa-lg"></span>
</a>
</li>
@@ -132,6 +136,7 @@
</div><!--/.navbar -->
</header>
<div class="row">
@@ -143,36 +148,39 @@
</div>
<div class="ref-description">
<p>See <code>magrittr::%&gt;%</code> for details.</p>
</div>
<pre class="usage"><span class='no'>lhs</span> <span class='kw'>%&gt;%</span> <span class='no'>rhs</span></pre>
</div>
<div class="col-md-3 hidden-xs hidden-sm" id="sidebar">
<h2>Contents</h2>
<ul class="nav nav-pills nav-stacked">
</ul>
</ul>
</div>
</div>
<footer>
<div class="copyright">
<p>Developed by Ryan Timpe.</p>
</div>
<div class="pkgdown">
<p>Site built with <a href="https://pkgdown.r-lib.org/">pkgdown</a> 1.3.0.</p>
<p>Site built with <a href="https://pkgdown.r-lib.org/">pkgdown</a> 1.4.1.</p>
</div>
</footer>
</div>
</body>
</html>
+24 -19
View File
@@ -15,21 +15,25 @@
<link rel="apple-touch-icon" type="image/png" sizes="120x120" href="../apple-touch-icon-120x120.png" />
<link rel="apple-touch-icon" type="image/png" sizes="76x76" href="../apple-touch-icon-76x76.png" />
<link rel="apple-touch-icon" type="image/png" sizes="60x60" href="../apple-touch-icon-60x60.png" />
<!-- jquery -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js" integrity="sha256-FgpCb/KJQlLNfOu91ta32o/NMZxltwRo8QtmkMRdAu8=" crossorigin="anonymous"></script>
<!-- Bootstrap -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha256-916EbMg70RQy9LHiGkXzG8hSg9EdNy97GazNG/aiY1w=" crossorigin="anonymous" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha256-U5ZEeKfGNOja007MMD3YBI0A3OSZOQbeG6z2f2Y0hu8=" crossorigin="anonymous"></script>
<!-- Font Awesome icons -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css" integrity="sha256-eZrrJcwDc/3uDhsdt61sL2oOBY362qM3lon1gyExkL0=" crossorigin="anonymous" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.7.1/css/all.min.css" integrity="sha256-nAmazAk6vS34Xqo0BSrTb+abbtFlgsFK7NKSi6o7Y78=" crossorigin="anonymous" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.7.1/css/v4-shims.min.css" integrity="sha256-6qHlizsOWFskGlwVOKuns+D1nB6ssZrHQrNj1wGplHc=" crossorigin="anonymous" />
<!-- clipboard.js -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/clipboard.js/2.0.4/clipboard.min.js" integrity="sha256-FiZwavyI2V6+EXO1U+xzLG3IKldpiTFf3153ea9zikQ=" crossorigin="anonymous"></script>
<!-- sticky kit -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/sticky-kit/1.1.3/sticky-kit.min.js" integrity="sha256-c4Rlo1ZozqTPE2RLuvbusY3+SU1pQaJC0TjuhygMipw=" crossorigin="anonymous"></script>
<!-- headroom.js -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/headroom/0.9.4/headroom.min.js" integrity="sha256-DJFC1kqIhelURkuza0AvYal5RxMtpzLjFhsnVIeuk+U=" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/headroom/0.9.4/jQuery.headroom.min.js" integrity="sha256-ZX/yNShbjqsohH1k95liqY9Gd8uOiE1S4vZc+9KQ1K4=" crossorigin="anonymous"></script>
<!-- pkgdown -->
<link href="../pkgdown.css" rel="stylesheet">
@@ -39,15 +43,15 @@
<link href="../extra.css" rel="stylesheet">
<meta property="og:title" content="Color scales for bricks - ggplot2 extension — scale_fill_brick" />
<meta property="og:description" content="brickr counterpart to ggplot2::scale_fill_discrete() to map bar colors to the palette of LEGO mold colors." />
<meta property="og:image" content="http://brickr.org/logo.png" />
<meta name="twitter:card" content="summary" />
<!-- mathjax -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/MathJax.js" integrity="sha256-nvJJv9wWKEm88qvoQl9ekL2J+k/RWIsaSScxxlsrv8k=" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/config/TeX-AMS-MML_HTMLorMML.js" integrity="sha256-84DKXVJXs0/F8OTMzX4UR909+jtl4G7SPypPavF+GfA=" crossorigin="anonymous"></script>
@@ -58,6 +62,7 @@
<![endif]-->
</head>
<body>
@@ -74,7 +79,7 @@
</button>
<span class="navbar-brand">
<a class="navbar-link" href="../index.html">brickr</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.1.0.9024</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.2.0</span>
</span>
</div>
@@ -82,7 +87,7 @@
<ul class="nav navbar-nav">
<li>
<a href="../index.html">
<span class="fa fa-home fa-lg"></span>
<span class="fas fa fas fa-home fa-lg"></span>
</a>
</li>
@@ -117,11 +122,10 @@
<a href="../news/index.html">Changelog</a>
</li>
</ul>
<ul class="nav navbar-nav navbar-right">
<li>
<a href="https://github.com/ryantimpe/brickr">
<span class="fa fa-github fa-lg"></span>
<span class="fab fa fab fa-github fa-lg"></span>
</a>
</li>
@@ -132,6 +136,7 @@
</div><!--/.navbar -->
</header>
<div class="row">
@@ -143,20 +148,18 @@
</div>
<div class="ref-description">
<p>brickr counterpart to <code><a href='https://ggplot2.tidyverse.org/reference/scale_hue.html'>ggplot2::scale_fill_discrete()</a></code> to map bar colors to the palette of LEGO mold colors.</p>
</div>
<pre class="usage"><span class='fu'>scale_fill_brick</span>(<span class='kw'>brick_theme</span> <span class='kw'>=</span> <span class='st'>"classic"</span>, <span class='no'>...</span>)</pre>
<h2 class="hasAnchor" id="arguments"><a class="anchor" href="#arguments"></a>Arguments</h2>
<table class="ref-arguments">
<colgroup><col class="name" /><col class="desc" /></colgroup>
<tr>
<th>brick_theme</th>
<td><p>Color palette for bricks. Same as <code><a href='theme_brick.html'>brickr::theme_brick()</a></code>. Options include:
<code><a href='https://www.rdocumentation.org/packages/base/topics/c'> c("classic", "hp", "sw_light", "sw_dark", "friends", "elves",
<code><a href='https://rdrr.io/r/base/c.html'> c("classic", "hp", "sw_light", "sw_dark", "friends", "elves",
"ninja", "classy", "city", "ocean", "movie", "space",
"jurassic", "duplo", "superhero", "80s",
"rainbow7", "rainbow13", "doublerainbow", "blue")</a></code>.</p></td>
@@ -204,19 +207,19 @@ as output</p></li>
<dt>guide</dt><dd><p>A function used to create a guide or its name. See
<code>guides()</code> for more info.</p></dd>
<dt>super</dt><dd><p>The super class to use for the constructed scale</p></dd>
</dl></td>
</tr>
</table>
<h2 class="hasAnchor" id="see-also"><a class="anchor" href="#see-also"></a>See also</h2>
<div class='dont-index'><p>Other Graphs: <code><a href='coord-brick.html'>coord_brick</a></code>,
<code><a href='geom_brick_col.html'>geom_brick_col</a></code>,
<code><a href='geom_brick_rect.html'>geom_brick_rect</a></code>, <code><a href='theme_brick.html'>theme_brick</a></code></p></div>
<h2 class="hasAnchor" id="examples"><a class="anchor" href="#examples"></a>Examples</h2>
<pre class="examples"><div class='input'><span class='no'>df</span> <span class='kw'>&lt;-</span> <span class='fu'><a href='https://www.rdocumentation.org/packages/base/topics/data.frame'>data.frame</a></span>(<span class='kw'>trt</span> <span class='kw'>=</span> <span class='fu'><a href='https://www.rdocumentation.org/packages/base/topics/c'>c</a></span>(<span class='st'>"a"</span>, <span class='st'>"b"</span>, <span class='st'>"c"</span>), <span class='kw'>outcome</span> <span class='kw'>=</span> <span class='fu'><a href='https://www.rdocumentation.org/packages/base/topics/c'>c</a></span>(<span class='fl'>2.3</span>, <span class='fl'>1.9</span>, <span class='fl'>3.2</span>))
<pre class="examples"><div class='input'><span class='no'>df</span> <span class='kw'>&lt;-</span> <span class='fu'><a href='https://rdrr.io/r/base/data.frame.html'>data.frame</a></span>(<span class='kw'>trt</span> <span class='kw'>=</span> <span class='fu'><a href='https://rdrr.io/r/base/c.html'>c</a></span>(<span class='st'>"a"</span>, <span class='st'>"b"</span>, <span class='st'>"c"</span>), <span class='kw'>outcome</span> <span class='kw'>=</span> <span class='fu'><a href='https://rdrr.io/r/base/c.html'>c</a></span>(<span class='fl'>2.3</span>, <span class='fl'>1.9</span>, <span class='fl'>3.2</span>))
<span class='no'>p</span> <span class='kw'>&lt;-</span> <span class='fu'>ggplot</span>(<span class='no'>df</span>, <span class='fu'>aes</span>(<span class='no'>trt</span>, <span class='no'>outcome</span>)) +
<span class='fu'><a href='geom_brick_col.html'>geom_brick_col</a></span>(<span class='fu'>aes</span>(<span class='kw'>fill</span> <span class='kw'>=</span> <span class='no'>trt</span>)) +
<span class='fu'><a href='coord-brick.html'>coord_brick</a></span>()
@@ -232,28 +235,30 @@ as output</p></li>
<h2>Contents</h2>
<ul class="nav nav-pills nav-stacked">
<li><a href="#arguments">Arguments</a></li>
<li><a href="#see-also">See also</a></li>
<li><a href="#examples">Examples</a></li>
</ul>
</div>
</div>
<footer>
<div class="copyright">
<p>Developed by Ryan Timpe.</p>
</div>
<div class="pkgdown">
<p>Site built with <a href="https://pkgdown.r-lib.org/">pkgdown</a> 1.3.0.</p>
<p>Site built with <a href="https://pkgdown.r-lib.org/">pkgdown</a> 1.4.1.</p>
</div>
</footer>
</div>
</body>
</html>
+23 -18
View File
@@ -15,21 +15,25 @@
<link rel="apple-touch-icon" type="image/png" sizes="120x120" href="../apple-touch-icon-120x120.png" />
<link rel="apple-touch-icon" type="image/png" sizes="76x76" href="../apple-touch-icon-76x76.png" />
<link rel="apple-touch-icon" type="image/png" sizes="60x60" href="../apple-touch-icon-60x60.png" />
<!-- jquery -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js" integrity="sha256-FgpCb/KJQlLNfOu91ta32o/NMZxltwRo8QtmkMRdAu8=" crossorigin="anonymous"></script>
<!-- Bootstrap -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha256-916EbMg70RQy9LHiGkXzG8hSg9EdNy97GazNG/aiY1w=" crossorigin="anonymous" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha256-U5ZEeKfGNOja007MMD3YBI0A3OSZOQbeG6z2f2Y0hu8=" crossorigin="anonymous"></script>
<!-- Font Awesome icons -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css" integrity="sha256-eZrrJcwDc/3uDhsdt61sL2oOBY362qM3lon1gyExkL0=" crossorigin="anonymous" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.7.1/css/all.min.css" integrity="sha256-nAmazAk6vS34Xqo0BSrTb+abbtFlgsFK7NKSi6o7Y78=" crossorigin="anonymous" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.7.1/css/v4-shims.min.css" integrity="sha256-6qHlizsOWFskGlwVOKuns+D1nB6ssZrHQrNj1wGplHc=" crossorigin="anonymous" />
<!-- clipboard.js -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/clipboard.js/2.0.4/clipboard.min.js" integrity="sha256-FiZwavyI2V6+EXO1U+xzLG3IKldpiTFf3153ea9zikQ=" crossorigin="anonymous"></script>
<!-- sticky kit -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/sticky-kit/1.1.3/sticky-kit.min.js" integrity="sha256-c4Rlo1ZozqTPE2RLuvbusY3+SU1pQaJC0TjuhygMipw=" crossorigin="anonymous"></script>
<!-- headroom.js -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/headroom/0.9.4/headroom.min.js" integrity="sha256-DJFC1kqIhelURkuza0AvYal5RxMtpzLjFhsnVIeuk+U=" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/headroom/0.9.4/jQuery.headroom.min.js" integrity="sha256-ZX/yNShbjqsohH1k95liqY9Gd8uOiE1S4vZc+9KQ1K4=" crossorigin="anonymous"></script>
<!-- pkgdown -->
<link href="../pkgdown.css" rel="stylesheet">
@@ -39,15 +43,15 @@
<link href="../extra.css" rel="stylesheet">
<meta property="og:title" content="Convert image output from scale_image() to bricks — scaled_to_colors" />
<meta property="og:description" content="Convert image output from scale_image() to bricks" />
<meta property="og:image" content="http://brickr.org/logo.png" />
<meta name="twitter:card" content="summary" />
<!-- mathjax -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/MathJax.js" integrity="sha256-nvJJv9wWKEm88qvoQl9ekL2J+k/RWIsaSScxxlsrv8k=" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/config/TeX-AMS-MML_HTMLorMML.js" integrity="sha256-84DKXVJXs0/F8OTMzX4UR909+jtl4G7SPypPavF+GfA=" crossorigin="anonymous"></script>
@@ -58,6 +62,7 @@
<![endif]-->
</head>
<body>
@@ -74,7 +79,7 @@
</button>
<span class="navbar-brand">
<a class="navbar-link" href="../index.html">brickr</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.1.0.9024</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.2.0</span>
</span>
</div>
@@ -82,7 +87,7 @@
<ul class="nav navbar-nav">
<li>
<a href="../index.html">
<span class="fa fa-home fa-lg"></span>
<span class="fas fa fas fa-home fa-lg"></span>
</a>
</li>
@@ -117,11 +122,10 @@
<a href="../news/index.html">Changelog</a>
</li>
</ul>
<ul class="nav navbar-nav navbar-right">
<li>
<a href="https://github.com/ryantimpe/brickr">
<span class="fa fa-github fa-lg"></span>
<span class="fab fa fab fa-github fa-lg"></span>
</a>
</li>
@@ -132,6 +136,7 @@
</div><!--/.navbar -->
</header>
<div class="row">
@@ -143,12 +148,10 @@
</div>
<div class="ref-description">
<p>Convert image output from scale_image() to bricks</p>
</div>
<h2 class="hasAnchor" id="arguments"><a class="anchor" href="#arguments"></a>Arguments</h2>
<table class="ref-arguments">
<colgroup><col class="name" /><col class="desc" /></colgroup>
@@ -160,7 +163,7 @@
<th>method</th>
<td><p>The method to use for comparison. Either 'brickr_classic', 'euclidean', 'cie1976', 'cie94', 'cie2000', or 'cmc'.
'brickr_classic' is an explicit euclidean distance formula, but yield different results than 'euclidean' in farver.
See <code><a href='https://www.rdocumentation.org/packages/farver/topics/compare_colour'>farver::compare_colour</a></code>.</p></td>
See <code><a href='https://rdrr.io/pkg/farver/man/compare_colour.html'>farver::compare_colour</a></code>.</p></td>
</tr>
<tr>
<th>color_table</th>
@@ -181,37 +184,39 @@ Use "bw" for only grayscale bricks. Ignored if a <code>color_table</code> is sup
<td><p>For <code>color_palette = "bw"</code>. A value &gt;1 will increase the contrast of the image while a positive value &lt;1 will decrease the contrast.</p></td>
</tr>
</table>
<h2 class="hasAnchor" id="value"><a class="anchor" href="#value"></a>Value</h2>
<p>A list with element <code>Img_lego</code> containing a data frame of the x- &amp; y-coordinates, R, G, B channels, and mapped color of each brick (pixel).</p>
</div>
<div class="col-md-3 hidden-xs hidden-sm" id="sidebar">
<h2>Contents</h2>
<ul class="nav nav-pills nav-stacked">
<li><a href="#arguments">Arguments</a></li>
<li><a href="#value">Value</a></li>
</ul>
</ul>
</div>
</div>
<footer>
<div class="copyright">
<p>Developed by Ryan Timpe.</p>
</div>
<div class="pkgdown">
<p>Site built with <a href="https://pkgdown.r-lib.org/">pkgdown</a> 1.3.0.</p>
<p>Site built with <a href="https://pkgdown.r-lib.org/">pkgdown</a> 1.4.1.</p>
</div>
</footer>
</div>
</body>
</html>
+23 -18
View File
@@ -15,21 +15,25 @@
<link rel="apple-touch-icon" type="image/png" sizes="120x120" href="../apple-touch-icon-120x120.png" />
<link rel="apple-touch-icon" type="image/png" sizes="76x76" href="../apple-touch-icon-76x76.png" />
<link rel="apple-touch-icon" type="image/png" sizes="60x60" href="../apple-touch-icon-60x60.png" />
<!-- jquery -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js" integrity="sha256-FgpCb/KJQlLNfOu91ta32o/NMZxltwRo8QtmkMRdAu8=" crossorigin="anonymous"></script>
<!-- Bootstrap -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha256-916EbMg70RQy9LHiGkXzG8hSg9EdNy97GazNG/aiY1w=" crossorigin="anonymous" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha256-U5ZEeKfGNOja007MMD3YBI0A3OSZOQbeG6z2f2Y0hu8=" crossorigin="anonymous"></script>
<!-- Font Awesome icons -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css" integrity="sha256-eZrrJcwDc/3uDhsdt61sL2oOBY362qM3lon1gyExkL0=" crossorigin="anonymous" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.7.1/css/all.min.css" integrity="sha256-nAmazAk6vS34Xqo0BSrTb+abbtFlgsFK7NKSi6o7Y78=" crossorigin="anonymous" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.7.1/css/v4-shims.min.css" integrity="sha256-6qHlizsOWFskGlwVOKuns+D1nB6ssZrHQrNj1wGplHc=" crossorigin="anonymous" />
<!-- clipboard.js -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/clipboard.js/2.0.4/clipboard.min.js" integrity="sha256-FiZwavyI2V6+EXO1U+xzLG3IKldpiTFf3153ea9zikQ=" crossorigin="anonymous"></script>
<!-- sticky kit -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/sticky-kit/1.1.3/sticky-kit.min.js" integrity="sha256-c4Rlo1ZozqTPE2RLuvbusY3+SU1pQaJC0TjuhygMipw=" crossorigin="anonymous"></script>
<!-- headroom.js -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/headroom/0.9.4/headroom.min.js" integrity="sha256-DJFC1kqIhelURkuza0AvYal5RxMtpzLjFhsnVIeuk+U=" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/headroom/0.9.4/jQuery.headroom.min.js" integrity="sha256-ZX/yNShbjqsohH1k95liqY9Gd8uOiE1S4vZc+9KQ1K4=" crossorigin="anonymous"></script>
<!-- pkgdown -->
<link href="../pkgdown.css" rel="stylesheet">
@@ -39,15 +43,15 @@
<link href="../extra.css" rel="stylesheet">
<meta property="og:title" content="Brick color themes - ggplot2 extension — theme_brick" />
<meta property="og:description" content="Brick color themes - ggplot2 extension" />
<meta property="og:image" content="http://brickr.org/logo.png" />
<meta name="twitter:card" content="summary" />
<!-- mathjax -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/MathJax.js" integrity="sha256-nvJJv9wWKEm88qvoQl9ekL2J+k/RWIsaSScxxlsrv8k=" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/config/TeX-AMS-MML_HTMLorMML.js" integrity="sha256-84DKXVJXs0/F8OTMzX4UR909+jtl4G7SPypPavF+GfA=" crossorigin="anonymous"></script>
@@ -58,6 +62,7 @@
<![endif]-->
</head>
<body>
@@ -74,7 +79,7 @@
</button>
<span class="navbar-brand">
<a class="navbar-link" href="../index.html">brickr</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.1.0.9024</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.2.0</span>
</span>
</div>
@@ -82,7 +87,7 @@
<ul class="nav navbar-nav">
<li>
<a href="../index.html">
<span class="fa fa-home fa-lg"></span>
<span class="fas fa fas fa-home fa-lg"></span>
</a>
</li>
@@ -117,11 +122,10 @@
<a href="../news/index.html">Changelog</a>
</li>
</ul>
<ul class="nav navbar-nav navbar-right">
<li>
<a href="https://github.com/ryantimpe/brickr">
<span class="fa fa-github fa-lg"></span>
<span class="fab fa fab fa-github fa-lg"></span>
</a>
</li>
@@ -132,6 +136,7 @@
</div><!--/.navbar -->
</header>
<div class="row">
@@ -143,59 +148,59 @@
</div>
<div class="ref-description">
<p>Brick color themes - ggplot2 extension</p>
</div>
<pre class="usage"><span class='fu'>theme_brick</span>(<span class='kw'>brick_theme</span> <span class='kw'>=</span> <span class='st'>"classic"</span>)</pre>
<h2 class="hasAnchor" id="arguments"><a class="anchor" href="#arguments"></a>Arguments</h2>
<table class="ref-arguments">
<colgroup><col class="name" /><col class="desc" /></colgroup>
<tr>
<th>brick_theme</th>
<td><p>Color palette for bricks. Same as <code>brickr::theme_brick()</code>. Options include:
<code><a href='https://www.rdocumentation.org/packages/base/topics/c'> c("classic", "hp", "sw_light", "sw_dark", "friends", "elves",
<code><a href='https://rdrr.io/r/base/c.html'> c("classic", "hp", "sw_light", "sw_dark", "friends", "elves",
"ninja", "classy", "city", "ocean", "movie", "space",
"jurassic", "duplo", "superhero", "80s",
"rainbow7", "rainbow13", "doublerainbow", "blue")</a></code>.</p></td>
</tr>
</table>
<h2 class="hasAnchor" id="see-also"><a class="anchor" href="#see-also"></a>See also</h2>
<div class='dont-index'><p>Other Graphs: <code><a href='coord-brick.html'>coord_brick</a></code>,
<code><a href='geom_brick_col.html'>geom_brick_col</a></code>,
<code><a href='geom_brick_rect.html'>geom_brick_rect</a></code>,
<code><a href='scale_fill_brick.html'>scale_fill_brick</a></code></p></div>
</div>
<div class="col-md-3 hidden-xs hidden-sm" id="sidebar">
<h2>Contents</h2>
<ul class="nav nav-pills nav-stacked">
<li><a href="#arguments">Arguments</a></li>
<li><a href="#see-also">See also</a></li>
</ul>
</ul>
</div>
</div>
<footer>
<div class="copyright">
<p>Developed by Ryan Timpe.</p>
</div>
<div class="pkgdown">
<p>Site built with <a href="https://pkgdown.r-lib.org/">pkgdown</a> 1.3.0.</p>
<p>Site built with <a href="https://pkgdown.r-lib.org/">pkgdown</a> 1.4.1.</p>
</div>
</footer>
</div>
</body>
</html>
+3
View File
@@ -27,6 +27,9 @@
<url>
<loc>http://brickr.org/reference/build_bricks.html</loc>
</url>
<url>
<loc>http://brickr.org/reference/build_bricks_rayshader.html</loc>
</url>
<url>
<loc>http://brickr.org/reference/build_colors.html</loc>
</url>
+1
View File
@@ -38,6 +38,7 @@ Other 3D Models: \code{\link{bricks_from_excel}},
\code{\link{bricks_from_mosaic}},
\code{\link{bricks_from_rayshader}},
\code{\link{bricks_from_table}},
\code{\link{build_bricks_rayshader}},
\code{\link{build_bricks}}
}
\concept{3D Models}
+1
View File
@@ -40,6 +40,7 @@ Other 3D Models: \code{\link{bricks_from_coords}},
\code{\link{bricks_from_mosaic}},
\code{\link{bricks_from_rayshader}},
\code{\link{bricks_from_table}},
\code{\link{build_bricks_rayshader}},
\code{\link{build_bricks}}
}
\concept{3D Models}
+1
View File
@@ -25,6 +25,7 @@ Other 3D Models: \code{\link{bricks_from_coords}},
\code{\link{bricks_from_excel}},
\code{\link{bricks_from_rayshader}},
\code{\link{bricks_from_table}},
\code{\link{build_bricks_rayshader}},
\code{\link{build_bricks}}
}
\concept{3D Models}
+1
View File
@@ -28,6 +28,7 @@ Other 3D Models: \code{\link{bricks_from_coords}},
\code{\link{bricks_from_excel}},
\code{\link{bricks_from_mosaic}},
\code{\link{bricks_from_table}},
\code{\link{build_bricks_rayshader}},
\code{\link{build_bricks}}
}
\concept{3D Models}
+2 -1
View File
@@ -4,7 +4,7 @@
\alias{bricks_from_table}
\title{Convert a matrix table into a brickr 3D object}
\usage{
bricks_from_table(matrix_table, color_guide = lego_colors,
bricks_from_table(matrix_table, color_guide = brickr::lego_colors,
.re_level = TRUE, increment_level = 0, max_level = Inf,
increment_x = 0, max_x = Inf, increment_y = 0, max_y = Inf,
exclude_color = NULL, exclude_level = NULL)
@@ -43,6 +43,7 @@ Other 3D Models: \code{\link{bricks_from_coords}},
\code{\link{bricks_from_excel}},
\code{\link{bricks_from_mosaic}},
\code{\link{bricks_from_rayshader}},
\code{\link{build_bricks_rayshader}},
\code{\link{build_bricks}}
}
\concept{3D Models}
+18 -20
View File
@@ -1,42 +1,40 @@
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/build-bricks.R
% Please edit documentation in R/build-bricks-rgl.R
\name{build_bricks}
\alias{build_bricks}
\title{Build 3D brick model with rayshader.}
\title{Build 3D brick model with rgl}
\usage{
build_bricks(brick_list, brick_type = "brick", brick_res = "sd",
view_levels = NULL, solidcolor = "#a3a2a4", water = FALSE,
waterdepth = 0, ...)
build_bricks(brick_list, background_color = "white", rgl_lit = TRUE,
outline_bricks = FALSE, trans_alpha = 0.5, view_levels = NULL)
}
\arguments{
\item{brick_list}{List output from collect_bricks(). Contains an element \code{Img_lego}.}
\item{background_color}{Default 'white'. Color of the background.}
\item{rgl_lit}{Default 'TRUE'. Include RGL lighting features in rendering.}
\item{outline_bricks}{Default 'FALSE'. Include black outlines around brick edges.
Set to 'TRUE' and rgl_lit='FALSE' for cartoon-looking bricks.}
\item{trans_alpha}{Default 0.5. Alpha level for transparent bricks.}
\item{view_levels}{Numeric array of Levels/z values to display. Leave as 'NULL' to include all.}
\item{brick_type}{Type of brick to use. Default is 'brick'. Other option is 'plate', which is 1/3 the height of a brick.}
\item{brick_res}{Resolution, expressed at number of pixels on one side of a 1x1 brick. Defaults to 'sd' (15px). Use 'hd' for 30px per brick, and 'uhd' for 60px.
Enter a value for a custom resolution. High resolutions take longer to render.}
\item{view_levels}{Numeric array of Levels/z values to display. Leave as \code{NULL} to include all.}
\item{solidcolor}{Hex color of mosaic base. Only renders on bottom.}
\item{water}{Default 'FALSE'. If 'TRUE', a water layer is rendered.}
\item{waterdepth}{Default '0'. Water level.}
\item{...}{All other inputs from rayshader::plot_3d() EXCEPT \code{hillshade}, \code{soliddepth}, \code{zscale}, and \code{shadow}.}
}
\value{
3D brick model rendered in the 'rgl' package.
}
\description{
Build 3D brick model with rayshader.
Build 3D brick model with rgl
}
\seealso{
Other 3D Models: \code{\link{bricks_from_coords}},
\code{\link{bricks_from_excel}},
\code{\link{bricks_from_mosaic}},
\code{\link{bricks_from_rayshader}},
\code{\link{bricks_from_table}}
\code{\link{bricks_from_table}},
\code{\link{build_bricks_rayshader}}
}
\concept{3D Models}
+43
View File
@@ -0,0 +1,43 @@
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/build-bricks.R
\name{build_bricks_rayshader}
\alias{build_bricks_rayshader}
\title{Build 3D brick model with rayshader.}
\usage{
build_bricks_rayshader(brick_list, brick_type = "brick",
brick_res = "sd", view_levels = NULL, solidcolor = "#a3a2a4",
water = FALSE, waterdepth = 0, ...)
}
\arguments{
\item{brick_list}{List output from collect_bricks(). Contains an element \code{Img_lego}.}
\item{brick_type}{Type of brick to use. Default is 'brick'. Other option is 'plate', which is 1/3 the height of a brick.}
\item{brick_res}{Resolution, expressed at number of pixels on one side of a 1x1 brick. Defaults to 'sd' (15px). Use 'hd' for 30px per brick, and 'uhd' for 60px.
Enter a value for a custom resolution. High resolutions take longer to render.}
\item{view_levels}{Numeric array of Levels/z values to display. Leave as \code{NULL} to include all.}
\item{solidcolor}{Hex color of mosaic base. Only renders on bottom.}
\item{water}{Default 'FALSE'. If 'TRUE', a water layer is rendered.}
\item{waterdepth}{Default '0'. Water level.}
\item{...}{All other inputs from rayshader::plot_3d() EXCEPT \code{hillshade}, \code{soliddepth}, \code{zscale}, and \code{shadow}.}
}
\value{
3D brick model rendered in the 'rgl' package.
}
\description{
Build 3D brick model with rayshader.
}
\seealso{
Other 3D Models: \code{\link{bricks_from_coords}},
\code{\link{bricks_from_excel}},
\code{\link{bricks_from_mosaic}},
\code{\link{bricks_from_rayshader}},
\code{\link{bricks_from_table}},
\code{\link{build_bricks}}
}
\concept{3D Models}
+4 -2
View File
@@ -4,10 +4,12 @@
\alias{build_colors}
\title{Display available brick colors}
\usage{
build_colors(.names_only = FALSE)
build_colors(.names_only = FALSE, include_transparent = TRUE)
}
\arguments{
\item{.names_only}{Return an array of the 41 brick color names. Does not plot.}
\item{.names_only}{Return an array of the 41 solid brick color names and 13 transparent colors. Does not plot.}
\item{include_transparent}{Include transparent colors in the plot output.}
}
\value{
A table and ggplot of brick colors & ID numbers.
+14 -7
View File
@@ -12,6 +12,7 @@ knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>"
)
rgl::setupKnitr()
```
```{r setup, include = FALSE}
@@ -20,7 +21,7 @@ library(brickr)
## Getting started
The `bricks_from_*` series of functions creates 3D models of LEGO bricks from a variety of input formats. These models are rendered using [Tyler Morgan-Wall](https://twitter.com/tylermorganwall)'s [rayshader](https://www.rayshader.com/) package. This package must be installed.
The `bricks_from_*` series of functions creates 3D models of LEGO bricks from a variety of input formats.
## 3D mosaics
@@ -29,7 +30,7 @@ Begin with a brickr mosaic from an image. Rather than graphically rendering the
* `mosaic_height` is the number of bricks stacked at the mosaic's highest point. The default is 6.
* `highest_el` specifies if 'light' or 'dark' color bricks should be the tallest in the model. The default is 'light'.
```{r bricks_6, echo=TRUE, warning=FALSE, message=FALSE, fig.width=4, fig.height=4}
```{r bricks_6, rgl=TRUE, dev='png', echo=TRUE, warning=FALSE, message=FALSE, fig.width=4, fig.height=4}
demo_img = tempfile()
download.file("http://ryantimpe.com/files/mf_unicorn.PNG", demo_img, mode="wb")
@@ -37,12 +38,17 @@ mosaic <- png::readPNG(demo_img) %>%
image_to_mosaic()
mosaic %>% build_mosaic()
```
```{r bricks_6a, rgl=TRUE, dev='png', echo=TRUE, warning=FALSE, message=FALSE, fig.width=4, fig.height=4}
mosaic %>%
bricks_from_mosaic(highest_el = "dark") %>%
build_bricks(phi = 60, theta = 15)
build_bricks()
rayshader::render_snapshot(clear = TRUE)
#From dput(round(rgl::par3d("userMatrix"),1)) after manual rotation
custom_rotation <- structure(c(0.9, 0.3, -0.3, 0, -0.3, 0.9, -0.3,
0, 0.2, 0.4, 0.9, 0, 0, 0, 0, 1), .Dim = c(4L, 4L))
rgl::par3d(userMatrix = rgl::rotate3d(custom_rotation, 0, 0, pi/4 ,1))
```
## Models from rayshader
@@ -56,7 +62,7 @@ rayshader::render_snapshot(clear = TRUE)
* `max_height` is the number of bricks stacked at the mosaic's highest point. The default is 12.
* `img_size` is the number of bricks on each side of the model. The default is 48.
```{r bricks_rayshader, echo=TRUE, warning=FALSE, message=FALSE, fig.width=4, fig.height=4}
```{r bricks_rayshader, rgl=TRUE, dev='png', echo=TRUE, warning=FALSE, message=FALSE, fig.width=4, fig.height=4}
library(rayshader)
#Example from rayshader.com
@@ -85,7 +91,8 @@ rayshader::render_snapshot(clear = TRUE)
#Plot as bricks
rayshader_object %>%
bricks_from_rayshader(elmat) %>%
build_bricks(theta = 135, phi = 45)
build_bricks_rayshader(theta = 135, phi = 45)
rayshader::render_snapshot(clear = TRUE)
```
This example is rendered using `build_bricks_rayshader()`, which a bit faster for very large sets.
+24 -22
View File
@@ -12,6 +12,7 @@ knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>"
)
rgl::setupKnitr()
```
```{r setup, include = FALSE}
@@ -20,7 +21,7 @@ library(brickr)
## Getting started
The `bricks_from_*` series of functions creates 3D models of LEGO bricks from a variety of input formats. These models are rendered using [Tyler Morgan-Wall](https://twitter.com/tylermorganwall)'s [rayshader](https://www.rayshader.com/) package. This package must be installed.
The `bricks_from_*` series of functions creates 3D models of LEGO bricks from a variety of input formats.
Use `bricks_from_coords()` to programmatically build 3D LEGO models rather than manually drawing them in a spreadsheet or table. Prove the function with a data frame with x, y, and z coordinates, along with an official LEGO color name for each point.
@@ -28,7 +29,7 @@ Use `bricks_from_coords()` to programmatically build 3D LEGO models rather than
Below, we create a 8x8x8 cube by expanding a data frame with the array 1:8 as the x-, y-, and z-coordinates. We then assign each row of that data frame one of three colors: Bright blue, Bright yellow, or Bright red.
```{r bricks_6, echo=TRUE, warning=FALSE, message=FALSE, fig.width=4, fig.height=4}
```{r bricks_6, rgl=TRUE, dev='png', echo=TRUE, warning=FALSE, message=FALSE, fig.width=4, fig.height=4}
use_colors <- c("Bright blue", "Bright yellow", "Bright red")
cube <- expand.grid(
@@ -41,14 +42,14 @@ cube$Color <- sample(use_colors, nrow(cube), replace = TRUE, prob = c(5, 3, 1))
cube %>%
bricks_from_coords() %>%
build_bricks(brick_res = "uhd", phi = 30, theta = 30)
build_bricks()
rayshader::render_snapshot(clear = TRUE)
rgl::par3d(userMatrix = rgl::rotate3d(rgl::par3d("userMatrix"), 1.1*pi/4, 0, 0 ,1))
```
Using the same logic, we can build a sphere with a specified radius, and then apply rules to color each brick based on its coordinates.
```{r bricks_7, echo=TRUE, warning=FALSE, message=FALSE, fig.width=4, fig.height=4}
```{r bricks_7, rgl=TRUE, dev='png', echo=TRUE, warning=FALSE, message=FALSE, fig.width=4, fig.height=4}
radius <- 4
sphere_coords <- expand.grid(
x = 1:round((radius*2.5)),
@@ -67,19 +68,21 @@ sphere_coords <- expand.grid(
sphere_coords %>%
bricks_from_coords() %>%
build_bricks(brick_res = "uhd", phi = 30, theta = 30)
build_bricks(rgl_lit = FALSE, outline_bricks = TRUE)
rayshader::render_snapshot(clear = TRUE)
rgl::par3d(userMatrix = rgl::rotate3d(rgl::par3d("userMatrix"), 1.1*pi/4, 0, 0 ,1))
```
The option `outline_bricks = TRUE` adds a black outline around the edges of the bricks. Setting `rgl_lit = FALSE` turns off automated lighting effects from rgl. Changing these two inputs together renders bricks in a more cartoon fashion.
## It takes a village
Rather than directly writing a data frame for a model, you can write a function that returns a data frame with x, y, z, and Color coordinates given initial starting parameters.
Below, the function `brick_house()` creates a LEGO house with randomized colors. The x- and y-coordinates and the size of the house are inputs to the functions.
```{r bricks_8, echo=TRUE, warning=FALSE, message=FALSE, fig.width=4, fig.height=4}
brick_house <- function(x_coord = 0, y_coord = 0, width=6, length=5, height=6){
```{r bricks_8, rgl=TRUE, dev='png', echo=TRUE, warning=FALSE, message=FALSE, fig.width=4, fig.height=4}
brick_house <- function(x_coord = 0, y_coord = 0, width=6, length=5, height=7){
roof_colors <- c("Dark orange", "Dark brown", "Medium nougat", "Medium stone grey")
roof_col <- sample(roof_colors, 1)
@@ -96,9 +99,9 @@ brick_house <- function(x_coord = 0, y_coord = 0, width=6, length=5, height=6){
roof & (abs(y - floor(length/2) -1) <= (height-z)) ~ roof_col,
roof ~ NA_character_,
#Door and windows
x == round(width/2) & z == 1 ~ NA_character_,
dplyr::between(x, 2, width-1) & x %% 2 == 0 & y > 1 & z == 2 ~ NA_character_,
dplyr::between(y, 2, length-1) & y %% 2 == 0 & z == 2 ~ NA_character_,
x == round(width/2) & y==1 & z <= 3 ~ NA_character_,
dplyr::between(x, 2, width-1) & x %% 2 == 0 & y > 1 & z == 3 ~ NA_character_,
dplyr::between(y, 2, length-1) & y %% 2 == 0 & z == 3 ~ NA_character_,
x %in% c(1, width) | y %in% c(1, length) ~ house_col),
x = x+x_coord,
y = y+y_coord
@@ -109,13 +112,14 @@ brick_house <- function(x_coord = 0, y_coord = 0, width=6, length=5, height=6){
#Build one house
brick_house() %>%
bricks_from_coords() %>%
build_bricks(theta = 225)
rayshader::render_snapshot(clear = TRUE)
build_bricks()
rgl::par3d(userMatrix = rgl::rotate3d(rgl::par3d("userMatrix"), 1.1*pi/4, 0, 0 ,1))
```
Next, we write one more function, `brick_street()` to build a road and grass foundation. The, for an arbitrary number of houses and neighborhood size, use `purrr::pmap_df` to generate many houses and place them along the road.
```{r bricks_9, echo=TRUE, warning=FALSE, message=FALSE, fig.width=4, fig.height=4}
```{r bricks_9, rgl=TRUE, dev='png', echo=TRUE, warning=FALSE, message=FALSE, fig.width=4, fig.height=4}
brick_street <- function(width = 100, length = 40){
expand.grid(x=1:width, y=1:length, z=1) %>%
dplyr::mutate(
@@ -130,20 +134,18 @@ brick_street <- function(width = 100, length = 40){
n_houses = 14
sz = c(100, 40)
list(x_coord = c(sample(seq(10, sz[1]-10, by = 10), n_houses/2),
sample(seq(10, sz[1]-10, by = 10), n_houses/2)),
list(x_coord = c(sample(seq(10, sz[1]-10, by = 12), n_houses/2),
sample(seq(10, sz[1]-10, by = 12), n_houses/2)),
y_coord = c(rep(sz[2]/2-15, n_houses/2), rep(sz[2]/2+10, n_houses/2)),
width = sample(4:10, n_houses, replace = TRUE),
length = sample(4:8, n_houses, replace = TRUE),
height = sample(5:8, n_houses, replace = TRUE)
length = sample(5:8, n_houses, replace = TRUE),
height = sample(7:9, n_houses, replace = TRUE)
) %>%
purrr::pmap_df(brick_house) %>%
dplyr::bind_rows(brick_street(sz[1], sz[2])) %>%
bricks_from_coords() %>%
build_bricks()
rayshader::render_camera(theta = 60, phi = 20, zoom = 0.75)
rayshader::render_snapshot(clear = TRUE)
rgl::par3d(userMatrix = rgl::rotate3d(rgl::par3d("userMatrix"), 1.1*pi/4, pi/4, 0 ,1))
```
+14 -11
View File
@@ -12,6 +12,7 @@ knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>"
)
rgl::setupKnitr()
```
```{r setup, include = FALSE}
@@ -20,7 +21,7 @@ library(brickr)
## Getting started
The `bricks_from_*` series of functions creates 3D models of LEGO bricks from a variety of input formats. These models are rendered using [Tyler Morgan-Wall](https://twitter.com/tylermorganwall)'s [rayshader](https://www.rayshader.com/) package. This package must be installed.
The `bricks_from_*` series of functions creates 3D models of LEGO bricks from a variety of input formats.
`bricks_from_table()` converts a matrix-shaped table of integers into LEGO bricks, where most columns are x-coordinates, rows are y-coordinates, and a special `Level` column denotes the elevation of the row. For simple models, this table can be made manually using `data.frame()` or `tibble::tribble()`.
@@ -32,7 +33,7 @@ Pass the output of any `bricks_from_*()` function to `build_bricks()` to render
Create a single 2x4 brick with a 2x4 data frame, with an additional column to specify the 'Level'. These can be letters or numbers.
```{r bricks_1, echo=TRUE, warning=FALSE, message=FALSE, fig.width=3, fig.height=3}
```{r bricks_1, rgl=TRUE, dev='png', echo=TRUE, warning=FALSE, message=FALSE, fig.width=3, fig.height=3}
#This is a 2 (columns) x 4 (rows) brick
(brick <- data.frame(
Level="A",
@@ -42,23 +43,23 @@ Create a single 2x4 brick with a 2x4 data frame, with an additional column to sp
brick %>%
bricks_from_table() %>%
build_bricks(brick_res = "hd") #Bricks available in standard def, high def, and ultra hd.
build_bricks()
rayshader::render_snapshot( clear = TRUE)
rgl::par3d(userMatrix = rgl::rotate3d(rgl::par3d("userMatrix"), 1.1*pi/4, 0, 0 ,1))
```
Stack many bricks by changing the 'Level' value in the data frame. The script below uses `purrr::map_df()` to avoid copying and pasting. Changing the numeric values inside the data frame for each level creates different colors.
```{r bricks_2, echo=TRUE, warning=FALSE, message=FALSE, fig.width=3, fig.height=3}
```{r bricks_2, rgl=TRUE, dev='png', echo=TRUE, warning=FALSE, message=FALSE, fig.width=3, fig.height=3}
1:10 %>%
purrr::map_df(~dplyr::mutate(brick,
Level = LETTERS[.x],
X1 = .x,
X2 = .x)) %>%
bricks_from_table() %>%
build_bricks(brick_res = "hd")
build_bricks(rgl_lit=FALSE, outline_bricks = TRUE)
rayshader::render_snapshot( clear = TRUE)
rgl::par3d(userMatrix = rgl::rotate3d(rgl::par3d("userMatrix"), 1.1*pi/4, 0, 0 ,1))
```
## Full models
@@ -67,7 +68,7 @@ The most direct way to create a 3D model is to manually create a data frame. Bel
The data frame has 3 numbers as input (values of 0 are void spaces in the model). Rather than use the default brickr colors for the values of 1, 2, and 3, we define another data frame 'brick_colors'
```{r bricks_5, echo=TRUE, warning=FALSE, message=FALSE, fig.width=4, fig.height=4}
```{r bricks_5, rgl=TRUE, dev='png', echo=TRUE, warning=FALSE, message=FALSE, fig.width=4, fig.height=4}
tree_or_mushroom <- tibble::tribble(
~Level, ~X1, ~X2, ~X3, ~X4, ~X5, ~X6,
"A", 1, 1, 1, 1, 1, 1,
@@ -109,13 +110,15 @@ brick_colors <- tibble::tribble(
tree_or_mushroom %>%
bricks_from_table(brick_colors) %>%
build_bricks(theta = 210, phi = 20, brick_res = "hd")
build_bricks()
rayshader::render_snapshot(clear = TRUE)
rgl::par3d(userMatrix = rgl::rotate3d(rgl::par3d("userMatrix"), 1.1*pi/4, 0, 0 ,1))
```
### Plates instead of bricks
**Currently unavailable in `build_bricks()`. Use `build_bricks_rayshader()`**
That's clearly a tree, right? Why is the data frame called 'tree_or_mushroom'?
Use the input 'brick_type="plate"' to render the 3D model using LEGO plates rather than bricks, which are 1/3 as tall.
@@ -130,7 +133,7 @@ brick_colors <- tibble::tribble(
tree_or_mushroom %>%
bricks_from_table(brick_colors) %>%
build_bricks(theta = 210, phi = 10, brick_res = "hd", brick_type="plate")
build_bricks_rayshader(theta = 210, phi = 10, brick_res = "hd", brick_type="plate")
rayshader::render_snapshot(clear = TRUE)
```
+8 -4
View File
@@ -12,6 +12,7 @@ knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>"
)
rgl::setupKnitr()
```
```{r setup, include=FALSE}
@@ -140,12 +141,15 @@ The input `brightness` can be used to scale up or down the RGB values of the ima
With [rayshader](https://www.rayshader.com/) installed, passing the mosaic object to `bricks_from_mosaic()` will render a 3D object, stacking layers of bricks on each other to create an elevated mosaic. By default, the lightest color bricks will be on top, but this can be changed using the `highest_el = 'dark'` option.
```{r c_threed}
```{r c_threed, rgl=TRUE, dev='png'}
png::readPNG(demo_img) %>%
image_to_mosaic(32) %>%
bricks_from_mosaic(highest_el = "dark") %>%
build_bricks(brick_type = "plate")
build_bricks()
rayshader::render_camera(theta = 15)
rayshader::render_snapshot(clear = TRUE)
#From dput(round(rgl::par3d("userMatrix"),1)) after manual rotation
custom_rotation <- structure(c(0.9, 0.3, -0.3, 0, -0.3, 0.9, -0.3,
0, 0.2, 0.4, 0.9, 0, 0, 0, 0, 1), .Dim = c(4L, 4L))
rgl::par3d(userMatrix = rgl::rotate3d(custom_rotation, 0, 0, pi/4 ,1))
```