Extra tracers
This commit is contained in:
parent
33c51e425b
commit
716fe65841
|
|
@ -95,6 +95,35 @@ impl Space {
|
||||||
let p = loc.pos + corr * loc.rot * off;
|
let p = loc.pos + corr * loc.rot * off;
|
||||||
Location { pos: p, rot: corr * loc.rot }
|
Location { pos: p, rot: corr * loc.rot }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn trace_inner(&self, ray: Ray) -> Ray {
|
||||||
|
assert_eq!(self.which_subspace(ray.pos), Inner);
|
||||||
|
let cell = RectInside { rect: self.rect };
|
||||||
|
let ray = cell.ray_to_local(ray);
|
||||||
|
let ray = cell.to_boundary(ray).expect("Can't get outta here!");
|
||||||
|
cell.ray_to_global(ray)
|
||||||
|
}
|
||||||
|
|
||||||
|
fn trace_outer(&self, ray: Ray) -> Option<Ray> {
|
||||||
|
assert_eq!(self.which_subspace(ray.pos), Outer);
|
||||||
|
let cell = basic_shapes::Rect { size: vec2(self.rect.outer_radius, self.rect.external_halflength) };
|
||||||
|
if let Some(dist) = cell.trace_into(ray) {
|
||||||
|
Some(Ray { pos: ray.pos + ray.dir * dist, dir: ray.dir })
|
||||||
|
} else {
|
||||||
|
None
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn trace_boundary(&self, ray: Ray) -> Ray {
|
||||||
|
assert_eq!(self.which_subspace(ray.pos), Boundary);
|
||||||
|
let mut ray = ray;
|
||||||
|
loop {
|
||||||
|
ray = self.trace_step(ray);
|
||||||
|
if self.which_subspace(ray.pos) != Boundary {
|
||||||
|
break ray;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn draw_ray_2(gc: &mut Vec<Draw>, space: &Space, base: Vec2, dir: Vec2) {
|
fn draw_ray_2(gc: &mut Vec<Draw>, space: &Space, base: Vec2, dir: Vec2) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user