# Visualization Library

A lightweight C++ OpenGL middleware for 2D/3D graphics

[Home] [Tutorials] [All Classes] [Grouped Classes]

Classes | Public Member Functions | Protected Member Functions | Protected Attributes

# vl::EdgeExtractor Class Reference

The EdgeExtractor class extracts the edges from one or more Geometry objects. More...

`#include <EdgeExtractor.hpp>`

Inheritance diagram for vl::EdgeExtractor:

List of all members.

## Classes

class | Edge
| A single edge as extracted from the EdgeExtractor class. More...

## Public Member Functions

| EdgeExtractor ()
void | extractEdges (Geometry *geom)
| Extracts the edges from the given Geometry and appends them to edges().
bool | extractEdges (Actor *actor)
void | extractEdges (ActorCollection *actors)
void | extractEdges (SceneManager *scenemanager)
void | extractEdges (Rendering *rendering)
ref< Geometry > | generateEdgeGeometry () const
const std::vector< Edge > & | edges () const
std::vector< Edge > & | edges ()
void | reset ()
float | creaseAngle () const
| The minimum angle (in degrees) considered to generate crease-edges.
void | setCreaseAngle (float a)
| The minimum angle (in degrees) considered to generate crease-edges.
bool | warnNonManifold () const
void | setWarnNonManifold (bool warn_on)

## Protected Member Functions

void | addEdge (std::set< EdgeExtractor::Edge > &edges, const EdgeExtractor::Edge &e, const fvec3 &n)

## Protected Attributes

std::vector< Edge > | mEdges
float | mCreaseAngle
bool | mWarnNonManifold

## Detailed Description

The EdgeExtractor class extracts the edges from one or more Geometry objects.

The edges are always extracted from the triangles or quads that are part of a vl::Geometry and can be of three types: silhouette edges, crease edges and boundary edges.

- Silhouette edges are those edges that are shared by a backfacing and front facing quad or triangle.

- Crease edges are those edges that are shared by two triangles or quads and that form an angle >= creaseAngle(), ie: 0 means that the two triangles or quads are coplanar; the edges of a cube define 90 degrees angles; the lateral edges of a 10 faces cylinder define 36 (360/10) degrees angles and so on.

- Boundary edges are those edges that belong to a single triangle or quad.

Usage
  - Extract the edges from one or more Geometry objects using one of the extractEdges() methods.
  - Assign the Geometry returned by generateEdgeGeometry() to a new Actor. This geometry will contain the edges previously extracted ready to be rendered.
  - Assign a new EdgeUpdateCallback to the previously created Actor, using the Actor::renderEventCallbacks() method.
  - Initialize the previously created EdgeUpdateCallback edges with the edges extracted by the EdgeExtractor, that is, assign EdgeExtractor::edges() to EdgeUpdateCallback::edges().

See also:
  - Edge Enhancement and Wireframe Rendering Tutorial
  - vl::EdgeRenderer

Definition at line 73 of file EdgeExtractor.hpp.

## Constructor & Destructor Documentation

vl::EdgeExtractor::EdgeExtractor | ( | ) | `[inline]`

Definition at line 136 of file EdgeExtractor.hpp.

References VL_DEBUG_SET_OBJECT_NAME.

## Member Function Documentation

void EdgeExtractor::extractEdges | ( | Geometry * | geom ) |

Extracts the edges from the given Geometry and appends them to edges().

Definition at line 67 of file EdgeExtractor.cpp.

References vl::acos(), addEdge(), vl::Collection< T >::at(), vl::clamp(), creaseAngle(), vl::cross(), vl::VertexAttribInfo::data(), vl::dot(), vl::Geometry::drawCalls(), edges(), vl::Log::error(), vl::fPi, vl::ArrayAbstract::getAsVec3(), vl::TriangleIterator::hasNext(), vl::Vector3< T_Scalar >::isNull(), mEdges, vl::EdgeExtractor::Edge::normal1(), vl::EdgeExtractor::Edge::normal2(), vl::Vector3< T_Scalar >::normalize(), NULL, vl::EdgeExtractor::Edge::setIsCrease(), vl::Collection< T >::size(), vl::DrawCall::triangleIterator(), vl::VA_Position, vl::Geometry::vertexArray(), and vl::Geometry::vertexAttribArray().

