diff --git a/src/bin/wireframe/scene.rs b/src/bin/wireframe/scene.rs index a938b37..eac5a5d 100644 --- a/src/bin/wireframe/scene.rs +++ b/src/bin/wireframe/scene.rs @@ -58,6 +58,18 @@ fn draw_ellipse(center: Vec3, u: Vec3, v: Vec3) -> Line { ) } +fn draw_mark(pos: Vec3) -> Vec { + [ + 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 { let tube = Tube { inner_radius: 30.0, @@ -104,11 +116,17 @@ pub fn build() -> Vec { fn draw_ray_2(gc: &mut Vec, space: &Space, camera: Location, dir: Vec3) { let pos = vec3(0., 0., 0.); let (hits, path) = space.trace_dbg(camera, Ray { pos, dir }); - let hits2 = space.trace(camera, Ray { pos, dir }); - for (a, b) in hits.into_iter().zip(hits2.into_iter()) { - assert_eq!(a.id, b.id); - assert_eq!(a.pos, b.pos); - assert_eq!(a.rel, b.rel); + if true { + let hits2 = space.trace(camera, Ray { pos, dir }); + for (a, b) in hits.iter().zip(hits2.into_iter()) { + assert_eq!(a.id, b.id); + 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;