Home Reference Source
import {WorldOctreeRaycaster} from 'rabbit-hole'
public class | source

WorldOctreeRaycaster

A world octree raycaster.

This raycaster is a specialised hybrid that uses a voxel traversal algorithm to iterate over the octants of the highest LOD grid and an octree traversal algorithm to raycast the identified subtrees.

The voxel traversal implementation is a 3D supercover variant of the Digital Differential Analyzer (DDA) line algorithm and is similar to the Bresenham algorithm. The octree traversal algorithm relies on octant child existence information to skip empty space and to avoid hashmap lookup misses.

References:

"Voxel Traversal along a 3D Line" by D. Cohen (1994)

"An Efficient Parametric Algorithm for Octree Traversal" by J. Revelles et al. (2000)

Static Method Summary

Static Public Methods
public static

intersectWorldOctree(world: WorldOctree, ray: Ray, intersects: Array): WorldOctant[]

Finds (pseudo) leaf octants that intersect with the given ray.

Static Public Methods

public static intersectWorldOctree(world: WorldOctree, ray: Ray, intersects: Array): WorldOctant[] source

Finds (pseudo) leaf octants that intersect with the given ray.

Params:

NameTypeAttributeDescription
world WorldOctree

A world octree.

ray Ray

A ray.

intersects Array
  • optional

An optional target list to be filled with the intersecting octants.

Return:

WorldOctant[]

The intersecting octants. Sorted by distance, closest first.