Git Product home page Git Product logo

lbvh's Introduction

LBVH

An implementation of the LBVH algorithm for performing fast bounding-box intersections. NVIDIA has a great series of blog posts that describes, in detail, the algorithm for LBVH construction/traversal:

  1. https://developer.nvidia.com/blog/thinking-parallel-part-i-collision-detection-gpu/
  2. https://developer.nvidia.com/blog/thinking-parallel-part-ii-tree-traversal-gpu/
  3. https://developer.nvidia.com/blog/thinking-parallel-part-iii-tree-construction-gpu/

This repo's implementation is CPU-only for now, but it does include python and Mathematica bindings.

Python

Precompiled binaries are available for many versions of python on mac, linux and windows. To install python bindings for use with jax or numpy, do

pip3 install lbvh

The python bindings expect arrays of bounding boxes to be specified in one of the following formats:

# list of 2D bounding boxes, as arrays with shape (*, 4)
[[min_x, min_y, max_x, max_y], ... ]

# list of 2D bounding boxes, as arrays with shape (*, 2, 2)
[[[min_x, min_y], [max_x, max_y]], ... ]

# list of 3D bounding boxes, as arrays with shape (*, 6)
[[min_x, min_y, min_z, max_x, max_y, max_z], ... ]

# list of 3D bounding boxes, as arrays with shape (*, 2, 3)
[[[min_x, min_y, min_z], [max_x, max_y, max_z]], ... ]

See https://github.com/samuelpmish/LBVH/tree/main/python for some basic examples of bounding box queries.

C++

To build from source:

1. clone the repo

git clone [email protected]:samuelpmish/LBVH.git

2. configure CMake

cd LBVH
cmake . -Bbuild -DCMAKE_BUILD_TYPE=Release 

This project has a few (off by default) configure arguments that control which targets get built, including

  • LBVH_ENABLE_PYTHON_BINDINGS
  • LBVH_ENABLE_MATHEMATICA_BINDINGS
  • LBVH_ENABLE_TESTS

3. build

cmake --build build

To use LBVH in another CMake project, you can use FetchContent to automatically build it along with the parent CMake project

...

# fetch and build LBVH
include(FetchContent)
FetchContent_Declare(
  LBVH
  GIT_REPOSITORY https://github.com/samuelpmish/LBVH.git
  GIT_TAG main
)
set(LBVH_ENABLE_PYTHON_BINDINGS OFF CACHE INTERNAL "")
set(LBVH_ENABLE_MATHEMATICA_BINDINGS OFF CACHE INTERNAL "")
set(LBVH_ENABLE_TESTING OFF CACHE INTERNAL "")
FetchContent_MakeAvailable(LBVH)

...

# link it against any targets in the parent project
target_link_libraries(my_project PUBLIC LBVH)

lbvh's People

Contributors

samuelpmish avatar samuelpmishllnl avatar dependabot[bot] avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.