A bunch of documentation edits after CRAN review
@@ -1,15 +1,16 @@
|
||||
Package: brickr
|
||||
Title: Emulate LEGO Bricks in 2D and 3D
|
||||
Version: 0.3.0
|
||||
Version: 0.3.1
|
||||
Authors@R:
|
||||
person(given = "Ryan",
|
||||
family = "Timpe",
|
||||
role = c("aut", "cre"),
|
||||
email = "ryan.timpe@gmail.com")
|
||||
Description:
|
||||
Generate digital LEGO models using tidyverse functions.
|
||||
Generate digital LEGO models using 'tidyverse' functions.
|
||||
Convert image files into 2D and 3D LEGO mosaics, complete with piece counts and instructions.
|
||||
Render 3D models using simple data frame instructions.
|
||||
Developed under the LEGO Group's Fair Play policy <https://www.lego.com/en-us/legal/notices-and-policies/fair-play/>.
|
||||
License: MIT + file LICENSE
|
||||
Encoding: UTF-8
|
||||
LazyData: true
|
||||
|
||||
@@ -11,7 +11,6 @@ export(build_instructions)
|
||||
export(build_mosaic)
|
||||
export(build_pieces)
|
||||
export(build_pieces_table)
|
||||
export(geom_brick_rect)
|
||||
export(image_to_mosaic)
|
||||
importFrom(magrittr,"%>%")
|
||||
importFrom(purrr,"%||%")
|
||||
|
||||
4
NEWS.md
@@ -1,6 +1,4 @@
|
||||
# Current version
|
||||
|
||||
# brickr 0.3.0
|
||||
# brickr 0.3.1
|
||||
|
||||
* An overall leaner package to ensure optimal performance and remove experimental features.
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#' \code{brickr} package
|
||||
#' 'brickr' package
|
||||
#'
|
||||
#' Tools to emulate the LEGO® System in R
|
||||
#' Emulate LEGO Bricks in 2D and 3D
|
||||
#'
|
||||
#' @docType package
|
||||
#' @name brickr
|
||||
|
||||
@@ -1,12 +1,27 @@
|
||||
#' Convert a 2D LEGO mosaic into a brickr 3D object
|
||||
#' Convert a 2D LEGO mosaic into a 'brickr' 3D object
|
||||
#'
|
||||
#' Stacks LEGO plates to create a 3D version of the 2D brick mosaics.
|
||||
#'
|
||||
#' Height of bricks determined by brightness of color.
|
||||
#'
|
||||
#' @param mosaic_list List output from collect_bricks() or image_to_bricks(). Contains an element \code{Img_lego}.
|
||||
#' @param mosaic_list List output from image_to_bricks(). Contains an element \code{Img_lego}.
|
||||
#' @param mosaic_height Number of layers in the 3D image.
|
||||
#' @param highest_el Brick height is determined by brightness of color. Use \code{highest_el = 'dark'} for darkest bricks to have \code{mosaic_height}.
|
||||
#' @return A list with elements \code{Img_lego} to pass to \code{collect_bricks()}.
|
||||
#' @return A list with elements \code{Img_lego} to pass to \code{\link{build_bricks}}.
|
||||
#' @family 3D Models
|
||||
#' @export
|
||||
#' @examples \donttest{
|
||||
#' # Create a random 24x24 'image'.
|
||||
#' # Otherwise, use a jpeg or png
|
||||
#' demo_image = array(scales::rescale(runif(24*24*3), c(0, 1)), dim=c(24, 24, 3))
|
||||
#'
|
||||
#' demo_image %>%
|
||||
#' image_to_mosaic(img_size = 24) %>%
|
||||
#' bricks_from_mosaic() %>%
|
||||
#' build_bricks()
|
||||
#'
|
||||
#' rgl::clear3d()
|
||||
#'}
|
||||
bricks_from_mosaic <- function(mosaic_list, mosaic_height = 6, highest_el = "light"){
|
||||
|
||||
#Get previous data
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
#' Convert a matrix table into a brickr 3D object
|
||||
#' Convert a matrix table into a 'brickr' 3D object
|
||||
#'
|
||||
#' Convert a data frame into a 3D brick object.
|
||||
#'
|
||||
#' @param matrix_table A data frame of a 3D brick model design. Left-most column is level/height/z dimension, with rows as Y axis and columns as X axis. See example. Use \code{tribble} for ease.
|
||||
#' @param matrix_table A data frame of a 3D brick model design. Left-most column is level/height/z dimension, with rows as Y axis and columns as X axis. See example. Use \code{\link[tibble]{tribble}} for ease.
|
||||
#' @param color_guide A data frame linking numeric \code{.value} in \code{matrix_table} to official LEGO color names. Defaults to data frame 'lego_colors'.
|
||||
#' @param piece_matrix A data frame in same shape as \code{matrix_table} with piece shape IDs.
|
||||
#' @param use_bricks Array of brick sizes to use in mosaic. Defaults to \code{c('4x2', '3x2', '2x2', '3x1', '2x1', '1x1')}`.
|
||||
@@ -14,10 +16,24 @@
|
||||
#' @param max_y Default 'Inf'. Use in animations. Any y values above this value will be cut off.
|
||||
#' @param exclude_color Numeric array of color ID numbers to exclude.
|
||||
#' @param exclude_level Numeric array of Level/z dimensions to exclude.
|
||||
#' @return A list with elements \code{Img_lego} to pass to \code{collect_bricks()}.
|
||||
#' @return A list with elements \code{Img_lego} to pass to \code{\link{build_bricks}}.
|
||||
#' @family 3D Models
|
||||
#' @export
|
||||
#' @examples \donttest{
|
||||
#' #This is a brick
|
||||
#'brick <- data.frame(
|
||||
#' Level="A",
|
||||
#' X1 = rep(3,4), #The number 3 is the brickrID for 'bright red'
|
||||
#' X2 = rep(3,4)
|
||||
#')
|
||||
#'
|
||||
#'brick %>%
|
||||
#' bricks_from_table() %>%
|
||||
#' build_bricks()
|
||||
#'
|
||||
#' rgl::clear3d()
|
||||
#' }
|
||||
|
||||
bricks_from_table <- function(matrix_table, color_guide = brickr::lego_colors,
|
||||
piece_matrix = NULL,
|
||||
use_bricks = NULL,
|
||||
@@ -171,15 +187,32 @@ bricks_from_table <- function(matrix_table, color_guide = brickr::lego_colors,
|
||||
)
|
||||
}
|
||||
|
||||
#' Convert an Excel {brickr} template into a brickr 3D object
|
||||
#' Convert an Excel 'brickr' template into a 3D object
|
||||
#'
|
||||
#' Convert am Excel template file into a 3D brick object.
|
||||
#'
|
||||
#' @param excel_table Sheet imported from a brickr Excel template to build model. Contains stud placement and colors.
|
||||
#' @param piece_table Sheet identical in shape to \code{excel_table} with piece shape IDs.
|
||||
#' @param use_bricks Array of brick sizes to use in mosaic. Defaults to \code{c('4x2', '3x2', '2x2', '3x1', '2x1', '1x1')}`.
|
||||
#' @param repeat_levels How many times to repeat a level. Can save time in model planning. Default is 1.
|
||||
#' @inheritParams bricks_from_table
|
||||
#' @return A list with elements \code{Img_lego} to pass to \code{collect_bricks()}.
|
||||
#' @return A list with elements \code{Img_lego} to pass to \code{\link{build_bricks}}.
|
||||
#' @family 3D Models
|
||||
#' @export
|
||||
#' @examples \donttest{
|
||||
#' #Demo table in same format as Excel template
|
||||
#' #This creates a 1x3 red brick.
|
||||
#'brick <- tibble::tribble(
|
||||
#' ~Level, ~"1", ~"2", ~"3", ~user_color, ~LEGO_color,
|
||||
#' "A", 1, 1, 1, 1, "Bright red"
|
||||
#' )
|
||||
#'
|
||||
#'brick %>%
|
||||
#' bricks_from_excel() %>%
|
||||
#' build_bricks()
|
||||
#'
|
||||
#' rgl::clear3d()
|
||||
#' }
|
||||
#'
|
||||
bricks_from_excel <- function(excel_table,
|
||||
piece_table = NULL,
|
||||
@@ -274,10 +307,12 @@ bricks_from_excel <- function(excel_table,
|
||||
return(brickr_out)
|
||||
}
|
||||
|
||||
#' Convert a data frame with x, y, z & Color columns into a brickr 3D object
|
||||
#' Create a 3D model object from a long coordinate data frame
|
||||
#'
|
||||
#' Convert a data frame with x, y, z & Color columns into a 3D object
|
||||
#'
|
||||
#' @param coord_table A data frame of a 3D brick model design. Contains 'x', 'y', and 'z' (vertical height) dimensions, as well as 'Color' from official LEGO color names.
|
||||
#' See \code{build_colors()}. Optional column 'piece_type' for shapes other than rectangular bricks.
|
||||
#' See \code{\link{build_colors}}. Optional column 'piece_type' for shapes other than rectangular bricks.
|
||||
#' Optional column ' mid_Level' with values 0, 1, or 2 (default 0) for 1-height placement of bricks.
|
||||
#' @param use_bricks Array of brick sizes to use in mosaic. Defaults to \code{c('4x2', '3x2', '2x2', '3x1', '2x1', '1x1')}`.
|
||||
#' @param increment_level Default '0'. Use in animations. Shift Level/z dimension by an integer.
|
||||
@@ -289,10 +324,39 @@ bricks_from_excel <- function(excel_table,
|
||||
#' @param max_y Default 'Inf'. Use in animations. Any y values above this value will be cut off.
|
||||
#' @param exclude_color Numeric array of color ID numbers to exclude.
|
||||
#' @param exclude_level Numeric array of Level/z dimensions to exclude.
|
||||
#' @return A list with elements \code{Img_lego} to pass to \code{collect_bricks()}.
|
||||
#' @return A list with elements \code{Img_lego} to pass to \code{\link{build_bricks}}.
|
||||
#' @family 3D Models
|
||||
#' @export
|
||||
#' @examples \donttest{
|
||||
#' #This is a 1x4 yellow brick
|
||||
#' brick <- data.frame(
|
||||
#' x = 1:4,
|
||||
#' y = 1, z=1,
|
||||
#' color = "Bright yellow",
|
||||
#' stringsAsFactors=FALSE)
|
||||
#'
|
||||
#' brick %>%
|
||||
#' bricks_from_coords() %>%
|
||||
#' build_bricks()
|
||||
#'
|
||||
#' rgl::clear3d()
|
||||
#'
|
||||
#' #This is a lot of bricks
|
||||
#' bricks <- expand.grid(
|
||||
#' x = 1:8,
|
||||
#' y = 1:4,
|
||||
#' z = 1:3)
|
||||
#'
|
||||
#' #Color them in sets of these 3 options
|
||||
#' bricks$color <- rep(rep(c("Bright yellow", "Bright red", "Dark green"), each=4), 8)
|
||||
#'
|
||||
#' bricks %>%
|
||||
#' bricks_from_coords() %>%
|
||||
#' build_bricks()
|
||||
#'
|
||||
#' rgl::clear3d()
|
||||
#'
|
||||
#' }
|
||||
bricks_from_coords <- function(coord_table,
|
||||
use_bricks = NULL,
|
||||
increment_level = 0, min_level = 1, max_level = Inf,
|
||||
|
||||
@@ -1,13 +1,15 @@
|
||||
#' Build 3D brick model with rgl
|
||||
#' Build 3D brick model with 'rgl'
|
||||
#'
|
||||
#' Render the output of any of the \code{bricks_from_*} functions as a 3D model.
|
||||
#'
|
||||
#' @param brick_list List output from collect_bricks(). Contains an element \code{Img_lego}.
|
||||
#' @param brick_list List output from a \code{bricks_from_*} function. Contains an element \code{Img_lego}.
|
||||
#' @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.
|
||||
#' @examples \dontrun{
|
||||
#' @examples \donttest{
|
||||
#' #This is a brick
|
||||
#'brick <- data.frame(
|
||||
#' Level="A",
|
||||
@@ -18,6 +20,8 @@
|
||||
#'brick %>%
|
||||
#' bricks_from_table() %>%
|
||||
#' build_bricks()
|
||||
#'
|
||||
#'rgl::clear3d()
|
||||
#' }
|
||||
#' @return 3D brick model rendered in the 'rgl' package.
|
||||
#' @family 3D Models
|
||||
|
||||
@@ -1,10 +1,28 @@
|
||||
#' Create instruction manual for 2D image mosaics
|
||||
#' Create instruction manual
|
||||
#'
|
||||
#' Render faceted plot of instructions for 2D mosacis or 3D model objects.
|
||||
#'
|
||||
#' Instructions for 2D mosaics are split into sections beginning at the bottom of the image.
|
||||
#' This makes it easier to follow each row when building an actual brick mosaic.
|
||||
#'
|
||||
#' 3D model instructions are displayed one Level (z value) at a time.
|
||||
#' The current model level is clearly displayed, while the previous level is shows as transparent.
|
||||
#'
|
||||
#' @param brickr_obj brickr mosaic or 3D model object.
|
||||
#' @param num_steps Number of discrete steps in instruction manual, for mosaics only
|
||||
#' @param num_steps Number of discrete steps in instruction manual, for mosaics only.
|
||||
#' @return A single plot object of steps to build brickr model or mosaic.
|
||||
#' @family Resources
|
||||
#' @export
|
||||
#' @examples \donttest{
|
||||
#' # Create a random 24x24 'image'.
|
||||
#' # Otherwise, use a jpeg or png
|
||||
#' demo_image = array(scales::rescale(runif(24*24*3), c(0, 1)), dim=c(24, 24, 3))
|
||||
#'
|
||||
#' demo_image %>%
|
||||
#' image_to_mosaic(img_size = 24) %>%
|
||||
#' build_instructions()
|
||||
#'}
|
||||
#'
|
||||
|
||||
build_instructions <- function(brickr_obj, num_steps=6) {
|
||||
in_list <- brickr_obj
|
||||
|
||||
@@ -1,10 +1,21 @@
|
||||
#' Display 2D LEGO mosaic as a plot image
|
||||
#'
|
||||
#' Render a plot image of the 2D brick mosaic with optional title.
|
||||
#'
|
||||
#' @param brick_obj List output from image_to_bricks(). Contains an element \code{Img_lego}.
|
||||
#' @param brick_obj List output from image_to_bricks(). Contains an element \code{Img_lego}.
|
||||
#' @param title Optional title to include above plotted mosaic.
|
||||
#' @return A single plot object to display 2D mosaic.
|
||||
#' @family Mosaics
|
||||
#' @export
|
||||
#' @examples \donttest{
|
||||
#' # Create a random 24x24 'image'.
|
||||
#' # Otherwise, use a jpeg or png
|
||||
#' demo_image = array(scales::rescale(runif(24*24*3), c(0, 1)), dim=c(24, 24, 3))
|
||||
#'
|
||||
#' demo_image %>%
|
||||
#' image_to_mosaic(img_size = 24) %>%
|
||||
#' build_mosaic()
|
||||
#'}
|
||||
|
||||
build_mosaic <- function(brick_obj, title=NULL){
|
||||
in_list <- brick_obj
|
||||
|
||||
@@ -26,7 +26,7 @@ collect_bricks <- function(image_list, use_bricks = NULL,
|
||||
#Allowed bricks ----
|
||||
|
||||
if(is.null(use_bricks)){
|
||||
use_bricks <- c('4x2', '2x2', '4x1', '3x2', '3x1', '2x1', '1x1')
|
||||
use_bricks <- c('4x2', '2x2', '4x1', '3x1', '2x1', '1x1') #3x2 once I change build_pieces()
|
||||
} else {
|
||||
#Must contain 1x1... duplicated gets dropped
|
||||
use_bricks <- c(use_bricks, '1x1')
|
||||
|
||||
@@ -1,13 +1,15 @@
|
||||
#' Display available brick colors
|
||||
#'
|
||||
#' Generates a plot of available brick colors. Use .names_only = TRUE to get a list of color names.
|
||||
#' 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 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.
|
||||
#' @return An array or ggplot of brick colors & ID numbers.
|
||||
#' @examples
|
||||
#' #Generate plot of colors
|
||||
#' \dontrun{
|
||||
#' \donttest{
|
||||
#' build_colors()
|
||||
#' }
|
||||
#'
|
||||
|
||||
2
R/data.R
@@ -1,6 +1,6 @@
|
||||
#' Brickr colors available for mosaics & 3D models
|
||||
#'
|
||||
#' A dataset containing the 54 colors available in brickr, along with metadata
|
||||
#' A dataset containing the 54 colors available in 'brickr', along with metadata
|
||||
#'
|
||||
#' @format A data frame with 54 rows and 10 variables:
|
||||
#' \describe{
|
||||
|
||||
@@ -1,18 +1,21 @@
|
||||
#' Tile charts as Bricks - ggplot2 extension
|
||||
#' Tile charts as bricks
|
||||
#'
|
||||
#' `geom_rect`, except bars look like LEGO(R) bricks.
|
||||
#' `geom_rect`, except bars look like LEGO bricks.
|
||||
#'
|
||||
#' Currently all 'ggplot2' extensions are for internal use only.
|
||||
#'
|
||||
#' @inheritParams ggplot2::geom_rect
|
||||
#' @param label Character string to include as embossed text inside brick knobs. Maximum 6 characters.
|
||||
#' @param label_scale Scale text size of label as a percentage.
|
||||
#' @param simplified_threshold Maximum number of knobs on the plot before embossed label is suppressed.
|
||||
#' @param use_bricks Array of brick sizes to use in mosaic. Defaults to \code{c('4x2', '2x2', '3x1', '2x1', '1x1')}`.
|
||||
#' @family Graphs
|
||||
#' @export
|
||||
#' @keywords internal
|
||||
#'
|
||||
geom_brick_rect <- function(mapping = NULL, data = NULL,
|
||||
stat = "identity", position = "identity",
|
||||
...,
|
||||
label = "brickr", simplified_threshold = 24*24, label_scale = 1,
|
||||
label = "", simplified_threshold = 24*24, label_scale = 1,
|
||||
use_bricks = NULL,
|
||||
linejoin = "mitre",
|
||||
na.rm = FALSE,
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
#' Create a 2D LEGO mosaic from an image array
|
||||
#'
|
||||
#' Generate brick mosaics from an image or matrix with customization options.
|
||||
#'
|
||||
#' @param img Image to convert into mosaic. Usually from \code{jpeg::readJPEG()} or \code{png::readPNG()}.
|
||||
#' @param img Image matrix to convert into mosaic. Usually from \code{\link[jpeg]{readJPEG}} or \code{\link[png]{readPNG}}.
|
||||
#' @param img_size Size of output image in pixel, where one pixel = one 'brick'. Use a single value (e.g. \code{48}) for a square image with 48 pixels on each side.
|
||||
#' Use an array of two values for a rectangular image \code{c(width, height)}.
|
||||
#' @param method The method to use for comparison. Either 'brickr_classic', 'euclidean', 'cie1976', 'cie94', 'cie2000', or 'cmc'.
|
||||
@@ -18,6 +20,21 @@
|
||||
#' @return A list with element \code{Img_lego} containing a data frame of the x- & y-coordinates, R, G, B channels, and mapped color of each brick (pixel).
|
||||
#' @family Mosaics
|
||||
#' @export
|
||||
#' @examples
|
||||
#' \donttest{
|
||||
#' # Create a random 24x24 'image'.
|
||||
#' # Otherwise, use a jpeg or png
|
||||
#' demo_image = array(scales::rescale(runif(24*24*3), c(0, 1)), dim=c(24, 24, 3))
|
||||
#'
|
||||
#' demo_image %>%
|
||||
#' image_to_mosaic(img_size = 24) %>%
|
||||
#' build_mosaic()
|
||||
#'
|
||||
#' #Only use the most common "universal" LEGO colors
|
||||
#' demo_image %>%
|
||||
#' image_to_mosaic(img_size = 24, color_palette = "universal") %>%
|
||||
#' build_mosaic()
|
||||
#' }
|
||||
#'
|
||||
image_to_mosaic <- function(img, img_size = 48, color_table = NULL,
|
||||
method = "cie94",
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
#' Scale an image raster array to a small number of pixels. Process into a data frame. Internal function.
|
||||
#' Scale an image raster array to a small number of pixels.
|
||||
#'
|
||||
#' Decrease the size of an image, in pixel. Process into a data frame. Internal function.
|
||||
#'
|
||||
#' @param image A raster array from an image.
|
||||
#' @param img_size Size of output image in pixel, where one pixel = one 'brick'. Use a single value (e.g. \code{48}) for a square image with 48 pixels on each side.
|
||||
@@ -9,6 +11,7 @@
|
||||
#' @usage NULL
|
||||
#' @return A list with element \code{Img_scaled} containing a data frame of the x- & y-coordinates, R, G, B channels, and hex color of each brick (pixel).
|
||||
#' @keywords internal
|
||||
|
||||
image_to_scaled <- function(image, img_size = 48, brightness = 1, warhol = 1:3){
|
||||
|
||||
#Adjust brightness. Max channel value is 1
|
||||
@@ -93,6 +96,8 @@ image_to_scaled <- function(image, img_size = 48, brightness = 1, warhol = 1:3){
|
||||
}
|
||||
|
||||
#' Convert image output from scale_image() to bricks
|
||||
#'
|
||||
#' Match raw color channel values to a smaller subset of colors.
|
||||
#'
|
||||
#' @param image_list List output from scale_image(). Contains an element \code{Img_scaled}.
|
||||
#' @param method Default 'cie94'. The method to use for comparison. Either 'brickr_classic', 'euclidean', 'cie1976', 'cie94', 'cie2000', or 'cmc'.
|
||||
|
||||
@@ -1,9 +1,20 @@
|
||||
#' Generate required bricks as a data frame.
|
||||
#'
|
||||
#' Create a dataframe of brick colors and sizes used in a brick mosaic or model.
|
||||
#'
|
||||
#' @param brick_obj brickr mosaic or 3D model object.
|
||||
#' @return Data frame of piece counts by LEGO color name and size.
|
||||
#' @family Resources
|
||||
#' @export
|
||||
#' @examples \donttest{
|
||||
#' # Create a random 24x24 'image'.
|
||||
#' # Otherwise, use a jpeg or png
|
||||
#' demo_image = array(scales::rescale(runif(24*24*3), c(0, 1)), dim=c(24, 24, 3))
|
||||
#'
|
||||
#' demo_image %>%
|
||||
#' image_to_mosaic(img_size = 24) %>%
|
||||
#' build_pieces_table()
|
||||
#'}
|
||||
|
||||
build_pieces_table <- function(brick_obj){
|
||||
pcs <- brick_obj$pieces
|
||||
@@ -15,11 +26,22 @@ build_pieces_table <- function(brick_obj){
|
||||
}
|
||||
|
||||
#' Display bricks required to build model or mosaic.
|
||||
#'
|
||||
#' Create a chart of brick colors and sizes used in a brick mosaic or model.
|
||||
#'
|
||||
#' @param brick_obj brickr mosaic or 3D model object.
|
||||
#' @return Plot object of required bricks by color and size.
|
||||
#' @family Resources
|
||||
#' @export
|
||||
#' @examples \donttest{
|
||||
#' # Create a random 24x24 'image'.
|
||||
#' # Otherwise, use a jpeg or png
|
||||
#' demo_image = array(scales::rescale(runif(24*24*3), c(0, 1)), dim=c(24, 24, 3))
|
||||
#'
|
||||
#' demo_image %>%
|
||||
#' image_to_mosaic(img_size = 24) %>%
|
||||
#' build_pieces()
|
||||
#'}
|
||||
#'
|
||||
|
||||
build_pieces <- function(brick_obj){
|
||||
|
||||
|
Before Width: | Height: | Size: 18 KiB After Width: | Height: | Size: 18 KiB |
|
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 14 KiB |
|
Before Width: | Height: | Size: 22 KiB After Width: | Height: | Size: 22 KiB |
|
Before Width: | Height: | Size: 9.8 KiB After Width: | Height: | Size: 9.9 KiB |
@@ -78,7 +78,7 @@
|
||||
</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.3.0</span>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.3.1</span>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -78,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.3.0</span>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.3.1</span>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -78,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.3.0</span>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.3.1</span>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -78,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.3.0</span>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.3.1</span>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -39,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.3.0</span>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.3.1</span>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
|
||||
|
Before Width: | Height: | Size: 47 KiB After Width: | Height: | Size: 48 KiB |
|
Before Width: | Height: | Size: 190 KiB After Width: | Height: | Size: 190 KiB |
@@ -39,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.3.0</span>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.3.1</span>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
|
||||
|
Before Width: | Height: | Size: 48 KiB After Width: | Height: | Size: 48 KiB |
|
Before Width: | Height: | Size: 31 KiB After Width: | Height: | Size: 32 KiB |
|
Before Width: | Height: | Size: 29 KiB After Width: | Height: | Size: 30 KiB |
|
Before Width: | Height: | Size: 65 KiB After Width: | Height: | Size: 66 KiB |
@@ -39,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.3.0</span>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.3.1</span>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -39,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.3.0</span>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.3.1</span>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
|
||||
|
Before Width: | Height: | Size: 23 KiB After Width: | Height: | Size: 24 KiB |
|
Before Width: | Height: | Size: 34 KiB After Width: | Height: | Size: 34 KiB |
|
Before Width: | Height: | Size: 22 KiB After Width: | Height: | Size: 22 KiB |
|
Before Width: | Height: | Size: 23 KiB After Width: | Height: | Size: 24 KiB |
@@ -39,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.3.0</span>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.3.1</span>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
|
||||
|
Before Width: | Height: | Size: 49 KiB After Width: | Height: | Size: 49 KiB |
|
Before Width: | Height: | Size: 51 KiB After Width: | Height: | Size: 52 KiB |
|
Before Width: | Height: | Size: 174 KiB After Width: | Height: | Size: 175 KiB |
|
Before Width: | Height: | Size: 188 KiB After Width: | Height: | Size: 108 KiB |
|
Before Width: | Height: | Size: 43 KiB After Width: | Height: | Size: 43 KiB |
|
Before Width: | Height: | Size: 183 KiB After Width: | Height: | Size: 184 KiB |
|
Before Width: | Height: | Size: 59 KiB After Width: | Height: | Size: 59 KiB |
|
Before Width: | Height: | Size: 63 KiB After Width: | Height: | Size: 63 KiB |
@@ -78,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.3.0</span>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.3.1</span>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -21,7 +21,8 @@
|
||||
<meta property="og:description" content="
|
||||
Generate digital LEGO models using tidyverse functions.
|
||||
Convert image files into 2D and 3D LEGO mosaics, complete with piece counts and instructions.
|
||||
Render 3D models using simple data frame instructions.">
|
||||
Render 3D models using simple data frame instructions.
|
||||
Developed under the LEGO Group's Fair Play policy <https://www.lego.com/en-us/legal/notices-and-policies/fair-play/>.">
|
||||
<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]>
|
||||
@@ -42,7 +43,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.3.0</span>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.3.1</span>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -78,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.3.0</span>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.3.1</span>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
@@ -145,9 +145,9 @@
|
||||
<small>Source: <a href='https://github.com/ryantimpe/brickr/blob/master/NEWS.md'><code>NEWS.md</code></a></small>
|
||||
</div>
|
||||
|
||||
<div id="brickr-030" class="section level1">
|
||||
<div id="brickr-031" class="section level1">
|
||||
<h1 class="page-header">
|
||||
<a href="#brickr-030" class="anchor"></a>brickr 0.3.0</h1>
|
||||
<a href="#brickr-031" class="anchor"></a>brickr 0.3.1</h1>
|
||||
<ul>
|
||||
<li><p>An overall leaner package to ensure optimal performance and remove experimental features.</p></li>
|
||||
<li><p>Updated documentation to increase accessibility and usability.</p></li>
|
||||
@@ -277,7 +277,7 @@
|
||||
<div id="tocnav">
|
||||
<h2>Contents</h2>
|
||||
<ul class="nav nav-pills nav-stacked">
|
||||
<li><a href="#brickr-030">0.3.0</a></li>
|
||||
<li><a href="#brickr-031">0.3.1</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>
|
||||
|
||||
@@ -79,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.3.0</span>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.3.1</span>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -79,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.3.0</span>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.3.1</span>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -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>Convert a data frame with x, y, z & Color columns into a brickr 3D object — bricks_from_coords • brickr</title>
|
||||
<title>Create a 3D model object from a long coordinate data frame — bricks_from_coords • brickr</title>
|
||||
|
||||
<!-- favicons -->
|
||||
<link rel="icon" type="image/png" sizes="16x16" href="../favicon-16x16.png">
|
||||
@@ -44,7 +44,7 @@
|
||||
<link href="../extra.css" rel="stylesheet">
|
||||
|
||||
|
||||
<meta property="og:title" content="Convert a data frame with x, y, z & Color columns into a brickr 3D object — bricks_from_coords" />
|
||||
<meta property="og:title" content="Create a 3D model object from a long coordinate data frame — bricks_from_coords" />
|
||||
<meta property="og:description" content="Convert a data frame with x, y, z &amp; Color columns into a brickr 3D object" />
|
||||
<meta property="og:image" content="http://brickr.org/logo.png" />
|
||||
<meta name="twitter:card" content="summary" />
|
||||
@@ -79,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.3.0</span>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.3.1</span>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
@@ -142,7 +142,7 @@
|
||||
<div class="row">
|
||||
<div class="col-md-9 contents">
|
||||
<div class="page-header">
|
||||
<h1>Convert a data frame with x, y, z & Color columns into a brickr 3D object</h1>
|
||||
<h1>Create a 3D model object from a long coordinate data frame</h1>
|
||||
<small class="dont-index">Source: <a href='https://github.com/ryantimpe/brickr/blob/master/R/bricks-from-tables.R'><code>R/bricks-from-tables.R</code></a></small>
|
||||
<div class="hidden name"><code>bricks_from_coords.Rd</code></div>
|
||||
</div>
|
||||
@@ -171,7 +171,7 @@
|
||||
<tr>
|
||||
<th>coord_table</th>
|
||||
<td><p>A data frame of a 3D brick model design. Contains 'x', 'y', and 'z' (vertical height) dimensions, as well as 'Color' from official LEGO color names.
|
||||
See <code><a href='build_colors.html'>build_colors()</a></code>. Optional column 'piece_type' for shapes other than rectangular bricks.
|
||||
See <code><a href='build_colors.html'>build_colors</a></code>. Optional column 'piece_type' for shapes other than rectangular bricks.
|
||||
Optional column ' mid_Level' with values 0, 1, or 2 (default 0) for 1-height placement of bricks.</p></td>
|
||||
</tr>
|
||||
<tr>
|
||||
@@ -218,7 +218,7 @@ Optional column ' mid_Level' with values 0, 1, or 2 (default 0) for 1-height pla
|
||||
|
||||
<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>
|
||||
<p>A list with elements <code>Img_lego</code> to pass to <code><a href='build_bricks.html'>build_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:
|
||||
@@ -227,6 +227,37 @@ Optional column ' mid_Level' with values 0, 1, or 2 (default 0) for 1-height pla
|
||||
<code><a href='bricks_from_table.html'>bricks_from_table</a>()</code>,
|
||||
<code><a href='build_bricks.html'>build_bricks</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'># \donttest{</span>
|
||||
<span class='co'>#This is a 1x4 yellow brick</span>
|
||||
<span class='no'>brick</span> <span class='kw'><-</span> <span class='fu'><a href='https://rdrr.io/r/base/data.frame.html'>data.frame</a></span>(
|
||||
<span class='kw'>x</span> <span class='kw'>=</span> <span class='fl'>1</span>:<span class='fl'>4</span>,
|
||||
<span class='kw'>y</span> <span class='kw'>=</span> <span class='fl'>1</span>, <span class='kw'>z</span><span class='kw'>=</span><span class='fl'>1</span>,
|
||||
<span class='kw'>color</span> <span class='kw'>=</span> <span class='st'>"Bright yellow"</span>,
|
||||
<span class='kw'>stringsAsFactors</span><span class='kw'>=</span><span class='fl'>FALSE</span>)
|
||||
|
||||
<span class='no'>brick</span> <span class='kw'>%>%</span>
|
||||
<span class='fu'>bricks_from_coords</span>() <span class='kw'>%>%</span>
|
||||
<span class='fu'><a href='build_bricks.html'>build_bricks</a></span>()
|
||||
|
||||
<span class='kw pkg'>rgl</span><span class='kw ns'>::</span><span class='fu'><a href='https://rdrr.io/pkg/rgl/man/scene.html'>clear3d</a></span>()
|
||||
|
||||
<span class='co'>#This is a lot of bricks</span>
|
||||
<span class='no'>bricks</span> <span class='kw'><-</span> <span class='fu'><a href='https://rdrr.io/r/base/expand.grid.html'>expand.grid</a></span>(
|
||||
<span class='kw'>x</span> <span class='kw'>=</span> <span class='fl'>1</span>:<span class='fl'>8</span>,
|
||||
<span class='kw'>y</span> <span class='kw'>=</span> <span class='fl'>1</span>:<span class='fl'>4</span>,
|
||||
<span class='kw'>z</span> <span class='kw'>=</span> <span class='fl'>1</span>:<span class='fl'>3</span>)
|
||||
|
||||
<span class='co'>#Color them in sets of these 3 options</span>
|
||||
<span class='no'>bricks</span>$<span class='no'>color</span> <span class='kw'><-</span> <span class='fu'><a href='https://rdrr.io/r/base/rep.html'>rep</a></span>(<span class='fu'><a href='https://rdrr.io/r/base/rep.html'>rep</a></span>(<span class='fu'><a href='https://rdrr.io/r/base/c.html'>c</a></span>(<span class='st'>"Bright yellow"</span>, <span class='st'>"Bright red"</span>, <span class='st'>"Dark green"</span>), <span class='kw'>each</span><span class='kw'>=</span><span class='fl'>4</span>), <span class='fl'>8</span>)
|
||||
|
||||
<span class='no'>bricks</span> <span class='kw'>%>%</span>
|
||||
<span class='fu'>bricks_from_coords</span>() <span class='kw'>%>%</span>
|
||||
<span class='fu'><a href='build_bricks.html'>build_bricks</a></span>()
|
||||
|
||||
<span class='kw pkg'>rgl</span><span class='kw ns'>::</span><span class='fu'><a href='https://rdrr.io/pkg/rgl/man/scene.html'>clear3d</a></span>()
|
||||
|
||||
<span class='co'># }</span></div></pre>
|
||||
</div>
|
||||
<div class="col-md-3 hidden-xs hidden-sm" id="sidebar">
|
||||
<h2>Contents</h2>
|
||||
@@ -234,6 +265,7 @@ Optional column ' mid_Level' with values 0, 1, or 2 (default 0) for 1-height pla
|
||||
<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>
|
||||
|
||||
@@ -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>Convert an Excel brickr template into a brickr 3D object — bricks_from_excel • brickr</title>
|
||||
<title>Convert an Excel 'brickr' template into a brickr 3D object — bricks_from_excel • brickr</title>
|
||||
|
||||
<!-- favicons -->
|
||||
<link rel="icon" type="image/png" sizes="16x16" href="../favicon-16x16.png">
|
||||
@@ -44,8 +44,8 @@
|
||||
<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:title" content="Convert an Excel 'brickr' template into a brickr 3D object — bricks_from_excel" />
|
||||
<meta property="og:description" content="Convert am Excel template file into a 3D brick object." />
|
||||
<meta property="og:image" content="http://brickr.org/logo.png" />
|
||||
<meta name="twitter:card" content="summary" />
|
||||
|
||||
@@ -79,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.3.0</span>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.3.1</span>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
@@ -142,13 +142,13 @@
|
||||
<div class="row">
|
||||
<div class="col-md-9 contents">
|
||||
<div class="page-header">
|
||||
<h1>Convert an Excel brickr template into a brickr 3D object</h1>
|
||||
<h1>Convert an Excel 'brickr' template into a brickr 3D object</h1>
|
||||
<small class="dont-index">Source: <a href='https://github.com/ryantimpe/brickr/blob/master/R/bricks-from-tables.R'><code>R/bricks-from-tables.R</code></a></small>
|
||||
<div class="hidden name"><code>bricks_from_excel.Rd</code></div>
|
||||
</div>
|
||||
|
||||
<div class="ref-description">
|
||||
<p>Convert an Excel brickr template into a brickr 3D object</p>
|
||||
<p>Convert am Excel template file into a 3D brick object.</p>
|
||||
</div>
|
||||
|
||||
<pre class="usage"><span class='fu'>bricks_from_excel</span>(
|
||||
@@ -226,7 +226,7 @@
|
||||
|
||||
<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>
|
||||
<p>A list with elements <code>Img_lego</code> to pass to <code><a href='build_bricks.html'>build_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:
|
||||
@@ -235,6 +235,21 @@
|
||||
<code><a href='bricks_from_table.html'>bricks_from_table</a>()</code>,
|
||||
<code><a href='build_bricks.html'>build_bricks</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'># \donttest{</span>
|
||||
<span class='co'>#Demo table in same format as Excel template</span>
|
||||
<span class='co'>#This creates a 1x3 red brick.</span>
|
||||
<span class='no'>brick</span> <span class='kw'><-</span> <span class='kw pkg'>tibble</span><span class='kw ns'>::</span><span class='fu'><a href='https://tibble.tidyverse.org/reference/tribble.html'>tribble</a></span>(
|
||||
~<span class='no'>Level</span>, ~<span class='st'>"1"</span>, ~<span class='st'>"2"</span>, ~<span class='st'>"3"</span>, ~<span class='no'>user_color</span>, ~<span class='no'>LEGO_color</span>,
|
||||
<span class='st'>"A"</span>, <span class='fl'>1</span>, <span class='fl'>1</span>, <span class='fl'>1</span>, <span class='fl'>1</span>, <span class='st'>"Bright red"</span>
|
||||
)
|
||||
|
||||
<span class='no'>brick</span> <span class='kw'>%>%</span>
|
||||
<span class='fu'>bricks_from_excel</span>() <span class='kw'>%>%</span>
|
||||
<span class='fu'><a href='build_bricks.html'>build_bricks</a></span>()
|
||||
|
||||
<span class='kw pkg'>rgl</span><span class='kw ns'>::</span><span class='fu'><a href='https://rdrr.io/pkg/rgl/man/scene.html'>clear3d</a></span>()
|
||||
<span class='co'># }</span></div></pre>
|
||||
</div>
|
||||
<div class="col-md-3 hidden-xs hidden-sm" id="sidebar">
|
||||
<h2>Contents</h2>
|
||||
@@ -242,6 +257,7 @@
|
||||
<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>
|
||||
|
||||
@@ -45,7 +45,7 @@
|
||||
|
||||
|
||||
<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:description" content="Stacks LEGO plates to create a 3D version of the 2D brick mosaics." />
|
||||
<meta property="og:image" content="http://brickr.org/logo.png" />
|
||||
<meta name="twitter:card" content="summary" />
|
||||
|
||||
@@ -79,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.3.0</span>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.3.1</span>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
@@ -148,7 +148,7 @@
|
||||
</div>
|
||||
|
||||
<div class="ref-description">
|
||||
<p>Convert a 2D LEGO mosaic into a brickr 3D object</p>
|
||||
<p>Stacks LEGO plates to create a 3D version of the 2D brick mosaics.</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>
|
||||
@@ -158,7 +158,7 @@
|
||||
<colgroup><col class="name" /><col class="desc" /></colgroup>
|
||||
<tr>
|
||||
<th>mosaic_list</th>
|
||||
<td><p>List output from collect_bricks() or image_to_bricks(). Contains an element <code>Img_lego</code>.</p></td>
|
||||
<td><p>List output from image_to_bricks(). Contains an element <code>Img_lego</code>.</p></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>mosaic_height</th>
|
||||
@@ -172,7 +172,10 @@
|
||||
|
||||
<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>
|
||||
<p>A list with elements <code>Img_lego</code> to pass to <code><a href='build_bricks.html'>build_bricks</a></code>.</p>
|
||||
<h2 class="hasAnchor" id="details"><a class="anchor" href="#details"></a>Details</h2>
|
||||
|
||||
<p>Height of bricks determined by brightness of color.</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:
|
||||
@@ -181,13 +184,28 @@
|
||||
<code><a href='bricks_from_table.html'>bricks_from_table</a>()</code>,
|
||||
<code><a href='build_bricks.html'>build_bricks</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'># \donttest{</span>
|
||||
<span class='co'># Create a random 24x24 'image'. </span>
|
||||
<span class='co'># Otherwise, use a jpeg or png</span>
|
||||
<span class='no'>demo_image</span> <span class='kw'>=</span> <span class='fu'><a href='https://rdrr.io/r/base/array.html'>array</a></span>(<span class='kw pkg'>scales</span><span class='kw ns'>::</span><span class='fu'><a href='https://scales.r-lib.org//reference/rescale.html'>rescale</a></span>(<span class='fu'><a href='https://rdrr.io/r/stats/Uniform.html'>runif</a></span>(<span class='fl'>24</span>*<span class='fl'>24</span>*<span class='fl'>3</span>), <span class='fu'><a href='https://rdrr.io/r/base/c.html'>c</a></span>(<span class='fl'>0</span>, <span class='fl'>1</span>)), <span class='kw'>dim</span><span class='kw'>=</span><span class='fu'><a href='https://rdrr.io/r/base/c.html'>c</a></span>(<span class='fl'>24</span>, <span class='fl'>24</span>, <span class='fl'>3</span>))
|
||||
|
||||
<span class='no'>demo_image</span> <span class='kw'>%>%</span>
|
||||
<span class='fu'><a href='image_to_mosaic.html'>image_to_mosaic</a></span>(<span class='kw'>img_size</span> <span class='kw'>=</span> <span class='fl'>24</span>) <span class='kw'>%>%</span>
|
||||
<span class='fu'>bricks_from_mosaic</span>() <span class='kw'>%>%</span>
|
||||
<span class='fu'><a href='build_bricks.html'>build_bricks</a></span>()
|
||||
|
||||
<span class='kw pkg'>rgl</span><span class='kw ns'>::</span><span class='fu'><a href='https://rdrr.io/pkg/rgl/man/scene.html'>clear3d</a></span>()
|
||||
<span class='co'># }</span></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="#details">Details</a></li>
|
||||
<li><a href="#see-also">See also</a></li>
|
||||
<li><a href="#examples">Examples</a></li>
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
|
||||
@@ -45,7 +45,7 @@
|
||||
|
||||
|
||||
<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:description" content="Convert a data frame into a 3D brick object." />
|
||||
<meta property="og:image" content="http://brickr.org/logo.png" />
|
||||
<meta name="twitter:card" content="summary" />
|
||||
|
||||
@@ -79,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.3.0</span>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.3.1</span>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
@@ -148,7 +148,7 @@
|
||||
</div>
|
||||
|
||||
<div class="ref-description">
|
||||
<p>Convert a matrix table into a brickr 3D object</p>
|
||||
<p>Convert a data frame into a 3D brick object.</p>
|
||||
</div>
|
||||
|
||||
<pre class="usage"><span class='fu'>bricks_from_table</span>(
|
||||
@@ -173,7 +173,7 @@
|
||||
<colgroup><col class="name" /><col class="desc" /></colgroup>
|
||||
<tr>
|
||||
<th>matrix_table</th>
|
||||
<td><p>A data frame of a 3D brick model design. Left-most column is level/height/z dimension, with rows as Y axis and columns as X axis. See example. Use <code>tribble</code> for ease.</p></td>
|
||||
<td><p>A data frame of a 3D brick model design. Left-most column is level/height/z dimension, with rows as Y axis and columns as X axis. See example. Use <code><a href='https://tibble.tidyverse.org/reference/tribble.html'>tribble</a></code> for ease.</p></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>color_guide</th>
|
||||
@@ -231,7 +231,7 @@
|
||||
|
||||
<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>
|
||||
<p>A list with elements <code>Img_lego</code> to pass to <code><a href='build_bricks.html'>build_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:
|
||||
@@ -240,6 +240,21 @@
|
||||
<code><a href='bricks_from_mosaic.html'>bricks_from_mosaic</a>()</code>,
|
||||
<code><a href='build_bricks.html'>build_bricks</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'># \donttest{</span>
|
||||
<span class='co'>#This is a brick</span>
|
||||
<span class='no'>brick</span> <span class='kw'><-</span> <span class='fu'><a href='https://rdrr.io/r/base/data.frame.html'>data.frame</a></span>(
|
||||
<span class='kw'>Level</span><span class='kw'>=</span><span class='st'>"A"</span>,
|
||||
<span class='kw'>X1</span> <span class='kw'>=</span> <span class='fu'><a href='https://rdrr.io/r/base/rep.html'>rep</a></span>(<span class='fl'>3</span>,<span class='fl'>4</span>), <span class='co'>#The number 3 is the brickrID for 'bright red'</span>
|
||||
<span class='kw'>X2</span> <span class='kw'>=</span> <span class='fu'><a href='https://rdrr.io/r/base/rep.html'>rep</a></span>(<span class='fl'>3</span>,<span class='fl'>4</span>)
|
||||
)
|
||||
|
||||
<span class='no'>brick</span> <span class='kw'>%>%</span>
|
||||
<span class='fu'>bricks_from_table</span>() <span class='kw'>%>%</span>
|
||||
<span class='fu'><a href='build_bricks.html'>build_bricks</a></span>()
|
||||
|
||||
<span class='kw pkg'>rgl</span><span class='kw ns'>::</span><span class='fu'><a href='https://rdrr.io/pkg/rgl/man/scene.html'>clear3d</a></span>()
|
||||
<span class='co'># }</span></div></pre>
|
||||
</div>
|
||||
<div class="col-md-3 hidden-xs hidden-sm" id="sidebar">
|
||||
<h2>Contents</h2>
|
||||
@@ -247,6 +262,7 @@
|
||||
<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>
|
||||
|
||||
@@ -45,7 +45,7 @@
|
||||
|
||||
|
||||
<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:description" content="Render the output of any of the bricks_from_* functions as a 3D model." />
|
||||
<meta property="og:image" content="http://brickr.org/logo.png" />
|
||||
<meta name="twitter:card" content="summary" />
|
||||
|
||||
@@ -79,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.3.0</span>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.3.1</span>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
@@ -148,7 +148,7 @@
|
||||
</div>
|
||||
|
||||
<div class="ref-description">
|
||||
<p>Build 3D brick model with rgl</p>
|
||||
<p>Render the output of any of the <code>bricks_from_*</code> functions as a 3D model.</p>
|
||||
</div>
|
||||
|
||||
<pre class="usage"><span class='fu'>build_bricks</span>(
|
||||
@@ -165,7 +165,7 @@
|
||||
<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>
|
||||
<td><p>List output from a <code>bricks_from_*</code> function. Contains an element <code>Img_lego</code>.</p></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>background_color</th>
|
||||
@@ -202,7 +202,7 @@ Set to 'TRUE' and rgl_lit='FALSE' for cartoon-looking bricks.</p></td>
|
||||
<code><a href='bricks_from_table.html'>bricks_from_table</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='kw'>if</span> (<span class='fl'>FALSE</span>) {
|
||||
<pre class="examples"><div class='input'><span class='co'># \donttest{</span>
|
||||
<span class='co'>#This is a brick</span>
|
||||
<span class='no'>brick</span> <span class='kw'><-</span> <span class='fu'><a href='https://rdrr.io/r/base/data.frame.html'>data.frame</a></span>(
|
||||
<span class='kw'>Level</span><span class='kw'>=</span><span class='st'>"A"</span>,
|
||||
@@ -213,7 +213,9 @@ Set to 'TRUE' and rgl_lit='FALSE' for cartoon-looking bricks.</p></td>
|
||||
<span class='no'>brick</span> <span class='kw'>%>%</span>
|
||||
<span class='fu'><a href='bricks_from_table.html'>bricks_from_table</a></span>() <span class='kw'>%>%</span>
|
||||
<span class='fu'>build_bricks</span>()
|
||||
}</div></pre>
|
||||
|
||||
<span class='kw pkg'>rgl</span><span class='kw ns'>::</span><span class='fu'><a href='https://rdrr.io/pkg/rgl/man/scene.html'>clear3d</a></span>()
|
||||
<span class='co'># }</span></div></pre>
|
||||
</div>
|
||||
<div class="col-md-3 hidden-xs hidden-sm" id="sidebar">
|
||||
<h2>Contents</h2>
|
||||
|
||||
|
Before Width: | Height: | Size: 105 KiB After Width: | Height: | Size: 25 KiB |
@@ -45,7 +45,7 @@
|
||||
|
||||
|
||||
<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:description" content="Generates a plot of available brick colors." />
|
||||
<meta property="og:image" content="http://brickr.org/logo.png" />
|
||||
<meta name="twitter:card" content="summary" />
|
||||
|
||||
@@ -79,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.3.0</span>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.3.1</span>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
@@ -148,7 +148,7 @@
|
||||
</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>
|
||||
<p>Generates a plot of available brick colors.</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>, <span class='kw'>include_transparent</span> <span class='kw'>=</span> <span class='fl'>TRUE</span>)</pre>
|
||||
@@ -168,7 +168,10 @@
|
||||
|
||||
<h2 class="hasAnchor" id="value"><a class="anchor" href="#value"></a>Value</h2>
|
||||
|
||||
<p>A table and ggplot of brick colors & ID numbers.</p>
|
||||
<p>An array or ggplot of brick colors & ID numbers.</p>
|
||||
<h2 class="hasAnchor" id="details"><a class="anchor" href="#details"></a>Details</h2>
|
||||
|
||||
<p>Use .names_only = TRUE to get a list of color names.</p>
|
||||
<h2 class="hasAnchor" id="see-also"><a class="anchor" href="#see-also"></a>See also</h2>
|
||||
|
||||
<div class='dont-index'><p>Other Resources:
|
||||
@@ -178,9 +181,8 @@
|
||||
|
||||
<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='kw'>if</span> (<span class='fl'>FALSE</span>) {
|
||||
<span class='fu'>build_colors</span>()
|
||||
}
|
||||
<span class='co'># \donttest{</span>
|
||||
<span class='fu'>build_colors</span>()</div><div class='output co'>#> <span class='message'>Use View(lego_colors) to see these in a table format.</span></div><div class='output co'>#> <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'># }</span>
|
||||
|
||||
<span class='co'>#Print list of colors</span>
|
||||
<span class='fu'>build_colors</span>(<span class='fl'>TRUE</span>)</div><div class='output co'>#> [1] "White" "Brick yellow" "Bright red"
|
||||
@@ -207,6 +209,7 @@
|
||||
<ul class="nav nav-pills nav-stacked">
|
||||
<li><a href="#arguments">Arguments</a></li>
|
||||
<li><a href="#value">Value</a></li>
|
||||
<li><a href="#details">Details</a></li>
|
||||
<li><a href="#see-also">See also</a></li>
|
||||
<li><a href="#examples">Examples</a></li>
|
||||
</ul>
|
||||
|
||||
BIN
docs/reference/build_instructions-1.png
Normal file
|
After Width: | Height: | Size: 16 KiB |
@@ -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>Create instruction manual for 2D image mosaics — build_instructions • brickr</title>
|
||||
<title>Create instruction manuals — build_instructions • brickr</title>
|
||||
|
||||
<!-- favicons -->
|
||||
<link rel="icon" type="image/png" sizes="16x16" href="../favicon-16x16.png">
|
||||
@@ -44,8 +44,8 @@
|
||||
<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:title" content="Create instruction manuals — build_instructions" />
|
||||
<meta property="og:description" content="Render faceted plot of instructions for 2D mosacis or 3D model objects." />
|
||||
<meta property="og:image" content="http://brickr.org/logo.png" />
|
||||
<meta name="twitter:card" content="summary" />
|
||||
|
||||
@@ -79,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.3.0</span>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.3.1</span>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
@@ -142,13 +142,13 @@
|
||||
<div class="row">
|
||||
<div class="col-md-9 contents">
|
||||
<div class="page-header">
|
||||
<h1>Create instruction manual for 2D image mosaics</h1>
|
||||
<h1>Create instruction manuals</h1>
|
||||
<small class="dont-index">Source: <a href='https://github.com/ryantimpe/brickr/blob/master/R/build-instructions.R'><code>R/build-instructions.R</code></a></small>
|
||||
<div class="hidden name"><code>build_instructions.Rd</code></div>
|
||||
</div>
|
||||
|
||||
<div class="ref-description">
|
||||
<p>Create instruction manual for 2D image mosaics</p>
|
||||
<p>Render faceted plot of instructions for 2D mosacis or 3D model objects.</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>
|
||||
@@ -162,10 +162,19 @@
|
||||
</tr>
|
||||
<tr>
|
||||
<th>num_steps</th>
|
||||
<td><p>Number of discrete steps in instruction manual, for mosaics only</p></td>
|
||||
<td><p>Number of discrete steps in instruction manual, for mosaics only.</p></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<h2 class="hasAnchor" id="value"><a class="anchor" href="#value"></a>Value</h2>
|
||||
|
||||
<p>A single plot object of steps to build brickr model or mosaic.</p>
|
||||
<h2 class="hasAnchor" id="details"><a class="anchor" href="#details"></a>Details</h2>
|
||||
|
||||
<p>Instructions for 2D mosaics are split into sections beginning at the bottom of the image.
|
||||
This makes it easier to follow each row when building an actual brick mosaic.</p>
|
||||
<p>3D model instructions are displayed one Level (z value) at a time.
|
||||
The current model level is clearly displayed, while the previous level is shows as transparent.</p>
|
||||
<h2 class="hasAnchor" id="see-also"><a class="anchor" href="#see-also"></a>See also</h2>
|
||||
|
||||
<div class='dont-index'><p>Other Resources:
|
||||
@@ -173,12 +182,26 @@
|
||||
<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'># \donttest{</span>
|
||||
<span class='co'># Create a random 24x24 'image'. </span>
|
||||
<span class='co'># Otherwise, use a jpeg or png</span>
|
||||
<span class='no'>demo_image</span> <span class='kw'>=</span> <span class='fu'><a href='https://rdrr.io/r/base/array.html'>array</a></span>(<span class='kw pkg'>scales</span><span class='kw ns'>::</span><span class='fu'><a href='https://scales.r-lib.org//reference/rescale.html'>rescale</a></span>(<span class='fu'><a href='https://rdrr.io/r/stats/Uniform.html'>runif</a></span>(<span class='fl'>24</span>*<span class='fl'>24</span>*<span class='fl'>3</span>), <span class='fu'><a href='https://rdrr.io/r/base/c.html'>c</a></span>(<span class='fl'>0</span>, <span class='fl'>1</span>)), <span class='kw'>dim</span><span class='kw'>=</span><span class='fu'><a href='https://rdrr.io/r/base/c.html'>c</a></span>(<span class='fl'>24</span>, <span class='fl'>24</span>, <span class='fl'>3</span>))
|
||||
|
||||
<span class='no'>demo_image</span> <span class='kw'>%>%</span>
|
||||
<span class='fu'><a href='image_to_mosaic.html'>image_to_mosaic</a></span>(<span class='kw'>img_size</span> <span class='kw'>=</span> <span class='fl'>24</span>) <span class='kw'>%>%</span>
|
||||
<span class='fu'>build_instructions</span>()</div><div class='img'><img src='build_instructions-1.png' alt='' width='700' height='433' /></div><div class='input'># }
|
||||
|
||||
</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="#details">Details</a></li>
|
||||
<li><a href="#see-also">See also</a></li>
|
||||
<li><a href="#examples">Examples</a></li>
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
|
||||
BIN
docs/reference/build_mosaic-1.png
Normal file
|
After Width: | Height: | Size: 104 KiB |
@@ -45,7 +45,7 @@
|
||||
|
||||
|
||||
<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:description" content="Render a plot image of the 2D brick mosaic with optional title." />
|
||||
<meta property="og:image" content="http://brickr.org/logo.png" />
|
||||
<meta name="twitter:card" content="summary" />
|
||||
|
||||
@@ -79,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.3.0</span>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.3.1</span>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
@@ -148,7 +148,7 @@
|
||||
</div>
|
||||
|
||||
<div class="ref-description">
|
||||
<p>Display 2D LEGO mosaic as a plot image</p>
|
||||
<p>Render a plot image of the 2D brick mosaic with optional title.</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>
|
||||
@@ -158,7 +158,7 @@
|
||||
<colgroup><col class="name" /><col class="desc" /></colgroup>
|
||||
<tr>
|
||||
<th>brick_obj</th>
|
||||
<td><p>List output from image_to_bricks(). Contains an element <code>Img_lego</code>.</p></td>
|
||||
<td><p>List output from image_to_bricks(). Contains an element <code>Img_lego</code>.</p></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>title</th>
|
||||
@@ -166,17 +166,32 @@
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<h2 class="hasAnchor" id="value"><a class="anchor" href="#value"></a>Value</h2>
|
||||
|
||||
<p>A single plot object to display 2D mosaic.</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='image_to_mosaic.html'>image_to_mosaic</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'># \donttest{</span>
|
||||
<span class='co'># Create a random 24x24 'image'. </span>
|
||||
<span class='co'># Otherwise, use a jpeg or png</span>
|
||||
<span class='no'>demo_image</span> <span class='kw'>=</span> <span class='fu'><a href='https://rdrr.io/r/base/array.html'>array</a></span>(<span class='kw pkg'>scales</span><span class='kw ns'>::</span><span class='fu'><a href='https://scales.r-lib.org//reference/rescale.html'>rescale</a></span>(<span class='fu'><a href='https://rdrr.io/r/stats/Uniform.html'>runif</a></span>(<span class='fl'>24</span>*<span class='fl'>24</span>*<span class='fl'>3</span>), <span class='fu'><a href='https://rdrr.io/r/base/c.html'>c</a></span>(<span class='fl'>0</span>, <span class='fl'>1</span>)), <span class='kw'>dim</span><span class='kw'>=</span><span class='fu'><a href='https://rdrr.io/r/base/c.html'>c</a></span>(<span class='fl'>24</span>, <span class='fl'>24</span>, <span class='fl'>3</span>))
|
||||
|
||||
<span class='no'>demo_image</span> <span class='kw'>%>%</span>
|
||||
<span class='fu'><a href='image_to_mosaic.html'>image_to_mosaic</a></span>(<span class='kw'>img_size</span> <span class='kw'>=</span> <span class='fl'>24</span>) <span class='kw'>%>%</span>
|
||||
<span class='fu'>build_mosaic</span>()</div><div class='img'><img src='build_mosaic-1.png' alt='' width='700' height='433' /></div><div class='input'># }
|
||||
</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>
|
||||
|
||||
BIN
docs/reference/build_pieces-1.png
Normal file
|
After Width: | Height: | Size: 53 KiB |
@@ -45,7 +45,7 @@
|
||||
|
||||
|
||||
<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:description" content="Create a chart of brick colors and sizes used in a brick mosaic or model." />
|
||||
<meta property="og:image" content="http://brickr.org/logo.png" />
|
||||
<meta name="twitter:card" content="summary" />
|
||||
|
||||
@@ -79,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.3.0</span>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.3.1</span>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
@@ -148,7 +148,7 @@
|
||||
</div>
|
||||
|
||||
<div class="ref-description">
|
||||
<p>Display bricks required to build model or mosaic.</p>
|
||||
<p>Create a chart of brick colors and sizes used in a brick mosaic or model.</p>
|
||||
</div>
|
||||
|
||||
<pre class="usage"><span class='fu'>build_pieces</span>(<span class='no'>brick_obj</span>)</pre>
|
||||
@@ -172,6 +172,17 @@
|
||||
<code><a href='build_instructions.html'>build_instructions</a>()</code>,
|
||||
<code><a href='build_pieces_table.html'>build_pieces_table</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'># \donttest{</span>
|
||||
<span class='co'># Create a random 24x24 'image'. </span>
|
||||
<span class='co'># Otherwise, use a jpeg or png</span>
|
||||
<span class='no'>demo_image</span> <span class='kw'>=</span> <span class='fu'><a href='https://rdrr.io/r/base/array.html'>array</a></span>(<span class='kw pkg'>scales</span><span class='kw ns'>::</span><span class='fu'><a href='https://scales.r-lib.org//reference/rescale.html'>rescale</a></span>(<span class='fu'><a href='https://rdrr.io/r/stats/Uniform.html'>runif</a></span>(<span class='fl'>24</span>*<span class='fl'>24</span>*<span class='fl'>3</span>), <span class='fu'><a href='https://rdrr.io/r/base/c.html'>c</a></span>(<span class='fl'>0</span>, <span class='fl'>1</span>)), <span class='kw'>dim</span><span class='kw'>=</span><span class='fu'><a href='https://rdrr.io/r/base/c.html'>c</a></span>(<span class='fl'>24</span>, <span class='fl'>24</span>, <span class='fl'>3</span>))
|
||||
|
||||
<span class='no'>demo_image</span> <span class='kw'>%>%</span>
|
||||
<span class='fu'><a href='image_to_mosaic.html'>image_to_mosaic</a></span>(<span class='kw'>img_size</span> <span class='kw'>=</span> <span class='fl'>24</span>) <span class='kw'>%>%</span>
|
||||
<span class='fu'>build_pieces</span>()</div><div class='img'><img src='build_pieces-1.png' alt='' width='700' height='433' /></div><div class='input'># }
|
||||
|
||||
</div></pre>
|
||||
</div>
|
||||
<div class="col-md-3 hidden-xs hidden-sm" id="sidebar">
|
||||
<h2>Contents</h2>
|
||||
@@ -179,6 +190,7 @@
|
||||
<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>
|
||||
|
||||
@@ -45,7 +45,7 @@
|
||||
|
||||
|
||||
<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:description" content="Create a dataframe of brick colors and sizes used in a brick mosaic or model." />
|
||||
<meta property="og:image" content="http://brickr.org/logo.png" />
|
||||
<meta name="twitter:card" content="summary" />
|
||||
|
||||
@@ -79,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.3.0</span>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.3.1</span>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
@@ -148,7 +148,7 @@
|
||||
</div>
|
||||
|
||||
<div class="ref-description">
|
||||
<p>Generate required bricks as a data frame.</p>
|
||||
<p>Create a dataframe of brick colors and sizes used in a brick mosaic or model.</p>
|
||||
</div>
|
||||
|
||||
<pre class="usage"><span class='fu'>build_pieces_table</span>(<span class='no'>brick_obj</span>)</pre>
|
||||
@@ -172,6 +172,29 @@
|
||||
<code><a href='build_instructions.html'>build_instructions</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'># \donttest{</span>
|
||||
<span class='co'># Create a random 24x24 'image'. </span>
|
||||
<span class='co'># Otherwise, use a jpeg or png</span>
|
||||
<span class='no'>demo_image</span> <span class='kw'>=</span> <span class='fu'><a href='https://rdrr.io/r/base/array.html'>array</a></span>(<span class='kw pkg'>scales</span><span class='kw ns'>::</span><span class='fu'><a href='https://scales.r-lib.org//reference/rescale.html'>rescale</a></span>(<span class='fu'><a href='https://rdrr.io/r/stats/Uniform.html'>runif</a></span>(<span class='fl'>24</span>*<span class='fl'>24</span>*<span class='fl'>3</span>), <span class='fu'><a href='https://rdrr.io/r/base/c.html'>c</a></span>(<span class='fl'>0</span>, <span class='fl'>1</span>)), <span class='kw'>dim</span><span class='kw'>=</span><span class='fu'><a href='https://rdrr.io/r/base/c.html'>c</a></span>(<span class='fl'>24</span>, <span class='fl'>24</span>, <span class='fl'>3</span>))
|
||||
|
||||
<span class='no'>demo_image</span> <span class='kw'>%>%</span>
|
||||
<span class='fu'><a href='image_to_mosaic.html'>image_to_mosaic</a></span>(<span class='kw'>img_size</span> <span class='kw'>=</span> <span class='fl'>24</span>) <span class='kw'>%>%</span>
|
||||
<span class='fu'>build_pieces_table</span>()</div><div class='output co'>#> <span style='color: #555555;'># A tibble: 40 x 4</span><span>
|
||||
#> Piece `LEGO Brick Color` `1 x 1` `2 x 1`
|
||||
#> </span><span style='color: #555555;font-style: italic;'><chr></span><span> </span><span style='color: #555555;font-style: italic;'><chr></span><span> </span><span style='color: #555555;font-style: italic;'><dbl></span><span> </span><span style='color: #555555;font-style: italic;'><dbl></span><span>
|
||||
#> </span><span style='color: #555555;'> 1</span><span> p Aqua 26 2
|
||||
#> </span><span style='color: #555555;'> 2</span><span> p Black 9 0
|
||||
#> </span><span style='color: #555555;'> 3</span><span> p Br. yellowish green 21 2
|
||||
#> </span><span style='color: #555555;'> 4</span><span> p Brick yellow 9 0
|
||||
#> </span><span style='color: #555555;'> 5</span><span> p Bright blue 22 1
|
||||
#> </span><span style='color: #555555;'> 6</span><span> p Bright bluish green 9 0
|
||||
#> </span><span style='color: #555555;'> 7</span><span> p Bright green 30 1
|
||||
#> </span><span style='color: #555555;'> 8</span><span> p Bright orange 10 0
|
||||
#> </span><span style='color: #555555;'> 9</span><span> p Bright purple 26 3
|
||||
#> </span><span style='color: #555555;'>10</span><span> p Bright red 12 0
|
||||
#> </span><span style='color: #555555;'># ... with 30 more rows</span><span></div><div class='input'># }
|
||||
</div></span></pre>
|
||||
</div>
|
||||
<div class="col-md-3 hidden-xs hidden-sm" id="sidebar">
|
||||
<h2>Contents</h2>
|
||||
@@ -179,6 +202,7 @@
|
||||
<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>
|
||||
|
||||
@@ -79,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.3.0</span>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.3.1</span>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -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>Tile charts as Bricks - ggplot2 extension — geom_brick_rect • brickr</title>
|
||||
<title>Tile charts as bricks — geom_brick_rect • brickr</title>
|
||||
|
||||
<!-- favicons -->
|
||||
<link rel="icon" type="image/png" sizes="16x16" href="../favicon-16x16.png">
|
||||
@@ -44,8 +44,8 @@
|
||||
<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:title" content="Tile charts as bricks — geom_brick_rect" />
|
||||
<meta property="og:description" content="geom_rect, except bars look like LEGO bricks." />
|
||||
<meta property="og:image" content="http://brickr.org/logo.png" />
|
||||
<meta name="twitter:card" content="summary" />
|
||||
|
||||
@@ -79,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.3.0</span>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.3.1</span>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
@@ -142,13 +142,13 @@
|
||||
<div class="row">
|
||||
<div class="col-md-9 contents">
|
||||
<div class="page-header">
|
||||
<h1>Tile charts as Bricks - ggplot2 extension</h1>
|
||||
<h1>Tile charts as bricks</h1>
|
||||
<small class="dont-index">Source: <a href='https://github.com/ryantimpe/brickr/blob/master/R/geom-brick-rect.R'><code>R/geom-brick-rect.R</code></a></small>
|
||||
<div class="hidden name"><code>geom_brick_rect.Rd</code></div>
|
||||
</div>
|
||||
|
||||
<div class="ref-description">
|
||||
<p><code>geom_rect</code>, except bars look like LEGO(R) bricks.</p>
|
||||
<p><code>geom_rect</code>, except bars look like LEGO bricks.</p>
|
||||
</div>
|
||||
|
||||
<pre class="usage"><span class='fu'>geom_brick_rect</span>(
|
||||
@@ -157,7 +157,7 @@
|
||||
<span class='kw'>stat</span> <span class='kw'>=</span> <span class='st'>"identity"</span>,
|
||||
<span class='kw'>position</span> <span class='kw'>=</span> <span class='st'>"identity"</span>,
|
||||
<span class='no'>...</span>,
|
||||
<span class='kw'>label</span> <span class='kw'>=</span> <span class='st'>"brickr"</span>,
|
||||
<span class='kw'>label</span> <span class='kw'>=</span> <span class='st'>""</span>,
|
||||
<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>,
|
||||
@@ -250,12 +250,16 @@ the default plot specification, e.g. <code><a href='https://ggplot2.tidyverse.or
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<h2 class="hasAnchor" id="details"><a class="anchor" href="#details"></a>Details</h2>
|
||||
|
||||
<p>Currently all 'ggplot2' extensions are for internal use only.</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="#details">Details</a></li>
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
|
||||
BIN
docs/reference/image_to_mosaic-1.png
Normal file
|
After Width: | Height: | Size: 103 KiB |
BIN
docs/reference/image_to_mosaic-2.png
Normal file
|
After Width: | Height: | Size: 58 KiB |
@@ -45,7 +45,7 @@
|
||||
|
||||
|
||||
<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:description" content="Generate brick mosaics from an image or matrix with customization options." />
|
||||
<meta property="og:image" content="http://brickr.org/logo.png" />
|
||||
<meta name="twitter:card" content="summary" />
|
||||
|
||||
@@ -79,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.3.0</span>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.3.1</span>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
@@ -148,7 +148,7 @@
|
||||
</div>
|
||||
|
||||
<div class="ref-description">
|
||||
<p>Create a 2D LEGO mosaic from an image array</p>
|
||||
<p>Generate brick mosaics from an image or matrix with customization options.</p>
|
||||
</div>
|
||||
|
||||
<pre class="usage"><span class='fu'>image_to_mosaic</span>(
|
||||
@@ -169,7 +169,7 @@
|
||||
<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://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>
|
||||
<td><p>Image matrix to convert into mosaic. Usually from <code><a href='https://rdrr.io/pkg/jpeg/man/readJPEG.html'>readJPEG</a></code> or <code><a href='https://rdrr.io/pkg/png/man/readPNG.html'>readPNG</a></code>.</p></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>img_size</th>
|
||||
@@ -222,6 +222,21 @@ Use "bw" for only grayscale bricks. Ignored if a <code>color_table</code> is sup
|
||||
<div class='dont-index'><p>Other Mosaics:
|
||||
<code><a href='build_mosaic.html'>build_mosaic</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'># \donttest{</span>
|
||||
<span class='co'># Create a random 24x24 'image'. </span>
|
||||
<span class='co'># Otherwise, use a jpeg or png</span>
|
||||
<span class='no'>demo_image</span> <span class='kw'>=</span> <span class='fu'><a href='https://rdrr.io/r/base/array.html'>array</a></span>(<span class='kw pkg'>scales</span><span class='kw ns'>::</span><span class='fu'><a href='https://scales.r-lib.org//reference/rescale.html'>rescale</a></span>(<span class='fu'><a href='https://rdrr.io/r/stats/Uniform.html'>runif</a></span>(<span class='fl'>24</span>*<span class='fl'>24</span>*<span class='fl'>3</span>), <span class='fu'><a href='https://rdrr.io/r/base/c.html'>c</a></span>(<span class='fl'>0</span>, <span class='fl'>1</span>)), <span class='kw'>dim</span><span class='kw'>=</span><span class='fu'><a href='https://rdrr.io/r/base/c.html'>c</a></span>(<span class='fl'>24</span>, <span class='fl'>24</span>, <span class='fl'>3</span>))
|
||||
|
||||
<span class='no'>demo_image</span> <span class='kw'>%>%</span>
|
||||
<span class='fu'>image_to_mosaic</span>(<span class='kw'>img_size</span> <span class='kw'>=</span> <span class='fl'>24</span>) <span class='kw'>%>%</span>
|
||||
<span class='fu'><a href='build_mosaic.html'>build_mosaic</a></span>()</div><div class='img'><img src='image_to_mosaic-1.png' alt='' width='700' height='433' /></div><div class='input'>
|
||||
<span class='co'>#Only use the most common "universal" LEGO colors</span>
|
||||
<span class='no'>demo_image</span> <span class='kw'>%>%</span>
|
||||
<span class='fu'>image_to_mosaic</span>(<span class='kw'>img_size</span> <span class='kw'>=</span> <span class='fl'>24</span>, <span class='kw'>color_palette</span> <span class='kw'>=</span> <span class='st'>"universal"</span>) <span class='kw'>%>%</span>
|
||||
<span class='fu'><a href='build_mosaic.html'>build_mosaic</a></span>()</div><div class='img'><img src='image_to_mosaic-2.png' alt='' width='700' height='433' /></div><div class='input'># }
|
||||
|
||||
</div></pre>
|
||||
</div>
|
||||
<div class="col-md-3 hidden-xs hidden-sm" id="sidebar">
|
||||
<h2>Contents</h2>
|
||||
@@ -229,6 +244,7 @@ Use "bw" for only grayscale bricks. Ignored if a <code>color_table</code> is sup
|
||||
<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>
|
||||
|
||||
@@ -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>Scale an image raster array to a small number of pixels. Process into a data frame. Internal function. — image_to_scaled • brickr</title>
|
||||
<title>Scale an image raster array to a small number of pixels. — image_to_scaled • brickr</title>
|
||||
|
||||
<!-- favicons -->
|
||||
<link rel="icon" type="image/png" sizes="16x16" href="../favicon-16x16.png">
|
||||
@@ -44,8 +44,8 @@
|
||||
<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:title" content="Scale an image raster array to a small number of pixels. — image_to_scaled" />
|
||||
<meta property="og:description" content="Decrease the size of an image, in pixel. Process into a data frame. Internal function." />
|
||||
<meta property="og:image" content="http://brickr.org/logo.png" />
|
||||
<meta name="twitter:card" content="summary" />
|
||||
|
||||
@@ -79,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.3.0</span>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.3.1</span>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
@@ -142,13 +142,13 @@
|
||||
<div class="row">
|
||||
<div class="col-md-9 contents">
|
||||
<div class="page-header">
|
||||
<h1>Scale an image raster array to a small number of pixels. Process into a data frame. Internal function.</h1>
|
||||
<h1>Scale an image raster array to a small number of pixels.</h1>
|
||||
<small class="dont-index">Source: <a href='https://github.com/ryantimpe/brickr/blob/master/R/image-to-prep-mosaic.R'><code>R/image-to-prep-mosaic.R</code></a></small>
|
||||
<div class="hidden name"><code>image_to_scaled.Rd</code></div>
|
||||
</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>
|
||||
<p>Decrease the size of an image, in pixel. Process into a data frame. Internal function.</p>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
@@ -78,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.3.0</span>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.3.1</span>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
@@ -184,13 +184,13 @@
|
||||
<td>
|
||||
<p><code><a href="bricks_from_coords.html">bricks_from_coords()</a></code> </p>
|
||||
</td>
|
||||
<td><p>Convert a data frame with x, y, z & Color columns into a brickr 3D object</p></td>
|
||||
<td><p>Create a 3D model object from a long coordinate data frame</p></td>
|
||||
</tr><tr>
|
||||
|
||||
<td>
|
||||
<p><code><a href="bricks_from_excel.html">bricks_from_excel()</a></code> </p>
|
||||
</td>
|
||||
<td><p>Convert an Excel brickr template into a brickr 3D object</p></td>
|
||||
<td><p>Convert an Excel 'brickr' template into a brickr 3D object</p></td>
|
||||
</tr><tr>
|
||||
|
||||
<td>
|
||||
@@ -228,7 +228,7 @@
|
||||
<td>
|
||||
<p><code><a href="build_instructions.html">build_instructions()</a></code> </p>
|
||||
</td>
|
||||
<td><p>Create instruction manual for 2D image mosaics</p></td>
|
||||
<td><p>Create instruction manuals</p></td>
|
||||
</tr><tr>
|
||||
|
||||
<td>
|
||||
|
||||
@@ -79,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.3.0</span>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.3.1</span>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -79,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.3.0</span>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.3.1</span>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -45,7 +45,7 @@
|
||||
|
||||
|
||||
<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:description" content="Match raw color channel values to a smaller subset of colors." />
|
||||
<meta property="og:image" content="http://brickr.org/logo.png" />
|
||||
<meta name="twitter:card" content="summary" />
|
||||
|
||||
@@ -79,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.3.0</span>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.3.1</span>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
@@ -148,7 +148,7 @@
|
||||
</div>
|
||||
|
||||
<div class="ref-description">
|
||||
<p>Convert image output from scale_image() to bricks</p>
|
||||
<p>Match raw color channel values to a smaller subset of colors.</p>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
\docType{package}
|
||||
\name{brickr}
|
||||
\alias{brickr}
|
||||
\title{\code{brickr} package}
|
||||
\title{'brickr' package}
|
||||
\description{
|
||||
Tools to emulate the LEGO® System in R
|
||||
Emulate LEGO Bricks in 2D and 3D
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
% Please edit documentation in R/bricks-from-tables.R
|
||||
\name{bricks_from_coords}
|
||||
\alias{bricks_from_coords}
|
||||
\title{Convert a data frame with x, y, z & Color columns into a brickr 3D object}
|
||||
\title{Create a 3D model object from a long coordinate data frame}
|
||||
\usage{
|
||||
bricks_from_coords(
|
||||
coord_table,
|
||||
@@ -20,7 +20,7 @@ bricks_from_coords(
|
||||
}
|
||||
\arguments{
|
||||
\item{coord_table}{A data frame of a 3D brick model design. Contains 'x', 'y', and 'z' (vertical height) dimensions, as well as 'Color' from official LEGO color names.
|
||||
See \code{build_colors()}. Optional column 'piece_type' for shapes other than rectangular bricks.
|
||||
See \code{\link{build_colors}}. Optional column 'piece_type' for shapes other than rectangular bricks.
|
||||
Optional column ' mid_Level' with values 0, 1, or 2 (default 0) for 1-height placement of bricks.}
|
||||
|
||||
\item{use_bricks}{Array of brick sizes to use in mosaic. Defaults to \code{c('4x2', '3x2', '2x2', '3x1', '2x1', '1x1')}`.}
|
||||
@@ -44,10 +44,42 @@ Optional column ' mid_Level' with values 0, 1, or 2 (default 0) for 1-height pla
|
||||
\item{exclude_level}{Numeric array of Level/z dimensions to exclude.}
|
||||
}
|
||||
\value{
|
||||
A list with elements \code{Img_lego} to pass to \code{collect_bricks()}.
|
||||
A list with elements \code{Img_lego} to pass to \code{\link{build_bricks}}.
|
||||
}
|
||||
\description{
|
||||
Convert a data frame with x, y, z & Color columns into a brickr 3D object
|
||||
Convert a data frame with x, y, z & Color columns into a 3D object
|
||||
}
|
||||
\examples{
|
||||
\donttest{
|
||||
#This is a 1x4 yellow brick
|
||||
brick <- data.frame(
|
||||
x = 1:4,
|
||||
y = 1, z=1,
|
||||
color = "Bright yellow",
|
||||
stringsAsFactors=FALSE)
|
||||
|
||||
brick \%>\%
|
||||
bricks_from_coords() \%>\%
|
||||
build_bricks()
|
||||
|
||||
rgl::clear3d()
|
||||
|
||||
#This is a lot of bricks
|
||||
bricks <- expand.grid(
|
||||
x = 1:8,
|
||||
y = 1:4,
|
||||
z = 1:3)
|
||||
|
||||
#Color them in sets of these 3 options
|
||||
bricks$color <- rep(rep(c("Bright yellow", "Bright red", "Dark green"), each=4), 8)
|
||||
|
||||
bricks \%>\%
|
||||
bricks_from_coords() \%>\%
|
||||
build_bricks()
|
||||
|
||||
rgl::clear3d()
|
||||
|
||||
}
|
||||
}
|
||||
\seealso{
|
||||
Other 3D Models:
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
% Please edit documentation in R/bricks-from-tables.R
|
||||
\name{bricks_from_excel}
|
||||
\alias{bricks_from_excel}
|
||||
\title{Convert an Excel {brickr} template into a brickr 3D object}
|
||||
\title{Convert an Excel 'brickr' template into a 3D object}
|
||||
\usage{
|
||||
bricks_from_excel(
|
||||
excel_table,
|
||||
@@ -48,10 +48,27 @@ bricks_from_excel(
|
||||
\item{exclude_level}{Numeric array of Level/z dimensions to exclude.}
|
||||
}
|
||||
\value{
|
||||
A list with elements \code{Img_lego} to pass to \code{collect_bricks()}.
|
||||
A list with elements \code{Img_lego} to pass to \code{\link{build_bricks}}.
|
||||
}
|
||||
\description{
|
||||
Convert an Excel {brickr} template into a brickr 3D object
|
||||
Convert am Excel template file into a 3D brick object.
|
||||
}
|
||||
\examples{
|
||||
\donttest{
|
||||
#Demo table in same format as Excel template
|
||||
#This creates a 1x3 red brick.
|
||||
brick <- tibble::tribble(
|
||||
~Level, ~"1", ~"2", ~"3", ~user_color, ~LEGO_color,
|
||||
"A", 1, 1, 1, 1, "Bright red"
|
||||
)
|
||||
|
||||
brick \%>\%
|
||||
bricks_from_excel() \%>\%
|
||||
build_bricks()
|
||||
|
||||
rgl::clear3d()
|
||||
}
|
||||
|
||||
}
|
||||
\seealso{
|
||||
Other 3D Models:
|
||||
|
||||
@@ -2,22 +2,39 @@
|
||||
% Please edit documentation in R/bricks-from-mosaic.R
|
||||
\name{bricks_from_mosaic}
|
||||
\alias{bricks_from_mosaic}
|
||||
\title{Convert a 2D LEGO mosaic into a brickr 3D object}
|
||||
\title{Convert a 2D LEGO mosaic into a 'brickr' 3D object}
|
||||
\usage{
|
||||
bricks_from_mosaic(mosaic_list, mosaic_height = 6, highest_el = "light")
|
||||
}
|
||||
\arguments{
|
||||
\item{mosaic_list}{List output from collect_bricks() or image_to_bricks(). Contains an element \code{Img_lego}.}
|
||||
\item{mosaic_list}{List output from image_to_bricks(). Contains an element \code{Img_lego}.}
|
||||
|
||||
\item{mosaic_height}{Number of layers in the 3D image.}
|
||||
|
||||
\item{highest_el}{Brick height is determined by brightness of color. Use \code{highest_el = 'dark'} for darkest bricks to have \code{mosaic_height}.}
|
||||
}
|
||||
\value{
|
||||
A list with elements \code{Img_lego} to pass to \code{collect_bricks()}.
|
||||
A list with elements \code{Img_lego} to pass to \code{\link{build_bricks}}.
|
||||
}
|
||||
\description{
|
||||
Convert a 2D LEGO mosaic into a brickr 3D object
|
||||
Stacks LEGO plates to create a 3D version of the 2D brick mosaics.
|
||||
}
|
||||
\details{
|
||||
Height of bricks determined by brightness of color.
|
||||
}
|
||||
\examples{
|
||||
\donttest{
|
||||
# Create a random 24x24 'image'.
|
||||
# Otherwise, use a jpeg or png
|
||||
demo_image = array(scales::rescale(runif(24*24*3), c(0, 1)), dim=c(24, 24, 3))
|
||||
|
||||
demo_image \%>\%
|
||||
image_to_mosaic(img_size = 24) \%>\%
|
||||
bricks_from_mosaic() \%>\%
|
||||
build_bricks()
|
||||
|
||||
rgl::clear3d()
|
||||
}
|
||||
}
|
||||
\seealso{
|
||||
Other 3D Models:
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
% Please edit documentation in R/bricks-from-tables.R
|
||||
\name{bricks_from_table}
|
||||
\alias{bricks_from_table}
|
||||
\title{Convert a matrix table into a brickr 3D object}
|
||||
\title{Convert a matrix table into a 'brickr' 3D object}
|
||||
\usage{
|
||||
bricks_from_table(
|
||||
matrix_table,
|
||||
@@ -22,7 +22,7 @@ bricks_from_table(
|
||||
)
|
||||
}
|
||||
\arguments{
|
||||
\item{matrix_table}{A data frame of a 3D brick model design. Left-most column is level/height/z dimension, with rows as Y axis and columns as X axis. See example. Use \code{tribble} for ease.}
|
||||
\item{matrix_table}{A data frame of a 3D brick model design. Left-most column is level/height/z dimension, with rows as Y axis and columns as X axis. See example. Use \code{\link[tibble]{tribble}} for ease.}
|
||||
|
||||
\item{color_guide}{A data frame linking numeric \code{.value} in \code{matrix_table} to official LEGO color names. Defaults to data frame 'lego_colors'.}
|
||||
|
||||
@@ -51,10 +51,26 @@ bricks_from_table(
|
||||
\item{exclude_level}{Numeric array of Level/z dimensions to exclude.}
|
||||
}
|
||||
\value{
|
||||
A list with elements \code{Img_lego} to pass to \code{collect_bricks()}.
|
||||
A list with elements \code{Img_lego} to pass to \code{\link{build_bricks}}.
|
||||
}
|
||||
\description{
|
||||
Convert a matrix table into a brickr 3D object
|
||||
Convert a data frame into a 3D brick object.
|
||||
}
|
||||
\examples{
|
||||
\donttest{
|
||||
#This is a brick
|
||||
brick <- data.frame(
|
||||
Level="A",
|
||||
X1 = rep(3,4), #The number 3 is the brickrID for 'bright red'
|
||||
X2 = rep(3,4)
|
||||
)
|
||||
|
||||
brick \%>\%
|
||||
bricks_from_table() \%>\%
|
||||
build_bricks()
|
||||
|
||||
rgl::clear3d()
|
||||
}
|
||||
}
|
||||
\seealso{
|
||||
Other 3D Models:
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
% Please edit documentation in R/build-bricks-rgl.R
|
||||
\name{build_bricks}
|
||||
\alias{build_bricks}
|
||||
\title{Build 3D brick model with rgl}
|
||||
\title{Build 3D brick model with 'rgl'}
|
||||
\usage{
|
||||
build_bricks(
|
||||
brick_list,
|
||||
@@ -14,7 +14,7 @@ build_bricks(
|
||||
)
|
||||
}
|
||||
\arguments{
|
||||
\item{brick_list}{List output from collect_bricks(). Contains an element \code{Img_lego}.}
|
||||
\item{brick_list}{List output from a \code{bricks_from_*} function. Contains an element \code{Img_lego}.}
|
||||
|
||||
\item{background_color}{Default 'white'. Color of the background.}
|
||||
|
||||
@@ -31,10 +31,10 @@ Set to 'TRUE' and rgl_lit='FALSE' for cartoon-looking bricks.}
|
||||
3D brick model rendered in the 'rgl' package.
|
||||
}
|
||||
\description{
|
||||
Build 3D brick model with rgl
|
||||
Render the output of any of the \code{bricks_from_*} functions as a 3D model.
|
||||
}
|
||||
\examples{
|
||||
\dontrun{
|
||||
\donttest{
|
||||
#This is a brick
|
||||
brick <- data.frame(
|
||||
Level="A",
|
||||
@@ -45,6 +45,8 @@ brick <- data.frame(
|
||||
brick \%>\%
|
||||
bricks_from_table() \%>\%
|
||||
build_bricks()
|
||||
|
||||
rgl::clear3d()
|
||||
}
|
||||
}
|
||||
\seealso{
|
||||
|
||||
@@ -12,14 +12,17 @@ build_colors(.names_only = FALSE, include_transparent = TRUE)
|
||||
\item{include_transparent}{Include transparent colors in the plot output.}
|
||||
}
|
||||
\value{
|
||||
A table and ggplot of brick colors & ID numbers.
|
||||
An array or ggplot of brick colors & ID numbers.
|
||||
}
|
||||
\description{
|
||||
Generates a plot of available brick colors. Use .names_only = TRUE to get a list of color names.
|
||||
Generates a plot of available brick colors.
|
||||
}
|
||||
\details{
|
||||
Use .names_only = TRUE to get a list of color names.
|
||||
}
|
||||
\examples{
|
||||
#Generate plot of colors
|
||||
\dontrun{
|
||||
\donttest{
|
||||
build_colors()
|
||||
}
|
||||
|
||||
|
||||
@@ -2,17 +2,39 @@
|
||||
% Please edit documentation in R/build-instructions.R
|
||||
\name{build_instructions}
|
||||
\alias{build_instructions}
|
||||
\title{Create instruction manual for 2D image mosaics}
|
||||
\title{Create instruction manual}
|
||||
\usage{
|
||||
build_instructions(brickr_obj, num_steps = 6)
|
||||
}
|
||||
\arguments{
|
||||
\item{brickr_obj}{brickr mosaic or 3D model object.}
|
||||
|
||||
\item{num_steps}{Number of discrete steps in instruction manual, for mosaics only}
|
||||
\item{num_steps}{Number of discrete steps in instruction manual, for mosaics only.}
|
||||
}
|
||||
\value{
|
||||
A single plot object of steps to build brickr model or mosaic.
|
||||
}
|
||||
\description{
|
||||
Create instruction manual for 2D image mosaics
|
||||
Render faceted plot of instructions for 2D mosacis or 3D model objects.
|
||||
}
|
||||
\details{
|
||||
Instructions for 2D mosaics are split into sections beginning at the bottom of the image.
|
||||
This makes it easier to follow each row when building an actual brick mosaic.
|
||||
|
||||
3D model instructions are displayed one Level (z value) at a time.
|
||||
The current model level is clearly displayed, while the previous level is shows as transparent.
|
||||
}
|
||||
\examples{
|
||||
\donttest{
|
||||
# Create a random 24x24 'image'.
|
||||
# Otherwise, use a jpeg or png
|
||||
demo_image = array(scales::rescale(runif(24*24*3), c(0, 1)), dim=c(24, 24, 3))
|
||||
|
||||
demo_image \%>\%
|
||||
image_to_mosaic(img_size = 24) \%>\%
|
||||
build_instructions()
|
||||
}
|
||||
|
||||
}
|
||||
\seealso{
|
||||
Other Resources:
|
||||
|
||||
@@ -7,12 +7,26 @@
|
||||
build_mosaic(brick_obj, title = NULL)
|
||||
}
|
||||
\arguments{
|
||||
\item{brick_obj}{List output from image_to_bricks(). Contains an element \code{Img_lego}.}
|
||||
\item{brick_obj}{List output from image_to_bricks(). Contains an element \code{Img_lego}.}
|
||||
|
||||
\item{title}{Optional title to include above plotted mosaic.}
|
||||
}
|
||||
\value{
|
||||
A single plot object to display 2D mosaic.
|
||||
}
|
||||
\description{
|
||||
Display 2D LEGO mosaic as a plot image
|
||||
Render a plot image of the 2D brick mosaic with optional title.
|
||||
}
|
||||
\examples{
|
||||
\donttest{
|
||||
# Create a random 24x24 'image'.
|
||||
# Otherwise, use a jpeg or png
|
||||
demo_image = array(scales::rescale(runif(24*24*3), c(0, 1)), dim=c(24, 24, 3))
|
||||
|
||||
demo_image \%>\%
|
||||
image_to_mosaic(img_size = 24) \%>\%
|
||||
build_mosaic()
|
||||
}
|
||||
}
|
||||
\seealso{
|
||||
Other Mosaics:
|
||||
|
||||
@@ -13,7 +13,19 @@ build_pieces(brick_obj)
|
||||
Plot object of required bricks by color and size.
|
||||
}
|
||||
\description{
|
||||
Display bricks required to build model or mosaic.
|
||||
Create a chart of brick colors and sizes used in a brick mosaic or model.
|
||||
}
|
||||
\examples{
|
||||
\donttest{
|
||||
# Create a random 24x24 'image'.
|
||||
# Otherwise, use a jpeg or png
|
||||
demo_image = array(scales::rescale(runif(24*24*3), c(0, 1)), dim=c(24, 24, 3))
|
||||
|
||||
demo_image \%>\%
|
||||
image_to_mosaic(img_size = 24) \%>\%
|
||||
build_pieces()
|
||||
}
|
||||
|
||||
}
|
||||
\seealso{
|
||||
Other Resources:
|
||||
|
||||
@@ -13,7 +13,18 @@ build_pieces_table(brick_obj)
|
||||
Data frame of piece counts by LEGO color name and size.
|
||||
}
|
||||
\description{
|
||||
Generate required bricks as a data frame.
|
||||
Create a dataframe of brick colors and sizes used in a brick mosaic or model.
|
||||
}
|
||||
\examples{
|
||||
\donttest{
|
||||
# Create a random 24x24 'image'.
|
||||
# Otherwise, use a jpeg or png
|
||||
demo_image = array(scales::rescale(runif(24*24*3), c(0, 1)), dim=c(24, 24, 3))
|
||||
|
||||
demo_image \%>\%
|
||||
image_to_mosaic(img_size = 24) \%>\%
|
||||
build_pieces_table()
|
||||
}
|
||||
}
|
||||
\seealso{
|
||||
Other Resources:
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
% Please edit documentation in R/geom-brick-rect.R
|
||||
\name{geom_brick_rect}
|
||||
\alias{geom_brick_rect}
|
||||
\title{Tile charts as Bricks - ggplot2 extension}
|
||||
\title{Tile charts as bricks}
|
||||
\usage{
|
||||
geom_brick_rect(
|
||||
mapping = NULL,
|
||||
@@ -10,7 +10,7 @@ geom_brick_rect(
|
||||
stat = "identity",
|
||||
position = "identity",
|
||||
...,
|
||||
label = "brickr",
|
||||
label = "",
|
||||
simplified_threshold = 24 * 24,
|
||||
label_scale = 1,
|
||||
use_bricks = NULL,
|
||||
@@ -77,6 +77,10 @@ that define both data and aesthetics and shouldn't inherit behaviour from
|
||||
the default plot specification, e.g. \code{\link[ggplot2:borders]{borders()}}.}
|
||||
}
|
||||
\description{
|
||||
\code{geom_rect}, except bars look like LEGO(R) bricks.
|
||||
\code{geom_rect}, except bars look like LEGO bricks.
|
||||
}
|
||||
\details{
|
||||
Currently all 'ggplot2' extensions are for internal use only.
|
||||
}
|
||||
\concept{Graphs}
|
||||
\keyword{internal}
|
||||
|
||||
@@ -18,7 +18,7 @@ image_to_mosaic(
|
||||
)
|
||||
}
|
||||
\arguments{
|
||||
\item{img}{Image to convert into mosaic. Usually from \code{jpeg::readJPEG()} or \code{png::readPNG()}.}
|
||||
\item{img}{Image matrix to convert into mosaic. Usually from \code{\link[jpeg]{readJPEG}} or \code{\link[png]{readPNG}}.}
|
||||
|
||||
\item{img_size}{Size of output image in pixel, where one pixel = one 'brick'. Use a single value (e.g. \code{48}) for a square image with 48 pixels on each side.
|
||||
Use an array of two values for a rectangular image \code{c(width, height)}.}
|
||||
@@ -47,7 +47,24 @@ Use "bw" for only grayscale bricks. Ignored if a \code{color_table} is supplied.
|
||||
A list with element \code{Img_lego} containing a data frame of the x- & y-coordinates, R, G, B channels, and mapped color of each brick (pixel).
|
||||
}
|
||||
\description{
|
||||
Create a 2D LEGO mosaic from an image array
|
||||
Generate brick mosaics from an image or matrix with customization options.
|
||||
}
|
||||
\examples{
|
||||
\donttest{
|
||||
# Create a random 24x24 'image'.
|
||||
# Otherwise, use a jpeg or png
|
||||
demo_image = array(scales::rescale(runif(24*24*3), c(0, 1)), dim=c(24, 24, 3))
|
||||
|
||||
demo_image \%>\%
|
||||
image_to_mosaic(img_size = 24) \%>\%
|
||||
build_mosaic()
|
||||
|
||||
#Only use the most common "universal" LEGO colors
|
||||
demo_image \%>\%
|
||||
image_to_mosaic(img_size = 24, color_palette = "universal") \%>\%
|
||||
build_mosaic()
|
||||
}
|
||||
|
||||
}
|
||||
\seealso{
|
||||
Other Mosaics:
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
% Please edit documentation in R/image-to-prep-mosaic.R
|
||||
\name{image_to_scaled}
|
||||
\alias{image_to_scaled}
|
||||
\title{Scale an image raster array to a small number of pixels. Process into a data frame. Internal function.}
|
||||
\title{Scale an image raster array to a small number of pixels.}
|
||||
\arguments{
|
||||
\item{image}{A raster array from an image.}
|
||||
|
||||
@@ -17,6 +17,6 @@ Use an array of two values for a rectangular image \code{c(width, height)}.}
|
||||
A list with element \code{Img_scaled} containing a data frame of the x- & y-coordinates, R, G, B channels, and hex color of each brick (pixel).
|
||||
}
|
||||
\description{
|
||||
Scale an image raster array to a small number of pixels. Process into a data frame. Internal function.
|
||||
Decrease the size of an image, in pixel. Process into a data frame. Internal function.
|
||||
}
|
||||
\keyword{internal}
|
||||
|
||||
@@ -24,6 +24,6 @@
|
||||
lego_colors
|
||||
}
|
||||
\description{
|
||||
A dataset containing the 54 colors available in brickr, along with metadata
|
||||
A dataset containing the 54 colors available in 'brickr', along with metadata
|
||||
}
|
||||
\keyword{datasets}
|
||||
|
||||
@@ -27,6 +27,6 @@ Use "bw" for only grayscale bricks. Ignored if a \code{color_table} is supplied.
|
||||
A list with element \code{Img_lego} containing a data frame of the x- & y-coordinates, R, G, B channels, and mapped color of each brick (pixel).
|
||||
}
|
||||
\description{
|
||||
Convert image output from scale_image() to bricks
|
||||
Match raw color channel values to a smaller subset of colors.
|
||||
}
|
||||
\keyword{internal}
|
||||
|
||||