Description Usage Arguments Value See Also Examples
View source: R/bricks-from-tables.R
Create a 3D brick object from a data frame. Left-most column is level/height/z dimension, with rows as Y axis and columns as X axis.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
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 |
color_guide |
A data frame linking numeric |
piece_matrix |
A data frame in same shape as |
use_bricks |
Array of brick sizes to use in mosaic. Defaults to |
.re_level |
Logical to reassign the Level/z dimension to layers in alphanumeric order. Set to FALSE to explicitly provide levels. |
increment_level |
Default '0'. Use in animations. Shift Level/z dimension by an integer. |
min_level |
Default '1'. Use in animations. Any Level/z values below this value will be cut off. |
max_level |
Default 'Inf'. Use in animations. Any Level/z values above this value will be cut off. |
increment_x |
Default '0'. Use in animations. Shift x dimension by an integer. |
max_x |
Default 'Inf'. Use in animations. Any x values above this value will be cut off. |
increment_y |
Default '0'. Use in animations. Shift y dimension by an integer. |
max_y |
Default 'Inf'. Use in animations. Any y values above this value will be cut off. |
exclude_color |
Numeric array of color ID numbers to exclude. |
exclude_level |
Numeric array of Level/z dimensions to exclude. |
A list with elements Img_lego
to pass to build_bricks
.
Other 3D Models:
bricks_from_coords()
,
bricks_from_excel()
,
bricks_from_mosaic()
,
build_bricks()
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 | #This is a 4x2 brick. One level high, 2 x-values (columns), 4 y-values (rows).
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()
#Build on top of each other by changing the Level value.
#This example builds a blue 2x2 brick on top of a red 2x2
brick <- data.frame(
Level=c("A", "A", "B", "B"),
X1 = c(3, 3, 4, 4), #3 is red, 4 is blue
X2 = c(3, 3, 4, 4)
)
brick %>%
bricks_from_table() %>%
build_bricks()
rgl::clear3d()
#Provide an additional piece_matrix argument to change the default brick shape.
pieces <- data.frame(
Level=c("A", "A", "B", "B"),
X1 = c("b", "b", "p", "p"), #b is brick (default), p is plate
X2 = c("b", "b", "p", "p")
)
brick %>%
bricks_from_table(piece_matrix=pieces) %>%
build_bricks()
rgl::clear3d()
#Provide a custom table of colors
custom_colors <- data.frame(
.value = c(3, 4),
Color = c("Bright orange", "Dark green")
)
brick %>%
bricks_from_table(color_guide = custom_colors) %>%
build_bricks()
rgl::clear3d()
#Limit the size of bricks used in the model with use_bricks
brick %>%
bricks_from_table(use_bricks = "2x1") %>% #Only use 2x1 bricks.
build_bricks()
rgl::clear3d()
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.