/ray_tracing

Fast grid-based ray tracing in C++ and Python

Primary LanguageC++MIT LicenseMIT

ray_tracing

Fast grid-based ray tracing in C++ and Python

What is ray_tracing?

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.

How to use ray_tracing?

  1. 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
  2. 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
  3. If you are in C++, use the function trace_rays() in the file ray_tracing.hpp to find out by how many rays each grid cell is hit.

  4. If you are in Python, install the library via the CMake file and use one of the functions raytracing.trace1d, raytracing.trace2d, and raytracing.trace3d, defined in raytracing.py.

Also have a look at the test cases to verify your installation and to further familiarize yourself with the functions.