HE::Polyhedron_GL Class Reference

Wrapper class used to visualize a Polyhedron. More...

#include <polyhedron_gl.h>

List of all members.

Public Member Functions

 Polyhedron_GL (const Polyhedron *p)
 Constructor.
void drawBoundingBox () const
 Issues OpenGL commands to render the bounding box of the mesh.
void drawVertices () const
 Issues OpenGL commands to render the vertices of the mesh.
void drawCentroids () const
 Issues OpenGL commands to render the centroids of the faces of the mesh.
void drawEdges () const
 Issues OpenGL commands to render the edges of the mesh.
void drawHoles () const
 Issues OpenGL commands to render the boundaries of the holes of the mesh (edges adjacent to a hole).
void drawFaces (bool flat=false, bool faceColors=false) const
 Issues OpenGL commands to render the faces of the mesh.
void drawFaces (const std::map< const Face *, Geometry::Vector3Df > &fnormals, bool faceColors=false) const
 Issues OpenGL commands to render the faces of the mesh.
void drawFacesWithColors (const std::map< const Vertex *, Geometry::Vector3Df > &vcolors, bool flat=false) const
 Issues OpenGL commands to render the faces of the mesh.
void drawFacesWithTexture (const std::map< const Vertex *, Geometry::Vector3Df > &tCoords, bool flat=false) const
 Draws the faces using the provided texture coordinates.
void drawTriangles (bool flat=false, bool faceColors=false) const
 Issues OpenGL commands to render the faces of the mesh as if they were triangles.
void drawNormals () const
 Issues OpenGL commands to render the normals of the mesh.
void drawFaceNormals () const
 Issues OpenGL commands to render the face normals of the mesh.
void drawFaceNormals (const std::map< const Face *, Geometry::Vector3Df > &fn) const
 Issues OpenGL commands to render the face normals of the mesh.
void recomputeNormals ()
 Recomputes the vertex and face normals of the mesh.
void recomputeCentroids ()
 Recomputes the centroids of the faces of the mesh.
void recomputeColors ()
 Recomputes the random colors associated to each face in the mesh.
void recomputeBoundingBox ()
 Recomputes the bounding box of the mesh.
float normalLen () const
 Returns the length used for rendering the normals.
void normalLen (float l)
 Sets the length used for rendering the normals.

Protected Attributes

const Polyhedron_poly
std::map< const
Vertex *,
Geometry::Vector3Df
_vNormals
std::map< const Face *,
Geometry::Vector3Df
_fNormals
std::map< const Face *,
Geometry::Vector3Df
_centroids
std::map< const Face *,
Geometry::Vector3Df
_randomColors
float _normalLen
Geometry::Vector3Df _bbox [2]


Detailed Description

Wrapper class used to visualize a Polyhedron.

It calls OpenGL functions to help applications draw the different elements of the mesh easily. It only deals with issuing the contained information to OpenGL, not with the transformations, window management and other tasks necessary to render an object. These tasks are left to the client application.

Definition at line 34 of file polyhedron_gl.h.


Constructor & Destructor Documentation

Polyhedron_GL::Polyhedron_GL ( const Polyhedron p  ) 

Constructor.

Creates a Polyhedron_GL around a Polyhedron which is to be drawn.

Parameters:
p The Polyhedron used for drawing.

Definition at line 34 of file polyhedron_gl.cpp.

References _poly, HE::Polyhedron::fBegin(), HE::Polyhedron::fEnd(), HE::Polyhedron::GL(), HE::Polyhedron::numFaces(), HE::Polyhedron::numHoles(), HE::Polyhedron::numVertices(), recomputeBoundingBox(), recomputeCentroids(), recomputeColors(), and recomputeNormals().


Member Function Documentation

void Polyhedron_GL::drawFaces ( bool  flat = false,
bool  faceColors = false 
) const

Issues OpenGL commands to render the faces of the mesh.

The faces can be rendered in flat or Gouraud shading mode, and they can optionally be randomly colored. If all the faces are triangles, it is more efficient to use drawTriangles instead.

Parameters:
flat Indicates if flat shading should be used. The default is false (Gouraud shading).
faceColors Indicates if random colors should be used. The default is false.
See also:
drawTriangles

Definition at line 154 of file polyhedron_gl.cpp.

References _fNormals, _poly, _randomColors, _vNormals, HE::Face::begin(), HE::Polyhedron::fBegin(), HE::Polyhedron::fEnd(), HE::Face::hole(), and HE::Vertex::position().

void HE::Polyhedron_GL::drawFaces ( const std::map< const Face *, Geometry::Vector3Df > &  fnormals,
bool  faceColors = false 
) const

