CS488 PA8
Public Member Functions | Private Attributes | List of all members
ZBuffer Class Reference

#include <ZBuffer.h>

Public Member Functions

 ZBuffer (int width, int height)
 
 ~ZBuffer ()
 
void clear ()
 
double getPixel (int x, int y)
 
void setPixel (int x, int y, double z)
 

Private Attributes

double ** buffer
 
int height
 
int width
 
int xMax
 
int xMin
 
int yMax
 
int yMin
 

Detailed Description

A z-buffer (used for hidden line/surface removal).

A ZBuffer object uses Euclidean coordinates with (0,0) at the center.

Constructor & Destructor Documentation

◆ ZBuffer()

ZBuffer::ZBuffer ( int  width,
int  height 
)

Explicit Value Constructor.

Parameters
widthThe width of the ZBuffer (in pixels)
heightThe height of the ZBuffer (in pixels)

◆ ~ZBuffer()

ZBuffer::~ZBuffer ( )

Destructor.

Member Function Documentation

◆ clear()

void ZBuffer::clear ( )

Clear this ZBuffer.

◆ getPixel()

double ZBuffer::getPixel ( int  x,
int  y 
)

Get the z-value of the pixel at (x,y).

Parameters
xThe horizontal coordinate
yThe vertical coordinate
Returns
The z-value (or INFINITY if pixel empty or not valid)

◆ setPixel()

void ZBuffer::setPixel ( int  x,
int  y,
double  z 
)

Set the z-value of the pixel at (x,y).

Parameters
xThe horizontal coordinate
yThe vertical coordinate
zThe z-value

Member Data Documentation

◆ buffer

double** ZBuffer::buffer
private

The contents of the buffer.

◆ height

int ZBuffer::height
private

The height (in pixels).

◆ width

int ZBuffer::width
private

The width (in pixels).

◆ xMax

int ZBuffer::xMax
private

The maximum horizontal index.

◆ xMin

int ZBuffer::xMin
private

The minimum horizontal index.

◆ yMax

int ZBuffer::yMax
private

The maximum vertical index.

◆ yMin

int ZBuffer::yMin
private

The minimum vertical index.


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