Base class for picking mechanism.
More...
#include <easy3d/gui/picker.h>
|
| Picker (const Camera *cam) |
|
const Camera * | camera () 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...
|
|
Base class for picking mechanism.
- See also
- ModelPicker, PointCloudPicker, SurfaceMeshPicker
◆ picking_dir()
vec3 picking_dir |
( |
int |
x, |
|
|
int |
y |
|
) |
| const |
|
inline |
The picking direction, pointing inside the screen.
- Parameters
-
x | The cursor x-coordinate, relative to the left edge of the content area. |
y | The 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.
◆ picking_line()
Line3 picking_line |
( |
int |
x, |
|
|
int |
y |
|
) |
| const |
|
inline |
Construct a picking line.
- Parameters
-
x | The cursor x-coordinate, relative to the left edge of the content area. |
y | The 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.
◆ project()
Project a 3D point in the world coordinate system onto the 2D screen coordinate system.
- Parameters
-
p | A 3D point in the world coordinate system. |
- Returns
- The x and y components of the returned value denote the projected screen point expressed in the screen coordinate system, with (0, 0) being the upper left corner of the content area. The z component ranges between 0.0 (near plane) and 1.0 (excluded, far plane).
- 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.
◆ screen_to_opengl()
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.
- Parameters
-
x | The x-coordinate, relative to the left edge of the content area. |
y | The y-coordinate, relative to the top edge of the content area. |
gl_x | Returns the x component of the point in the OpenGL coordinate system. |
gl_y | Returns the y component of the point in the OpenGL coordinate system. |
width | The width of the OpenGL viewport (may not be identical to the width of the screen in pixels). |
height | The width of the OpenGL viewport (may not be identical to the height of the screen in pixels). |
◆ unproject()
vec3 unproject |
( |
int |
x, |
|
|
int |
y, |
|
|
float |
depth |
|
) |
| const |
|
inline |
Compute the world coordinates of a point defined in the screen coordinate system.
- Parameters
-
x | The cursor x-coordinate, relative to the left edge of the content area. |
y | The cursor y-coordinate, relative to the top edge of the content area. |
depth | The depth value of the screen point, ranging between 0.0 and 1.0 (excluded). |
- Returns
- The world unprojected coordinates of the screen point.
- 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.
The documentation for this class was generated from the following files:
- /Users/lnan/Documents/Projects/Easy3D/easy3d/gui/picker.h
- /Users/lnan/Documents/Projects/Easy3D/easy3d/gui/picker.cpp