ft: 4: ray class + simpl gradient

This commit is contained in:
djaidjai committed 2026-04-15 12:11:04 +02:00
1 parent 8e96a0ba11
commit 67c1eb861d
3 files changed
+154 -23

No files matched your search

+27
View File
@@ -0,0 +1,27 @@
use crate::vec3::Vec3;
pub struct Ray {
origin: Vec3,
dir: Vec3,
}
impl Ray {
pub fn at(self, t: f32) -> Vec3 {
self.origin + t * self.dir
}
pub fn new(origin: Vec3, dir: Vec3) -> Ray {
Ray {
origin: origin,
dir: dir,
}
}
pub fn origin(&self) -> &Vec3 {
&self.origin
}
pub fn dir(&self) -> &Vec3 {
&self.dir
}
}
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.