Skip to main content

Crate rayx

Crate rayx 

Source
Expand description

RayX: a small, fast ray intersection library.

rayx is a small Rust ray intersection library using Baldwin-Weber’s Fast Ray-Triangle Intersections by Coordinate Transformation (JCGT 2016).

The precompute costs a little memory per triangle but reduces per-ray arithmetic.

§Performance

Baldwin-Weber consistently outperforms Moller-Trumbore in intersection time by 10-45%, depending on the scene, especially at f32 precision. The crossover point for the initialization overhead is at about 5 rays per triangle. Learn more in the README.md.

§Usage

use rayx::{Ray, Triangle};

let tri = Triangle::<f64>::new([0.0, 0.0, 0.0], [1.0, 0.0, 0.0], [0.0, 1.0, 0.0]).unwrap();

let ray = Ray::new([0.25, 0.25, 1.0], [0.0, 0.0, -1.0]);
let hit = tri.intersect(ray, 0.0, 10.0).unwrap();

Modules§

intersect

Structs§

Hit
Ray–triangle intersection result with the distance to intersection t at the barycentric coordinates (u, v).
Ray
A ray with parametric form o + t*d.
Triangle
Triangle with precomputed transform coefficients for fast intersection tests.

Enums§

TriangleError