21 lines
489 B
Rust
21 lines
489 B
Rust
use ratio_ops::ratio::Ratio;
|
|
use crate::integer::{self,Planar64,Planar64Vec3};
|
|
|
|
pub struct Ray{
|
|
pub origin:Planar64Vec3,
|
|
pub direction:Planar64Vec3,
|
|
}
|
|
impl Ray{
|
|
pub fn extrapolate<Num,Den,N1,T1>(&self,t:Ratio<Num,Den>)->Planar64Vec3
|
|
where
|
|
Num:Copy,
|
|
Den:Copy,
|
|
Num:core::ops::Mul<Planar64,Output=N1>,
|
|
Planar64:core::ops::Mul<Den,Output=N1>,
|
|
N1:integer::Divide<Den,Output=T1>,
|
|
T1:integer::Fix<Planar64>,
|
|
{
|
|
self.origin+self.direction.map(|elem|(t*elem).divide().fix())
|
|
}
|
|
}
|