Issues OpenGL commands to render the faces of the mesh.

The faces are rendered in flat shading mode, and the normals are specified by the user, via an stl map. If all the faces are triangles, it is more efficient to use drawTriangles instead.

Parameters:
fnormals Indicates the normal of each face.
faceColors Indicates if random colors should be used. The default is false.
See also:
drawTriangles

drawFaces

void HE::Polyhedron_GL::drawFacesWithColors ( const std::map< const Vertex *, Geometry::Vector3Df > &  vcolors,
bool  flat = false 
) const

Issues OpenGL commands to render the faces of the mesh.

The faces are rendered with different colors for different vertices, as specified by the user via an stl map. If all the faces are triangles, it is more efficient to use drawTriangles instead.

Parameters:
vcolors Indicates the color of each vertex.
flat Indicates if flat shading should be used. The default is false (Gouraud shading).
See also:
drawTriangles

drawFaces

void HE::Polyhedron_GL::drawFacesWithTexture ( const std::map< const Vertex *, Geometry::Vector3Df > &  tCoords,
bool  flat = false 
) const

Draws the faces using the provided texture coordinates.

Parameters:
tCoords Per vertex texture coordinates.
flat Indicates if flat shading should be used. The default is false (Gouraud shading).
See also:
drawFaces

drawTriangles

void Polyhedron_GL::drawTriangles ( bool  flat = false,
bool  faceColors = false 
) const

Issues OpenGL commands to render the faces of the mesh as if they were triangles.

It is more efficient than drawFaces, but it leaves gaps if the faces are not triangular. The faces can be rendered in flat or Gouraud shading mode, and they can optionally be randomly colored.

Parameters:
flat Indicates if flat shading should be used. The default is false (Gouraud shading).
faceColors Indicates if random colors should be used. The default is false.
See also:
drawFaces

Definition at line 290 of file polyhedron_gl.cpp.

References _fNormals, _poly, _randomColors, _vNormals, HE::Face::begin(), HE::Polyhedron::fBegin(), HE::Polyhedron::fEnd(), HE::Face::hole(), and HE::Vertex::position().

void Polyhedron_GL::drawNormals (  )  const

Issues OpenGL commands to render the normals of the mesh.

Normals are rendered as short line segments starting from the vertices and along the appropriate direction.

Definition at line 245 of file polyhedron_gl.cpp.

References _normalLen, _poly, _vNormals, HE::Vertex::position(), HE::Polyhedron::vBegin(), and HE::Polyhedron::vEnd().

void Polyhedron_GL::drawFaceNormals (  )  const

Issues OpenGL commands to render the face normals of the mesh.

Face normals are rendered as short line segments starting from the centroids and along the appropriate direction.

Definition at line 259 of file polyhedron_gl.cpp.

References _centroids, _fNormals, _normalLen, _poly, HE::Polyhedron::fBegin(), and HE::Polyhedron::fEnd().

void HE::Polyhedron_GL::drawFaceNormals ( const std::map< const Face *, Geometry::Vector3Df > &  fn  )  const

Issues OpenGL commands to render the face normals of the mesh.

Face normals are rendered as short line segments starting from the centroids and along the appropriate direction.

Parameters:
fn Indicates the normals to be used for each face

void Polyhedron_GL::recomputeNormals (  ) 

Recomputes the vertex and face normals of the mesh.

These normals can be used for appropriate polygon shading, or they can also be directly rendered.

Definition at line 315 of file polyhedron_gl.cpp.

References _fNormals, _poly, _vNormals, HE::Polyhedron::fBegin(), HE::Polyhedron::fEnd(), HE::Face::normal(), HE::Vertex::normal(), HE::Polyhedron::vBegin(), and HE::Polyhedron::vEnd().

Referenced by HE::Polyhedron::invertNormals(), Polyhedron_GL(), and HE::Polyhedron::scaleAndCenter().

float HE::Polyhedron_GL::normalLen (  )  const [inline]

Returns the length used for rendering the normals.

Returns:
Length in OpenGL world units of the length of the rendered normals.

Definition at line 166 of file polyhedron_gl.h.

References _normalLen.

void HE::Polyhedron_GL::normalLen ( float  l  )  [inline]

Sets the length used for rendering the normals.

Parameters:
l Desired length in OpenGL world units of the length of the rendered normals.

Definition at line 172 of file polyhedron_gl.h.

References _normalLen.


The documentation for this class was generated from the following files:
Generated on Wed Apr 9 19:22:40 2008 for HalfEdge library by  doxygen 1.5.3