Viewer.h
1 /* This file is part of the Gudhi Library - https://gudhi.inria.fr/ - which is released under MIT.
2  * See file LICENSE or go to https://gudhi.inria.fr/licensing/ for full license details.
3  * Author(s): David Salinas
4  *
5  * Copyright (C) 2014 Inria
6  *
7  * Modification(s):
8  * - YYYY/MM Author: Description of the modification
9  */
10 
11 #ifndef VIEW_VIEWER_H_
12 #define VIEW_VIEWER_H_
13 
14 #include <QGLViewer/qglviewer.h>
15 
16 #include <vector>
17 
18 #include "View_parameter.h"
19 #include "model/Complex_typedefs.h"
20 #include "Color.h"
21 #include "Viewer_instructor.h"
22 
23 class Viewer_instructor;
24 
25 class Viewer : public QGLViewer {
26  Q_OBJECT
27 
28  Viewer_instructor * instructor;
29 
33  double theta, phi;
34  typedef Complex::GT Gudhi_kernel;
35  typedef Gudhi_kernel::Point_3 Point_3;
36 
37  public:
38  Viewer(QWidget* parent);
39 
40  void set_instructor(Viewer_instructor* instructor_);
41 
42  void show_entire_scene();
43 
44  void draw();
45 
46  void set_bounding_box(const Point_3 & lower_left, const Point_3 & upper_right);
47 
48  void update_GL();
49 
50  void init_scene();
51 
52  void init_light();
53 
54  void set_light();
55 
56  void set_light_direction(double theta, double phi);
57 
61  void set_light_direction();
62 
63  protected:
64  virtual void postSelection(const QPoint& point);
65 
66  public:
68  // draw
70  void set_size_point(double size_points);
71 
72  void set_color(const Color& color);
73 
74  void draw_point(const Point_3& p, const Color& color, double size_points);
75 
76  void begin_draw_points(double size, bool light = false);
77 
78  void draw_points(const Point_3 & point);
79 
80  void end_draw_points();
81 
82  void draw_edge(const Point_3 &a, const Point_3 &b, const Color& color, double size);
83 
84  void begin_draw_edges(double size, bool light = false);
85 
86  void draw_edges(const Point_3 &a, const Point_3 &b);
87 
88  void end_draw_edges();
89 
90  void begin_draw_triangles(double size, bool light, bool transparent = false);
91 
92  void draw_triangles(const Point_3& p1, const Point_3& p2, const Point_3& p3);
93 
94  // todo remove
95  void draw_triangles(const std::vector<Point_3*>& points);
96 
97  void end_draw_triangles();
98 
99 
100  signals:
101  void click(const Point_3& position);
102 };
103 
104 #endif // VIEW_VIEWER_H_
GUDHIdev  Version 3.5.0  - C++ library for Topological Data Analysis (TDA) and Higher Dimensional Geometry Understanding.  - Copyright : MIT Generated on Wed Apr 6 2022 19:26:28 for GUDHIdev by Doxygen 1.9.1