picking_structure
Result of a picking (picking_spheres...) with the selected index, the 3D position and the ray.
Fields and methods
Members of the struct picking_structure. Most of what you do with a CGP type goes through the free functions listed below.
Fields
bool active | True if the ray hit an element, false otherwise (the other fields except the ray are then not meaningful). |
int index | Index of the picked element in the array given to the picking function, -1 when nothing is picked. |
vec3 position | 3D position of the hit point on the picked sphere. |
vec3 normal | Normal at the hit point: the sphere normal for picking_spheres, the vertex normal for picking_mesh_vertex_as_sphere. |
vec3 ray_origin | Origin of the picking ray, the position of the camera. |
vec3 ray_direction | Unit direction of the picking ray, through the clicked point of the screen. |
vec2 screen_clicked | Clicked position in relative screen coordinates in [-1,1], as given to the picking function. |
Methods
| Builds an empty picking result: active false, index -1, zero vectors. src |
Functions taking a picking_structure
None.
Functions returning a picking_structure
Compute 2
Documented on another page
picking_mesh_vertex_as_sphereCasts the camera ray through the screen position and returns the closest vertex whose sphere of radius picking_distance it hits, with the hit point, the vertex normal and the vertex index (active is false if none).onvec2picking_spheresCast a ray through a screen position (normalized device coordinates) and return the closest hit among spheres of common radius, with its index, position and normal.onvec2
Operators
None.