ACloudViewer  3.9.4
A Modern Library for 3D Data Processing
cloudViewer::visualization::ViewControl Class Reference

View controller for visualizer. More...

#include <ViewControl.h>

Inheritance diagram for cloudViewer::visualization::ViewControl:
[legend]
Collaboration diagram for cloudViewer::visualization::ViewControl:
[legend]

Public Types

enum  ProjectionType { Perspective = 0, Orthogonal = 1 }
 

Public Member Functions

virtual ~ViewControl ()
 
void SetViewMatrices (const Eigen::Matrix4d &model_matrix=Eigen::Matrix4d::Identity())
 
bool ConvertToViewParameters (ViewParameters &status) const
 Function to get equivalent view parameters (support orthogonal) More...
 
bool ConvertFromViewParameters (const ViewParameters &status)
 
void SetZoom (const double zoom)
 
void SetUp (const Eigen::Vector3d &up)
 
void SetFront (const Eigen::Vector3d &front)
 
void SetLookat (const Eigen::Vector3d &lookat)
 
bool ConvertToPinholeCameraParameters (camera::PinholeCameraParameters &parameters)
 
bool ConvertFromPinholeCameraParameters (const camera::PinholeCameraParameters &parameters, bool allow_arbitrary=false)
 
ProjectionType GetProjectionType () const
 
void SetProjectionParameters ()
 
virtual void Reset ()
 
virtual void ChangeFieldOfView (double step)
 
virtual void ChangeWindowSize (int width, int height)
 
virtual void Scale (double scale)
 
virtual void Rotate (double x, double y, double xo=0.0, double yo=0.0)
 Function to process rotation. More...
 
virtual void Translate (double x, double y, double xo=0.0, double yo=0.0)
 Function to process translation. More...
 
virtual void CameraLocalTranslate (double forward, double right, double up)
 
virtual void CameraLocalRotate (double x, double y, double xo=0.0, double yo=0.0)
 
virtual void ResetCameraLocalRotate ()
 
virtual void Roll (double x)
 
const ccBBox & GetBoundingBox () const
 
void ResetBoundingBox ()
 
void FitInGeometry (const ccHObject &geometry)
 
double GetFieldOfView () const
 Function to get field of view. More...
 
gl_util::GLMatrix4f GetMVPMatrix () const
 
gl_util::GLMatrix4f GetProjectionMatrix () const
 
gl_util::GLMatrix4f GetViewMatrix () const
 
gl_util::GLMatrix4f GetModelMatrix () const
 
gl_util::GLVector3f GetEye () const
 
gl_util::GLVector3f GetLookat () const
 
gl_util::GLVector3f GetUp () const
 
gl_util::GLVector3f GetFront () const
 
gl_util::GLVector3f GetRight () const
 
int GetWindowWidth () const
 
int GetWindowHeight () const
 
double GetZNear () const
 
double GetZFar () const
 
void SetConstantZNear (double z_near)
 
void SetConstantZFar (double z_far)
 
void UnsetConstantZNear ()
 
void UnsetConstantZFar ()
 

Static Public Attributes

static const double FIELD_OF_VIEW_MAX = 90.0
 
static const double FIELD_OF_VIEW_MIN = 5.0
 
static const double FIELD_OF_VIEW_DEFAULT = 60.0
 
static const double FIELD_OF_VIEW_STEP = 5.0
 
static const double ZOOM_DEFAULT = 0.7
 
static const double ZOOM_MIN = 0.02
 
static const double ZOOM_MAX = 2.0
 
static const double ZOOM_STEP = 0.02
 
static const double ROTATION_RADIAN_PER_PIXEL = 0.003
 

Protected Attributes

int window_width_ = 0
 
int window_height_ = 0
 
ccBBox bounding_box_
 
Eigen::Vector3d eye_
 
Eigen::Vector3d lookat_
 
Eigen::Vector3d up_
 
Eigen::Vector3d front_
 
Eigen::Vector3d right_
 
double distance_
 
double field_of_view_
 
double zoom_
 
double view_ratio_
 
double aspect_
 
double z_near_
 
double z_far_
 
double constant_z_near_ = -1
 
double constant_z_far_ = -1
 
gl_util::GLMatrix4f projection_matrix_
 
gl_util::GLMatrix4f view_matrix_
 
gl_util::GLMatrix4f model_matrix_
 
gl_util::GLMatrix4f MVP_matrix_
 
Eigen::Vector3d start_local_rotate_up_
 
Eigen::Vector3d start_local_rotate_right_
 
Eigen::Vector3d start_local_rotate_front_
 
Eigen::Vector3d start_local_rotate_eye_
 
