Easy3D 2.6.1
|
Implementation of picking elements (i.e, vertices, faces, edges) from a surface mesh. More...
#include <easy3d/gui/picker_surface_mesh.h>
Public Member Functions | |
SurfaceMeshPicker (const Camera *cam) | |
Constructor. | |
~SurfaceMeshPicker () override=default | |
Destructor. | |
unsigned int | resolution () const |
Returns the picker resolution (in pixels). | |
void | set_resolution (unsigned int r) |
Sets the picker resolution (in pixels). | |
SurfaceMesh::Face | pick_face (SurfaceMesh *model, int x, int y) |
Pick a face from a surface mesh given the cursor position. | |
SurfaceMesh::Vertex | pick_vertex (SurfaceMesh *model, int x, int y) |
Pick a vertex from a surface mesh given the cursor position. | |
SurfaceMesh::Halfedge | pick_edge (SurfaceMesh *model, int x, int y) |
Pick an edge from a surface mesh given the cursor position. | |
SurfaceMesh::Vertex | pick_vertex (SurfaceMesh *model, SurfaceMesh::Face picked_face, int x, int y) |
Pick a vertex from a surface mesh given the cursor position and a known picked face. | |
SurfaceMesh::Halfedge | pick_edge (SurfaceMesh *model, SurfaceMesh::Face picked_face, int x, int y) |
Pick an edge from a surface mesh given the cursor position and a known picked face. | |
SurfaceMesh::Face | picked_face () const |
Query the previously picked face. | |
vec3 | picked_point (SurfaceMesh *model, SurfaceMesh::Face picked_face, int x, int y) const |
Query the coordinate of the previously picked position, which is the intersection between the picking line and the picked face. | |
std::vector< SurfaceMesh::Face > | pick_faces (SurfaceMesh *model, const Rect &rect) |
Pick faces of a surface mesh by a rectangle. | |
std::vector< SurfaceMesh::Face > | pick_faces (SurfaceMesh *model, const Polygon2 &plg) |
Pick faces of a surface mesh by a polygon/lasso. | |
![]() | |
Picker (const Camera *cam) | |
Constructor. | |
virtual | ~Picker () |
Destructor. | |
const Camera * | camera () const |
Returns the pointer of the camera. | |
Line3 | picking_line (int x, int y) const |
Construct a picking line. | |
vec3 | picking_dir (int x, int y) const |
The picking direction, pointing inside the screen. | |
vec3 | project (const vec3 &p) const |
Project a 3D point in the world coordinate system onto the 2D screen coordinate system. | |
vec3 | unproject (int x, int y, float depth) const |
Compute the world coordinates of a point defined in the screen coordinate system. | |
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. | |
Implementation of picking elements (i.e, vertices, faces, edges) from a surface mesh.
|
explicit |
Constructor.
cam | The camera used for picking. |
SurfaceMesh::Halfedge pick_edge | ( | SurfaceMesh * | model, |
int | x, | ||
int | y ) |
Pick an edge from a surface mesh given the cursor position.
model | The surface mesh model. |
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. |
SurfaceMesh::Halfedge pick_edge | ( | SurfaceMesh * | model, |
SurfaceMesh::Face | picked_face, | ||
int | x, | ||
int | y ) |
Pick an edge from a surface mesh given the cursor position and a known picked face.
model | The surface mesh model. |
picked_face | The picked face. |
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. |
SurfaceMesh::Face pick_face | ( | SurfaceMesh * | model, |
int | x, | ||
int | y ) |
Pick a face from a surface mesh given the cursor position.
model | The surface mesh model. |
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. |
std::vector< SurfaceMesh::Face > pick_faces | ( | SurfaceMesh * | model, |
const Polygon2 & | plg ) |
Pick faces of a surface mesh by a polygon/lasso.
model | The surface mesh model. |
plg | The polygon region. |
std::vector< SurfaceMesh::Face > pick_faces | ( | SurfaceMesh * | model, |
const Rect & | rect ) |
Pick faces of a surface mesh by a rectangle.
model | The surface mesh model. |
rect | The rectangle region. |
SurfaceMesh::Vertex pick_vertex | ( | SurfaceMesh * | model, |
int | x, | ||
int | y ) |
Pick a vertex from a surface mesh given the cursor position.
model | The surface mesh model. |
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. |
SurfaceMesh::Vertex pick_vertex | ( | SurfaceMesh * | model, |
SurfaceMesh::Face | picked_face, | ||
int | x, | ||
int | y ) |
Pick a vertex from a surface mesh given the cursor position and a known picked face.
model | The surface mesh model. |
picked_face | The picked face. |
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. |
SurfaceMesh::Face picked_face | ( | ) | const |
Query the previously picked face.
vec3 picked_point | ( | SurfaceMesh * | model, |
SurfaceMesh::Face | picked_face, | ||
int | x, | ||
int | y ) const |
Query the coordinate of the previously picked position, which is the intersection between the picking line and the picked face.
model | The surface mesh model. |
picked_face | The picked face. |
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. |
|
inline |
Returns the picker resolution (in pixels).
The picker resolution indicates the sensitivity for picking a vertex or an edge.
|
inline |
Sets the picker resolution (in pixels).
The picker resolution indicates the sensitivity for picking a vertex or an edge.
r | The new picker resolution in pixels. |