Added ray module

This commit is contained in:
STP
2023-11-11 00:41:03 -05:00
parent ae9f35d116
commit 943f54a4b8
2 changed files with 23 additions and 4 deletions

15
src/ray.rs Normal file
View File

@@ -0,0 +1,15 @@
use nalgebra::Vector4;
pub struct Ray {
a: Vector4<f32>,
b: Vector4<f32>,
}
impl Ray {
fn new(_a: Vector4<f32>, _b: Vector4<f32>) -> Ray {
Ray { a: _a, b: _b }
}
fn at_t(self, t: f32) -> Vector4<f32> {
self.a + self.b * t
}
}