|
| VHSceneCanvas (DynScene &ds) |
| Default constructor for the visual Helios scene canvas. More...
|
|
| VHSceneCanvas (DynScene &ds, string const title, bool const normalsKeyboardCallbackEnabled=true, bool const normalsUsageTextEnabled=true, bool const renderingNormals=true, float const normalMagnitude=0.2) |
| Constructor for the visual Helios scene canvas which allows for title specification, flags configuration and normal magnitude specification. More...
|
|
void | configure () override |
|
void | start () override |
|
void | update () override |
|
void | renderNormals (VHStaticObjectAdapter &staticObj) override |
| Render normals for each primitive of given static object. More...
|
|
void | unrenderAllNormals () override |
| Remove all rendered normals. More...
|
|
| VHNormalsCanvas () |
| Default constructor for the visual Helios normals canvas. More...
|
|
| VHNormalsCanvas (string const title, bool const normalsKeyboardCallbackEnabled=true, bool const normalsUsageTextEnabled=true, bool const renderingNormals=true, float const normalMagnitude=1.0) |
| Main constructor for the visual helios normals canvas which allows for title specification, flags specification and normal magnitude specification too. More...
|
|
virtual bool | isRenderingNormals () const |
| Check whether the normals canvas is rendering normals or not. More...
|
|
virtual void | setRenderingNormals (bool const renderingNormals) |
| Enable or disable normals rendering. More...
|
|
virtual float | getNormalMagnitude () const |
| Obtain the magnitude for normal vectors visualization. More...
|
|
virtual void | setNormalMagnitude (float const normalMagnitude) |
| Set the magnitude for normal vectors visualization. More...
|
|
virtual bool | isNormalsKeyboardCallbackEnabled () const |
| Check whether normals keyboard callback is enabled (true) or not (false) More...
|
|
virtual bool | isNormalsUsageTextEnabled () const |
| Check whether normals usage text is enabled (true) or not (false) More...
|
|
virtual float const * | getNormalDefColor () const |
| Return the default color for normals visualization. More...
|
|
virtual void | setNormalDefColor (float const color[3]) |
| Set the default color for normals visualization. More...
|
|
virtual void | setNormalDefColor (float const r, float const g, float const b) |
| Set the default color for normals visualization. More...
|
|
| VHDynCanvas () |
| Default constructor for the visual Helios dynamic canvas. More...
|
|
| VHDynCanvas (string const title) |
| Constructor for the visual Helios dynamic canvas which allows for title specification. More...
|
|
virtual bool | isNeedingUpdate () const |
| Check whether the dynamic canvas needs an update no matter what (true) or not (false) More...
|
|
virtual void | setNeedsUpdate (bool const needsUpdate) |
| Specify if the dynamic canvas needs an update no matter what (true) or not (false) More...
|
|
| VHCanvas () |
| Default constructor for the visual helios canvas.
|
|
| VHCanvas (string const title) |
| Constructor for the visual helios canvas which allows for title specification. More...
|
|
virtual void | show () |
| Make the visualization effective.
|
|
int | getTimeBetweenUpdates () const |
| Obtain milliseconds between canvas updates. More...
|
|
void | setTimeBetweenUpdates (int const timeBetweenUpdates) |
| Set the milliseconds between canvas updates. More...
|
|
bool | isForceRedraw () const |
| Check if force redraw is enabled or not. More...
|
|
void | setForceRedraw (bool const forceRedraw) |
| Enable or disable force redraw. More...
|
|
string const & | getTitle () const |
| Obtain the visual helios canvas title. More...
|
|
|
shared_ptr< VHDynSceneAdapter< VHStaticObjectXYZRGBAdapter, VHDynObjectXYZRGBAdapter > > | dynScene |
| The dynamic scene that must be rendered.
|
|
bool | normalsKeyboardCallbackEnabled |
| Specify if the keyboard callback to toggle normals visualization is enabled (true) or not (false)
|
|
bool | normalsUsageTextEnabled |
| Specify if the normals keyboard callback usage text is enabled (true) or not (false)
|
|
bool | renderingNormals |
| Specify if the normals canvas must render normals (true) or not (false)
|
|
float | normalMagnitude |
| Specify the magnitude of normal vector for visualization.
|
|
float | normalDefColor [3] |
| Default color for normals in RGB format with components in \([0, 1]\).
|
|
bool | needsUpdate = false |
| Control whether an update is needed even when dynamic objects themselves have not been updated (true) or not (false)
|
|
string const | title |
| The title of the visual Helios canvas.
|
|
PCLVisualizer::Ptr | viewer |
| The PCL visualizer which is used to render graphics.
|
|
int | timeBetweenUpdates |
| How many milliseconds must elapsed between canvas updates.
|
|
bool | forceRedraw |
| Force redraw even when it is not required if true. Try to avoid unnecessary redraws if false.
|
|
Visual Helios Scene Canvas is a class which supports rendering a dynamic scene.
- Author
- Alberto M. Esmoris Pena
- Version
- 1.0
void VHSceneCanvas::cameraFromScene |
( |
| ) |
|
|
protected |
Set the camera position from the scene.
For this purpose let \(O\) be the point where the camera is located, \(P\) be the point with minimum coordinates from the scene and \(C\) be the centroid of the scene. Now lets define the normalized director vector \(\hat{v}\) that will be used to define the \(\overrightarrow{OP}\) direction with a \(\frac{\pi}{8}\) angle which is half of \(\frac{\pi}{4}\) angle that is the approximated angle corresponding to camera field of view:
\[ \hat{v} = \left( \sqrt{1-\cos\left(\frac{\pi}{8}\right)^2}, 0, \cos\left(\frac{\pi}{8}\right) \right) \]
For the point \(O = \left(O_x, O_y, O_z\right)\) its \(O_x\) and \(O_y\) components are known, but its \(O_z\) component must be calculated from expression \(\overrightarrow{OP} = O + t\hat{v}\) as the required \(z\)-distance so the camera is guaranteed to view all the scene from above. Thus, following system must be solved:
\[ \left\{\begin{array}{lll} P_x - O_x &=& O_x + t \hat{v}_x \\ P_z - O_z &=& O_z + t \hat{v}_z \end{array}\right. \]
It is easy to see that:
\[ t = \frac{P_x - 2 O_x}{\hat{v}_x} \]
In consequence:
\[ O_z = \frac{P_z - t \hat{v}_z}{2} = \frac{1}{2}\left[ P_z - \frac{\cos\left(\frac{\pi}{8}\right)} {\sqrt{1-\cos\left(\frac{\pi}{8}\right)^2}} \left(P_x - 2 O_x\right) \right] \]
Finally, one last consideration must be taken into account. If \(z^*\) is the maximum value of the \(z\) coordinate in the scene, then when \(O_z < z^*\) the \(z\) coordinate for the initial camera position will be \(z^*\) instead of \(O_z\). It is, the camera position will be \(O = \left(O_x, O_y, z^*\right)\)