rayx 0.1.1

Fast ray intersection using Baldwin-Weber algorithm
Documentation

RayX

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

Usage

Install rayx with

cargo add rayx

Example:

use rayx::{Ray, Triangle};

let tri = Triangle::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();

assert!((hit.t - 1.0).abs() < 1e-12);
assert!((hit.u - 0.25).abs() < 1e-12);
assert!((hit.v - 0.25).abs() < 1e-12);