Here we provide instructions on how to install Szalinski, run it, and change the rules and features of the Caddy language. If you are interested to use Szalinski, please reach out to us!
Following are the steps for setting up Szalinski from scratch on a different machine that runs Ubuntu 19.10.
-
Install rust. Type
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | shin the terminal and follow the subsequent instructions. The version we used is1.41.0. Seehttps://www.rust-lang.org/tools/installfor more information. -
Make sure you configure your current shell by typing:
source $HOME/.cargo/env(the Rust installation will prompt you to do this). -
Install make by typing:
sudo apt-get install make -
Install g++ by typing:
sudo apt-get install g++ -
Install jq by typing:
sudo apt-get install jq -
Install CGAL by typing
sudo apt-get install libcgal-dev -
Install OpenSCAD by typing
sudo apt-get install openscad -
Install git by typing
sudo apt install git -
Install pip by typing
sudo apt install python3-pipand then installnumpyby typingpip3 install numpyandmatplotlibby typingpip3 install matplotlib
- First compile Szalinski by running
cargo build --release - To optimize a 3D model (a
.csexpfile) with Szalinski, runtarget/release/optimize path/to/foo.csexp path/to/out/foo.json - You can also navigate to the
Makefileand learn more about how to convert an SCAD file to a.csexpfile.
-
The Caddy language is defined in
cad.rsin thesrcdirectory. A simple feature you can add is support for a new primitive or new transformations. You can also change the costs of various language constructs. The definition of thecostfunction starts at line267. -
As we described in the paper, to verify the correctness of Szalinski, we evaluate Caddy programs to flat Core Caddy and pretty print to CSG. This code is in
eval.rs. -
solve.rsandpermute.rscontains code that solves for first and second degree polynomials in Cartesian and Spherical coordinates, and performs partitioning and permutations of lists. -
The rewrites rules are in
rules.rs. Syntactic rewrites are written using therw!macro. Each rewrite has a name, a left hand side, and a right hand side. You can add / remove rules to see how that affects the final Caddy output of Szalinski. For example, if you comment out the rules for inverse transformations, they will not be propagated and eliminated, and therefore the quality of Szalinski's output will not be as good.
Szalinski is implemented in Rust.
As mentioned in Section 6 of the paper,
it uses OpenSCAD
to compile CSG programs to triangular meshes, and
CGAL to compute the
Hausdorff distance between two meshes.