Fast grid-based ray tracing in C++ and Python
This library implements ray tracing through a uniform grid according to the algorithm proposed by Amanatides and Woo:
Amanatides, John, and Andrew Woo.
A fast voxel traversal algorithm for ray tracing.
Eurographics. Vol. 87. No. 3. 1987.
The ray_tracing
library is written in C++.
In addition, it comes with Python bindings via pybind11.
-
Install the required dependencies Catch2, pytest, and pybind11.
git clone https://github.com/catchorg/Catch2.git mkdir Catch2/build cd Catch2/build cmake .. make -j8 sudo make install pip install pytest git clone https://github.com/pybind/pybind11.git mkdir pybind11/build cd pybind11/build cmake .. make -j8 sudo make install
-
Download and compile the repository.
git clone https://github.com/acschaefer/ray_tracing.git mkdir ray_tracing/build && cd ray_tracing/build cmake .. -DPYTHON_EXECUTABLE=$(which python) make -j8 sudo make install
-
If you are in C++, use the function
trace_rays()
in the fileray_tracing.hpp
to find out by how many rays each grid cell is hit. -
If you are in Python, install the library via the CMake file and use one of the functions
raytracing.trace1d
,raytracing.trace2d
, andraytracing.trace3d
, defined inraytracing.py
.
Also have a look at the test cases to verify your installation and to further familiarize yourself with the functions.