Eigen::Vector3d start_local_rotate_lookat_
 
double local_rotate_up_accum_
 
double local_rotate_right_accum_
 

Detailed Description

View controller for visualizer.

Member Enumeration Documentation

◆ ProjectionType

Enumerator
Perspective 
Orthogonal 

Constructor & Destructor Documentation

◆ ~ViewControl()

virtual cloudViewer::visualization::ViewControl::~ViewControl ( )
inlinevirtual

Member Function Documentation

◆ CameraLocalRotate()

void cloudViewer::visualization::ViewControl::CameraLocalRotate ( double  x,
double  y,
double  xo = 0.0,
double  yo = 0.0 
)
virtual

◆ CameraLocalTranslate()

void cloudViewer::visualization::ViewControl::CameraLocalTranslate ( double  forward,
double  right,
double  up 
)
virtual

◆ ChangeFieldOfView()

void cloudViewer::visualization::ViewControl::ChangeFieldOfView ( double  step)
virtual

◆ ChangeWindowSize()

void cloudViewer::visualization::ViewControl::ChangeWindowSize ( int  width,
int  height 
)
virtual

◆ ConvertFromPinholeCameraParameters()

bool cloudViewer::visualization::ViewControl::ConvertFromPinholeCameraParameters ( const camera::PinholeCameraParameters &  parameters,
bool  allow_arbitrary = false 
)

Function to get view controller from pinhole camera parameters.

Parameters
parametersThe pinhole camera parameter to convert from.
allow_arbitraryAllow an arbitrary pinhole camera parameters. This can be useful to render images or depthmaps without any restriction in window size, FOV and zoom.

References bounding_box_, distance_, cloudViewer::camera::PinholeCameraParameters::extrinsic_, eye_, field_of_view_, FIELD_OF_VIEW_MAX, FIELD_OF_VIEW_MIN, front_, ccBBox::GetCenter(), ccBBox::GetMaxExtent(), GetProjectionType(), cloudViewer::camera::PinholeCameraParameters::intrinsic_, LogWarning, lookat_, M_PI, right_, up_, view_ratio_, window_height_, window_width_, zoom_, ZOOM_MAX, and ZOOM_MIN.

Referenced by cloudViewer::visualization::ViewControlWithCustomAnimation::LoadTrajectoryFromCameraTrajectory().

◆ ConvertFromViewParameters()

◆ ConvertToPinholeCameraParameters()

bool cloudViewer::visualization::ViewControl::ConvertToPinholeCameraParameters ( camera::PinholeCameraParameters &  parameters)

Function to get equivalent pinhole camera parameters (does not support orthogonal since it is not a real camera view).

Parameters
Thepinhole camera parameter to convert to.

References cloudViewer::camera::PinholeCameraParameters::extrinsic_, eye_, field_of_view_, front_, GetProjectionType(), cloudViewer::camera::PinholeCameraParameters::intrinsic_, LogWarning, M_PI, right_, SetProjectionParameters(), up_, window_height_, and window_width_.

◆ ConvertToViewParameters()

◆ FitInGeometry()

◆ GetBoundingBox()

const ccBBox& cloudViewer::visualization::ViewControl::GetBoundingBox ( ) const
inline

◆ GetEye()

gl_util::GLVector3f cloudViewer::visualization::ViewControl::GetEye ( ) const
inline

References eye_.

◆ GetFieldOfView()

double cloudViewer::visualization::ViewControl::GetFieldOfView ( ) const
inline

Function to get field of view.

References field_of_view_.

◆ GetFront()

gl_util::GLVector3f cloudViewer::visualization::ViewControl::GetFront ( ) const
inline

References front_.

◆ GetLookat()

gl_util::GLVector3f cloudViewer::visualization::ViewControl::GetLookat ( ) const
inline

References lookat_.

◆ GetModelMatrix()

gl_util::GLMatrix4f cloudViewer::visualization::ViewControl::GetModelMatrix ( ) const
inline

References model_matrix_.

◆ GetMVPMatrix()

gl_util::GLMatrix4f cloudViewer::visualization::ViewControl::GetMVPMatrix ( ) const
inline

◆ GetProjectionMatrix()

gl_util::GLMatrix4f cloudViewer::visualization::ViewControl::GetProjectionMatrix ( ) const
inline

References projection_matrix_.

◆ GetProjectionType()

◆ GetRight()

gl_util::GLVector3f cloudViewer::visualization::ViewControl::GetRight ( ) const
inline

References right_.

◆ GetUp()

gl_util::GLVector3f cloudViewer::visualization::ViewControl::GetUp ( ) const
inline

