Algorithm that calculate the optimial amount and size of LEGO bricks to build a 3D figure or mosaic image with lego bricks.
- Calculate optimal brick amount
- Prefere bigger size for lower cost
- Calculate price, weight and size of finished figure
- Transform true color to LEGO bricks color
A full service of this algorithm (with frontend) can be bound here (German).
- Fill out config.php
- Import SQL to MySQL with init_install.sql
- Call main function with base64 coded image:
<?php
require(__DIR__ . '/src/bricksfinder.class.php');
$bricksfinder = new Bricksfinder(B64_STRING_HERE);
$bricksfinder->getBricks(); // return array of bricks configuration
For example 3D figure of "Megaman":
Input:
(Builded) Output:
MIT Licence