Easy3D 2.6.1
Loading...
Searching...
No Matches
picker_point_cloud.h
1/********************************************************************
2 * Copyright (C) 2015 Liangliang Nan <liangliang.nan@gmail.com>
3 * https://3d.bk.tudelft.nl/liangliang/
4 *
5 * This file is part of Easy3D. If it is useful in your research/work,
6 * I would be grateful if you show your appreciation by citing it:
7 * ------------------------------------------------------------------
8 * Liangliang Nan.
9 * Easy3D: a lightweight, easy-to-use, and efficient C++ library
10 * for processing and rendering 3D data.
11 * Journal of Open Source Software, 6(64), 3255, 2021.
12 * ------------------------------------------------------------------
13 *
14 * Easy3D is free software; you can redistribute it and/or modify
15 * it under the terms of the GNU General Public License Version 3
16 * as published by the Free Software Foundation.
17 *
18 * Easy3D is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU General Public License for more details.
22 *
23 * You should have received a copy of the GNU General Public License
24 * along with this program. If not, see <http://www.gnu.org/licenses/>.
25 ********************************************************************/
26
27#ifndef EASY3D_GUI_PICKER_POINT_CLOUD_H
28#define EASY3D_GUI_PICKER_POINT_CLOUD_H
29
30
31#include <easy3d/gui/picker.h>
32#include <easy3d/core/point_cloud.h>
33
34
35namespace easy3d {
36
37 class ShaderProgram;
38
44 class PointCloudPicker : public Picker {
45 public:
50 explicit PointCloudPicker(const Camera *cam);
51
58 unsigned int resolution() const { return hit_resolution_; }
59
66 void set_resolution(unsigned int r) { hit_resolution_ = r; }
67
75 PointCloud::Vertex pick_vertex(PointCloud *model, int x, int y);
76
84 void pick_vertices(PointCloud *model, const Rect& rect, bool deselect);
85
93 void pick_vertices(PointCloud *model, const Polygon2 &plg, bool deselect);
94
95 private:
96 // pick implemented in CPU (with OpenMP if supported)
97 PointCloud::Vertex pick_vertex_cpu(PointCloud *model, int x, int y);
98
99 // pick plain points implemented in GPU (using shader program)
100 PointCloud::Vertex pick_vertex_gpu_plain(PointCloud *model, int x, int y);
101
102 // pick sphere points implemented in GPU (using shader program)
103 PointCloud::Vertex pick_vertex_gpu_sphere(PointCloud *model, int x, int y);
104
105 private:
106 unsigned int hit_resolution_; // in pixels
107 ShaderProgram* program_;
108 };
109
110}
111
112#endif // EASY3D_GUI_PICKER_POINT_CLOUD_H
A perspective or orthographic camera.
Definition camera.h:113
Picker(const Camera *cam)
Constructor.
Definition picker.cpp:39
A data structure for point clouds.
Definition point_cloud.h:45
PointCloud::Vertex pick_vertex(PointCloud *model, int x, int y)
Pick vertex at a given screen location.
Definition picker_point_cloud.cpp:51
void pick_vertices(PointCloud *model, const Rect &rect, bool deselect)
Pick vertices of a point cloud by a rectangle. The selected vertices will be marked in vertex propert...
Definition picker_point_cloud.cpp:276
unsigned int resolution() const
Returns the picker resolution (in pixels).
Definition picker_point_cloud.h:58
PointCloudPicker(const Camera *cam)
Constructor.
Definition picker_point_cloud.cpp:42
void set_resolution(unsigned int r)
Sets the picker resolution (in pixels).
Definition picker_point_cloud.h:66
OpenGL Shader Compilation.
Definition shader_program.h:75
Definition collider.cpp:182
GenericPolygon< float > Polygon2
A 2D polygon of float type.
Definition types.h:116
GenericRect< float > Rect
A 2D axis-aligned rectangle of float type.
Definition types.h:111
This type represents a vertex (internally it is basically an index).
Definition point_cloud.h:129