| 8 | namespace sk { |
| 9 | |
| 10 | bool32_t plane_ray_intersect (plane_t plane, ray_t ray, vec3 *out_pt) { |
| 11 | // t = -(Pi . N + d) / (V . N) |
| 12 | // Pf = Pi + tV |
| 13 | float t = |
| 14 | -(vec3_dot(ray.pos, plane.normal) + plane.d) / |
| 15 | vec3_dot(ray.dir, plane.normal); |
| 16 | *out_pt = ray.pos + ray.dir * t; |
| 17 | return t >= 0; |
| 18 | } |
| 19 | |
| 20 | /////////////////////////////////////////// |
| 21 |
no test coverage detected