Easy3D 2.5.3
SurfaceMeshPicker Class Reference

Implementation of picking elements (i.e, vertices, faces, edges) from a surface mesh. More...

#include <easy3d/gui/picker_surface_mesh.h>

Inheritance diagram for SurfaceMeshPicker:
Picker

Public Member Functions

 SurfaceMeshPicker (const Camera *cam)
 
unsigned int resolution () const
 Returns the picker resolution (in pixels). More...
 
void set_resolution (unsigned int r)
 Sets the picker resolution (in pixels). More...
 
SurfaceMesh::Face pick_face (SurfaceMesh *model, int x, int y)
 
SurfaceMesh::Vertex pick_vertex (SurfaceMesh *model, int x, int y)
 Pick a vertex from a surface mesh given the cursor position. More...
 
SurfaceMesh::Halfedge pick_edge (SurfaceMesh *model, int x, int y)
 Pick an edge from a surface mesh given the cursor position. More...
 
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. More...
 
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. More...
 
SurfaceMesh::Face picked_face () const
 Query the previously picked face. More...
 
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. More...
 
std::vector< SurfaceMesh::Facepick_faces (SurfaceMesh *model, const Rect &rect)
 Pick faces of a surface mesh by a rectangle. More...
 
std::vector< SurfaceMesh::Facepick_faces (SurfaceMesh *model, const Polygon2 &plg)
 Pick faces of a surface mesh by a polygon/lasso. 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 elements (i.e, vertices, faces, edges) from a surface mesh.

See also
Picker, ModelPicker, PointCloudPicker
Examples
Tutorial_402_FacePicker.

Member Function Documentation

◆ pick_edge() [1/2]

SurfaceMesh::Halfedge pick_edge ( SurfaceMesh model,
int  x,
int  y 
)

Pick an edge from a surface mesh given the cursor position.

Parameters
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 halfedge.

◆ pick_edge() [2/2]

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.

Parameters
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.
picked_faceThe picked face.
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 halfedge.
Attention
This method must be called after calling to pick_face(). The result is valid only if the picked_face is valid.

◆ pick_face()

SurfaceMesh::Face pick_face ( SurfaceMesh model,
int  x,
int  y 
)

Pick a face from a surface mesh given the cursor position.

Parameters
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 face.

◆ pick_faces() [1/2]

std::vector< SurfaceMesh::Face > pick_faces ( SurfaceMesh model,
const Polygon2 plg 
)

Pick faces of a surface mesh by a polygon/lasso.

Parameters
plgThe polygon region.
Returns
The faces selected during this operation (regardless of their previous status).

◆ pick_faces() [2/2]

std::vector< SurfaceMesh::Face > pick_faces ( SurfaceMesh model,
const Rect rect 
)

Pick faces of a surface mesh by a rectangle.

Parameters
rectThe rectangle region.
Returns
The faces selected during this operation (regardless of their previous status).

◆ pick_vertex() [1/2]

SurfaceMesh::Vertex pick_vertex ( SurfaceMesh model,
int  x,
int  y 
)

Pick a vertex from a surface mesh given the cursor position.

Parameters
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 vertex.

◆ pick_vertex() [2/2]

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.

Parameters
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.
picked_faceThe picked face.
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 vertex.
Attention
This method must be called after calling to pick_face(). The result is valid only if the picked_face is valid.

◆ picked_face()

SurfaceMesh::Face picked_face ( ) const

Query the previously picked face.

Returns
The previously picked face.
Attention
This method must be called after calling to one of the above pick element methods. The results is valid only if a face has been picked.

◆ picked_point()

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.

Parameters
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.
picked_faceThe picked face.
Returns
The xyz coordinate of the picked position.
Attention
This method must be called after calling to pick_face(). The result is valid only if the picked_face is valid.

◆ resolution()

unsigned int resolution ( ) const
inline

Returns the picker resolution (in pixels).

The picker resolution indicates the sensitivity for picking a vertex or an edge.

◆ set_resolution()

void set_resolution ( unsigned int  r)
inline

Sets the picker resolution (in pixels).

The picker resolution indicates the sensitivity for picking a vertex or an edge.


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