All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
GfCamera Class Reference

Object-based representation of a camera. More...

Public Types

enum  Projection { Perspective = 0, Orthographic }
 Projection type. More...
 
enum  FOVDirection { FOVHorizontal = 0, FOVVertical }
 Direction used for Field of View or orthographic size. More...
 

Public Member Functions

GF_API GfCamera (const GfMatrix4d &transform=GfMatrix4d(1.0), Projection projection=Perspective, float horizontalAperture=DEFAULT_HORIZONTAL_APERTURE, float verticalAperture=DEFAULT_VERTICAL_APERTURE, float horizontalApertureOffset=0.0, float verticalApertureOffset=0.0, float focalLength=50.0, const GfRange1f &clippingRange=GfRange1f(1, 1000000), const std::vector< GfVec4f > &clippingPlanes=std::vector< GfVec4f >(), float fStop=0.0, float focusDistance=0.0)
 
GF_API void SetTransform (const GfMatrix4d &val)
 Sets the transform of the filmback in world space to val. More...
 
GF_API void SetProjection (const Projection &val)
 Sets the projection type. More...
 
GF_API void SetClippingRange (const GfRange1f &val)
 Sets the clipping range in world units. More...
 
GF_API void SetClippingPlanes (const std::vector< GfVec4f > &val)
 Sets additional arbitrarily oriented clipping planes. More...
 
GF_API void SetFStop (const float val)
 Sets the lens aperture, unitless. More...
 
GF_API void SetFocusDistance (const float val)
 Sets the focus distance in world units. More...
 
GF_API GfMatrix4d GetTransform () const
 Returns the transform of the filmback in world space. More...
 
GF_API Projection GetProjection () const
 Returns the projection type. More...
 
GF_API float GetHorizontalAperture () const
 Returns the width of the projector aperture in tenths of a world unit (e.g., mm if the world unit is assumed to be cm). More...
 
GF_API float GetVerticalAperture () const
 Returns the height of the projector aperture in tenths of a world unit (e.g., mm if the world unit is assumed to be cm). More...
 
GF_API float GetHorizontalApertureOffset () const
 Returns the horizontal offset of the projector aperture in tenths of a world unit (e.g., mm if the world unit is assumed to be cm). More...
 
GF_API float GetVerticalApertureOffset () const
 Returns the vertical offset of the projector aperture in tenths of a world unit (e.g., mm if the world unit is assumed to be cm). More...
 
GF_API float GetAspectRatio () const
 Returns the projector aperture aspect ratio. More...
 
GF_API float GetFocalLength () const
 Returns the focal length in tenths of a world unit (e.g., mm if the world unit is assumed to be cm). More...
 
GF_API float GetFieldOfView (FOVDirection direction) const
 Returns the horizontal or vertical field of view in degrees. More...
 
GF_API GfRange1f GetClippingRange () const
 Returns the clipping range in world units. More...
 
GF_API const std::vector
< GfVec4f > & 
GetClippingPlanes () const
 Returns additional clipping planes. More...
 
GF_API GfFrustum GetFrustum () const
 Returns the computed, world-space camera frustum. More...
 
GF_API float GetFStop () const
 Returns the lens aperture. More...
 
GF_API float GetFocusDistance () const
 Returns the focus distance in world units. More...
 
GF_API bool operator== (const GfCamera &other) const
 Equality operator. true iff all parts match. More...
 
GF_API bool operator!= (const GfCamera &other) const
 
Physics based camera setup
GF_API void SetFocalLength (const float val)
 These are the values actually stored in the class and they correspond to measurements of an actual physical camera (in mm). More...
 
GF_API void SetHorizontalAperture (const float val)
 Sets the width of the projector aperture in tenths of a world unit (e.g., mm if the world unit is assumed to be cm). More...
 
GF_API void SetVerticalAperture (const float val)
 Sets the height of the projector aperture in tenths of a world unit (e.g., mm if the world unit is assumed to be cm). More...
 
GF_API void SetHorizontalApertureOffset (const float val)
 Sets the horizontal offset of the projector aperture in tenths of a world unit (e.g., mm if the world unit is assumed to be cm). More...
 
GF_API void SetVerticalApertureOffset (const float val)
 Sets the vertical offset of the projector aperture in tenths of a world unit (e.g., mm if the world unit is assumed to be cm). More...
 
Frustum geometry setup
GF_API void SetPerspectiveFromAspectRatioAndFieldOfView (float aspectRatio, float fieldOfView, FOVDirection direction, float horizontalAperture=DEFAULT_HORIZONTAL_APERTURE)
 Sets the frustum to be projective with the given aspectRatio and horizontal, respectively, vertical field of view fieldOfView (similar to gluPerspective when direction = FOVVertical). More...
 
GF_API void SetOrthographicFromAspectRatioAndSize (float aspectRatio, float orthographicSize, FOVDirection direction)
 Sets the frustum to be orthographic such that it has the given aspectRatio and such that the orthographic width, respectively, orthographic height (in cm) is equal to orthographicSize (depending on direction). More...
 

Static Public Attributes

static GF_API const double APERTURE_UNIT
 The unit for horizontal and vertical aperture is one tenth of the world unit. More...
 
static GF_API const double FOCAL_LENGTH_UNIT
 The unit for focal length. Similar to APERTURE_UNIT. More...
 
static GF_API const double DEFAULT_HORIZONTAL_APERTURE
 Default horizontal and vertical aperture, based on a 35mm (non-anamorphic) projector aperture (0.825 x 0602 inches, converted to mm). More...
 
