Easy3D 2.5.3
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:
46 explicit PointCloudPicker(const Camera *cam);
47
51 unsigned int resolution() const { return hit_resolution_; }
55 void set_resolution(unsigned int r) { hit_resolution_ = r; }
56
63 PointCloud::Vertex pick_vertex(PointCloud *model, int x, int y);
64
71 void pick_vertices(PointCloud *model, const Rect& rect, bool deselect);
72
79 void pick_vertices(PointCloud *model, const Polygon2 &plg, bool deselect);
80
81 private:
82 // pick implemented in CPU (with OpenMP if supported)
83 PointCloud::Vertex pick_vertex_cpu(PointCloud *model, int x, int y);
84
85 // pick plain points implemented in GPU (using shader program)
86 PointCloud::Vertex pick_vertex_gpu_plain(PointCloud *model, int x, int y);
87
88 // pick sphere points implemented in GPU (using shader program)
89 PointCloud::Vertex pick_vertex_gpu_sphere(PointCloud *model, int x, int y);
90
91 private:
92 unsigned int hit_resolution_; // in pixels
93 ShaderProgram* program_;
94 };
95
96}
97
98#endif // EASY3D_GUI_PICKER_POINT_CLOUD_H
A perspective or orthographic camera.
Definition: camera.h:116
A 2D polygon representation.
Definition: polygon.h:41
The GenericRect class defines a rectangle in the 2D space.
Definition: rect.h:42
Base class for picking mechanism.
Definition: picker.h:43
A data structure for point clouds.
Definition: point_cloud.h:45
Implementation of picking points from a point cloud.
Definition: picker_point_cloud.h:44
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:51
void set_resolution(unsigned int r)
Sets the picker resolution (in pixels).
Definition: picker_point_cloud.h:55
OpenGL Shader Compilation.
Definition: shader_program.h:78
Definition: collider.cpp:182
this type represents a vertex (internally it is basically an index)
Definition: point_cloud.h:96