mirror of
https://github.com/ryantimpe/brickr.git
synced 2026-04-27 06:09:39 -05:00
83 lines
2.6 KiB
R
83 lines
2.6 KiB
R
% Generated by roxygen2: do not edit by hand
|
|
% 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}
|
|
\usage{
|
|
bricks_from_table(
|
|
matrix_table,
|
|
color_guide = brickr::lego_colors,
|
|
piece_matrix = NULL,
|
|
use_bricks = NULL,
|
|
.re_level = TRUE,
|
|
increment_level = 0,
|
|
min_level = 1,
|
|
max_level = Inf,
|
|
increment_x = 0,
|
|
max_x = Inf,
|
|
increment_y = 0,
|
|
max_y = Inf,
|
|
exclude_color = NULL,
|
|
exclude_level = NULL
|
|
)
|
|
}
|
|
\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{\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'.}
|
|
|
|
\item{piece_matrix}{A data frame in same shape as \code{matrix_table} with piece shape IDs.}
|
|
|
|
\item{use_bricks}{Array of brick sizes to use in mosaic. Defaults to \code{c('4x2', '3x2', '2x2', '3x1', '2x1', '1x1')}`.}
|
|
|
|
\item{.re_level}{Logical to reassign the Level/z dimension to layers in alphanumeric order. Set to FALSE to explicitly provide levels.}
|
|
|
|
\item{increment_level}{Default '0'. Use in animations. Shift Level/z dimension by an integer.}
|
|
|
|
\item{min_level}{Default '1'. Use in animations. Any Level/z values below this value will be cut off.}
|
|
|
|
\item{max_level}{Default 'Inf'. Use in animations. Any Level/z values above this value will be cut off.}
|
|
|
|
\item{increment_x}{Default '0'. Use in animations. Shift x dimension by an integer.}
|
|
|
|
\item{max_x}{Default 'Inf'. Use in animations. Any x values above this value will be cut off.}
|
|
|
|
\item{increment_y}{Default '0'. Use in animations. Shift y dimension by an integer.}
|
|
|
|
\item{max_y}{Default 'Inf'. Use in animations. Any y values above this value will be cut off.}
|
|
|
|
\item{exclude_color}{Numeric array of color ID numbers to exclude.}
|
|
|
|
\item{exclude_level}{Numeric array of Level/z dimensions to exclude.}
|
|
}
|
|
\value{
|
|
A list with elements \code{Img_lego} to pass to \code{\link{build_bricks}}.
|
|
}
|
|
\description{
|
|
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:
|
|
\code{\link{bricks_from_coords}()},
|
|
\code{\link{bricks_from_excel}()},
|
|
\code{\link{bricks_from_mosaic}()},
|
|
\code{\link{build_bricks}()}
|
|
}
|
|
\concept{3D Models}
|