References up_.

◆ GetViewMatrix()

gl_util::GLMatrix4f cloudViewer::visualization::ViewControl::GetViewMatrix ( ) const
inline

References view_matrix_.

◆ GetWindowHeight()

int cloudViewer::visualization::ViewControl::GetWindowHeight ( ) const
inline

◆ GetWindowWidth()

int cloudViewer::visualization::ViewControl::GetWindowWidth ( ) const
inline

◆ GetZFar()

double cloudViewer::visualization::ViewControl::GetZFar ( ) const
inline

References z_far_.

◆ GetZNear()

double cloudViewer::visualization::ViewControl::GetZNear ( ) const
inline

References z_near_.

◆ Reset()

◆ ResetBoundingBox()

void cloudViewer::visualization::ViewControl::ResetBoundingBox ( )
inline

◆ ResetCameraLocalRotate()

◆ Roll()

void cloudViewer::visualization::ViewControl::Roll ( double  x)
virtual
Parameters
xis the distances the mouse cursor has moved. Coordinates are measured in screen coordinates relative to the top-left corner of the window client area.

References front_, ROTATION_RADIAN_PER_PIXEL, SetProjectionParameters(), up_, and x.

◆ Rotate()

void cloudViewer::visualization::ViewControl::Rotate ( double  x,
double  y,
double  xo = 0.0,
double  yo = 0.0 
)
virtual

Function to process rotation.

Coordinates are measured in screen coordinates relative to the top-left corner of the window client area.

Parameters
xThe distance the mouse cursor has moved in x-axis.
yThe distance the mouse cursor has moved in y-axis.
xoOriginal point coordinate of the mouse in x-axis.
yoOriginal point coordinate of the mouse in y-axis.

Reimplemented in cloudViewer::visualization::ViewControlWithEditing, and cloudViewer::visualization::ViewControlWithCustomAnimation.

References front_, right_, ROTATION_RADIAN_PER_PIXEL, SetProjectionParameters(), up_, x, and y.

Referenced by cloudViewer::visualization::ViewControlWithCustomAnimation::AddSpinKeyFrames(), cloudViewer::visualization::ViewControlWithCustomAnimation::Rotate(), and cloudViewer::visualization::ViewControlWithEditing::Rotate().

◆ Scale()

void cloudViewer::visualization::ViewControl::Scale ( double  scale)
virtual

◆ SetConstantZFar()

void cloudViewer::visualization::ViewControl::SetConstantZFar ( double  z_far)
inline

Function to change the far z-plane of the visualizer to a constant value, i.e., independent of zoom and bounding box size.

Parameters
z_farThe depth of the far z-plane of the visualizer.

References constant_z_far_.

◆ SetConstantZNear()

void cloudViewer::visualization::ViewControl::SetConstantZNear ( double  z_near)
inline

Function to change the near z-plane of the visualizer to a constant value, i.e., independent of zoom and bounding box size.

Parameters
z_nearThe depth of the near z-plane of the visualizer.

References constant_z_near_.

◆ SetFront()

void cloudViewer::visualization::ViewControl::SetFront ( const Eigen::Vector3d &  front)

◆ SetLookat()

void cloudViewer::visualization::ViewControl::SetLookat ( const Eigen::Vector3d &  lookat)

◆ SetProjectionParameters()

◆ SetUp()

void cloudViewer::visualization::ViewControl::SetUp ( const Eigen::Vector3d &  up)

◆ SetViewMatrices()

void cloudViewer::visualization::ViewControl::SetViewMatrices ( const Eigen::Matrix4d &  model_matrix = Eigen::Matrix4d::Identity())

◆ SetZoom()

void cloudViewer::visualization::ViewControl::SetZoom ( const double  zoom)

◆ Translate()

void cloudViewer::visualization::ViewControl::Translate ( double  x,
double  y,
double  xo = 0.0,
double  yo = 0.0 
)
virtual

Function to process translation.

Coordinates are measured in screen coordinates relative to the top-left corner of the window client area.

Parameters
xDistance the mouse cursor has moved in x-axis.
yDistance the mouse cursor has moved in y-axis.
xoOriginal point coordinate of the mouse in x-axis.
yoOriginal point coordinate of the mouse in y-axis.

Reimplemented in cloudViewer::visualization::ViewControlWithEditing, and cloudViewer::visualization::ViewControlWithCustomAnimation.

References eye_, lookat_, right_, SetProjectionParameters(), up_, view_ratio_, window_height_, x, and y.

Referenced by cloudViewer::visualization::ViewControlWithCustomAnimation::Translate(), and cloudViewer::visualization::ViewControlWithEditing::Translate().

