Figure Class Reference

[BlockOut Index] [BlockOut Heirarchy]


Manages the displaying and manipulating of figures build up of cubes of the size 1,1,1 More...

#include <Figure.h>

Public Members

Protected Members


Detailed Description

Manages the displaying and manipulating of figures build up of cubes of the size 1,1,1.


Figure(const int _sizeX, const int _sizeY, const char _sizeZ)

Surrounding border.

Figure(const Figure& fig)

Creates a copy of the cubes.

void addCube(const Position& pos, const Color* color)

Adds a cube with the color color to position pos. No check is done if there already exists a cube - causes memory leak if so -.

Cubes are oriented from pos to pos.getX+1, pos.getY+1, pos.getZ+ 1.

On clear the color is deleted.

void rotateX(const int direction)

Rotation around the x-axis. direction==1 means clock wise.

void rotateY(const int direction)

Rotation around the y-axis. direction==1 means clock wise.

void rotateZ(const int direction)

Rotation around the z-axis. direction==1 means clock wise.

int getCountOfCubes()

Returns the count of cubes set in this figure.

int getSizeX()

Returns the extend in x direction.

int getSizeY()

Returns the extend in y direction.

int getSizeZ()

Returns the extend in z direction.

virtual void clear()

Removes and deletes all cubes.

void moveTo(const Position& newPos)

Moves figure to position newPos.

void moveRel(const Position& rel)

Moves figure relative with rel.

const Position& getOrigin() const

Returns current position.

bool areCollisions(const Figure& fig)

Checks if any cube of this is on the same absolute position as any of fig and returns true in this case.

void insertFigure(Figure& fig1)

Removes the cubes from fig and inserts them in this at same absolute position.

No check for collisions is done - use checkForCollision before.

virtual void draw()

Draws figure on Draw3D::globalInstance using a z-buffer for planes.

static void setLookCenter(double x, double y)

Sets the x,y coordinates of the center of the view to determine if side of cube is visible or hidden - lower left corner is 0,0.

int get3DIndex(const Position& pos)

Return index of pos in linear addressing cubes or planeZBuffer.

int get2DIndex(const int x, const int y)

Return index of pos in linear addressing maxHeight.

void calculateZBuffer()

Calculates the z-Buffer from the cubes buffer.

void incrementPosition(int *x, int *y, int *z)

Increments the position of x,y,z with order x,y,z.

Position origin

The position of this figure relativ to origin of coordinate system

int size

sizeX*sizeY*sizeZ

const Color **cubes

Stores the color of the cubes or null if no cube present at position. cubes=[z][y][x] with 0<=x

unsigned char *planeZBuffer

Stores the visibility of the planes of the cubes of the figure. planeZBuffer=[z][y][x] with 0<=x

bool zBufferNeedsUpdate

True in case of new cubes in figure or movement.


Documentation generated by skyhunter@Dagobah on Wed Sep 16 18:39:03 MEST 1998
Kdoc