Add object crossings
This commit is contained in:
parent
6da6944fa3
commit
8e7a57761e
|
|
@ -58,6 +58,18 @@ fn draw_ellipse(center: Vec3, u: Vec3, v: Vec3) -> Line {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn draw_mark(pos: Vec3) -> Vec<Line> {
|
||||||
|
[
|
||||||
|
vec3(1., 1., 1.),
|
||||||
|
vec3(1., 1., -1.),
|
||||||
|
vec3(1., -1., 1.),
|
||||||
|
vec3(1., -1., -1.),
|
||||||
|
]
|
||||||
|
.into_iter()
|
||||||
|
.map(|off| draw_line(pos - off, pos + off))
|
||||||
|
.collect()
|
||||||
|
}
|
||||||
|
|
||||||
pub fn build() -> Vec<FancyLine> {
|
pub fn build() -> Vec<FancyLine> {
|
||||||
let tube = Tube {
|
let tube = Tube {
|
||||||
inner_radius: 30.0,
|
inner_radius: 30.0,
|
||||||
|
|
@ -104,11 +116,17 @@ pub fn build() -> Vec<FancyLine> {
|
||||||
fn draw_ray_2(gc: &mut Vec<Line>, space: &Space, camera: Location, dir: Vec3) {
|
fn draw_ray_2(gc: &mut Vec<Line>, space: &Space, camera: Location, dir: Vec3) {
|
||||||
let pos = vec3(0., 0., 0.);
|
let pos = vec3(0., 0., 0.);
|
||||||
let (hits, path) = space.trace_dbg(camera, Ray { pos, dir });
|
let (hits, path) = space.trace_dbg(camera, Ray { pos, dir });
|
||||||
let hits2 = space.trace(camera, Ray { pos, dir });
|
if true {
|
||||||
for (a, b) in hits.into_iter().zip(hits2.into_iter()) {
|
let hits2 = space.trace(camera, Ray { pos, dir });
|
||||||
assert_eq!(a.id, b.id);
|
for (a, b) in hits.iter().zip(hits2.into_iter()) {
|
||||||
assert_eq!(a.pos, b.pos);
|
assert_eq!(a.id, b.id);
|
||||||
assert_eq!(a.rel, b.rel);
|
assert_eq!(a.pos, b.pos);
|
||||||
|
assert_eq!(a.rel, b.rel);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for hit in hits {
|
||||||
|
gc.extend(draw_mark(hit.pos));
|
||||||
}
|
}
|
||||||
|
|
||||||
let mut pts = path.points;
|
let mut pts = path.points;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user