(state: &mut DefaultRand)
| 22 | } |
| 23 | |
| 24 | pub fn random_in_unit_sphere(state: &mut DefaultRand) -> Vec3 { |
| 25 | loop { |
| 26 | let p = random_snorm_vec(state); |
| 27 | if p.magnitude_squared() >= 1.0 { |
| 28 | continue; |
| 29 | } |
| 30 | return p; |
| 31 | } |
| 32 | } |
| 33 | |
| 34 | pub fn reflect(v: Vec3, n: Vec3) -> Vec3 { |
| 35 | v - 2.0 * v.dot(n) * n |
no test coverage detected