◆ UnsetConstantZFar()

void cloudViewer::visualization::ViewControl::UnsetConstantZFar ( )
inline

Function to remove a previously set constant z far value, i.e., far z-plane of the visualizer is dynamically set dependent on zoom and bounding box size.

References constant_z_far_.

◆ UnsetConstantZNear()

void cloudViewer::visualization::ViewControl::UnsetConstantZNear ( )
inline

Function to remove a previously set constant z near value, i.e., near z-plane of the visualizer is dynamically set dependent on zoom and bounding box size.

References constant_z_near_.

Member Data Documentation

◆ aspect_

double cloudViewer::visualization::ViewControl::aspect_
protected

◆ bounding_box_

◆ constant_z_far_

double cloudViewer::visualization::ViewControl::constant_z_far_ = -1
protected

◆ constant_z_near_

double cloudViewer::visualization::ViewControl::constant_z_near_ = -1
protected

◆ distance_

double cloudViewer::visualization::ViewControl::distance_
protected

◆ eye_

Eigen::Vector3d cloudViewer::visualization::ViewControl::eye_
protected

◆ field_of_view_

◆ FIELD_OF_VIEW_DEFAULT

const double cloudViewer::visualization::ViewControl::FIELD_OF_VIEW_DEFAULT = 60.0
static

Referenced by Reset().

◆ FIELD_OF_VIEW_MAX

const double cloudViewer::visualization::ViewControl::FIELD_OF_VIEW_MAX = 90.0
static

◆ FIELD_OF_VIEW_MIN

◆ FIELD_OF_VIEW_STEP

const double cloudViewer::visualization::ViewControl::FIELD_OF_VIEW_STEP = 5.0
static

◆ front_

◆ local_rotate_right_accum_

double cloudViewer::visualization::ViewControl::local_rotate_right_accum_
protected

◆ local_rotate_up_accum_

double cloudViewer::visualization::ViewControl::local_rotate_up_accum_
protected

◆ lookat_

◆ model_matrix_

gl_util::GLMatrix4f cloudViewer::visualization::ViewControl::model_matrix_
protected

Referenced by GetModelMatrix(), and SetViewMatrices().

◆ MVP_matrix_

gl_util::GLMatrix4f cloudViewer::visualization::ViewControl::MVP_matrix_
protected

Referenced by GetMVPMatrix(), and SetViewMatrices().

◆ projection_matrix_

gl_util::GLMatrix4f cloudViewer::visualization::ViewControl::projection_matrix_
protected

◆ right_

◆ ROTATION_RADIAN_PER_PIXEL

const double cloudViewer::visualization::ViewControl::ROTATION_RADIAN_PER_PIXEL = 0.003
static

◆ start_local_rotate_eye_

Eigen::Vector3d cloudViewer::visualization::ViewControl::start_local_rotate_eye_
protected

◆ start_local_rotate_front_

Eigen::Vector3d cloudViewer::visualization::ViewControl::start_local_rotate_front_
protected

◆ start_local_rotate_lookat_

Eigen::Vector3d cloudViewer::visualization::ViewControl::start_local_rotate_lookat_
protected

◆ start_local_rotate_right_

Eigen::Vector3d cloudViewer::visualization::ViewControl::start_local_rotate_right_
protected

◆ start_local_rotate_up_

Eigen::Vector3d cloudViewer::visualization::ViewControl::start_local_rotate_up_
protected

◆ up_

◆ view_matrix_

gl_util::GLMatrix4f cloudViewer::visualization::ViewControl::view_matrix_
protected

Referenced by GetViewMatrix(), and SetViewMatrices().

◆ view_ratio_

double cloudViewer::visualization::ViewControl::view_ratio_
protected

◆ window_height_

◆ window_width_

◆ z_far_

double cloudViewer::visualization::ViewControl::z_far_
protected

Referenced by GetZFar(), and SetViewMatrices().

◆ z_near_

double cloudViewer::visualization::ViewControl::z_near_
protected

Referenced by GetZNear(), and SetViewMatrices().

◆ zoom_

◆ ZOOM_DEFAULT

const double cloudViewer::visualization::ViewControl::ZOOM_DEFAULT = 0.7
static

◆ ZOOM_MAX

const double cloudViewer::visualization::ViewControl::ZOOM_MAX = 2.0
static

◆ ZOOM_MIN

const double cloudViewer::visualization::ViewControl::ZOOM_MIN = 0.02
static

◆ ZOOM_STEP

const double cloudViewer::visualization::ViewControl::ZOOM_STEP = 0.02
static

Referenced by Scale().


The documentation for this class was generated from the following files: