CIvfExtrusion Class Reference

#include <ivf/IvfExtrusion.h>

Inheritance diagram for CIvfExtrusion:

CIvfShape CIvfObject CIvfBase CIvfRefCountBase CIvfRTTIBase CIvfSolidLine CIvfTubeExtrusion CIvfSplineTube List of all members.

Public Member Functions

 CIvfExtrusion ()
virtual ~CIvfExtrusion ()
 IvfClassInfo ("CIvfExtrusion", CIvfShape)
void setSectionSize (int size)
int getSectionSize ()
void setSectionCoord (int pos, double x, double y)
void getSectionCoord (int pos, double &x, double &y)
void setSectionNormal (int pos, double x, double y)
void getSectionNormal (int pos, double &x, double &y)
void setSpineSize (int size)
int getSpineSize ()
void setSpineCoord (int pos, double x, double y, double z)
void getSpineCoord (int pos, double &x, double &y, double &z)
void setSpineColor (int pos, float red, float green, float blue)
void getSpineColor (int pos, float &red, float &green, float &blue)
void setUseColor (bool flag)
bool getUseColor ()
void setSelectScale (double scale)
void setUpVector (double x, double y, double z)
void setTextureMode (int mode)
void setJoinStyle (int style)
void setStartEnd (int startIdx, int endIdx)
void setUseTwist (bool flag)
bool getUseTwist ()
void setSpineTwist (int pos, double twist)
void getSpineTwist (int pos, double &twist)
void updateBoundingSphere ()

Protected Member Functions

virtual void createSelect ()
virtual void createGeometry ()

Detailed Description

Extrusion shape class

CIvfExtrusion implements an extrusion shape using the gle library functions. A spine and a section are specified. Colors can also be set at each spine vertex. The following code shows how the extrusion class is used:

        // Create extrusion
 
        CIvfExtrusion* extrusion = new CIvfExtrusion();
        
        // Create section
        
        r = 0.5;
        nSides = 12;
        
        extrusion->setSectionSize(nSides + 1);
        
        for (i = 0; i<=nSides; i++)
        {
                angle = 2.0*M_PI*( ((double)i) / ((double)nSides) );
                x = r * cos(angle);
                y = r * sin(angle);
                extrusion->setSectionCoord(i, x, y);
                extrusion->setSectionNormal(i, x/r, y/r);
        }
        
        // Set spine
 
        extrusion->setSpineSize(6);
        extrusion->setSpineCoord(0,  0.5,  0.0,  1.5);
        extrusion->setSpineCoord(1,  1.0,  0.0,  1.0);
        extrusion->setSpineCoord(2,  1.0,  0.0, -1.0);
        extrusion->setSpineCoord(3, -1.0,  0.0, -1.0);
        extrusion->setSpineCoord(4, -1.0,  0.0,  1.0);
        extrusion->setSpineCoord(5, -0.5,  0.0,  1.5);
 
        // Set up-vector
        
        extrusion->setUpVector(0.0, 1.0, 0.0);
 
        // Set join style
 
        extrusion->setJoinStyle(TUBE_NORM_EDGE|TUBE_JN_ANGLE|TUBE_JN_CAP);
Author:
Jonas Lindemann
Version:
1.0.0
Examples:

extrusion.cpp.

Definition at line 89 of file IvfExtrusion.h.


Constructor & Destructor Documentation

CIvfExtrusion::CIvfExtrusion  ) 
 

CIvfExtrusion constructor.

virtual CIvfExtrusion::~CIvfExtrusion  )  [virtual]
 

CIvfExtrusion destructor.


Member Function Documentation

virtual void CIvfExtrusion::createGeometry  )  [protected, virtual]
 

Forces an object recalculation.

Reimplemented from CIvfShape.

virtual void CIvfExtrusion::createSelect  )  [protected, virtual]
 

Creates the select object.

When the object is selected. This method is called to create the object respresenting the select state.

Reimplemented from CIvfShape.

void CIvfExtrusion::getSectionCoord int  pos,
double &  x,
double &  y
 

Return section coordinate

void CIvfExtrusion::getSectionNormal int  pos,
double &  x,
double &  y
 

Return section normal

int CIvfExtrusion::getSectionSize  ) 
 

Returns the section size

void CIvfExtrusion::getSpineColor int  pos,
float &  red,
float &  green,
float &  blue
 

Return spine color

void CIvfExtrusion::getSpineCoord int  pos,
double &  x,
double &  y,
double &  z
 

Return spine coordinate

int CIvfExtrusion::getSpineSize  ) 
 

Returns spine size

void CIvfExtrusion::getSpineTwist int  pos,
double &  twist
 

Returns the spine twist at a given spine position

