![]() |
ACloudViewer
3.9.4
A Modern Library for 3D Data Processing
|
View controller for visualizer. More...
#include <ViewControl.h>
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 ¶meters) |
| bool | ConvertFromPinholeCameraParameters (const camera::PinholeCameraParameters ¶meters, 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_ |
View controller for visualizer.
|
inlinevirtual |
|
virtual |
|
virtual |
References front_, lookat_, right_, SetProjectionParameters(), and up_.
|
virtual |
Function to change field of view.
| step | The step to change field of view. |
Reimplemented in cloudViewer::visualization::ViewControlWithEditing, and cloudViewer::visualization::ViewControlWithCustomAnimation.
References field_of_view_, FIELD_OF_VIEW_MAX, FIELD_OF_VIEW_MIN, FIELD_OF_VIEW_STEP, and SetProjectionParameters().
Referenced by cloudViewer::visualization::ViewControlWithCustomAnimation::ChangeFieldOfView(), and cloudViewer::visualization::ViewControlWithEditing::ChangeFieldOfView().
|
virtual |
References aspect_, height, SetProjectionParameters(), width, window_height_, and window_width_.
| bool cloudViewer::visualization::ViewControl::ConvertFromPinholeCameraParameters | ( | const camera::PinholeCameraParameters & | parameters, |
| bool | allow_arbitrary = false |
||
| ) |
Function to get view controller from pinhole camera parameters.
| parameters | The pinhole camera parameter to convert from. |
| allow_arbitrary | Allow 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().
| bool cloudViewer::visualization::ViewControl::ConvertFromViewParameters | ( | const ViewParameters & | status | ) |
References bounding_box_, cloudViewer::visualization::ViewParameters::boundingbox_max_, cloudViewer::visualization::ViewParameters::boundingbox_min_, cloudViewer::visualization::ViewParameters::field_of_view_, field_of_view_, cloudViewer::visualization::ViewParameters::front_, front_, ccBBox::IsEmpty(), cloudViewer::visualization::ViewParameters::lookat_, lookat_, cloudViewer::BoundingBoxTpl< T >::maxCorner(), cloudViewer::BoundingBoxTpl< T >::minCorner(), SetProjectionParameters(), cloudViewer::BoundingBoxTpl< T >::setValidity(), cloudViewer::visualization::ViewParameters::up_, up_, cloudViewer::visualization::ViewParameters::zoom_, and zoom_.
Referenced by cloudViewer::visualization::ViewControlWithEditing::SetEditingMode(), and cloudViewer::visualization::ViewControlWithCustomAnimation::SetViewControlFromTrajectory().
| 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).
| The | pinhole 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_.
| bool cloudViewer::visualization::ViewControl::ConvertToViewParameters | ( | ViewParameters & | status | ) | const |
Function to get equivalent view parameters (support orthogonal)
References bounding_box_, cloudViewer::visualization::ViewParameters::boundingbox_max_, cloudViewer::visualization::ViewParameters::boundingbox_min_, cloudViewer::visualization::ViewParameters::field_of_view_, field_of_view_, cloudViewer::visualization::ViewParameters::front_, front_, ccBBox::GetMaxBound(), ccBBox::GetMinBound(), cloudViewer::visualization::ViewParameters::lookat_, lookat_, cloudViewer::visualization::ViewParameters::up_, up_, cloudViewer::visualization::ViewParameters::zoom_, and zoom_.
Referenced by cloudViewer::visualization::ViewControlWithCustomAnimation::AddKeyFrame(), cloudViewer::visualization::ViewControlWithCustomAnimation::LoadTrajectoryFromCameraTrajectory(), cloudViewer::visualization::ViewControlWithEditing::SetEditingMode(), and cloudViewer::visualization::ViewControlWithCustomAnimation::UpdateKeyFrame().
|
inline |
References CV_TYPES::BBOX, bounding_box_, CV_TYPES::FACET, ccBBox::GetAxisAlignedBoundingBox(), CV_TYPES::IMAGE2, ccObject::isKindOf(), CV_TYPES::LINESET, CV_TYPES::MESH, CV_TYPES::MESH_BASE, CV_TYPES::ORIENTED_BBOX, CV_TYPES::POINT_CLOUD, CV_TYPES::POINT_OCTREE2, CV_TYPES::POLY_LINE, CV_TYPES::RGBD_IMAGE, SetProjectionParameters(), and CV_TYPES::VOXEL_GRID.
|
inline |
|
inline |
References eye_.
|
inline |
Function to get field of view.
References field_of_view_.
|
inline |
References front_.
|
inline |
References lookat_.
|
inline |
References model_matrix_.
|
inline |
References MVP_matrix_.
Referenced by cloudViewer::visualization::SelectionPolygon::CreateSelectionPolygonVolume().
|
inline |
References projection_matrix_.
| ViewControl::ProjectionType cloudViewer::visualization::ViewControl::GetProjectionType | ( | ) | const |
References field_of_view_, FIELD_OF_VIEW_MIN, and cloudViewer::visualization::gl_util::Perspective().
Referenced by cloudViewer::visualization::ViewControlWithCustomAnimation::ChangeFieldOfView(), ConvertFromPinholeCameraParameters(), ConvertToPinholeCameraParameters(), SetProjectionParameters(), and SetViewMatrices().
|
inline |
References right_.
|
inline |
References up_.
|
inline |
References view_matrix_.
|
inline |
References window_height_.
Referenced by cloudViewer::visualization::SelectionPolygon::CreateSelectionPolygonVolume().
|
inline |
References window_width_.
Referenced by cloudViewer::visualization::SelectionPolygon::CreateSelectionPolygonVolume().
|
inline |
References z_far_.
|
inline |
References z_near_.
|
virtual |
Reimplemented in cloudViewer::visualization::ViewControlWithEditing, and cloudViewer::visualization::ViewControlWithCustomAnimation.
References bounding_box_, field_of_view_, FIELD_OF_VIEW_DEFAULT, front_, ccBBox::GetCenter(), lookat_, SetProjectionParameters(), up_, zoom_, and ZOOM_DEFAULT.
Referenced by cloudViewer::visualization::ViewControlWithCustomAnimation::Reset(), and cloudViewer::visualization::ViewControlWithEditing::Reset().
|
inline |
References bounding_box_, and cloudViewer::BoundingBoxTpl< T >::clear().
|
virtual |
|
virtual |
| x | is 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.
|
virtual |
Function to process rotation.
Coordinates are measured in screen coordinates relative to the top-left corner of the window client area.
| x | The distance the mouse cursor has moved in x-axis. |
| y | The distance the mouse cursor has moved in y-axis. |
| xo | Original point coordinate of the mouse in x-axis. |
| yo | Original 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().
|
virtual |
Function to process scaling
| scale | is the scale ratio. |
Reimplemented in cloudViewer::visualization::ViewControlWithEditing, and cloudViewer::visualization::ViewControlWithCustomAnimation.
References SetProjectionParameters(), zoom_, ZOOM_MAX, ZOOM_MIN, and ZOOM_STEP.
Referenced by cloudViewer::visualization::ViewControlWithCustomAnimation::Scale(), and cloudViewer::visualization::ViewControlWithEditing::Scale().
|
inline |
Function to change the far z-plane of the visualizer to a constant value, i.e., independent of zoom and bounding box size.
| z_far | The depth of the far z-plane of the visualizer. |
References constant_z_far_.
|
inline |
Function to change the near z-plane of the visualizer to a constant value, i.e., independent of zoom and bounding box size.
| z_near | The depth of the near z-plane of the visualizer. |
References constant_z_near_.
| void cloudViewer::visualization::ViewControl::SetFront | ( | const Eigen::Vector3d & | front | ) |
References front_, and SetProjectionParameters().
Referenced by cloudViewer::visualization::DrawGeometries().
| void cloudViewer::visualization::ViewControl::SetLookat | ( | const Eigen::Vector3d & | lookat | ) |
References lookat_, and SetProjectionParameters().
Referenced by cloudViewer::visualization::DrawGeometries().
| void cloudViewer::visualization::ViewControl::SetProjectionParameters | ( | ) |
References bounding_box_, distance_, eye_, field_of_view_, FIELD_OF_VIEW_STEP, front_, ccBBox::GetMaxExtent(), GetProjectionType(), lookat_, M_PI, cloudViewer::visualization::gl_util::Perspective(), ResetCameraLocalRotate(), right_, up_, view_ratio_, and zoom_.
Referenced by CameraLocalRotate(), CameraLocalTranslate(), cloudViewer::visualization::ViewControlWithCustomAnimation::ChangeFieldOfView(), ChangeFieldOfView(), ChangeWindowSize(), ConvertFromViewParameters(), ConvertToPinholeCameraParameters(), FitInGeometry(), cloudViewer::visualization::ViewControlWithEditing::Reset(), Reset(), Roll(), cloudViewer::visualization::ViewControlWithEditing::Rotate(), Rotate(), Scale(), SetFront(), SetLookat(), SetUp(), SetZoom(), and Translate().
| void cloudViewer::visualization::ViewControl::SetUp | ( | const Eigen::Vector3d & | up | ) |
References SetProjectionParameters(), and up_.
Referenced by cloudViewer::visualization::DrawGeometries().
| void cloudViewer::visualization::ViewControl::SetViewMatrices | ( | const Eigen::Matrix4d & | model_matrix = Eigen::Matrix4d::Identity() | ) |
Function to set view points This function obtains OpenGL context and calls OpenGL functions to set the view point.
References aspect_, bounding_box_, constant_z_far_, constant_z_near_, distance_, eye_, field_of_view_, ccBBox::GetMaxExtent(), GetProjectionType(), LogWarning, cloudViewer::visualization::gl_util::LookAt(), lookat_, model_matrix_, MVP_matrix_, cloudViewer::visualization::gl_util::Ortho(), cloudViewer::visualization::gl_util::Perspective(), projection_matrix_, up_, view_matrix_, view_ratio_, window_height_, window_width_, z_far_, and z_near_.
| void cloudViewer::visualization::ViewControl::SetZoom | ( | const double | zoom | ) |
References SetProjectionParameters(), and zoom_.
Referenced by cloudViewer::visualization::DrawGeometries().
|
virtual |
Function to process translation.
Coordinates are measured in screen coordinates relative to the top-left corner of the window client area.
| x | Distance the mouse cursor has moved in x-axis. |
| y | Distance the mouse cursor has moved in y-axis. |
| xo | Original point coordinate of the mouse in x-axis. |
| yo | Original 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().
|
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_.
|
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_.
|
protected |
Referenced by ChangeWindowSize(), and SetViewMatrices().
|
protected |
|
protected |
Referenced by SetConstantZFar(), SetViewMatrices(), and UnsetConstantZFar().
|
protected |
Referenced by SetConstantZNear(), SetViewMatrices(), and UnsetConstantZNear().
|
protected |
Referenced by CameraLocalRotate(), ConvertFromPinholeCameraParameters(), SetProjectionParameters(), and SetViewMatrices().
|
protected |
|
protected |
Referenced by cloudViewer::visualization::ViewControlWithCustomAnimation::ChangeFieldOfView(), ChangeFieldOfView(), ConvertFromPinholeCameraParameters(), ConvertFromViewParameters(), ConvertToPinholeCameraParameters(), ConvertToViewParameters(), GetFieldOfView(), GetProjectionType(), cloudViewer::visualization::ViewControlWithEditing::Reset(), Reset(), SetProjectionParameters(), and SetViewMatrices().
|
static |
Referenced by Reset().
|
static |
Referenced by ChangeFieldOfView(), and ConvertFromPinholeCameraParameters().
|
static |
|
static |
Referenced by ChangeFieldOfView(), and SetProjectionParameters().
|
protected |
Referenced by CameraLocalRotate(), CameraLocalTranslate(), ConvertFromPinholeCameraParameters(), ConvertFromViewParameters(), ConvertToPinholeCameraParameters(), ConvertToViewParameters(), GetFront(), cloudViewer::visualization::ViewControlWithEditing::Reset(), Reset(), ResetCameraLocalRotate(), Roll(), Rotate(), SetFront(), and SetProjectionParameters().
|
protected |
Referenced by CameraLocalRotate(), and ResetCameraLocalRotate().
|
protected |
Referenced by CameraLocalRotate(), and ResetCameraLocalRotate().
|
protected |
Referenced by CameraLocalRotate(), CameraLocalTranslate(), ConvertFromPinholeCameraParameters(), ConvertFromViewParameters(), ConvertToViewParameters(), GetLookat(), cloudViewer::visualization::ViewControlWithEditing::Reset(), Reset(), ResetCameraLocalRotate(), SetLookat(), SetProjectionParameters(), SetViewMatrices(), and Translate().
|
protected |
Referenced by GetModelMatrix(), and SetViewMatrices().
|
protected |
Referenced by GetMVPMatrix(), and SetViewMatrices().
|
protected |
Referenced by GetProjectionMatrix(), and SetViewMatrices().
|
protected |
|
static |
Referenced by cloudViewer::visualization::ViewControlWithCustomAnimation::AddSpinKeyFrames(), Roll(), and Rotate().
|
protected |
Referenced by CameraLocalRotate(), and ResetCameraLocalRotate().
|
protected |
Referenced by CameraLocalRotate(), and ResetCameraLocalRotate().
|
protected |
Referenced by CameraLocalRotate(), and ResetCameraLocalRotate().
|
protected |
Referenced by CameraLocalRotate(), and ResetCameraLocalRotate().
|
protected |
Referenced by CameraLocalRotate(), and ResetCameraLocalRotate().
|
protected |
Referenced by CameraLocalRotate(), CameraLocalTranslate(), ConvertFromPinholeCameraParameters(), ConvertFromViewParameters(), ConvertToPinholeCameraParameters(), ConvertToViewParameters(), GetUp(), cloudViewer::visualization::ViewControlWithEditing::Reset(), Reset(), ResetCameraLocalRotate(), Roll(), cloudViewer::visualization::ViewControlWithEditing::Rotate(), Rotate(), SetProjectionParameters(), SetUp(), SetViewMatrices(), and Translate().
|
protected |
Referenced by GetViewMatrix(), and SetViewMatrices().
|
protected |
Referenced by CameraLocalRotate(), ConvertFromPinholeCameraParameters(), SetProjectionParameters(), SetViewMatrices(), and Translate().
|
protected |
|
protected |
|
protected |
Referenced by GetZFar(), and SetViewMatrices().
|
protected |
Referenced by GetZNear(), and SetViewMatrices().
|
protected |
|
static |
Referenced by cloudViewer::visualization::ViewControlWithEditing::Reset(), and Reset().
|
static |
Referenced by ConvertFromPinholeCameraParameters(), and Scale().
|
static |
Referenced by ConvertFromPinholeCameraParameters(), and Scale().
|
static |
Referenced by Scale().