Small bug fixes and doc updates

This commit is contained in:
ryantimpe
2019-08-29 09:42:16 -04:00
parent a12b6e127d
commit 772547b1d2
71 changed files with 121 additions and 86 deletions

View File

@@ -26,7 +26,11 @@ bricks_from_rayshader <- function(hillshade, heightmap, max_height = 12, img_siz
hghtmp <- hghtmp_list[[1]] %>%
dplyr::select(x, y, height = R) %>%
dplyr::mutate(Level = round(height * (max_height))+1) %>%
dplyr::select(-height)
dplyr::select(-height) %>%
dplyr::mutate(ww = max(x) - x,
x = max(y) - y,
y = ww) %>%
dplyr::select(-ww)
#New levels for the image
img_sorted_by_lum <- in_list$Img_lego %>%

View File

@@ -37,12 +37,12 @@ bricks_from_table <- function(matrix_table, color_guide = lego_colors, .re_level
if(ncol(color_guide) < 2){stop(color_guide_error_msg)}
if(!(".value" %in% names(color_guide)) | !("Color" %in% names(color_guide))){stop(color_guide_error_msg)}
if(!all(color_guide$Color %in% build_colors(.names_only = TRUE))){
stop(paste("At least one color name supplied does not match allowed brick color names. See build_colors().\n\n",
paste(color_guide$Color[!(color_guide$Color %in% build_colors(.names_only = TRUE))],collapse = ", ")
))
}
# if(!all(color_guide$Color %in% build_colors(.names_only = TRUE))){
# stop(paste("At least one color name supplied does not match allowed brick color names. See build_colors().\n\n",
# paste(color_guide$Color[!(color_guide$Color %in% build_colors(.names_only = TRUE))],collapse = ", ")
# ))
#
# }
color_map <- color_guide %>%
dplyr::mutate(Color = as.character(Color)) %>%

View File

@@ -82,11 +82,11 @@ layer_from_bricks <- function(brick_list, brick_type = "brick", lev=1, brick_res
TRUE ~ elevation
)) %>%
#Remove the bottom corners of brick for bricks with an offset
dplyr::do(
if(ex_size >= 20){
dplyr::filter(., !((x %in% c(min(x), max(x))) & (y %in% c(min(y), max(y)))))
} else {.}
) %>%
# dplyr::do(
# if(ex_size >= 20){
# dplyr::filter(., !((x %in% c(min(x), max(x))) & (y %in% c(min(y), max(y)))))
# } else {.}
# ) %>%
dplyr::ungroup() %>%
dplyr::mutate(y = max(y)-y) %>%
#Calculate stud placement... radius of 5/8 * (1/2) and height of 0.5 plate
@@ -173,13 +173,16 @@ layer_from_bricks <- function(brick_list, brick_type = "brick", lev=1, brick_res
#' @param brick_res Resolution, expressed at number of pixels on one side of a 1x1 brick. Defaults to 'sd' (15px). Use 'hd' for 30px per brick, and 'uhd' for 60px.
#' Enter a value for a custom resolution. High resolutions take longer to render.
#' @param solidcolor Hex color of mosaic base. Only renders on bottom.
#' @param water Default 'FALSE'. If 'TRUE', a water layer is rendered.
#' @param waterdepth Default '0'. Water level.
#' @param ... All other inputs from rayshader::plot_3d() EXCEPT \code{hillshade}, \code{soliddepth}, \code{zscale}, and \code{shadow}.
#' @return 3D brick model rendered in the 'rgl' package.
#' @family 3D Models
#' @export
#'
build_bricks <- function(brick_list, brick_type = "brick", brick_res = "sd",
view_levels = NULL, solidcolor = "#a3a2a4", ...){
view_levels = NULL, solidcolor = "#a3a2a4",
water = FALSE, waterdepth = 0, ...){
#Requires Rayshader
if (!requireNamespace("rayshader", quietly = TRUE)) {
stop("Package \"rayshader\" needed for this function to work. Please install it.",
@@ -197,12 +200,23 @@ build_bricks <- function(brick_list, brick_type = "brick", brick_res = "sd",
}
for(ii in view_levels){
brick_layer <- brick_list %>% layer_from_bricks(ii, brick_type = brick_type, brick_res = brick_res)
brick_layer <- brick_list %>%
layer_from_bricks(ii, brick_type = brick_type, brick_res = brick_res)
brick_layer$`threed_hillshade`%>%
rayshader::plot_3d(brick_layer$`threed_elevation`, zscale=0.167*(15/brick_layer$`brick_resolution`),
solid = FALSE,
solidcolor=solidcolor, shadow = FALSE, ...)
if(ii == min(view_levels) & water){
brick_layer$`threed_hillshade`%>%
rayshader::plot_3d(brick_layer$`threed_elevation`, zscale=0.167*(15/brick_layer$`brick_resolution`),
solid = FALSE,
solidcolor=solidcolor, shadow = FALSE,
water = TRUE, waterdepth = waterdepth * 3, ...)
} else {
brick_layer$`threed_hillshade`%>%
rayshader::plot_3d(brick_layer$`threed_elevation`, zscale=0.167*(15/brick_layer$`brick_resolution`),
solid = FALSE,
solidcolor=solidcolor, shadow = FALSE,
water = FALSE, waterdepth = 0, ...)
}
}
}

View File

@@ -89,7 +89,7 @@ The `bricks_from_*` series of functions creates 3D models of LEGO bricks from a
- `bricks_from_coords()` takes a data frame with `x`, `y`, & `z` integer values, and `Color` columns, where each combination of x, y, & z is a point in 3-dimensional space. Color must be an official LEGO color name from `build_colors()`. This format is much more flexible than `bricks_from_table()` and allows the programmatic development of 3D models.
-`bricks_from_mosaic()` converts a 2D [mosaic](#mosaics) object from an image into 3D LEGO models, respectively. `bricks_from_rayshader()` creates a LEGO model from the same input as `rayshader::plot_3d()`.
- `bricks_from_mosaic()` converts a 2D [mosaic](#mosaics) object from an image into 3D LEGO models, respectively. `bricks_from_rayshader()` creates a LEGO model from the same input as `rayshader::plot_3d()`.
Pass the output from any `bricks_from_*()` function to `build_bricks()` to see the 3D model. The `brick_res` option allows for higher resolution bricks in 'hd' or 'uhd', which will take longer to render.
@@ -149,7 +149,7 @@ brick_colors <- tibble::tribble(
my_first_model %>%
bricks_from_table(brick_colors) %>%
build_bricks(theta = 210, brick_res = "hd")
build_bricks(theta = 210, brick_res = "uhd")
rayshader::render_snapshot(clear = TRUE)
```
@@ -177,7 +177,7 @@ sphere_coords <- expand.grid(
sphere_coords %>%
bricks_from_coords() %>%
build_bricks(phi = 30, theta = 30)
build_bricks(brick_res = "uhd", phi = 30, theta = 30)
rayshader::render_snapshot(clear = TRUE)
```

View File

@@ -122,9 +122,10 @@ Morgan-Wall](https://twitter.com/tylermorganwall)s
flexible than `bricks_from_table()` and allows the programmatic
development of 3D models.
\-`bricks_from_mosaic()` converts a 2D [mosaic](#mosaics) object from an
image into 3D LEGO models, respectively. `bricks_from_rayshader()`
creates a LEGO model from the same input as `rayshader::plot_3d()`.
- `bricks_from_mosaic()` converts a 2D [mosaic](#mosaics) object from
an image into 3D LEGO models, respectively.
`bricks_from_rayshader()` creates a LEGO model from the same input
as `rayshader::plot_3d()`.
Pass the output from any `bricks_from_*()` function to `build_bricks()`
to see the 3D model. The `brick_res` option allows for higher resolution
@@ -191,7 +192,7 @@ brick_colors <- tibble::tribble(
my_first_model %>%
bricks_from_table(brick_colors) %>%
build_bricks(theta = 210, brick_res = "hd")
build_bricks(theta = 210, brick_res = "uhd")
rayshader::render_snapshot(clear = TRUE)
```
@@ -224,7 +225,7 @@ sphere_coords <- expand.grid(
sphere_coords %>%
bricks_from_coords() %>%
build_bricks(phi = 30, theta = 30)
build_bricks(brick_res = "uhd", phi = 30, theta = 30)
rayshader::render_snapshot(clear = TRUE)
```

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.0 KiB

After

Width:  |  Height:  |  Size: 9.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 58 KiB

After

Width:  |  Height:  |  Size: 53 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 62 KiB

After

Width:  |  Height:  |  Size: 48 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.8 KiB

After

Width:  |  Height:  |  Size: 4.8 KiB

View File

@@ -72,7 +72,7 @@
</button>
<span class="navbar-brand">
<a class="navbar-link" href="index.html">brickr</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.1.0.9022</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.1.0.9024</span>
</span>
</div>

View File

@@ -72,7 +72,7 @@
</button>
<span class="navbar-brand">
<a class="navbar-link" href="index.html">brickr</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.1.0.9022</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.1.0.9024</span>
</span>
</div>

View File

@@ -38,7 +38,7 @@
</button>
<span class="navbar-brand">
<a class="navbar-link" href="../index.html">brickr</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.1.0.9022</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.1.0.9024</span>
</span>
</div>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 21 KiB

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 62 KiB

After

Width:  |  Height:  |  Size: 63 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 27 KiB

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 35 KiB

After

Width:  |  Height:  |  Size: 36 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 101 KiB

After

Width:  |  Height:  |  Size: 98 KiB

View File

@@ -72,7 +72,7 @@
</button>
<span class="navbar-brand">
<a class="navbar-link" href="../index.html">brickr</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.1.0.9022</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.1.0.9024</span>
</span>
</div>

View File

@@ -38,7 +38,7 @@
</button>
<span class="navbar-brand">
<a class="navbar-link" href="../index.html">brickr</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.1.0.9022</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.1.0.9024</span>
</span>
</div>
@@ -185,7 +185,7 @@
<a class="sourceLine" id="cb4-2" title="2"><span class="co">#Plot as bricks</span></a>
<a class="sourceLine" id="cb4-3" title="3">rayshader_object <span class="op">%&gt;%</span><span class="st"> </span></a>
<a class="sourceLine" id="cb4-4" title="4"><span class="st"> </span><span class="kw"><a href="../reference/bricks_from_rayshader.html">bricks_from_rayshader</a></span>(elmat) <span class="op">%&gt;%</span><span class="st"> </span></a>
<a class="sourceLine" id="cb4-5" title="5"><span class="st"> </span><span class="kw"><a href="../reference/build_bricks.html">build_bricks</a></span>(<span class="dt">theta =</span> <span class="dv">135</span>, <span class="dt">zoom =</span> <span class="fl">0.75</span>, <span class="dt">phi =</span> <span class="dv">45</span>)</a>
<a class="sourceLine" id="cb4-5" title="5"><span class="st"> </span><span class="kw"><a href="../reference/build_bricks.html">build_bricks</a></span>(<span class="dt">theta =</span> <span class="dv">135</span>, <span class="dt">phi =</span> <span class="dv">45</span>)</a>
<a class="sourceLine" id="cb4-6" title="6"></a>
<a class="sourceLine" id="cb4-7" title="7">rayshader<span class="op">::</span><span class="kw"><a href="https://www.rdocumentation.org/packages/rayshader/topics/render_snapshot">render_snapshot</a></span>(<span class="dt">clear =</span> <span class="ot">TRUE</span>)</a></code></pre></div>
<p><img src="models-from-other_files/figure-html/bricks_rayshader-2.png" width="384"></p>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 241 KiB

After

Width:  |  Height:  |  Size: 264 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 364 KiB

After

Width:  |  Height:  |  Size: 290 KiB

View File

@@ -38,7 +38,7 @@
</button>
<span class="navbar-brand">
<a class="navbar-link" href="../index.html">brickr</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.1.0.9022</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.1.0.9024</span>
</span>
</div>
@@ -125,14 +125,14 @@
<a class="sourceLine" id="cb1-3" title="3">cube &lt;-<span class="st"> </span><span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/expand.grid">expand.grid</a></span>(</a>
<a class="sourceLine" id="cb1-4" title="4"> <span class="dt">x =</span> <span class="dv">1</span><span class="op">:</span><span class="dv">8</span>,</a>
<a class="sourceLine" id="cb1-5" title="5"> <span class="dt">y =</span> <span class="dv">1</span><span class="op">:</span><span class="dv">8</span>,</a>
<a class="sourceLine" id="cb1-6" title="6"> <span class="dt">z =</span> <span class="dv">1</span><span class="op">:</span><span class="dv">8</span> </a>
<a class="sourceLine" id="cb1-6" title="6"> <span class="dt">z =</span> <span class="dv">1</span><span class="op">:</span><span class="dv">8</span></a>
<a class="sourceLine" id="cb1-7" title="7">) </a>
<a class="sourceLine" id="cb1-8" title="8"></a>
<a class="sourceLine" id="cb1-9" title="9">cube<span class="op">$</span>Color &lt;-<span class="st"> </span><span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/sample">sample</a></span>(use_colors, <span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/nrow">nrow</a></span>(cube), <span class="dt">replace =</span> <span class="ot">TRUE</span>, <span class="dt">prob =</span> <span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/c">c</a></span>(<span class="dv">5</span>, <span class="dv">3</span>, <span class="dv">1</span>))</a>
<a class="sourceLine" id="cb1-10" title="10"></a>
<a class="sourceLine" id="cb1-11" title="11">cube <span class="op">%&gt;%</span><span class="st"> </span></a>
<a class="sourceLine" id="cb1-12" title="12"><span class="st"> </span><span class="kw"><a href="../reference/bricks_from_coords.html">bricks_from_coords</a></span>() <span class="op">%&gt;%</span><span class="st"> </span></a>
<a class="sourceLine" id="cb1-13" title="13"><span class="st"> </span><span class="kw"><a href="../reference/build_bricks.html">build_bricks</a></span>(<span class="dt">brick_res =</span> <span class="st">"hd"</span>, <span class="dt">phi =</span> <span class="dv">30</span>, <span class="dt">theta =</span> <span class="dv">30</span>)</a>
<a class="sourceLine" id="cb1-13" title="13"><span class="st"> </span><span class="kw"><a href="../reference/build_bricks.html">build_bricks</a></span>(<span class="dt">brick_res =</span> <span class="st">"uhd"</span>, <span class="dt">phi =</span> <span class="dv">30</span>, <span class="dt">theta =</span> <span class="dv">30</span>)</a>
<a class="sourceLine" id="cb1-14" title="14"></a>
<a class="sourceLine" id="cb1-15" title="15">rayshader<span class="op">::</span><span class="kw"><a href="https://www.rdocumentation.org/packages/rayshader/topics/render_snapshot">render_snapshot</a></span>(<span class="dt">clear =</span> <span class="ot">TRUE</span>)</a></code></pre></div>
<p><img src="models-from-program_files/figure-html/bricks_6-1.png" width="384"></p>
@@ -155,7 +155,7 @@
<a class="sourceLine" id="cb2-16" title="16"></a>
<a class="sourceLine" id="cb2-17" title="17">sphere_coords <span class="op">%&gt;%</span><span class="st"> </span></a>
<a class="sourceLine" id="cb2-18" title="18"><span class="st"> </span><span class="kw"><a href="../reference/bricks_from_coords.html">bricks_from_coords</a></span>() <span class="op">%&gt;%</span><span class="st"> </span></a>
<a class="sourceLine" id="cb2-19" title="19"><span class="st"> </span><span class="kw"><a href="../reference/build_bricks.html">build_bricks</a></span>(<span class="dt">brick_res =</span> <span class="st">"hd"</span>, <span class="dt">phi =</span> <span class="dv">30</span>, <span class="dt">theta =</span> <span class="dv">30</span>)</a>
<a class="sourceLine" id="cb2-19" title="19"><span class="st"> </span><span class="kw"><a href="../reference/build_bricks.html">build_bricks</a></span>(<span class="dt">brick_res =</span> <span class="st">"uhd"</span>, <span class="dt">phi =</span> <span class="dv">30</span>, <span class="dt">theta =</span> <span class="dv">30</span>)</a>
<a class="sourceLine" id="cb2-20" title="20"></a>
<a class="sourceLine" id="cb2-21" title="21">rayshader<span class="op">::</span><span class="kw"><a href="https://www.rdocumentation.org/packages/rayshader/topics/render_snapshot">render_snapshot</a></span>(<span class="dt">clear =</span> <span class="ot">TRUE</span>)</a></code></pre></div>
<p><img src="models-from-program_files/figure-html/bricks_7-1.png" width="384"></p>
@@ -193,9 +193,10 @@
<a class="sourceLine" id="cb3-26" title="26">}</a>
<a class="sourceLine" id="cb3-27" title="27"></a>
<a class="sourceLine" id="cb3-28" title="28"><span class="co">#Build one house</span></a>
<a class="sourceLine" id="cb3-29" title="29"><span class="kw">brick_house</span>() <span class="op">%&gt;%</span><span class="st"> </span><span class="kw"><a href="../reference/bricks_from_coords.html">bricks_from_coords</a></span>() <span class="op">%&gt;%</span><span class="st"> </span></a>
<a class="sourceLine" id="cb3-30" title="30"><span class="st"> </span><span class="kw"><a href="../reference/build_bricks.html">build_bricks</a></span>(<span class="dt">theta =</span> <span class="dv">225</span>)</a>
<a class="sourceLine" id="cb3-31" title="31">rayshader<span class="op">::</span><span class="kw"><a href="https://www.rdocumentation.org/packages/rayshader/topics/render_snapshot">render_snapshot</a></span>(<span class="dt">clear =</span> <span class="ot">TRUE</span>)</a></code></pre></div>
<a class="sourceLine" id="cb3-29" title="29"><span class="kw">brick_house</span>() <span class="op">%&gt;%</span><span class="st"> </span></a>
<a class="sourceLine" id="cb3-30" title="30"><span class="st"> </span><span class="kw"><a href="../reference/bricks_from_coords.html">bricks_from_coords</a></span>() <span class="op">%&gt;%</span><span class="st"> </span></a>
<a class="sourceLine" id="cb3-31" title="31"><span class="st"> </span><span class="kw"><a href="../reference/build_bricks.html">build_bricks</a></span>(<span class="dt">theta =</span> <span class="dv">225</span>)</a>
<a class="sourceLine" id="cb3-32" title="32">rayshader<span class="op">::</span><span class="kw"><a href="https://www.rdocumentation.org/packages/rayshader/topics/render_snapshot">render_snapshot</a></span>(<span class="dt">clear =</span> <span class="ot">TRUE</span>)</a></code></pre></div>
<p><img src="models-from-program_files/figure-html/bricks_8-1.png" width="384"></p>
<p>Next, we write one more function, <code>brick_street()</code> to build a road and grass foundation. The, for an arbitrary number of houses and neighborhood size, use <code><a href="https://purrr.tidyverse.org/reference/map2.html">purrr::pmap_df</a></code> to generate many houses and place them along the road.</p>
<div class="sourceCode" id="cb4"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb4-1" title="1">brick_street &lt;-<span class="st"> </span><span class="cf">function</span>(<span class="dt">width =</span> <span class="dv">100</span>, <span class="dt">length =</span> <span class="dv">40</span>){</a>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 133 KiB

After

Width:  |  Height:  |  Size: 162 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 59 KiB

After

Width:  |  Height:  |  Size: 80 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 123 KiB

After

Width:  |  Height:  |  Size: 121 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 151 KiB

After

Width:  |  Height:  |  Size: 155 KiB

View File

@@ -38,7 +38,7 @@
</button>
<span class="navbar-brand">
<a class="navbar-link" href="../index.html">brickr</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.1.0.9022</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.1.0.9024</span>
</span>
</div>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 22 KiB

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 43 KiB

After

Width:  |  Height:  |  Size: 48 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 50 KiB

After

Width:  |  Height:  |  Size: 72 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 41 KiB

After

Width:  |  Height:  |  Size: 56 KiB

View File

@@ -38,7 +38,7 @@
</button>
<span class="navbar-brand">
<a class="navbar-link" href="../index.html">brickr</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.1.0.9022</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.1.0.9024</span>
</span>
</div>
@@ -132,7 +132,7 @@
<div id="colors" class="section level2">
<h2 class="hasAnchor">
<a href="#colors" class="anchor"></a>Colors</h2>
<p>A key feature in <code><a href="../reference/image_to_mosaic.html">image_to_mosaic()</a></code> is the conversion of the original image into colors produced by LEGO. The default is to map each individual pixel to any of the 41 flat colors currently used for brick production using the <a href="https://en.wikipedia.org/wiki/Color_difference#CIE94">CIE94</a> algorithm. These defaults can be changed.</p>
<p>A key feature in <code><a href="../reference/image_to_mosaic.html">image_to_mosaic()</a></code> is the conversion of the original image into colors produced by LEGO. The default is to map each individual pixel to any of the 41 solid brick colors currently produced by LEGO useing the <a href="https://en.wikipedia.org/wiki/Color_difference#CIE94">CIE94</a> algorithm. These defaults can be changed.</p>
<div id="color-palettes" class="section level3">
<h3 class="hasAnchor">
<a href="#color-palettes" class="anchor"></a>Color palettes</h3>
@@ -144,7 +144,7 @@
<div id="default-color-palettes" class="section level4">
<h4 class="hasAnchor">
<a href="#default-color-palettes" class="anchor"></a>Default color palettes</h4>
<p>Each of the 41 colors belongs to one of three categories:</p>
<p>Each of the 41 colors belongs to one of three categories. These categories are mutually exclusive and can be used together.</p>
<ul>
<li>universal colors are the most common. This list includes white/black/grays/brown and the classic yellow, red, blue, and green colors. All brick sizes should be readily available in these colors.</li>
<li>generic colors are commonly used in LEGO products, though it might be more difficult to find every brick in these colors.</li>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 206 KiB

After

Width:  |  Height:  |  Size: 229 KiB

View File

@@ -72,7 +72,7 @@
</button>
<span class="navbar-brand">
<a class="navbar-link" href="index.html">brickr</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.1.0.9022</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.1.0.9024</span>
</span>
</div>

View File

@@ -40,7 +40,7 @@
</button>
<span class="navbar-brand">
<a class="navbar-link" href="index.html">brickr</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.1.0.9022</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.1.0.9024</span>
</span>
</div>
@@ -129,7 +129,7 @@
<div id="whats-the-point" class="section level3">
<h3 class="hasAnchor">
<a href="#whats-the-point" class="anchor"></a>Whats the point?</h3>
<p>The goal of {brickr} is to provide a series of tools to integrate the LEGO® system with R by:</p>
<p>The goal of <strong>brickr</strong> is to provide a series of tools to integrate the LEGO® system with R by:</p>
<ul>
<li>Enhancing a real world building experience with mosaics, generated instructions, and piece counts.</li>
<li>Generating interest in R and coding for new audiences with easy-to-create 3D models.</li>
@@ -161,7 +161,7 @@
<a class="sourceLine" id="cb2-7" title="7"><span class="co">#Plot 2D mosaic</span></a>
<a class="sourceLine" id="cb2-8" title="8">mosaic1 <span class="op">%&gt;%</span><span class="st"> </span><span class="kw"><a href="reference/build_mosaic.html">build_mosaic</a></span>()</a></code></pre></div>
<p><img src="index_files/figure-html/m1_set-1.png" width="288"></p>
<p>In general, any {brickr} function that begins with <code>build_</code> generates a graphical output from a {brickr} list object from other functions.</p>
<p>In general, any <strong>brickr</strong> function that begins with <code>build_</code> generates a graphical output from a <strong>brickr</strong> list object, generated from other functions.</p>
<div id="customization" class="section level3">
<h3 class="hasAnchor">
<a href="#customization" class="anchor"></a>Customization</h3>
@@ -180,8 +180,8 @@
<ul>
<li><p><code><a href="reference/bricks_from_table.html">bricks_from_table()</a></code> &amp; <code><a href="reference/bricks_from_excel.html">bricks_from_excel()</a></code> convert a matrix-shaped table of integers into LEGO bricks. For simple models, this table can be made manually using <code><a href="https://www.rdocumentation.org/packages/base/topics/data.frame">data.frame()</a></code> or <code><a href="https://tibble.tidyverse.org/reference/tribble.html">tibble::tribble()</a></code>. For more advanced models, its recommended you use MS Excel or a .csv file. The left-most column in the table is associated with the Level or z-axis of the model. <code><a href="reference/bricks_from_excel.html">bricks_from_excel()</a></code> is a wrapper function to more easily build models designed using a Microsoft Excel template. Please see this repo: <a href="https://github.com/ryantimpe/brickr_toybox">brickr toybox</a>.</p></li>
<li><p><code><a href="reference/bricks_from_coords.html">bricks_from_coords()</a></code> takes a data frame with <code>x</code>, <code>y</code>, &amp; <code>z</code> integer values, and <code>Color</code> columns, where each combination of x, y, &amp; z is a point in 3-dimensional space. Color must be an official LEGO color name from <code><a href="reference/build_colors.html">build_colors()</a></code>. This format is much more flexible than <code><a href="reference/bricks_from_table.html">bricks_from_table()</a></code> and allows the programmatic development of 3D models.</p></li>
<li><p><code><a href="reference/bricks_from_mosaic.html">bricks_from_mosaic()</a></code> converts a 2D <a href="#mosaics">mosaic</a> object from an image into 3D LEGO models, respectively. <code><a href="reference/bricks_from_rayshader.html">bricks_from_rayshader()</a></code> creates a LEGO model from the same input as <code><a href="https://www.rdocumentation.org/packages/rayshader/topics/plot_3d">rayshader::plot_3d()</a></code>.</p></li>
</ul>
<p>-<code><a href="reference/bricks_from_mosaic.html">bricks_from_mosaic()</a></code> converts a 2D <a href="#mosaics">mosaic</a> object from an image into 3D LEGO models, respectively. <code><a href="reference/bricks_from_rayshader.html">bricks_from_rayshader()</a></code> creates a LEGO model from the same input as <code><a href="https://www.rdocumentation.org/packages/rayshader/topics/plot_3d">rayshader::plot_3d()</a></code>.</p>
<p>Pass the output from any <code>bricks_from_*()</code> function to <code><a href="reference/build_bricks.html">build_bricks()</a></code> to see the 3D model. The <code>brick_res</code> option allows for higher resolution bricks in hd or uhd, which will take longer to render.</p>
<div class="sourceCode" id="cb3"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb3-1" title="1"><span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/library">library</a></span>(brickr)</a>
<a class="sourceLine" id="cb3-2" title="2"></a>
@@ -235,7 +235,7 @@
<a class="sourceLine" id="cb4-30" title="30"> </a>
<a class="sourceLine" id="cb4-31" title="31">my_first_model <span class="op">%&gt;%</span><span class="st"> </span></a>
<a class="sourceLine" id="cb4-32" title="32"><span class="st"> </span><span class="kw"><a href="reference/bricks_from_table.html">bricks_from_table</a></span>(brick_colors) <span class="op">%&gt;%</span><span class="st"> </span></a>
<a class="sourceLine" id="cb4-33" title="33"><span class="st"> </span><span class="kw"><a href="reference/build_bricks.html">build_bricks</a></span>(<span class="dt">theta =</span> <span class="dv">210</span>, <span class="dt">brick_res =</span> <span class="st">"hd"</span>)</a>
<a class="sourceLine" id="cb4-33" title="33"><span class="st"> </span><span class="kw"><a href="reference/build_bricks.html">build_bricks</a></span>(<span class="dt">theta =</span> <span class="dv">210</span>, <span class="dt">brick_res =</span> <span class="st">"uhd"</span>)</a>
<a class="sourceLine" id="cb4-34" title="34"></a>
<a class="sourceLine" id="cb4-35" title="35">rayshader<span class="op">::</span><span class="kw"><a href="https://www.rdocumentation.org/packages/rayshader/topics/render_snapshot">render_snapshot</a></span>(<span class="dt">clear =</span> <span class="ot">TRUE</span>)</a></code></pre></div>
<p><img src="index_files/figure-html/bricks_5-1.png" width="384"></p>
@@ -262,7 +262,7 @@
<a class="sourceLine" id="cb5-16" title="16"></a>
<a class="sourceLine" id="cb5-17" title="17">sphere_coords <span class="op">%&gt;%</span><span class="st"> </span></a>
<a class="sourceLine" id="cb5-18" title="18"><span class="st"> </span><span class="kw"><a href="reference/bricks_from_coords.html">bricks_from_coords</a></span>() <span class="op">%&gt;%</span><span class="st"> </span></a>
<a class="sourceLine" id="cb5-19" title="19"><span class="st"> </span><span class="kw"><a href="reference/build_bricks.html">build_bricks</a></span>(<span class="dt">phi =</span> <span class="dv">30</span>, <span class="dt">theta =</span> <span class="dv">30</span>)</a>
<a class="sourceLine" id="cb5-19" title="19"><span class="st"> </span><span class="kw"><a href="reference/build_bricks.html">build_bricks</a></span>(<span class="dt">brick_res =</span> <span class="st">"uhd"</span>, <span class="dt">phi =</span> <span class="dv">30</span>, <span class="dt">theta =</span> <span class="dv">30</span>)</a>
<a class="sourceLine" id="cb5-20" title="20"></a>
<a class="sourceLine" id="cb5-21" title="21">rayshader<span class="op">::</span><span class="kw"><a href="https://www.rdocumentation.org/packages/rayshader/topics/render_snapshot">render_snapshot</a></span>(<span class="dt">clear =</span> <span class="ot">TRUE</span>)</a></code></pre></div>
<p><img src="index_files/figure-html/bricks_6-1.png" width="480"></p>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 21 KiB

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 103 KiB

After

Width:  |  Height:  |  Size: 126 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 106 KiB

After

Width:  |  Height:  |  Size: 88 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 27 KiB

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 19 KiB

After

Width:  |  Height:  |  Size: 18 KiB

View File

@@ -72,7 +72,7 @@
</button>
<span class="navbar-brand">
<a class="navbar-link" href="../index.html">brickr</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.1.0.9022</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.1.0.9024</span>
</span>
</div>

View File

@@ -74,7 +74,7 @@
</button>
<span class="navbar-brand">
<a class="navbar-link" href="../index.html">brickr</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.1.0.9022</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.1.0.9024</span>
</span>
</div>

View File

@@ -74,7 +74,7 @@
</button>
<span class="navbar-brand">
<a class="navbar-link" href="../index.html">brickr</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.1.0.9022</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.1.0.9024</span>
</span>
</div>

View File

@@ -74,7 +74,7 @@
</button>
<span class="navbar-brand">
<a class="navbar-link" href="../index.html">brickr</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.1.0.9022</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.1.0.9024</span>
</span>
</div>

View File

@@ -74,7 +74,7 @@
</button>
<span class="navbar-brand">
<a class="navbar-link" href="../index.html">brickr</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.1.0.9022</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.1.0.9024</span>
</span>
</div>

View File

@@ -74,7 +74,7 @@
</button>
<span class="navbar-brand">
<a class="navbar-link" href="../index.html">brickr</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.1.0.9022</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.1.0.9024</span>
</span>
</div>

View File

@@ -74,7 +74,7 @@
</button>
<span class="navbar-brand">
<a class="navbar-link" href="../index.html">brickr</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.1.0.9022</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.1.0.9024</span>
</span>
</div>

View File

@@ -74,7 +74,7 @@
</button>
<span class="navbar-brand">
<a class="navbar-link" href="../index.html">brickr</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.1.0.9022</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.1.0.9024</span>
</span>
</div>

View File

@@ -74,7 +74,7 @@
</button>
<span class="navbar-brand">
<a class="navbar-link" href="../index.html">brickr</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.1.0.9022</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.1.0.9024</span>
</span>
</div>
@@ -149,7 +149,8 @@
</div>
<pre class="usage"><span class='fu'>build_bricks</span>(<span class='no'>brick_list</span>, <span class='kw'>brick_type</span> <span class='kw'>=</span> <span class='st'>"brick"</span>, <span class='kw'>brick_res</span> <span class='kw'>=</span> <span class='st'>"sd"</span>,
<span class='kw'>view_levels</span> <span class='kw'>=</span> <span class='kw'>NULL</span>, <span class='kw'>solidcolor</span> <span class='kw'>=</span> <span class='st'>"#a3a2a4"</span>, <span class='no'>...</span>)</pre>
<span class='kw'>view_levels</span> <span class='kw'>=</span> <span class='kw'>NULL</span>, <span class='kw'>solidcolor</span> <span class='kw'>=</span> <span class='st'>"#a3a2a4"</span>, <span class='kw'>water</span> <span class='kw'>=</span> <span class='fl'>FALSE</span>,
<span class='kw'>waterdepth</span> <span class='kw'>=</span> <span class='fl'>0</span>, <span class='no'>...</span>)</pre>
<h2 class="hasAnchor" id="arguments"><a class="anchor" href="#arguments"></a>Arguments</h2>
<table class="ref-arguments">
@@ -175,6 +176,14 @@ Enter a value for a custom resolution. High resolutions take longer to render.</
<th>solidcolor</th>
<td><p>Hex color of mosaic base. Only renders on bottom.</p></td>
</tr>
<tr>
<th>water</th>
<td><p>Default 'FALSE'. If 'TRUE', a water layer is rendered.</p></td>
</tr>
<tr>
<th>waterdepth</th>
<td><p>Default '0'. Water level.</p></td>
</tr>
<tr>
<th>...</th>
<td><p>All other inputs from rayshader::plot_3d() EXCEPT <code>hillshade</code>, <code>soliddepth</code>, <code>zscale</code>, and <code>shadow</code>.</p></td>

View File

@@ -74,7 +74,7 @@
</button>
<span class="navbar-brand">
<a class="navbar-link" href="../index.html">brickr</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.1.0.9022</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.1.0.9024</span>
</span>
</div>

View File

@@ -74,7 +74,7 @@
</button>
<span class="navbar-brand">
<a class="navbar-link" href="../index.html">brickr</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.1.0.9022</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.1.0.9024</span>
</span>
</div>

View File

@@ -74,7 +74,7 @@
</button>
<span class="navbar-brand">
<a class="navbar-link" href="../index.html">brickr</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.1.0.9022</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.1.0.9024</span>
</span>
</div>

View File

@@ -74,7 +74,7 @@
</button>
<span class="navbar-brand">
<a class="navbar-link" href="../index.html">brickr</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.1.0.9022</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.1.0.9024</span>
</span>
</div>

View File

@@ -74,7 +74,7 @@
</button>
<span class="navbar-brand">
<a class="navbar-link" href="../index.html">brickr</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.1.0.9022</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.1.0.9024</span>
</span>
</div>

View File

@@ -74,7 +74,7 @@
</button>
<span class="navbar-brand">
<a class="navbar-link" href="../index.html">brickr</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.1.0.9022</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.1.0.9024</span>
</span>
</div>

View File

@@ -74,7 +74,7 @@
</button>
<span class="navbar-brand">
<a class="navbar-link" href="../index.html">brickr</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.1.0.9022</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.1.0.9024</span>
</span>
</div>

View File

@@ -75,7 +75,7 @@ Use coord_brick_flip() for horizontal bars." />
</button>
<span class="navbar-brand">
<a class="navbar-link" href="../index.html">brickr</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.1.0.9022</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.1.0.9024</span>
</span>
</div>

View File

@@ -75,7 +75,7 @@ Bar height is determined by values in the data using the y aesthetic. With the e
</button>
<span class="navbar-brand">
<a class="navbar-link" href="../index.html">brickr</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.1.0.9022</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.1.0.9024</span>
</span>
</div>

View File

@@ -74,7 +74,7 @@
</button>
<span class="navbar-brand">
<a class="navbar-link" href="../index.html">brickr</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.1.0.9022</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.1.0.9024</span>
</span>
</div>

View File

@@ -74,7 +74,7 @@
</button>
<span class="navbar-brand">
<a class="navbar-link" href="../index.html">brickr</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.1.0.9022</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.1.0.9024</span>
</span>
</div>

View File

@@ -74,7 +74,7 @@
</button>
<span class="navbar-brand">
<a class="navbar-link" href="../index.html">brickr</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.1.0.9022</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.1.0.9024</span>
</span>
</div>

View File

@@ -72,7 +72,7 @@
</button>
<span class="navbar-brand">
<a class="navbar-link" href="../index.html">brickr</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.1.0.9022</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.1.0.9024</span>
</span>
</div>

View File

@@ -74,7 +74,7 @@
</button>
<span class="navbar-brand">
<a class="navbar-link" href="../index.html">brickr</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.1.0.9022</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.1.0.9024</span>
</span>
</div>

View File

@@ -74,7 +74,7 @@
</button>
<span class="navbar-brand">
<a class="navbar-link" href="../index.html">brickr</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.1.0.9022</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.1.0.9024</span>
</span>
</div>

View File

@@ -74,7 +74,7 @@
</button>
<span class="navbar-brand">
<a class="navbar-link" href="../index.html">brickr</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.1.0.9022</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.1.0.9024</span>
</span>
</div>

View File

@@ -74,7 +74,7 @@
</button>
<span class="navbar-brand">
<a class="navbar-link" href="../index.html">brickr</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.1.0.9022</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.1.0.9024</span>
</span>
</div>

View File

@@ -74,7 +74,7 @@
</button>
<span class="navbar-brand">
<a class="navbar-link" href="../index.html">brickr</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.1.0.9022</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.1.0.9024</span>
</span>
</div>

View File

@@ -5,7 +5,8 @@
\title{Build 3D brick model with rayshader.}
\usage{
build_bricks(brick_list, brick_type = "brick", brick_res = "sd",
view_levels = NULL, solidcolor = "#a3a2a4", ...)
view_levels = NULL, solidcolor = "#a3a2a4", water = FALSE,
waterdepth = 0, ...)
}
\arguments{
\item{brick_list}{List output from collect_bricks(). Contains an element \code{Img_lego}.}
@@ -19,6 +20,10 @@ Enter a value for a custom resolution. High resolutions take longer to render.}
\item{solidcolor}{Hex color of mosaic base. Only renders on bottom.}
\item{water}{Default 'FALSE'. If 'TRUE', a water layer is rendered.}
\item{waterdepth}{Default '0'. Water level.}
\item{...}{All other inputs from rayshader::plot_3d() EXCEPT \code{hillshade}, \code{soliddepth}, \code{zscale}, and \code{shadow}.}
}
\value{

View File

@@ -85,7 +85,7 @@ rayshader::render_snapshot(clear = TRUE)
#Plot as bricks
rayshader_object %>%
bricks_from_rayshader(elmat) %>%
build_bricks(theta = 135, zoom = 0.75, phi = 45)
build_bricks(theta = 135, phi = 45)
rayshader::render_snapshot(clear = TRUE)
```

View File

@@ -34,14 +34,14 @@ use_colors <- c("Bright blue", "Bright yellow", "Bright red")
cube <- expand.grid(
x = 1:8,
y = 1:8,
z = 1:8
z = 1:8
)
cube$Color <- sample(use_colors, nrow(cube), replace = TRUE, prob = c(5, 3, 1))
cube %>%
bricks_from_coords() %>%
build_bricks(brick_res = "hd", phi = 30, theta = 30)
build_bricks(brick_res = "uhd", phi = 30, theta = 30)
rayshader::render_snapshot(clear = TRUE)
```
@@ -67,7 +67,7 @@ sphere_coords <- expand.grid(
sphere_coords %>%
bricks_from_coords() %>%
build_bricks(brick_res = "hd", phi = 30, theta = 30)
build_bricks(brick_res = "uhd", phi = 30, theta = 30)
rayshader::render_snapshot(clear = TRUE)
```
@@ -107,7 +107,8 @@ brick_house <- function(x_coord = 0, y_coord = 0, width=6, length=5, height=6){
}
#Build one house
brick_house() %>% bricks_from_coords() %>%
brick_house() %>%
bricks_from_coords() %>%
build_bricks(theta = 225)
rayshader::render_snapshot(clear = TRUE)
```

View File

@@ -44,7 +44,7 @@ png::readPNG(demo_img) %>%
## Colors
A key feature in `image_to_mosaic()` is the conversion of the original image into colors produced by LEGO. The default is to map each individual pixel to any of the 41 flat colors currently used for brick production using the [CIE94](https://en.wikipedia.org/wiki/Color_difference#CIE94) algorithm. These defaults can be changed.
A key feature in `image_to_mosaic()` is the conversion of the original image into colors produced by LEGO. The default is to map each individual pixel to any of the 41 solid brick colors currently produced by LEGO useing the [CIE94](https://en.wikipedia.org/wiki/Color_difference#CIE94) algorithm. These defaults can be changed.
### Color palettes
@@ -55,7 +55,7 @@ There are currently 2 main ways to control the color palettes to build mosaics i
#### Default color palettes
Each of the 41 colors belongs to one of three categories:
Each of the 41 colors belongs to one of three categories. These categories are mutually exclusive and can be used together.
- 'universal' colors are the most common. This list includes white/black/grays/brown and the classic yellow, red, blue, and green colors. All brick sizes should be readily available in these colors.
- 'generic' colors are commonly used in LEGO products, though it might be more difficult to find every brick in these colors.