EZ
Up Prev Next Contents


12.14 Polyhedra, Sphere and Tube

The EZwgl includes a few functions for generating regular polyhedra, sphere and tube.

12.14.1 Tetrahedron

void EZ_Tetrahedron(float x, float y, float z, float size);

This function renders a tetrahedron based on the given size and center. It uses the current polygon mode to decide whether to render all face polygons or just to render the edges.

12.14.2 Cube

void EZ_Cube(float x, float y, float z, float size);

This function renders a cube based on the given size and center. It uses the current polygon mode to decide whether to render all face polygons or just to render the edges.

12.14.3 Octahedron

void EZ_Octahedron(float x, float y, float z, float size);

This function renders an octahedron based on the given size and center. It uses the current polygon mode to decide whether to render all face polygons or just to render the edges.

12.14.4 Dodecahedron

void EZ_Dodecahedron(float x, float y, float z, float size);

This function renders a dodecahedron based on the given size and center. It uses the current polygon mode to decide whether to render all face polygons or just to render the edges.

12.14.5 Icosahedron

void EZ_Icosahedron(float x, float y, float z, float size);

This function renders an icosahedron based on the given size and center. It uses the current polygon mode to decide whether to render all face polygons or just to render the edges.

12.14.6 Sphere

void EZ_Sphere(int type, int level, float x, float y, float z, float r);

This function renders a sphere based on the given information. It uses the current polygon mode to decide whether to render all face polygons or just to render the edges. Types are:

EZ_SPHERE_TRIANGLE EZ_SPHERE_QUAD EZ_SPHERE_PARAMETRIC

12.14.7 Tube

void EZ_Tube(float *data, int nsegs, int nsides)

This function renders a tube based on the given data. data specifies a static array of floats. It should contain 4 * nsegs numbers. If we think of data as an array of 4 vectors, then the first three floats of each vector specifies a point and the last one specifies a radius. nsegs specifies the number of segments in data. nsides specifies the number of sides for each radial section.

For example, the following code draws a cone.

static float cone[] = { -1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.5, 1.0, 0.0, 0.0, 1.0, }; EZ_Tube(cone, 3, 16);


Up Prev Next Contents

HTML Documentation Maintainance:Arturo Espinosa <arturo@nuclecu.unam.mx>