Use the ArcBallController method to control the camera view point in a scene.
More...
#include <ArcBallController.hpp>
Inherits CameraController.
|
| ArcBallController (double NewWidth, double NewHeight) |
| constructor
|
|
| ArcBallController (double NewWidth, double NewHeight, rw::graphics::SceneCamera::Ptr cam) |
| constructor
|
|
virtual | ~ArcBallController () |
| destructor
|
|
void | click (float x, float y) |
| register a mouse click event. The coordinates must be inside the specified bounds. More...
|
|
rw::math::Quaternion< double > | drag (float x, float y) |
| Calculates the rotation of the object/scene based on the mouse being dragged to the position (x,y). More...
|
|
void | draw () |
| draw the camera control. More...
|
|
void | setBounds (double NewWidth, double NewHeight) |
| set the bounds that define the area where the 2d point is valid. The bound is defined in a plane with [0,width] and [0,height]. Where (0,0) is the upper left corner of the plane. More...
|
|
virtual void | handleEvent (QEvent *event) |
| event handler, typically mouse and keyboard More...
|
|
virtual rw::math::Transform3D | getTransform () const |
| get the current world to camera transformation More...
|
|
void | setTransform (const rw::math::Transform3D<> &t3d) |
| set world to camera transformation More...
|
|
void | setCenter (const rw::math::Vector3D<> ¢er, const rw::math::Vector2D<> &screenCenter) |
| update the center of rotation and screen center More...
|
|
rw::math::Vector3D | getCenter () |
| get the current pivot point in world coordinates More...
|
|
void | zoom (double amount) |
| Zoom by amount specified by amount. More...
|
|
void | autoZoom (rw::core::Ptr< rw::models::WorkCell > workcell, rw::core::Ptr< const rw::kinematics::State > state, double fovy, double aspectRatio) |
| Zooms the camera to fit all devices into the camera view. More...
|
|
void | setZoomTarget (rw::math::Vector3D< double > target, bool enable=true) |
| set the 3D coordinate that should be zoomed towards. More...
|
|
void | setPanTarget (rw::math::Vector3D< double > target, bool enable=true) |
| set the 3D coordinate that should be moved. More...
|
|
rw::math::Vector3D | getPanTarget () |
| get the 3D coordinate that should be moved. More...
|
|
void | setDrawable (rw::graphics::DrawableNode::Ptr obj) |
| add a drawable to the camera controller More...
|
|
void | zoomScale (double scale=1) |
|
virtual | ~CameraController () |
| destructor
|
|
Use the ArcBallController method to control the camera view point in a scene.
The ArcBallController method defines a way to map a 2d position into a 3d position on some sphere. This means that the rotation is defined by dragging a point on a sphere around its center.
◆ autoZoom()
Zooms the camera to fit all devices into the camera view.
Useful when working with robots smaller or larger than standard. Calling this method moves the camera along its Z-axis.
- Parameters
-
workcell | [in] The autozoom functions fits all frames of workcell in the viewport |
state | [in] state with the current positions of the frames. If NULL, the default workcell state is used. |
fovy | [in] the field of view in the vertical direction (in radians). |
aspectRatio | [in] the aspect ratio of (width divided by height). |
Implements CameraController.
◆ click()
void click |
( |
float |
x, |
|
|
float |
y |
|
) |
| |
register a mouse click event. The coordinates must be inside the specified bounds.
- Parameters
-
x | [in] x-coodinate |
y | [in] y-coodinate |
◆ drag()
Calculates the rotation of the object/scene based on the mouse being dragged to the position (x,y).
- Parameters
-
x | [in] the x-coordinate of the current mouse position |
y | [in] the y-coordinate of the current mouse position |
- Returns
- the rotation that should be applied to the object/scene
◆ draw()
◆ getCenter()
get the current pivot point in world coordinates
- Returns
- current pivot point
Implements CameraController.
◆ getPanTarget()
get the 3D coordinate that should be moved.
- Returns
- the target position to move.
Reimplemented from CameraController.
◆ getTransform()
get the current world to camera transformation
- Returns
- world to camera transformation
Implements CameraController.
◆ handleEvent()
virtual void handleEvent |
( |
QEvent * |
event | ) |
|
|
virtual |
event handler, typically mouse and keyboard
- Parameters
-
event | [in] the specific event |
Implements CameraController.
◆ mapToSphere()
maps a 2d position (x,y) into a position on a 3D sphere which is centered around _centerPt.
- Parameters
-
◆ pan()
void pan |
( |
int |
x, |
|
|
int |
y |
|
) |
| |
|
protected |
move the camera in 2D relative to the scene
- Parameters
-
x | [in] current mouse position in x-axis |
y | [in] current mouse position in y-axis |
◆ setBounds()
void setBounds |
( |
double |
NewWidth, |
|
|
double |
NewHeight |
|
) |
| |
|
virtual |
set the bounds that define the area where the 2d point is valid. The bound is defined in a plane with [0,width] and [0,height]. Where (0,0) is the upper left corner of the plane.
- Parameters
-
NewWidth | [in] width |
NewHeight | [in] height |
Implements CameraController.
◆ setCenter()
update the center of rotation and screen center
- Parameters
-
center | [in] center of rotation in world coordinates |
screenCenter | [in] center of rotation in screen coordinates |
Implements CameraController.
◆ setDrawable()
add a drawable to the camera controller
- Parameters
-
obj | [in] a drawable to be controled by the camera controller |
Reimplemented from CameraController.
◆ setPanTarget()
set the 3D coordinate that should be moved.
- Parameters
-
target | [in] the target position to move. |
enable | [in] enable or disable pan with pantarget. |
Reimplemented from CameraController.
◆ setTransform()
set world to camera transformation
- Parameters
-
t3d | [in] world to camera transformation |
Implements CameraController.
◆ setZoomTarget()
set the 3D coordinate that should be zoomed towards.
- Parameters
-
target | [in] the target position to zoom towards. |
enable | [in] enable or disable zoom with zoomtarget. |
Reimplemented from CameraController.
◆ unproject()
project a image position into 3D space using pinhole model
- Parameters
-
x | [in] the x coordinate in the image |
y | [in] the y coordinate in the image |
z | [in] the z coordinate of the world |
- Returns
- the projected 3D position
◆ zoom()
void zoom |
( |
double |
amount | ) |
|
|
virtual |
Zoom by amount specified by amount.
Calling this method moves the camera along its Z-axis.
- Parameters
-
amount | [in] Meters to zoom the camera |
Implements CameraController.
The documentation for this class was generated from the following file: