documentation

This commit is contained in:
Djairo Hougee 2024-05-06 11:19:13 +02:00
parent 25f5456e9d
commit 5f6b88b34c
2 changed files with 29 additions and 0 deletions

View File

@ -74,6 +74,7 @@ void CameraMoveCallback::zoom(const bool in) {
clampCamera(this->cam->GetPosition()); clampCamera(this->cam->GetPosition());
} }
// we use the interactor's getKeySym instead of getKeyCode because getKeyCode is platform-dependent.
void CameraMoveCallback::pan(const string dir) { void CameraMoveCallback::pan(const string dir) {
double pos[3]; double pos[3];
this->cam->GetPosition(pos); this->cam->GetPosition(pos);

View File

@ -10,17 +10,45 @@
class CameraMoveCallback : public vtkCallbackCommand { class CameraMoveCallback : public vtkCallbackCommand {
public: public:
/** Create new instance using the vtk New template.
*/
static CameraMoveCallback *New(vtkCamera *cam); static CameraMoveCallback *New(vtkCamera *cam);
/** Constructor.
*/
CameraMoveCallback(); CameraMoveCallback();
/** Sets the camera to operate on.
*/
void setCam(const vtkSmartPointer<vtkCamera> &cam); void setCam(const vtkSmartPointer<vtkCamera> &cam);
private: private:
/** The camera to operate on.
*/
vtkSmartPointer<vtkCamera> cam; vtkSmartPointer<vtkCamera> cam;
/** Event callback. Should be subscribed to keyPressEvent and MouseWheelForward/MouseWheelBackward events.
*/
void Execute(vtkObject *caller, unsigned long evId, void *callData) override; void Execute(vtkObject *caller, unsigned long evId, void *callData) override;
/** Zooms the camera in or out.
* @param in : whether to zoom in or out.
*/
void zoom(const bool in); void zoom(const bool in);
/** Pans the camera in a direction, determined by the parameter.
* 'h' and 'left' : pan left
* 'j' and 'up' : pan up
* 'k' and 'down' : pan down
* 'l' and 'right' : pan right
* @param dir : string of the pressed keycode.
*/
void pan(const std::string dir); void pan(const std::string dir);
/** Edits the camera such that it only ever renders within the [-1,1] normalised coordinate field.
* Does so by making sure that the position of the camera (on the x,y axes), combined with the parallel scale, is never > 1.
* @param pos : pointer to new desired camera position. This will be changed if it would cause points outside [-1,1] to be displayed.
*/
void clampCamera(double *pos); void clampCamera(double *pos);
}; };