Add another unit test for Ray struct
This commit is contained in:
parent
3244181a08
commit
78ea2b2e64
|
|
@ -54,4 +54,9 @@ mod tests {
|
||||||
.fold(0.0, |a, &b| a.max(b.abs())) * std::f64::EPSILON * 128.0;
|
.fold(0.0, |a, &b| a.max(b.abs())) * std::f64::EPSILON * 128.0;
|
||||||
(p2 - p1).cross(&(p3 - p2)).norm() < epsilon
|
(p2 - p1).cross(&(p3 - p2)).norm() < epsilon
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[quickcheck]
|
||||||
|
fn t_is_distance(ray: Ray<f64>, t: f64) -> bool {
|
||||||
|
(ray.point_at(t) - ray.origin).norm() - t.abs() < 0.0000000001
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue