Easy3D 2.5.3
ModelPicker Class Reference

Implementation of picking mechanism for set of models. More...

#include <easy3d/gui/picker_model.h>

Inheritance diagram for ModelPicker:
Picker

Public Member Functions

 ModelPicker (const Camera *cam)
 
Modelpick (const std::vector< Model * > &models, int x, int y)
 Pick a model from a set of models given the cursor position in the screen coordinate system. More...
 
- Public Member Functions inherited from Picker
 Picker (const Camera *cam)
 
const Cameracamera () const
 Returns the pointer of the camera.
 
Line3 picking_line (int x, int y) const
 Construct a picking line. More...
 
vec3 picking_dir (int x, int y) const
 The picking direction, pointing inside the screen. More...
 
vec3 project (const vec3 &p) const
 Project a 3D point in the world coordinate system onto the 2D screen coordinate system. More...
 
vec3 unproject (int x, int y, float depth) const
 Compute the world coordinates of a point defined in the screen coordinate system. More...
 
void screen_to_opengl (int x, int y, int &gl_x, int &gl_y, int width, int height) const
 Convert a point expressed in the screen coordinate system (with an origin in the upper left corner) into the OpenGL coordinate system (with an origin in the lower left corner). The high DPI scaling is also taken into consideration, so the result always corresponds to its image pixel. More...
 

Detailed Description

Implementation of picking mechanism for set of models.

See also
Picker, PointCloudPicker, SurfaceMeshPicker
Examples
Tutorial_401_ModelPicker, and Tutorial_405_ObjectManipulation.

Member Function Documentation

◆ pick()

Model * pick ( const std::vector< Model * > &  models,
int  x,
int  y 
)

Pick a model from a set of models given the cursor position in the screen coordinate system.

Parameters
modelsThe models
xThe cursor x-coordinate, relative to the left edge of the content area.
yThe cursor y-coordinate, relative to the top edge of the content area.
Attention
The screen point is expressed in the screen coordinate system with an origin in the upper left corner. So it doesn't necessarily correspond to a pixel on High DPI devices, e.g. a Mac with a Retina display.
Returns
The picked model.

The documentation for this class was generated from the following files: