Functional tracer
This commit is contained in:
parent
716fe65841
commit
a82441677d
|
|
@ -116,13 +116,9 @@ impl Space {
|
||||||
|
|
||||||
fn trace_boundary(&self, ray: Ray) -> Ray {
|
fn trace_boundary(&self, ray: Ray) -> Ray {
|
||||||
assert_eq!(self.which_subspace(ray.pos), Boundary);
|
assert_eq!(self.which_subspace(ray.pos), Boundary);
|
||||||
let mut ray = ray;
|
std::iter::successors(Some(ray), |&ray| Some(self.trace_step(ray)))
|
||||||
loop {
|
.find(|&ray| self.which_subspace(ray.pos) != Boundary)
|
||||||
ray = self.trace_step(ray);
|
.expect("Can't get outta the wall!")
|
||||||
if self.which_subspace(ray.pos) != Boundary {
|
|
||||||
break ray;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user