cugl::Revolute Class Reference

#include <cugl.h>

Collaboration diagram for cugl::Revolute:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 Revolute (int numSteps, GLfloat profile[][2])
 ~Revolute ()
void setSlices (int slices)
void setEccentricity (double ecc)
void process ()
void draw (bool showNormals=false)

Private Member Functions

 Revolute::Revolute (const Revolute &)
const RevoluteRevolute::operator= (const Revolute &)

Private Attributes

int numSteps
int numSlices
double eccentricity
bool ready
GLfloatArraycoor
GLfloat * texCoor
Pointpoints
Vectornormals
VectorfaceNormals

Detailed Description

An instance is a surface of revolution represented by its profile.

The shape of the surface is determined by a 'profile'.

The profile is defined by an array. Each component of the array is a pair (h,r) in which h is measured along the axis of revolution and r is the distance from the axis. (If the axis is assumed to be vertical, then h suggests 'height' and r suggests 'radius'.) The surface is generated by rotating the profile about the Z-axis.

The function Revolute::draw() generates vertex coordinates, normals, and texture coordinates for the surface.

It is up to the caller to set the OpenGL state for rendering: this includes setting material properties and defining rules for polygon shading, or binding an appropriate texture.

The normals generated by Revolute::process() are obtained by averaging the normals of the polygons that meet at each vertex. Consequently, if GL_SMOOTH shading is used and sufficient points and slices are specified, the object should look fairly smooth.

Definition at line 2059 of file cugl.h.


Constructor & Destructor Documentation

cugl::Revolute::Revolute ( int  numSteps,
GLfloat  profile[][2] 
)

Construct a surface of revolution.

Parameters:
numSteps is the number of coordinates in the profile.
profile is the address of a 2D array giving the points of the profile.

cugl::Revolute::~Revolute (  ) 

Delete a surface of revolution.


Member Function Documentation

void cugl::Revolute::setSlices ( int  slices  ) 

Set the number of "slices". The value determines the visual quality of the object. The number of slices should be an odd number greater than 2. If it is not, Revolute::process() will change it. By default, the number of slices is 45, corresponding to 8 degrees per slice.

Note:
After changing the number of slices, you must call Revolute::process() again before calling Revolute::draw().

void cugl::Revolute::setEccentricity ( double  ecc  ) 

Set the eccentricity of the surface. By default, the eccentricity is 0, giving a surface with a circular cross-section. Setting the eccentricity to a non-zero value gives a surface with an elliptical cross-section. As the eccentricity approaches 1, the major axis of the ellipse increases without limit as the cross-section approaches a parabola.

Parameters:
ecc must be greater than or equal to zero and less than 1.
Note:
After changing the eccentricity, you must call Revolute::process() again before calling Revolute::draw().

void cugl::Revolute::process (  ) 

Compute vertexes, normals, and texture coordinates for the surface of revolution. This function must be called before calling Revolute::draw().

void cugl::Revolute::draw ( bool  showNormals = false  ) 

Draw the surface of revolution.

Parameters:
showNormals determines whether surface normals will be drawn. Note that surface normals are computed for lighting purposes anyway: showNormals is provided mainly as a debugging aid and should not normally be needed.
Note:
Revolute::process() must be called before this function.

cugl::Revolute::Revolute::Revolute ( const Revolute  )  [private]

The copy constructor is private and not implemented: instances cannot be copied implicitly.

const Revolute& cugl::Revolute::Revolute::operator= ( const Revolute  )  [private]

The assignment operator is private and not implemented: instances cannot be assigned.


Member Data Documentation

int cugl::Revolute::numSteps [private]

Definition at line 2133 of file cugl.h.

int cugl::Revolute::numSlices [private]

Definition at line 2136 of file cugl.h.

double cugl::Revolute::eccentricity [private]

Definition at line 2139 of file cugl.h.

bool cugl::Revolute::ready [private]

Definition at line 2142 of file cugl.h.

GLfloatArray* cugl::Revolute::coor [private]

Definition at line 2145 of file cugl.h.

GLfloat* cugl::Revolute::texCoor [private]

Definition at line 2148 of file cugl.h.

Point* cugl::Revolute::points [private]

Definition at line 2151 of file cugl.h.

Vector* cugl::Revolute::normals [private]

Definition at line 2154 of file cugl.h.

Vector* cugl::Revolute::faceNormals [private]

Definition at line 2157 of file cugl.h.


The documentation for this class was generated from the following file:
Generated on Wed Sep 12 14:31:42 2007 for CUGL by  doxygen 1.5.2