To use this method twisting should be enabled using the setUseTwist method.

bool CIvfExtrusion::getUseColor  ) 
 

Return UseColor flag

bool CIvfExtrusion::getUseTwist  ) 
 

Return twisting state

void CIvfExtrusion::setJoinStyle int  style  ) 
 

Sets the join style used

Texture modes corresponds to the defines in the GL/tube.h header file: /code TUBE_JN_RAW TUBE_JN_ANGLE TUBE_JN_CUT TUBE_JN_ROUND TUBE_JN_MASK TUBE_JN_CAP /endcode

void CIvfExtrusion::setSectionCoord int  pos,
double  x,
double  y
 

Set section coordinate

The section coordinates are specified in a 2D coordinate space. The spine is located at (0,0)

Parameters:
pos Section coordinate index. (0 to getSectionSize()-1)
x Section x-coordinate.
y Section y-coordinate.

void CIvfExtrusion::setSectionNormal int  pos,
double  x,
double  y
 

Set section normal

The section normals are specified in a 2D coordinate space.

Parameters:
pos Section normal index. (0 to getSectionSize()-1)
x Section normal x component.
y Section nromal y component.

void CIvfExtrusion::setSectionSize int  size  ) 
 

Sets section size

The size specifies the number of points and normals that constructs the section.

Parameters:
size Number of vertices in the section.

void CIvfExtrusion::setSelectScale double  scale  ) 
 

Set selection scaling

Sets the scalefactor on the select shape. (default 1.05)

Parameters:
scale 1.0 = same size as extrusion.

void CIvfExtrusion::setSpineColor int  pos,
float  red,
float  green,
float  blue
 

Set spine color

A color can be specified at each spine vertex. This color used if the UseColor flag is set.

Parameters:
pos Spine color index (0 to getSpineSize()-1)
red Red color component.
green Green color component.
blue Blue color component.

void CIvfExtrusion::setSpineCoord int  pos,
double  x,
double  y,
double  z
 

Set spine coordinate

The spine coordinates are specified in the global coordinate system.

Parameters:
pos Spine coordinate index (0 to getSpineSize()-1)
x Spine x coordinate
y Spine y coordinate
z Spine z coordinate

void CIvfExtrusion::setSpineSize int  size  ) 
 

Set spine size

The spine size property specifies how many vertices the spine should consist of. The first and last spine vertices are used to determine the orientation of the section in the first and last sections.

Parameters:
size Number of vertices in the spine (actual vertices + 2)

void CIvfExtrusion::setSpineTwist int  pos,
double  twist
 

Sets the spine twist at a given spine position

To use this method twisting should be enabled using the setUseTwist method.

void CIvfExtrusion::setStartEnd int  startIdx,
int  endIdx
 

Set start and end index for spine

This method can be used when drawing only a part of the extrusion

void CIvfExtrusion::setTextureMode int  mode  ) 
 

Sets the texture mode used

Texture modes corresponds to the defines in the GL/tube.h header file: /code GLE_TEXTURE_ENABLE GLE_TEXTURE_STYLE_MASK GLE_TEXTURE_VERTEX_FLAT GLE_TEXTURE_NORMAL_FLAT GLE_TEXTURE_VERTEX_CYL GLE_TEXTURE_NORMAL_CYL GLE_TEXTURE_VERTEX_SPH GLE_TEXTURE_NORMAL_SPH GLE_TEXTURE_VERTEX_MODEL_FLAT GLE_TEXTURE_NORMAL_MODEL_FLAT GLE_TEXTURE_VERTEX_MODEL_CYL GLE_TEXTURE_NORMAL_MODEL_CYL GLE_TEXTURE_VERTEX_MODEL_SPH GLE_TEXTURE_NORMAL_MODEL_SPH /endcode

void CIvfExtrusion::setUpVector double  x,
double  y,
double  z
 

Set the up-vector

Determines the orientation of the section.

Parameters:
x up vector x component
y up vector y component
z up vector z component

void CIvfExtrusion::setUseColor bool  flag  ) 
 

Set Use color flag

If this flag is set to TRUE the spine is drawn using the colors specified by the setSpineColor() method.

Parameters:
flag TRUE colors are used. FALSE standard material is used for the entire extrusion.

void CIvfExtrusion::setUseTwist bool  flag  ) 
 

Enable or disable twisting

void CIvfExtrusion::updateBoundingSphere  )  [virtual]
 

Updates bounding sphere

Upates the radius of the assigned bounding sphere, if any.

Reimplemented from CIvfObject.


The documentation for this class was generated from the following file:
Generated on Fri Sep 1 15:36:50 2006 for Interactive Visualisation Framework - Ivf++ by  doxygen 1.4.6-NO