All Projects → benraziel → bvh-tree

benraziel / bvh-tree

Licence: other
A Bounding Volume Hierarchy implementation using javascript

Programming Languages

javascript
184084 projects - #8 most used programming language
HTML
75241 projects
CSS
56736 projects

Projects that are alternatives of or similar to bvh-tree

ows4R
R Interface for OGC Web-Services (OWS)
Stars: ✭ 29 (-29.27%)
Mutual labels:  spatial
GeoJSON.Net.Contrib
Repository for all GeoJSON.Net *.Contrib projects
Stars: ✭ 31 (-24.39%)
Mutual labels:  spatial
wdpar
Interface to the World Database on Protected Areas
Stars: ✭ 27 (-34.15%)
Mutual labels:  spatial
geojson
GeoJSON classes for R
Stars: ✭ 32 (-21.95%)
Mutual labels:  spatial
Portal-Raycaster
A software portal rendering game engine
Stars: ✭ 41 (+0%)
Mutual labels:  raycasting
RayS
RayS: A Ray Searching Method for Hard-label Adversarial Attack (KDD2020)
Stars: ✭ 43 (+4.88%)
Mutual labels:  rays
r-spatial.org
r-spatial.org blog sources
Stars: ✭ 51 (+24.39%)
Mutual labels:  spatial
Spatial pre2021
This repo has been archived. The latest version of the GIS and Spatial Analysis online book is at https://github.com/mgimond/Spatial
Stars: ✭ 88 (+114.63%)
Mutual labels:  spatial
tile38
Real-time Geospatial and Geofencing
Stars: ✭ 8,117 (+19697.56%)
Mutual labels:  spatial
scanstatistics
An R package for space-time anomaly detection using scan statistics.
Stars: ✭ 41 (+0%)
Mutual labels:  spatial
delaunator-rs
Fast 2D Delaunay triangulation in Rust. A port of Delaunator.
Stars: ✭ 115 (+180.49%)
Mutual labels:  spatial
GeoJSON4EntityFramework
Create GeoJSON from Entity Framework Spatial Data or WKT
Stars: ✭ 18 (-56.1%)
Mutual labels:  spatial
binaural-audio-editor
This is an audio application that produces 3D binaural audio from 2D mono audio samples and positional information given by the graphical user interface. Listen to 3D audio through stereo headphones. Video Demo:https://www.youtube.com/watch?v=peF9cZSwVGw
Stars: ✭ 37 (-9.76%)
Mutual labels:  spatial
geometa
R tools to write, read & validate geographic metadata (OGC/ISO 19110, 19115, 19119, 19136 and 19139)
Stars: ✭ 37 (-9.76%)
Mutual labels:  spatial
GPU-Pathtracer
GPU Raytracer from scratch in C++/CUDA
Stars: ✭ 326 (+695.12%)
Mutual labels:  bvh
RaycastVisualization
This asset allows users to view raycasts as the user fires them.
Stars: ✭ 61 (+48.78%)
Mutual labels:  raycasting
genea visualizer
This repository provides scripts that can be used to visualize BVH files. These scripts were developed for the GENEA Challenge 2020, and enables reproducing the visualizations used for the challenge stimuli. The server consists of several containers which are launched together with the docker-compose.
Stars: ✭ 27 (-34.15%)
Mutual labels:  bvh
ComputeShaderBVHMeshHit
Unity ComputeShader implementation of BVH(Bounding Volume Hierarchy) based mesh hit checking.
Stars: ✭ 25 (-39.02%)
Mutual labels:  bvh
canvas-raycasting
Canvas + Raycasting Experiment
Stars: ✭ 17 (-58.54%)
Mutual labels:  raycasting
impact-tools
Simple blueprints for change-makers
Stars: ✭ 34 (-17.07%)
Mutual labels:  spatial

bvh-tree

A Bounding Volume Hierarchy data structure written in javascript, for spatial indexing of large triangle meshes. Enables fast intersection of rays with a triangle mesh.

Demo

ray-mesh intersection

Usage

Construct a BVH from a list of triangles

var triangle0 = [
  {x: 0.0, y: 0.0, z: 0.0},
  {x: 1000.0, y: 0.0, z: 0.0},
  {x:1000.0, y:1000.0, z:0.0}
];

var triangle1 = [
  {x: 0.0, y: 0.0, z: 0.0},
  {x: 2000.0, y: 0.0, z: 0.0},
  {x:2000.0, y:1000.0, z:0.0}
];

// the maximum number of triangles that can fit in a node before splitting it.
var maxTrianglesPerNode = 7; 

var bvh = new bvhtree.BVH([triangle0, triangle1], maxTrianglesPerNode);

Intersect a ray with the BVH

// origin point of the ray
var rayOrigin = {x: 1500.0, y: 3.0, z:1000};

// direction of the ray. should be normalized to unit length
var rayDirection = {x: 0, y:0, z:-1};

// if 'true', only intersections with front-faces of the mesh will be performed
var backfaceCulling = true;

var intersectionResult = bvh.intersectRay(rayOrigin, rayDirection, backfaceCulling);

intersectsRay() returns an array of intersection result objects, one for each triangle that intersected the ray. Each object contains the following properties:

  • triangle the triangle which the ray intersected
  • triangleIndex the position of the interescting triangle in the input triangle array provided to the BVH constructor.
  • intersectionPoint the interesection point of the ray on the triangle.

License

Copyright (c) 2015 Ben Raziel. MIT License

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].