Referenced by vl::EdgeRenderer::declareActor(), and extractEdges().

bool EdgeExtractor::extractEdges | ( | Actor * | actor ) |

Definition at line 163 of file EdgeExtractor.cpp.

References extractEdges(), vl::Actor::lod(), and NULL.

void EdgeExtractor::extractEdges | ( | ActorCollection * | actors ) |

Definition at line 171 of file EdgeExtractor.cpp.

References vl::Collection< T >::at(), extractEdges(), vl::Actor::lod(), and vl::Collection< T >::size().

void EdgeExtractor::extractEdges | ( | SceneManager * | scenemanager ) |

Definition at line 181 of file EdgeExtractor.cpp.

References vl::SceneManager::extractActors(), extractEdges(), and vl::ref< T >::get().

void EdgeExtractor::extractEdges | ( | Rendering * | rendering ) |

Definition at line 188 of file EdgeExtractor.cpp.

References vl::Collection< T >::at(), extractEdges(), vl::Rendering::sceneManagers(), and vl::Collection< T >::size().

ref< Geometry > EdgeExtractor::generateEdgeGeometry | ( | ) | const

Definition at line 127 of file EdgeExtractor.cpp.

References edges(), vl::ref< T >::get(), and vl::PT_LINES.

Referenced by vl::EdgeRenderer::declareActor().

const std::vector<Edge>& vl::EdgeExtractor::edges | ( | ) | const`[inline]`

Definition at line 149 of file EdgeExtractor.hpp.

Referenced by vl::EdgeRenderer::declareActor(), extractEdges(), and generateEdgeGeometry().

std::vector<Edge>& vl::EdgeExtractor::edges | ( | ) | `[inline]`

Definition at line 150 of file EdgeExtractor.hpp.

void vl::EdgeExtractor::reset | ( | ) | `[inline]`

Definition at line 152 of file EdgeExtractor.hpp.

float vl::EdgeExtractor::creaseAngle | ( | ) | const`[inline]`

The minimum angle (in degrees) considered to generate crease-edges.

Definition at line 155 of file EdgeExtractor.hpp.

Referenced by extractEdges().

void vl::EdgeExtractor::setCreaseAngle | ( | float | a ) | `[inline]`

The minimum angle (in degrees) considered to generate crease-edges.

Definition at line 157 of file EdgeExtractor.hpp.

Referenced by vl::EdgeRenderer::declareActor().

bool vl::EdgeExtractor::warnNonManifold | ( | ) | const`[inline]`

Definition at line 159 of file EdgeExtractor.hpp.

void vl::EdgeExtractor::setWarnNonManifold | ( | bool | warn_on ) | `[inline]`

Definition at line 160 of file EdgeExtractor.hpp.

void EdgeExtractor::addEdge | ( | std::set< EdgeExtractor::Edge > & | edges,
|  | const EdgeExtractor::Edge & | e,
|  | const fvec3 & | n
| ) |  | `[protected]`

Definition at line 43 of file EdgeExtractor.cpp.

References vl::Log::error(), vl::Vector3< T_Scalar >::isNull(), mWarnNonManifold, vl::EdgeExtractor::Edge::setNormal1(), vl::EdgeExtractor::Edge::setNormal2(), and VL_CHECK.

Referenced by extractEdges().

## Member Data Documentation

std::vector<Edge> vl::EdgeExtractor::mEdges`[protected]`

Definition at line 166 of file EdgeExtractor.hpp.

Referenced by extractEdges().

float vl::EdgeExtractor::mCreaseAngle`[protected]`

Definition at line 167 of file EdgeExtractor.hpp.

bool vl::EdgeExtractor::mWarnNonManifold`[protected]`

Definition at line 168 of file EdgeExtractor.hpp.

Referenced by addEdge().

The documentation for this class was generated from the following files:

- D:/VL/BuildSystem/VL_DISTRO/Visualization_Library_SDK/src/vlGraphics/EdgeExtractor.hpp
- D:/VL/BuildSystem/VL_DISTRO/Visualization_Library_SDK/src/vlGraphics/EdgeExtractor.cpp

Visualization Library v2011.09.1162 Reference Documentation
Copyright 2005-2011 Michele Bosi. All rights reserved.
Updated on Thu Jan 26 2012 00:44:34.
Permission is granted to use this page to write and publish articles regarding Visualization Library.