GluonGraphics::Frustrum Class Reference

Describes a geometrical frustrum for projection calculations. More...

#include <frustrum.h>

List of all members.

Classes

class  FrustrumPrivate

Public Member Functions

 Frustrum ()
virtual ~Frustrum ()
 Frustrum (const Frustrum &other)
Frustrumoperator= (const Frustrum &other)
QMatrix4x4 projectionMatrix ()
bool containsPoint (const QVector3D &point)
bool containsSphere (const QVector3D &point, float radius)
float nearPlane ()
float farPlane ()
QRectF viewPlane ()
void setOrthographic (float left, float right, float bottom, float top, float near, float far)
void setOrthoAdjusted (const QSizeF &area, float aspect, float near, float far)
void setPerspective (float fov, float aspect, float near, float far)
void updateFrustrum (float aspect)

Detailed Description

Describes a geometrical frustrum for projection calculations.

A frustrum is essentially a pyramid with the top removed. It is used for projection calculations and a technqiue called frustrum culling.

Todo:
Expand this description and its use.

Definition at line 41 of file frustrum.h.


Constructor & Destructor Documentation

Frustrum::Frustrum (  ) 

Constructor.

Creates an identity frustrum.

Definition at line 56 of file frustrum.cpp.

Frustrum::~Frustrum (  )  [virtual]

Destructor.

Definition at line 76 of file frustrum.cpp.

Frustrum::Frustrum ( const Frustrum other  ) 

Definition at line 62 of file frustrum.cpp.


Member Function Documentation

bool Frustrum::containsPoint ( const QVector3D &  point  ) 

Check whether a point falls within the frustrum.

Parameters:
point The point to check whether it is inside the frustrum.
Returns:
True if the point is inside, false if outside.

Definition at line 88 of file frustrum.cpp.

bool Frustrum::containsSphere ( const QVector3D &  point,
float  radius 
)

Check whether a sphere falls within the frustrum.

Parameters:
point The centre point of the sphere that needs to be checked.
Parameters:
radius The radius of the sphere to check.
Returns:
True if the sphere is inside or intersects the frustrum. False if not.

Definition at line 94 of file frustrum.cpp.

float Frustrum::farPlane (  ) 

Retrieve the distance to the far plane of this frustrum.

Returns:
The distance to the far plane of this frustrum.

Definition at line 104 of file frustrum.cpp.

float Frustrum::nearPlane (  ) 

Retrieve the distance to the near plane of this frustrum.

Returns:
The distrance to the near plane of this frustrum.

Definition at line 99 of file frustrum.cpp.

Frustrum & Frustrum::operator= ( const Frustrum other  ) 

Definition at line 68 of file frustrum.cpp.

QMatrix4x4 Frustrum::projectionMatrix (  ) 

Retrieve the projection matrix.

Returns:
The projection matrix of this frustrum.

Definition at line 82 of file frustrum.cpp.

void Frustrum::setOrthoAdjusted ( const QSizeF &  area,
float  aspect,
float  near,
float  far 
)

Set this frustrum to use an orthographic projection, adjusted for aspect ratio.

Note that the view plane will always be centred on 0,0; that is, the view plane's left coordinate will be -(area.width / 2).

Parameters:
area The area describing the width and height of the view plane.
Parameters:
aspect The aspect ratio to adjust for.
Parameters:
near The distance to the near plane.
Parameters:
far The distance to the far plane.

Definition at line 129 of file frustrum.cpp.

void Frustrum::setOrthographic ( float  left,
float  right,
float  bottom,
float  top,
float  near,
float  far 
)

Set this frustrum to use an orthographic projection.

Parameters:
left The left coordinate of the view plane.
Parameters:
right The right coordinate of the view plane.
Parameters:
bottom The bottom coordinate of the view plane.
Parameters:
top The top coordinate of the view plane.
Parameters:
near The distance to the near plane.
Parameters:
far The distance to the far plane. Should be > near .

Definition at line 115 of file frustrum.cpp.

void Frustrum::setPerspective ( float  fov,
float  aspect,
float  near,
float  far 
)

Set this frustrum to use a perspective projection.

Parameters:
fov The field of view, in radians.
Parameters:
aspect Aspect ratio of the frustrum.
Parameters:
near Distance to the near plane.
Parameters:
far Distance to the far plane.

Definition at line 155 of file frustrum.cpp.

void Frustrum::updateFrustrum ( float  aspect  ) 

Update the frustrum to account for a new aspect ratio.

Parameters:
aspect The new aspect ratio to use.

Definition at line 169 of file frustrum.cpp.

QRectF Frustrum::viewPlane (  ) 

Retrieve the view plane of this frustrum.

The view plane is equal to the near plane.

Returns:
The view plane of this frustrum.

Definition at line 109 of file frustrum.cpp.


The documentation for this class was generated from the following files:
Generated on Mon Dec 27 13:13:43 2010 for Gluon by  doxygen 1.6.3