static GF_API const double DEFAULT_VERTICAL_APERTURE
 

Detailed Description

Object-based representation of a camera.

This class provides a thin wrapper on the camera data model, with a small number of computations.

Definition at line 49 of file camera.h.

Member Enumeration Documentation

Direction used for Field of View or orthographic size.

Definition at line 59 of file camera.h.

enum Projection

Projection type.

Definition at line 53 of file camera.h.

Member Function Documentation

GF_API float GetAspectRatio ( ) const

Returns the projector aperture aspect ratio.

GF_API const std::vector<GfVec4f>& GetClippingPlanes ( ) const

Returns additional clipping planes.

GF_API GfRange1f GetClippingRange ( ) const

Returns the clipping range in world units.

GF_API float GetFieldOfView ( FOVDirection  direction) const

Returns the horizontal or vertical field of view in degrees.

GF_API float GetFocalLength ( ) const

Returns the focal length in tenths of a world unit (e.g., mm if the world unit is assumed to be cm).

GF_API float GetFocusDistance ( ) const

Returns the focus distance in world units.

GF_API GfFrustum GetFrustum ( ) const

Returns the computed, world-space camera frustum.

The frustum will always be that of a Y-up, -Z-looking camera.

GF_API float GetFStop ( ) const

Returns the lens aperture.

GF_API float GetHorizontalAperture ( ) const

Returns the width of the projector aperture in tenths of a world unit (e.g., mm if the world unit is assumed to be cm).

GF_API float GetHorizontalApertureOffset ( ) const

Returns the horizontal offset of the projector aperture in tenths of a world unit (e.g., mm if the world unit is assumed to be cm).

In particular, an offset is necessary when writing out a stereo camera with finite convergence distance as two cameras.

GF_API Projection GetProjection ( ) const

Returns the projection type.

GF_API GfMatrix4d GetTransform ( ) const

Returns the transform of the filmback in world space.

This is exactly the transform specified via SetTransform().

GF_API float GetVerticalAperture ( ) const

Returns the height of the projector aperture in tenths of a world unit (e.g., mm if the world unit is assumed to be cm).

GF_API float GetVerticalApertureOffset ( ) const

Returns the vertical offset of the projector aperture in tenths of a world unit (e.g., mm if the world unit is assumed to be cm).

GF_API bool operator== ( const GfCamera other) const

Equality operator. true iff all parts match.

GF_API void SetClippingPlanes ( const std::vector< GfVec4f > &  val)

Sets additional arbitrarily oriented clipping planes.

A vector (a,b,c,d) encodes a clipping plane that clips off points (x,y,z) with

   a * x + b * y + c * z + d * 1 < 0

where (x,y,z) are the coordinates in the camera's space.

GF_API void SetClippingRange ( const GfRange1f val)

Sets the clipping range in world units.

GF_API void SetFocalLength ( const float  val)

These are the values actually stored in the class and they correspond to measurements of an actual physical camera (in mm).

Together with the clipping range, they determine the camera frustum. Sets the focal length in tenths of a world unit (e.g., mm if the world unit is assumed to be cm).

GF_API void SetFocusDistance ( const float  val)

Sets the focus distance in world units.

GF_API void SetFStop ( const float  val)

Sets the lens aperture, unitless.

GF_API void SetHorizontalAperture ( const float  val)

Sets the width of the projector aperture in tenths of a world unit (e.g., mm if the world unit is assumed to be cm).

GF_API void SetHorizontalApertureOffset ( const float  val)

Sets the horizontal offset of the projector aperture in tenths of a world unit (e.g., mm if the world unit is assumed to be cm).

GF_API void SetOrthographicFromAspectRatioAndSize ( float  aspectRatio,
float  orthographicSize,
FOVDirection  direction 
)

Sets the frustum to be orthographic such that it has the given aspectRatio and such that the orthographic width, respectively, orthographic height (in cm) is equal to orthographicSize (depending on direction).

GF_API void SetPerspectiveFromAspectRatioAndFieldOfView ( float  aspectRatio,
float  fieldOfView,
FOVDirection  direction,
float  horizontalAperture = DEFAULT_HORIZONTAL_APERTURE 
)

Sets the frustum to be projective with the given aspectRatio and horizontal, respectively, vertical field of view fieldOfView (similar to gluPerspective when direction = FOVVertical).

Do not pass values for horionztalAperture unless you care about DepthOfField.

GF_API void SetProjection ( const Projection val)

Sets the projection type.

GF_API void SetTransform ( const GfMatrix4d val)

Sets the transform of the filmback in world space to val.

GF_API void SetVerticalAperture ( const float  val)

Sets the height of the projector aperture in tenths of a world unit (e.g., mm if the world unit is assumed to be cm).

GF_API void SetVerticalApertureOffset ( const float  val)

Sets the vertical offset of the projector aperture in tenths of a world unit (e.g., mm if the world unit is assumed to be cm).

Member Data Documentation

GF_API const double APERTURE_UNIT
static

The unit for horizontal and vertical aperture is one tenth of the world unit.

Thus, if the world unit is assumed to be cm, the horizontal and vertical aperture unit is mm.

Definition at line 67 of file camera.h.

GF_API const double DEFAULT_HORIZONTAL_APERTURE
static

Default horizontal and vertical aperture, based on a 35mm (non-anamorphic) projector aperture (0.825 x 0602 inches, converted to mm).

Definition at line 74 of file camera.h.

GF_API const double FOCAL_LENGTH_UNIT
static

The unit for focal length. Similar to APERTURE_UNIT.

Definition at line 69 of file camera.h.


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