Semantic Pointing for Object Picking in Complex 3D Environments This file is responsible the non-opengl related calculations in our implementation.
More...
#include <PickingHelper.hpp>
|
| ~PickingHelper () |
| PickingHelper class destructor.
|
|
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) |
| Searches pickbuffer window for nearest objects and returns the nearest objects ID and its euclidean distance to the mouse cursor. More...
|
|
double | scale_by_distance (double distance) |
| Scaling function Calls either mouse_scale_linear or mouse_scale_inverse and returns the scale factor. More...
|
|
double | springInput (double lastValue, double targetValue, double deltaTime, double springConstant) |
| Uses Spring function to smooth out input. More...
|
|
double | changeCutoffDistance (double deltaC) |
| Use this method to safely change the Cutoff - distance required for the linear scaling function. More...
|
|
double | changeMinScale (double delta_m) |
| Use this method to safely change the minumum value of the scale function interval. More...
|
|
double | changeMaxScale (double delta_M) |
| Use this method to safely change the maximum value of the scale function interval. More...
|
|
double | changeInverseExponent (double delta_S) |
| Use this method to safely change the exponent of the inverse scale function. More...
|
|
bool | toggleNaiveSearch () |
| Toggles between usage of the naive- and the sophicticated pickbuffer search algorithm. More...
|
|
bool | toggleLinearScaling () |
| Toggles between usage of the linear- and the inverse scaling function. More...
|
|
bool | toggleBubbleCursor () |
| Toggles wheather the bubble cursor should be displayed or the standard cursor. More...
|
|
void | togglePickbufferRectangle () |
| Toggles wheather the pickbuffer window should be displayed additionally.
|
|
|
| PickingHelper () |
| PickingHelper class constructor.
|
|
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) |
| Searches pickbuffer window for nearest objects and returns the nearest objects ID and its euclidean distance to the mouse cursor. More...
|
|
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) |
| Searches pickbuffer window for nearest objects and returns the nearest objects ID and its euclidean distance to the mouse cursor. More...
|
|
double | mouse_scale_linear (double distance) |
| Linear scaling function Returns a scaling factor based on the input euclidean distance. More...
|
|
double | mouse_scale_inverse (double distance) |
| Inverse scaling function Returns a scaling factor based on the input euclidean distance. More...
|
|
Semantic Pointing for Object Picking in Complex 3D Environments This file is responsible the non-opengl related calculations in our implementation.
double PickingHelper::changeCutoffDistance |
( |
double |
deltaC | ) |
|
|
inline |
Use this method to safely change the Cutoff - distance required for the linear scaling function.
- Parameters
-
deltaC | desired difference in cutoff distance. |
- Returns
- the new value.
double PickingHelper::changeInverseExponent |
( |
double |
delta_S | ) |
|
|
inline |
Use this method to safely change the exponent of the inverse scale function.
its range is limited by [0.1, 50.0]
- See also
- m_mouse_scaling_exponent
- Parameters
-
delta_S | desired difference in exponent. |
- Returns
- the new value.
double PickingHelper::changeMaxScale |
( |
double |
delta_M | ) |
|
|
inline |
Use this method to safely change the maximum value of the scale function interval.
its range is limited by [
- See also
- m_mouse_min_scale,
-
SCALE_MAX]
- Parameters
-
delta_M | desired difference in maximum interval. |
- Returns
- the new value.
double PickingHelper::changeMinScale |
( |
double |
delta_m | ) |
|
|
inline |
Use this method to safely change the minumum value of the scale function interval.
its range is limited by [ SCALE_MIN, m_mouse_max_scale]
- See also
- SCALE_MIN
-
m_mouse_max_scale
- Parameters
-
delta_m | desired difference in minimum interval. |
- Returns
- the new value.
void PickingHelper::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 |
|
) |
| |
Searches pickbuffer window for nearest objects and returns the nearest objects ID and its euclidean distance to the mouse cursor.
This method calls one of the private members
- See also
- checkNN_naive or
-
checkNN_sophisticated, depending on the flag m_useNaiveSearch.
- Parameters
-
pickbuffer_window | The pickbuffer window. It's supposed to contain object IDs > 0 whenever a pixel for a pickable object is drawn. |
x_size | Absolute width of the pickbuffer window. |
y_size | Absolute height of the pickbuffer window. |
x_center | Absolute mouse cursor x-location relative to pickbuffer_window origin. |
y_center | Absolute mouse cursor y-location relative to pickbuffer_window origin. |
id | Stores the object ID of the nearest object. Will be 0 if no object is found. |
distance | Stores the euclidean distance from the mouse cursor to the nearest object. Will be |
- See also
- DBL_MAX if no object is found.
void PickingHelper::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 |
|
) |
| |
|
private |
Searches pickbuffer window for nearest objects and returns the nearest objects ID and its euclidean distance to the mouse cursor.
This is a naive implementation. It runs through all entries in the pickbuffer. Due to its simplicity it is very fast for small pickbuffer windows.
- Parameters
-
pickbuffer_window | The pickbuffer window. It's supposed to contain object IDs > 0 whenever a pixel for a pickable object is drawn. |
x_size | Absolute width of the pickbuffer window. |
y_size | Absolute height of the pickbuffer window. |
x_center | Absolute mouse cursor x-location relative to pickbuffer_window origin. |
y_center | Absolute mouse cursor y-location relative to pickbuffer_window origin. |
id | Stores the object ID of the nearest object. Will be 0 if no object is found. |
distance | Stores the euclidean distance from the mouse cursor to the nearest object. Will be DBL_MAX |
- See also
- DBL_MAX if no object is found.
void PickingHelper::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 |
|
) |
| |
|
private |
Searches pickbuffer window for nearest objects and returns the nearest objects ID and its euclidean distance to the mouse cursor.
This implementation is a bit more sophisticated, than the naive approach. It searches for nearest objects by growing the search region starting from the mouse center until it hits an object. This will increase search performance, as long as objects are nearby.
- Parameters
-
pickbuffer_window | The pickbuffer window. It's supposed to contain object IDs > 0 whenever a pixel for a pickable object is drawn. |
x_size | Absolute width of the pickbuffer window. |
y_size | Absolute height of the pickbuffer window. |
x_center | Absolute mouse cursor x-location relative to pickbuffer_window origin. |
y_center | Absolute mouse cursor y-location relative to pickbuffer_window origin. |
id | Stores the object ID of the nearest object. Will be 0 if no object is found. |
distance | Stores the euclidean distance from the mouse cursor to the nearest object. Will be DBL_MAX |
- See also
- DBL_MAX if no object is found.
Use this to access the object instance.
- Returns
- The singleton object instance
double PickingHelper::mouse_scale_inverse |
( |
double |
distance | ) |
|
|
private |
double PickingHelper::mouse_scale_linear |
( |
double |
distance | ) |
|
|
private |
double PickingHelper::scale_by_distance |
( |
double |
distance | ) |
|
double PickingHelper::springInput |
( |
double |
lastValue, |
|
|
double |
targetValue, |
|
|
double |
deltaTime, |
|
|
double |
springConstant = 6.0 |
|
) |
| |
Uses Spring function to smooth out input.
Spring Equation used: out = targetValue + (lastValue-targetValue)*exp(-deltaTime*springConstant);
- Parameters
-
lastValue | the last value of teh variable. |
targetValue | The target value to smooth out. |
deltaTime | Time elapsed since last frame. |
springConstant | Spring Constant. Is 6 by default |
- Returns
- smoothed out value.
bool PickingHelper::toggleBubbleCursor |
( |
| ) |
|
|
inline |
Toggles wheather the bubble cursor should be displayed or the standard cursor.
- Returns
- the boolean state.
bool PickingHelper::toggleLinearScaling |
( |
| ) |
|
|
inline |
Toggles between usage of the linear- and the inverse scaling function.
- Returns
- the boolean state.
bool PickingHelper::toggleNaiveSearch |
( |
| ) |
|
|
inline |
Toggles between usage of the naive- and the sophicticated pickbuffer search algorithm.
- Returns
- the boolean state.
double PickingHelper::m_mouse_cutoff_distance |
|
private |
Cutoff distance.
If distance is higher than this threshold the maximum mouse scale factor will be output
The documentation for this class was generated from the following files:
- C:/Users/Felix/Documents/TU/VIS2/vis2/src/TheVengefulHandOfGod/src/PickingHelper.hpp
- C:/Users/Felix/Documents/TU/VIS2/vis2/src/TheVengefulHandOfGod/src/PickingHelper.cpp