Semantic Pointing for Object Picking in Complex 3D Environments
by Christian Kössler and Felix Kreuzer
 All Classes Files Functions Variables Macros Pages
PickingHelper.hpp
Go to the documentation of this file.
1 #pragma once
2 #include "common.hpp"
4 #define SCALE_MAX 1.0
5 #define SCALE_MIN 0.1
12 class PickingHelper
13 {
14  public:
15 
20  static PickingHelper* getInstance();
21 
25  ~PickingHelper();
26 
38  void checkNN(const GLint* pickbuffer_window, const int x_size, const int y_size, const int x_center, const int y_center, int& id, double& distance);
39 
48  double scale_by_distance(double distance);
49 
59  double springInput(double lastValue, double targetValue, double deltaTime, double springConstant);
60 
66  double changeCutoffDistance(double deltaC)
67  {
68  m_mouse_cutoff_distance = glm::clamp(m_mouse_cutoff_distance + deltaC, 0.0, 2203.0);
69  m_pickingbuffer_window_width = 2 * m_mouse_cutoff_distance / sqrt(2.0f);
70  return m_mouse_cutoff_distance;
71  };
72 
81  double changeMinScale(double delta_m){m_mouse_min_scale = glm::clamp(m_mouse_min_scale + delta_m, SCALE_MIN, m_mouse_max_scale); return m_mouse_min_scale;};
82 
89  double changeMaxScale(double delta_M){m_mouse_max_scale = glm::clamp(m_mouse_max_scale + delta_M, m_mouse_min_scale, SCALE_MAX); return m_mouse_max_scale;};
90 
98  double changeInverseExponent(double delta_S){m_mouse_scaling_exponent = glm::clamp(m_mouse_scaling_exponent + delta_S, 0.5, 50.0); return m_mouse_scaling_exponent;};
99 
104  bool toggleNaiveSearch() {m_useNaiveSearch = !m_useNaiveSearch;return m_useNaiveSearch;};
105 
110  bool toggleLinearScaling() {m_useLinearScaling = !m_useLinearScaling;return m_useLinearScaling;};
111 
116  bool toggleBubbleCursor() {m_showBubbleCursor = !m_showBubbleCursor;return m_showBubbleCursor;};
117 
121  void togglePickbufferRectangle() {m_showPickbufferRectangle = !m_showPickbufferRectangle;};
122 
123  bool m_useLinearScaling;
129 private:
130 
135 
139  PickingHelper();
140 
153  void checkNN_sophisticated(const GLint* pickbuffer_window, const int x_size, const int y_size, const int x_center, const int y_center, int& id, double& distance);
154 
166  void checkNN_naive(const GLint* pickbuffer_window, const int x_size, const int y_size, const int x_center, const int y_center, int& id, double& distance);
167 
178  double mouse_scale_linear(double distance);
179 
190  double mouse_scale_inverse(double distance);
191 
192  //VARIABLES
197 };
198 
double changeMaxScale(double delta_M)
Use this method to safely change the maximum value of the scale function interval.
Definition: PickingHelper.hpp:89
void togglePickbufferRectangle()
Toggles wheather the pickbuffer window should be displayed additionally.
Definition: PickingHelper.hpp:121
double changeMinScale(double delta_m)
Use this method to safely change the minumum value of the scale function interval.
Definition: PickingHelper.hpp:81
bool m_showPickbufferRectangle
pickbuffer rectangle visualization switch
Definition: PickingHelper.hpp:125
bool m_useNaiveSearch
search algorithm switch
Definition: PickingHelper.hpp:124
bool m_showBubbleCursor
bubble - / crosshair cursor switch
Definition: PickingHelper.hpp:126
double m_mouse_max_scale
maximum scale function value
Definition: PickingHelper.hpp:194
static PickingHelper * singletonPointer
The singleton pointer.
Definition: PickingHelper.hpp:134
#define SCALE_MIN
Global minimum mouse scale factor.
Definition: PickingHelper.hpp:5
double m_mouse_cutoff_distance
Cutoff distance.
Definition: PickingHelper.hpp:195
bool toggleBubbleCursor()
Toggles wheather the bubble cursor should be displayed or the standard cursor.
Definition: PickingHelper.hpp:116
bool toggleNaiveSearch()
Toggles between usage of the naive- and the sophicticated pickbuffer search algorithm.
Definition: PickingHelper.hpp:104
Semantic Pointing for Object Picking in Complex 3D Environments This file is responsible the non-open...
Definition: PickingHelper.hpp:12
bool toggleLinearScaling()
Toggles between usage of the linear- and the inverse scaling function.
Definition: PickingHelper.hpp:110
#define SCALE_MAX
Global maximum mouse scale factor.
Definition: PickingHelper.hpp:4
double changeInverseExponent(double delta_S)
Use this method to safely change the exponent of the inverse scale function.
Definition: PickingHelper.hpp:98
double m_mouse_min_scale
minimum scale function value
Definition: PickingHelper.hpp:193
double m_mouse_scaling_exponent
exponent in inverse scaling function
Definition: PickingHelper.hpp:196
double changeCutoffDistance(double deltaC)
Use this method to safely change the Cutoff - distance required for the linear scaling function...
Definition: PickingHelper.hpp:66
int m_pickingbuffer_window_width
Search width and height in pixel, assuming the window is quadratic.
Definition: PickingHelper.hpp:127