SPH
Public Member Functions | List of all members
PerspectiveCamera Class Reference

Perspective camera. More...

#include <Camera.h>

Inheritance diagram for PerspectiveCamera:
ICamera Polymorphic

Public Member Functions

 PerspectiveCamera (const CameraParams &data)
 
virtual void autoSetup (const Storage &storage) override
 Initializes the camera, using the provided particle storage. More...
 
virtual Optional< ProjectedPointproject (const Vector &r) const override
 Returns projected position of particle on the image. More...
 
virtual Optional< CameraRayunproject (const Coords &coords) const override
 Returns a ray in particle coordinates corresponding to given coordinates in the image plane. More...
 
virtual Pixel getSize () const override
 Returns the current resolution of the camera. More...
 
virtual AffineMatrix getFrame () const override
 Returns the transformation matrix converting camera space to world space. More...
 
virtual Vector getTarget () const override
 Returns the current target point of the camera. More...
 
virtual Vector getUpVector () const override
 Returns the reference "up" direction of the camera. More...
 
virtual Optional< float > getCutoff () const override
 Returns the clipping distance from plane passing through origin, perpendicular to camera direction. More...
 
virtual Optional< float > getWorldToPixel () const override
 Returns the world-to-pixel ratio. More...
 
virtual void setCutoff (const Optional< float > newCutoff) override
 Modifies the clipping distance of the camera. More...
 
virtual void zoom (const Pixel UNUSED(fixedPoint), const float magnitude) override
 
virtual void setPosition (const Vector &newPosition) override
 Moves the camera to new position in world space. More...
 
virtual void setTarget (const Vector &newTarget) override
 
virtual void transform (const AffineMatrix &matrix) override
 Transforms the current view by given matrix. More...
 
virtual void pan (const Pixel offset) override
 Moves the camera by relative offset in image space. More...
 
virtual void resize (const Pixel newSize) override
 Changes the image size. More...
 
virtual AutoPtr< ICameraclone () const override
 
- Public Member Functions inherited from ICamera
virtual void zoom (const Pixel fixedPoint, const float magnitude)=0
 
- Public Member Functions inherited from Polymorphic
virtual ~Polymorphic ()
 

Detailed Description

Perspective camera.

Definition at line 225 of file Camera.h.

Constructor & Destructor Documentation

◆ PerspectiveCamera()

PerspectiveCamera::PerspectiveCamera ( const CameraParams data)

Definition at line 219 of file Camera.cpp.

Member Function Documentation

◆ autoSetup()

void PerspectiveCamera::autoSetup ( const Storage storage)
overridevirtual

Initializes the camera, using the provided particle storage.

Implements ICamera.

Definition at line 226 of file Camera.cpp.

◆ clone()

virtual AutoPtr<ICamera> PerspectiveCamera::clone ( ) const
inlineoverridevirtual
Todo:
revert to ClonePtr!

Implements ICamera.

Definition at line 278 of file Camera.h.

◆ getCutoff()

Optional< float > PerspectiveCamera::getCutoff ( ) const
overridevirtual

Returns the clipping distance from plane passing through origin, perpendicular to camera direction.

If no clipping is used, the function returns NOTHING. Useful to view a section through a body rather than its surface.

Implements ICamera.

Definition at line 289 of file Camera.cpp.

◆ getFrame()

AffineMatrix PerspectiveCamera::getFrame ( ) const
overridevirtual

Returns the transformation matrix converting camera space to world space.

In the camera space, camera direction is aligned with the z-axis, y-axis corresponds to the up-vector and x-axis is perpendicular, i.e. left-vector.

Implements ICamera.

Definition at line 279 of file Camera.cpp.

◆ getSize()

Pixel PerspectiveCamera::getSize ( ) const
overridevirtual

Returns the current resolution of the camera.

Implements ICamera.

Definition at line 275 of file Camera.cpp.

◆ getTarget()

Vector PerspectiveCamera::getTarget ( ) const
overridevirtual

Returns the current target point of the camera.

Implements ICamera.

Definition at line 285 of file Camera.cpp.

◆ getUpVector()

Vector PerspectiveCamera::getUpVector ( ) const
overridevirtual

Returns the reference "up" direction of the camera.

Implements ICamera.

Definition at line 316 of file Camera.cpp.

◆ getWorldToPixel()

Optional< float > PerspectiveCamera::getWorldToPixel ( ) const
overridevirtual

Returns the world-to-pixel ratio.

Implements ICamera.

Definition at line 294 of file Camera.cpp.

◆ pan()

void PerspectiveCamera::pan ( const Pixel  offset)
overridevirtual

Moves the camera by relative offset in image space.

Implements ICamera.

Definition at line 329 of file Camera.cpp.

◆ project()

Optional< ProjectedPoint > PerspectiveCamera::project ( const Vector r) const
overridevirtual

Returns projected position of particle on the image.

If the particle is outside of the image region or is clipped by the projection, returns NOTHING.

Implements ICamera.

Definition at line 239 of file Camera.cpp.

◆ resize()

void PerspectiveCamera::resize ( const Pixel  newSize)
overridevirtual

Changes the image size.

Implements ICamera.

Definition at line 337 of file Camera.cpp.

◆ setCutoff()

void PerspectiveCamera::setCutoff ( const Optional< float >  newCutoff)
overridevirtual

Modifies the clipping distance of the camera.

The clipping can be disabled by passing NOTHING.

Implements ICamera.

Definition at line 298 of file Camera.cpp.

◆ setPosition()

void PerspectiveCamera::setPosition ( const Vector newPosition)
overridevirtual

Moves the camera to new position in world space.

Implements ICamera.

Definition at line 306 of file Camera.cpp.

◆ setTarget()

void PerspectiveCamera::setTarget ( const Vector newTarget)
overridevirtual

Implements ICamera.

Definition at line 311 of file Camera.cpp.

◆ transform()

void PerspectiveCamera::transform ( const AffineMatrix matrix)
overridevirtual

Transforms the current view by given matrix.

This replaces previous transformation matrix, i.e. subsequent calls do not accumulate.

Parameters
matrixTransform matrix applied to the camera.

Implements ICamera.

Definition at line 320 of file Camera.cpp.

◆ unproject()

Optional< CameraRay > PerspectiveCamera::unproject ( const Coords coords) const
overridevirtual

Returns a ray in particle coordinates corresponding to given coordinates in the image plane.

Todo:
implement far clipping plane (max ray param)

Implements ICamera.

Definition at line 264 of file Camera.cpp.

◆ zoom()

void PerspectiveCamera::zoom ( const Pixel   UNUSEDfixedPoint,
const float  magnitude 
)
overridevirtual

Definition at line 300 of file Camera.cpp.

Member Data Documentation

◆ dir

Vector PerspectiveCamera::dir

Unit direction of the camera.

Definition at line 231 of file Camera.h.

◆ left

Vector PerspectiveCamera::left

Left vector of the camera, size of which of represents the image size at unit distance.

Definition at line 237 of file Camera.h.

◆ up

Vector PerspectiveCamera::up

Up vector of the camera, size of which of represents the image size at unit distance.

Definition at line 234 of file Camera.h.

◆ velocity

Vector PerspectiveCamera::velocity

Definition at line 239 of file Camera.h.


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