View_parameter.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_VIEW_PARAMETER_H_
12 #define VIEW_VIEW_PARAMETER_H_
13 
14 #include <iostream>
15 
21  public:
22  bool light;
23  bool relative_light;
24 
25  double size_vertices;
26  double size_edges;
27  double light_edges; // in 0-1
28  double light_triangles; // in 0-1
29 
33  double theta;
34  double phi;
35 
36  enum VERTEX_MODE {
37  V_NONE, V_SIMPLE, V_COUNT
38  };
39 
40  enum EDGE_MODE {
41  E_NONE, E_SIMPLE, E_COUNT
42  };
43 
44  enum TRIANGLE_MODE {
45  T_NONE, T_SIMPLE, T_COUNT
46  };
47 
48  VERTEX_MODE vertex_mode;
49  EDGE_MODE edge_mode;
50  TRIANGLE_MODE triangle_mode;
51 
52  void change_vertex_mode() {
53  int current_value = vertex_mode;
54  vertex_mode = static_cast<VERTEX_MODE> (++current_value % V_COUNT);
55  std::clog << "Vertex mode : ";
56  switch (vertex_mode) {
57  case V_NONE:
58  std::clog << "empty\n";
59  break;
60  case V_SIMPLE:
61  std::clog << "simple\n";
62  break;
63  default:
64  break;
65  }
66  }
67 
68  void change_vertex_mode(int new_mode) {
69  vertex_mode = static_cast<VERTEX_MODE> (new_mode % V_COUNT);
70  }
71 
72  void change_edge_mode() {
73  int current_value = edge_mode;
74  edge_mode = static_cast<EDGE_MODE> (++current_value % E_COUNT);
75  }
76 
77  void change_edge_mode(int new_mode) {
78  edge_mode = static_cast<EDGE_MODE> (new_mode % E_COUNT);
79  }
80 
81  void change_triangle_mode() {
82  int current_value = triangle_mode;
83  triangle_mode = static_cast<TRIANGLE_MODE> (++current_value % T_COUNT);
84  }
85 
86  View_parameter() {
87  light = true;
88  relative_light = true;
89  vertex_mode = V_SIMPLE;
90  edge_mode = E_SIMPLE;
91  triangle_mode = T_NONE;
92 
93  size_vertices = 3;
94  size_edges = 2;
95 
96  light_edges = 0.3;
97  light_triangles = 0.85;
98  theta = 0;
99  phi = 0;
100  }
101 
102  friend std::ostream& operator<<(std::ostream& stream, const View_parameter& param) {
103  stream << param.light << " ";
104  stream << param.relative_light << " ";
105  stream << param.vertex_mode << " ";
106  stream << param.edge_mode << " ";
107  stream << param.triangle_mode << " ";
108  stream << param.size_vertices << " ";
109  stream << param.size_edges << " ";
110  stream << param.light_edges << " ";
111  stream << param.light_triangles << " ";
112  stream << param.theta << " ";
113  stream << param.phi << " ";
114  return stream;
115  }
116 
117  friend std::istream& operator>>(std::istream& stream, View_parameter& param) {
118  stream >> param.light;
119  stream >> param.relative_light;
120  int a;
121  stream >> a;
122  param.vertex_mode = static_cast<VERTEX_MODE> (a % V_COUNT);
123  stream >> a;
124  param.edge_mode = static_cast<EDGE_MODE> (a % E_COUNT);
125  stream >> a;
126  param.triangle_mode = static_cast<TRIANGLE_MODE> (a % T_COUNT);
127  stream >> a;
128  stream >> param.size_vertices;
129  stream >> param.size_edges;
130  stream >> param.light_edges;
131  stream >> param.light_triangles;
132  stream >> param.theta;
133  stream >> param.phi;
134  return stream;
135  }
136 };
137 
138 #endif // VIEW_VIEW_PARAMETER_H_
Definition: View_parameter.h:20
double theta
Definition: View_parameter.h:33
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