# 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
 NB: znear and zfar must be >0 (if perspective). More...

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

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

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

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

bool Perspective


Detailed Description

A Screen frustum, perspective or orthogonal.

No default ctor. Usefull for camera.

Author:
Lionel Berenguier , Nevrax France
Date:
2000

Definition at line 47 of file frustum.h.


Constructor & Destructor Documentation

NL3D::CFrustum::CFrustum   [inline]
 

Un-initialized frustum.

Definition at line 56 of file frustum.h.

References NL3D_MEM_FRUSTRUM.

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

ctor.

Definition at line 61 of file frustum.h.

References init, and NL3D_MEM_FRUSTRUM.


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 64 of file frustum.cpp.

References Bottom, Far, Left, Near, NL3D_MEM_FRUSTRUM, Right, and Top.

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

Init a centered frustum.

Definition at line 51 of file frustum.cpp.

References height, init, NL3D_MEM_FRUSTRUM, and width.

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 39 of file frustum.cpp.

References Bottom, Far, Left, Near, NL3D_MEM_FRUSTRUM, Perspective, Right, and Top.

Referenced by CFrustum, init, and initPerspective.

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 56 of file frustum.cpp.

References init, NL3D_MEM_FRUSTRUM, and w.

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 77 of file frustum.cpp.

References Bottom, Left, Near, NL3D_MEM_FRUSTRUM, Right, Top, and w.

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 124 of file frustum.cpp.

References Bottom, Far, Left, Near, NL3D_MEM_FRUSTRUM, nlstop, Right, Top, and w.


Member Data Documentation

float NL3D::CFrustum::Bottom
 

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

Definition at line 51 of file frustum.h.

Referenced by getValues, init, project, and unProject.

float NL3D::CFrustum::Far
 

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

Definition at line 51 of file frustum.h.

Referenced by getValues, init, and unProject.

float NL3D::CFrustum::Left
 

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

Definition at line 51 of file frustum.h.

Referenced by getValues, init, project, and unProject.

float NL3D::CFrustum::Near
 

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

Definition at line 51 of file frustum.h.

Referenced by getValues, init, project, and unProject.

bool NL3D::CFrustum::Perspective
 

Definition at line 52 of file frustum.h.

Referenced by init.

float NL3D::CFrustum::Right
 

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

Definition at line 51 of file frustum.h.

Referenced by getValues, init, project, and unProject.

float NL3D::CFrustum::Top
 

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

Definition at line 51 of file frustum.h.

Referenced by getValues, init, project, and unProject.


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