Fun In Flatland
A Python based 2D visulization and raytracing API
# Abstract Fun In Flatland is an API to facilitate the prototyping of 2D raytracing algorithms. It provides the basic infrastructure required to create a scene such as materials, objects and camera along with their intersection routines. One important aspect of the API is that all objects, camera and math primitives such as points, vectors, normals, and rays can be visualized. # Dependencies * [Turtle](https://docs.python.org/3.7/library/turtle.html?highlight=turtle) - for visulizations * Pillow - for saving images * Numpy # Example use cases Following are some example use cases for the API. ## Error in approximating visibility $$I = \int V(\theta)L(\theta)d\theta$$ $$I_{approx} = \int V(\theta)d\theta \int L(\theta)d\theta$$ where, $V$ is the visibility function at a shade point. The following plots shows the distribution of error over the incident directions for varying view angles and scene configuarations. | Scene | Error plot | |:-----:|:----------:| | ![](images/fifl/Test5setup.png)| ![](images/fifl/Test5.png) | | ![](images/fifl/Test6setup.png)| ![](images/fifl/Test6.png) | | ![](images/fifl/Test7setup.png)| ![](images/fifl/Test7.png) | | ![](images/fifl/Test8setup.png)| ![](images/fifl/Test8.png) | | ![](images/fifl/Test9setup.png)| ![](images/fifl/Test9.png) | ## Visibilty spectrum in Flatland The video shows the visibility function and its spectrum as we change the emitter orientation.