# Example implementation for "Accurate Rendering of Liquid-Crystals and Inhomogeneous Optically Anisotropic Media"

Provided under the MIT license.

## How to build this demo

```
cmake -H. -Bbuild
cd build
cmake --build .
```
The demo uses MATLAB for intergration, if MATLAB is not found on the target system then the demo will be built without MATLAB support.

Precompiled binaries are available in folder bin/. 

# Using 

The incidence light polarization and wavelength can be controlled using the built-in UI, likewise a polarization filter can be used that filters the light after it passes through the slab. Most interesting configurations appear when viewed under cross-polarized light.

Once the demo is launched, a homogeneous (and boring) default profile is selected. <br/>
To change to a profile from the available library, select the desired profile from the drop-down in the "Material" tab and confirm via the "Update" button. The slab's thickness can be changed dynamically using the slider under the same tab. 
Use the "Reset" button to reset back to the default material.

# Adding new profiles

Importing is easiest by first generating the profile in Matlab (using the generate.m script) and then using the stand-alone importer tool.
Otherwise, it is also possible import a profile generated by MATLAB, fill in the desired profile name under the "Create New Profile" tab as well as the path where the profile was saved (/tmp/ by default) and press "Import", which will spawn an import job that will parse the MATLAB output and create a new profile.

When compiled with MATLAB integration this process can be initiated directly from the demo by filling all material fields with functions using MATLAB syntax, selecting the expansion orders and pressing "Generate". This will launch a new job that will connect to MATLAB and create a new profile. The job manager list displays ongoing as well as finished jobs and their current status. Multiple jobs can be ran in parallel and a job can be cancelled from the job manager.

Unneeded profiles can be deleted by using the "Profiles" tab. This is a destructive operation!
