Rename “outer” to “global” as that’s what it is
This commit is contained in:
parent
a31a950eca
commit
7f560a2b49
|
|
@ -70,8 +70,8 @@ impl Space {
|
||||||
let objs = self.list_objects_inner();
|
let objs = self.list_objects_inner();
|
||||||
let dist = Rect { size }.trace_out_of(ray).expect("Can't get outta here!");
|
let dist = Rect { size }.trace_out_of(ray).expect("Can't get outta here!");
|
||||||
FlatTraceResult {
|
FlatTraceResult {
|
||||||
end: Some(self.tube.inner_to_outer(ray.forward(dist))),
|
end: Some(self.tube.inner_to_global(ray.forward(dist))),
|
||||||
objects: Self::hit_objects(objs.as_slice(), ray, dist, |pos| self.tube.inner_to_outer(pos)),
|
objects: Self::hit_objects(objs.as_slice(), ray, dist, |pos| self.tube.inner_to_global(pos)),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -154,9 +154,9 @@ impl Space {
|
||||||
Outer => vec![b],
|
Outer => vec![b],
|
||||||
Inner => {
|
Inner => {
|
||||||
let n = ((b - a).length() / step) as usize + 1;
|
let n = ((b - a).length() / step) as usize + 1;
|
||||||
let a = self.tube.outer_to_inner(a);
|
let a = self.tube.global_to_inner(a);
|
||||||
let b = self.tube.outer_to_inner(b);
|
let b = self.tube.global_to_inner(b);
|
||||||
(1..=n).map(|k| self.tube.inner_to_outer(a.lerp(b, k as f32 / n as f32))).collect()
|
(1..=n).map(|k| self.tube.inner_to_global(a.lerp(b, k as f32 / n as f32))).collect()
|
||||||
}
|
}
|
||||||
Boundary => panic!("Can't draw a line here!"),
|
Boundary => panic!("Can't draw a line here!"),
|
||||||
}
|
}
|
||||||
|
|
@ -230,31 +230,31 @@ mod coords {
|
||||||
use super::Tube;
|
use super::Tube;
|
||||||
|
|
||||||
pub trait Mapper<T> {
|
pub trait Mapper<T> {
|
||||||
fn inner_to_outer(self, v: T) -> T;
|
fn inner_to_global(self, v: T) -> T;
|
||||||
fn outer_to_inner(self, v: T) -> T;
|
fn global_to_inner(self, v: T) -> T;
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Mapper<Vec2> for Tube {
|
impl Mapper<Vec2> for Tube {
|
||||||
fn inner_to_outer(self, pos: Vec2) -> Vec2 {
|
fn inner_to_global(self, pos: Vec2) -> Vec2 {
|
||||||
vec2(pos.x, self.y(pos.y))
|
vec2(pos.x, self.y(pos.y))
|
||||||
}
|
}
|
||||||
|
|
||||||
fn outer_to_inner(self, pos: Vec2) -> Vec2 {
|
fn global_to_inner(self, pos: Vec2) -> Vec2 {
|
||||||
vec2(pos.x, self.v(pos.y))
|
vec2(pos.x, self.v(pos.y))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Mapper<Ray> for Tube {
|
impl Mapper<Ray> for Tube {
|
||||||
fn inner_to_outer(self, ray: Ray) -> Ray {
|
fn inner_to_global(self, ray: Ray) -> Ray {
|
||||||
Ray {
|
Ray {
|
||||||
pos: self.inner_to_outer(ray.pos),
|
pos: self.inner_to_global(ray.pos),
|
||||||
dir: vec2(ray.dir.x, self.dy(ray.pos.y) * ray.dir.y),
|
dir: vec2(ray.dir.x, self.dy(ray.pos.y) * ray.dir.y),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn outer_to_inner(self, ray: Ray) -> Ray {
|
fn global_to_inner(self, ray: Ray) -> Ray {
|
||||||
Ray {
|
Ray {
|
||||||
pos: self.outer_to_inner(ray.pos),
|
pos: self.global_to_inner(ray.pos),
|
||||||
dir: vec2(ray.dir.x, self.dv(ray.pos.y) * ray.dir.y),
|
dir: vec2(ray.dir.x, self.dv(ray.pos.y) * ray.dir.y),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user