URL: https://graphicscomputing.fr/cgp/reference/intersection_structure/
Description: Result of a ray intersection (valid flag, position and normal of the hit point).

# intersection_structure

Result of a ray intersection (valid flag, position and normal of the hit point).

Fields:

- `bool valid` - True if the ray hits the shape in front of its origin, false otherwise (position and normal then keep their default values).
- `vec3 position` - 3D position of the closest hit point in front of the ray origin, {0,0,0} by default.
- `vec3 normal` - Unit normal of the shape at the hit point, {0,0,1} by default.

Functions returning it:

- `intersection_structure intersection_ray_sphere(vec3 const& ray_origin, vec3 const& ray_direction, vec3 const& sphere_center, float sphere_radius)` - First intersection in front of the origin of a ray (unit direction expected) with a sphere, with its position and outward normal.
- `intersection_structure intersection_ray_plane(vec3 const& ray_origin, vec3 const& ray_direction, vec3 const& plane_position, vec3 const& plane_normal)` - Intersection in front of the origin of a ray with a plane given by a point and a normal, invalid if the ray is parallel to the plane.
- `intersection_structure intersection_ray_spheres_closest(vec3 const& ray_origin, vec3 const& ray_direction, numarray<vec3> const& sphere_centers, float sphere_radius, int* shape_index = nullptr)` - Closest intersection of a ray with a set of spheres of common radius, the index of the hit sphere (or -1) being written to shape_index if given.
- `intersection_structure picking_plane_orthogonal_to_camera(vec2 const& screen_position, vec3 const& plane_position, camera_generic_base const& camera, camera_projection_perspective const& projection)` - Intersects the camera ray through the screen position (relative coordinates) with the plane through plane_position orthogonal to the front direction of the camera.
