cpe::z_buffer Class Reference

Class to manage a depth-buffer. More...

+ Collaboration diagram for cpe::z_buffer:

Public Member Functions

 z_buffer ()
 Constructor with size=0. More...
 
 z_buffer (int size)
 Constructor with square picture of size: size*size. More...
 
 z_buffer (int size_x, int size_y)
 Constructor with square picture of given size. More...
 
void fill (double value)
 fill the z-buffe with special value More...
 
double operator() (const pos2 &u) const
 Accessor of value of the z-buffer. More...
 
double & operator() (const pos2 &u)
 Accessor of value of the z-buffer. More...
 
double get_max () const
 return the max value of the z-buffer (eliminating the infinity value) More...
 
double get_min () const
 return the min value of the z-buffer More...
 
int size_x () const
 size of the z-buffer in x More...
 
int size_y () const
 size of the z-buffer in y More...
 
void export_file (const std::string &filename) const
 write the z-buffer as an image into a file More...
 

Protected Member Functions

int coordinate_to_index (const pos2 &u) const
 convert (x,y) coordinate to index More...
 
void assert_position (const pos2 &u) const
 check if u is in bounds of the picture More...
 

Private Attributes

std::vector< double > internal_data
 check internal data More...
 
int internal_size_x
 size x of the z-buffer More...
 
int internal_size_y
 size y of the z-buffer More...
 

Static Private Attributes

static const double depth_infinity =9e5
 infinity value More...
 

Detailed Description

Class to manage a depth-buffer.

Constructor & Destructor Documentation

cpe::z_buffer::z_buffer ( )

Constructor with size=0.

cpe::z_buffer::z_buffer ( int  size)

Constructor with square picture of size: size*size.

Note
Init the z-buffer to infinity

References depth_infinity, and fill().

+ Here is the call graph for this function:

cpe::z_buffer::z_buffer ( int  size_x,
int  size_y 
)

Constructor with square picture of given size.

Note
Init the z-buffer to infinity

References depth_infinity, and fill().

+ Here is the call graph for this function:

Member Function Documentation

void cpe::z_buffer::assert_position ( const pos2 u) const
protected

check if u is in bounds of the picture

References internal_size_x, internal_size_y, MACRO_EXCEPTION_PARAMETER, cpe::pos2::x(), and cpe::pos2::y().

Referenced by operator()().

+ Here is the call graph for this function:

int cpe::z_buffer::coordinate_to_index ( const pos2 u) const
protected

convert (x,y) coordinate to index

References internal_size_x, cpe::pos2::x(), and cpe::pos2::y().

Referenced by operator()().

+ Here is the call graph for this function:

void cpe::z_buffer::export_file ( const std::string &  filename) const

write the z-buffer as an image into a file

References cpe::export_ppm().

+ Here is the call graph for this function:

void cpe::z_buffer::fill ( double  value)

fill the z-buffe with special value

References internal_data.

Referenced by z_buffer().

double cpe::z_buffer::get_max ( ) const

return the max value of the z-buffer (eliminating the infinity value)

References depth_infinity, and internal_data.

Referenced by cpe::export_ppm().

double cpe::z_buffer::get_min ( ) const

return the min value of the z-buffer

References depth_infinity, and internal_data.

Referenced by cpe::export_ppm().

double cpe::z_buffer::operator() ( const pos2 u) const

Accessor of value of the z-buffer.

References assert_position(), coordinate_to_index(), and internal_data.

+ Here is the call graph for this function:

double & cpe::z_buffer::operator() ( const pos2 u)

Accessor of value of the z-buffer.

References assert_position(), coordinate_to_index(), and internal_data.

+ Here is the call graph for this function:

int cpe::z_buffer::size_x ( ) const

size of the z-buffer in x

References internal_size_x.

Referenced by cpe::export_ppm().

int cpe::z_buffer::size_y ( ) const

size of the z-buffer in y

References internal_size_y.

Referenced by cpe::export_ppm().

Member Data Documentation

const double cpe::z_buffer::depth_infinity =9e5
staticprivate

infinity value

Referenced by get_max(), get_min(), and z_buffer().

std::vector<double> cpe::z_buffer::internal_data
private

check internal data

Referenced by fill(), get_max(), get_min(), and operator()().

int cpe::z_buffer::internal_size_x
private

size x of the z-buffer

Referenced by assert_position(), coordinate_to_index(), and size_x().

int cpe::z_buffer::internal_size_y
private

size y of the z-buffer

Referenced by assert_position(), and size_y().


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