# Home    # nevrax.com   
Nevrax
Nevrax.org
#News
#Mailing-list
#Documentation
#CVS
#Bugs
#License
Docs
 
Documentation  
Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages   Search  

NL3D::CFrustum Class Reference

A Screen frustum, perspective or orthogonal. More...

#include <frustum.h>

List of all members.

Public Methods

 CFrustum ()
 Un-initialized frustum. More...

 CFrustum (float left, float right, float bottom, float top, float znear, float zfar, bool perspective= true)
 ctor. More...

void init (float left, float right, float bottom, float top, float znear, float zfar, bool perspective= true)
 Init a frustum. More...

void init (float width, float height, float znear, float zfar, bool perspective= true)
 Init a centered frustum. More...

void initPerspective (float fov, float aspectRatio, float znear, float zfar)
 Setup a perspective frustum, giving a fov in radians. More...

void getValues (float &left, float &right, float &bottom, float &top, float &znear, float &zfar) const
 Get the value of the frustum. More...

CVector project (const CVector &vec) const
 project a vector (x,y,z) onto frustum. More...

CVector unProject (const CVector &vec) const
 unproject a point from screen to the frustum space. More...


Public Attributes

float Left
 NB: znear and zfar must be >0 (if perspective). More...

float Right
float Bottom
float Top
float Near
float Far
bool Perspective


Detailed Description

A Screen frustum, perspective or orthogonal.

No default ctor. Usefull for camera.

Author(s):
Lionel Berenguier , Nevrax France
Date:
2000

Definition at line 46 of file frustum.h.


Constructor & Destructor Documentation

NL3D::CFrustum::CFrustum ( ) [inline]
 

Un-initialized frustum.

Definition at line 55 of file frustum.h.

NL3D::CFrustum::CFrustum ( float left,
float right,
float bottom,
float top,
float znear,
float zfar,
bool perspective = true ) [inline]
 

ctor.

Definition at line 57 of file frustum.h.


Member Function Documentation

void NL3D::CFrustum::getValues ( float & left,
float & right,
float & bottom,
float & top,
float & znear,
float & zfar ) const
 

Get the value of the frustum.

Definition at line 59 of file frustum.cpp.

void NL3D::CFrustum::init ( float width,
float height,
float znear,
float zfar,
bool perspective = true )
 

Init a centered frustum.

Definition at line 48 of file frustum.cpp.

void NL3D::CFrustum::init ( float left,
float right,
float bottom,
float top,
float znear,
float zfar,
bool perspective = true )
 

Init a frustum.

Definition at line 37 of file frustum.cpp.

void NL3D::CFrustum::initPerspective ( float fov,
float aspectRatio,
float znear,
float zfar )
 

Setup a perspective frustum, giving a fov in radians.

Parameters:
fov   the horizontal angle of view, in radians. (Pi/2 as example)
aspectRatio   the ratio horizontal/vertical (1.33 as example).
znear   the front clipping plane distance.
zfar   the back clipping plane distance.

Definition at line 52 of file frustum.cpp.

CVector NL3D::CFrustum::project ( const CVector & vec ) const
 

project a vector (x,y,z) onto frustum.

Parameters:
vec   the point in 3D frustum space. Axis is NL3D axis: Xright, Yfront, Ztop.
Returns:
the point in 2D: Xright, Ytop, Z=0. Screen is mapped to X:[0..1], Y: [0..1].

Definition at line 71 of file frustum.cpp.

CVector NL3D::CFrustum::unProject ( const CVector & vec ) const
 

unproject a point from screen to the frustum space.

Parameters:
vec   the point on the screen, in Left hand axis (XRight, YTop, ZFront). Z must be in [0..1] and hyperbolic.
Returns:
the point in the frustum space (NL3D right hand axis).

Definition at line 117 of file frustum.cpp.


Member Data Documentation

float NL3D::CFrustum::Bottom
 

Definition at line 50 of file frustum.h.

float NL3D::CFrustum::Far
 

Definition at line 50 of file frustum.h.

float NL3D::CFrustum::Left
 

NB: znear and zfar must be >0 (if perspective).

Definition at line 50 of file frustum.h.

float NL3D::CFrustum::Near
 

Definition at line 50 of file frustum.h.

bool NL3D::CFrustum::Perspective
 

Definition at line 51 of file frustum.h.

float NL3D::CFrustum::Right
 

Definition at line 50 of file frustum.h.

float NL3D::CFrustum::Top
 

Definition at line 50 of file frustum.h.


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