cleaning up from upstream merge

This commit is contained in:
jeff 2013-11-06 18:43:56 -08:00
parent a53f9913a8
commit fd7003dc98
2 changed files with 6 additions and 6 deletions

View file

@ -35,12 +35,12 @@ fn test_from_points() {
#[test]
fn test_ray_intersection() {
let p0 = Plane::from_abcd(1f64, 0f64, 0f64, -7f64);
let r0 = Ray3::new(Point3::new(2f64, 3f64, 4f64), Vec3::new(1f64, 1f64, 1f64).normalize());
let r0: Ray3<f64> = Ray::new(Point3::new(2f64, 3f64, 4f64), Vec3::new(1f64, 1f64, 1f64).normalize());
assert_eq!((p0, r0).intersection(), Some(Point3::new(7f64, 8f64, 9f64)));
let p1 = Plane::from_points(Point3::new(5f64, 0f64, 5f64),
Point3::new(5f64, 5f64, 5f64),
Point3::new(5f64, 0f64, -1f64)).unwrap();
let r1 = Ray3::new(Point3::new(0f64, 0f64, 0f64), Vec3::new(-1f64, 0f64, 0f64).normalize());
let r1: Ray3<f64> = Ray::new(Point3::new(0f64, 0f64, 0f64), Vec3::new(-1f64, 0f64, 0f64).normalize());
assert_eq!((p1, r1).intersection(), None); // r1 points away from p1
}

View file

@ -8,10 +8,10 @@ use std::num;
#[test]
fn test_intersection() {
let sphere = Sphere {center: Point3::new(0f64,0f64,0f64), radius: 1f64};
let r0 = Ray3::new(Point3::new(0f64, 0f64, 5f64), Vec3::new(0f64, 0f64, -5f64).normalize());
let r1 = Ray3::new(Point3::new(num::cos(1f64), 0f64, 5f64), Vec3::new(0f64, 0f64, -5f64).normalize());
let r2 = Ray3::new(Point3::new(1f64, 0f64, 5f64), Vec3::new(0f64, 0f64, -5f64).normalize());
let r3 = Ray3::new(Point3::new(2f64, 0f64, 5f64), Vec3::new(0f64, 0f64, -5f64).normalize());
let r0: Ray3<f64> = Ray::new(Point3::new(0f64, 0f64, 5f64), Vec3::new(0f64, 0f64, -5f64).normalize());
let r1: Ray3<f64> = Ray::new(Point3::new(num::cos(1f64), 0f64, 5f64), Vec3::new(0f64, 0f64, -5f64).normalize());
let r2: Ray3<f64> = Ray::new(Point3::new(1f64, 0f64, 5f64), Vec3::new(0f64, 0f64, -5f64).normalize());
let r3: Ray3<f64> = Ray::new(Point3::new(2f64, 0f64, 5f64), Vec3::new(0f64, 0f64, -5f64).normalize());
assert_eq!((sphere,r0).intersection(), Some(Point3::new(0f64, 0f64, 1f64)));
assert_approx_eq!((sphere,r1).intersection().unwrap(), Point3::new(num::cos(1f64), 0f64, num::sin(1f64)));
assert_eq!((sphere,r2).intersection(), Some(Point3::new(1f64, 0f64, 0f64)));