ImFusion SDK 4.3
CameraNavigation Class Reference

#include <ImFusion/GUI/CameraNavigation.h>

Helper class to manipulate a 3D Camera using classic metaphors such as zoom, pan, etc. More...

Detailed Description

Helper class to manipulate a 3D Camera using classic metaphors such as zoom, pan, etc.

For instance InputEventHandlers for 3D views can leverage this class to reduce their implementation complexity. At the beginning of an interaction you call reset() with a reference state. Then you call any number of member functions to configure the camera movement. Finally, you can query the resulting camera state using camera().

Public Member Functions

 CameraNavigation (const Camera &referenceCam, double viewportHeight)
 Creates a new CameraNavigation object calling reset() with the given parameters.
 
void reset (const Camera &referenceCam, double viewportHeight)
 Resets the internal state to the given reference camera and viewport height.
 
const CamerareferenceCamera () const
 Returns the reference camera state as passed during the last call to reset().
 
Camera newCamera () const
 Returns the resulting camera setup after applying pan, zoom, and rotation to the reference camera passed during reset().
 
void addPan (const vec2 &translationPx)
 Accumulates in-plane panning to apply to the camera.
 
void setPan (const vec2 &translationPx)
 Sets the in-plane panning to apply to the camera removing any previously accumulated panning.
 
void addZoom (double distance, bool adaptive=true)
 Accumulates zooming to apply to the camera.
 
void setZoom (double distance, bool adaptive=true)
 Sets the zooming to apply to the camera removing any previously accumulated zoom.
 
void setRotationCenter (const vec3 &position)
 Sets the rotation center in world space around which the camera will be rotated.
 
const vec3 & rotationCenter () const
 Returns the rotation center in world space around which the camera will be rotated.
 
void addRotation (const vec3 &degreesXYZ)
 Accumulates a rotation around the rotation center in terms of degrees around the camera's XYZ axes.
 
void setRotation (const vec3 &degreesXYZ)
 Sets the rotation around the rotation center in terms of degrees around the camera's XYZ axes.
 

Member Function Documentation

◆ addZoom()

void addZoom ( double distance,
bool adaptive = true )

Accumulates zooming to apply to the camera.

Parameters
distanceUnit-less zoom amount, loosely relating to the camera movement in look direction for perspective projections, or a frustum height adjustment if similar scale for orthographic projections.
adaptiveIf true, distance will be linearly scaled based on the current distance between camera and rotation center

◆ setZoom()

void setZoom ( double distance,
bool adaptive = true )

Sets the zooming to apply to the camera removing any previously accumulated zoom.

Parameters
distanceUnit-less zoom amount, loosely relating to the camera movement in look direction for perspective projections, or a frustum height adjustment if similar scale for orthographic projections.
adaptiveIf true, distance will be linearly scaled based on the current distance between camera and rotation center

The documentation for this class was generated from the following file:
Search Tab / S to search, Esc to close