Visualization Library 2.1.0
A lightweight C++ OpenGL middleware for 2D/3D graphics
|
[Download] [Tutorials] [All Classes] [Grouped Classes] |
The PolygonSimplifier class reduces the amount of polygons present in a Geometry using a quadric error metric. More...
#include <PolygonSimplifier.hpp>
Classes | |
class | QErr |
The quadric error metric as defined by PolygonSimplifier. More... | |
class | Triangle |
A Triangle as defined by PolygonSimplifier. More... | |
class | Vertex |
A Vertex as defined by PolygonSimplifier. More... | |
Public Member Functions | |
PolygonSimplifier () | |
void | simplify () |
void | simplify (const std::vector< fvec3 > &in_verts, const std::vector< int > &in_tris) |
void | setIntput (Geometry *geom) |
Geometry * | input () |
const Geometry * | input () const |
std::vector< u32 > & | targets () |
const std::vector< u32 > & | targets () const |
std::vector< ref< Geometry > > & | output () |
const std::vector< ref< Geometry > > & | output () const |
void | setProtectedVertices (const std::vector< int > &protected_verts) |
int | simplifiedVerticesCount () const |
Vertex * | simplifiedVertices (int index) const |
int | simplifiedTrianglesCount () const |
Triangle * | simplifiedTriangles (int index) const |
void | clearTrianglesAndVertices () |
bool | removeDoubles () const |
void | setRemoveDoubles (bool remove_doubles) |
bool | verbose () const |
void | setVerbose (bool verbose) |
bool | quick () const |
void | setQuick (bool quick) |
Public Member Functions inherited from vl::Object | |
Object () | |
Constructor. More... | |
Object (const Object &other) | |
Copy constructor: copies the name, ref count mutex and user data. More... | |
Object & | operator= (const Object &other) |
Copy operator: copies the object's name, ref count mutex and user data. More... | |
const std::string & | objectName () const |
The name of the object, by default set to the object's class name. More... | |
void | setObjectName (const char *name) |
The name of the object, by default set to the object's class name in debug builds. More... | |
void | setObjectName (const std::string &name) |
The name of the object, by default set to the object's class name in debug builds. More... | |
void | setRefCountMutex (IMutex *mutex) |
The mutex used to protect the reference counting of an Object across multiple threads. More... | |
IMutex * | refCountMutex () |
The mutex used to protect the reference counting of an Object across multiple threads. More... | |
const IMutex * | refCountMutex () const |
The mutex used to protect the reference counting of an Object across multiple threads. More... | |
int | referenceCount () const |
Returns the number of references of an object. More... | |
void | incReference () const |
Increments the reference count of an object. More... | |
void | decReference () |
Decrements the reference count of an object and deletes it if both automaticDelete() is true the count reaches 0. More... | |
void | setAutomaticDelete (bool autodel_on) |
If set to true the Object is deleted when its reference count reaches 0. More... | |
bool | automaticDelete () const |
If set to true the Object is deleted when its reference count reaches 0. More... | |
template<class T > | |
T * | as () |
Casts an Object to the specified class. More... | |
template<class T > | |
const T * | as () const |
Casts an Object to the specified class. More... | |
Protected Member Functions | |
void | outputSimplifiedGeometry () |
void | collapse (Vertex *v) |
void | computeCollapseInfo (Vertex *v) |
Protected Member Functions inherited from vl::Object | |
virtual | ~Object () |
Protected Attributes | |
ref< Geometry > | mInput |
std::vector< ref< Geometry > > | mOutput |
std::vector< u32 > | mTargets |
std::vector< Vertex * > | mSimplifiedVertices |
std::vector< Triangle * > | mSimplifiedTriangles |
std::vector< int > | mProtectedVerts |
bool | mRemoveDoubles |
bool | mVerbose |
bool | mQuick |
Protected Attributes inherited from vl::Object | |
std::string | mObjectName |
IMutex * | mRefCountMutex |
int | mReferenceCount |
bool | mAutomaticDelete |
The PolygonSimplifier class reduces the amount of polygons present in a Geometry using a quadric error metric.
The algorithm simplifies only the position array of the Geometry all the other vertex attributes will be discarded.
Definition at line 52 of file PolygonSimplifier.hpp.
|
inline |
Definition at line 321 of file PolygonSimplifier.hpp.
void PolygonSimplifier::clearTrianglesAndVertices | ( | ) |
Definition at line 408 of file PolygonSimplifier.cpp.
|
inlineprotected |
Definition at line 607 of file PolygonSimplifier.hpp.
References vl::PolygonSimplifier::Vertex::adjacentVertex(), vl::PolygonSimplifier::Vertex::adjacentVerticesCount(), vl::PolygonSimplifier::Vertex::checkConnectivity(), vl::PolygonSimplifier::Vertex::checkTriangles(), vl::PolygonSimplifier::Vertex::incidentTrianglesCount(), vl::PolygonSimplifier::Vertex::isAdjacentVertex(), vl::PolygonSimplifier::Vertex::isIncidentTriangle(), vl::PolygonSimplifier::Vertex::mAdjacentVerts, vl::PolygonSimplifier::Vertex::mCollapsePosition, vl::PolygonSimplifier::Vertex::mCollapseVertex, vl::PolygonSimplifier::Vertex::mIncidentTriangles, vl::PolygonSimplifier::Vertex::mPosition, vl::PolygonSimplifier::Vertex::mQErr, vl::PolygonSimplifier::Vertex::mRemoved, vl::PolygonSimplifier::Vertex::removed(), and VL_CHECK.
|
inlineprotected |
Definition at line 696 of file PolygonSimplifier.hpp.
References vl::PolygonSimplifier::Vertex::adjacentVerticesCount(), vl::PolygonSimplifier::QErr::analyticSolution(), vl::cross(), vl::dot(), vl::PolygonSimplifier::QErr::evaluate(), vl::PolygonSimplifier::Triangle::hasVertex(), vl::PolygonSimplifier::Vertex::incidentTriangle(), vl::PolygonSimplifier::Vertex::incidentTrianglesCount(), vl::length(), vl::PolygonSimplifier::Vertex::mAdjacentVerts, vl::PolygonSimplifier::Vertex::mCollapseCost, vl::PolygonSimplifier::Vertex::mCollapsePosition, vl::PolygonSimplifier::Vertex::mCollapseVertex, vl::PolygonSimplifier::Vertex::mRemoved, vl::PolygonSimplifier::Triangle::normal(), vl::Vector3< T_Scalar >::normalize(), NULL, vl::PolygonSimplifier::Vertex::position(), vl::PolygonSimplifier::Vertex::qerr(), vl::PolygonSimplifier::Triangle::vertex(), and VL_CHECK.
|
inline |
Definition at line 327 of file PolygonSimplifier.hpp.
|
inline |
Definition at line 328 of file PolygonSimplifier.hpp.
Definition at line 333 of file PolygonSimplifier.hpp.
Definition at line 334 of file PolygonSimplifier.hpp.
|
protected |
Definition at line 358 of file PolygonSimplifier.cpp.
References vl::Array< T_VectorType, T_Scalar, T_GL_Size, T_GL_Type >::at(), vl::Array< T_VectorType, T_Scalar, T_GL_Size, T_GL_Type >::begin(), vl::Array< T_VectorType, T_Scalar, T_GL_Size, T_GL_Type >::end(), vl::ref< T >::get(), vl::DrawElements< arr_type >::indexBuffer(), vl::PT_TRIANGLES, vl::Array< T_VectorType, T_Scalar, T_GL_Size, T_GL_Type >::resize(), and VL_CHECK.
|
inline |
Definition at line 352 of file PolygonSimplifier.hpp.
|
inline |
Definition at line 346 of file PolygonSimplifier.hpp.
|
inline |
Definition at line 326 of file PolygonSimplifier.hpp.
|
inline |
Definition at line 336 of file PolygonSimplifier.hpp.
|
inline |
Definition at line 353 of file PolygonSimplifier.hpp.
|
inline |
Definition at line 347 of file PolygonSimplifier.hpp.
|
inline |
Definition at line 350 of file PolygonSimplifier.hpp.
|
inline |
Definition at line 342 of file PolygonSimplifier.hpp.
|
inline |
Definition at line 341 of file PolygonSimplifier.hpp.
|
inline |
Definition at line 339 of file PolygonSimplifier.hpp.
|
inline |
Definition at line 338 of file PolygonSimplifier.hpp.
void PolygonSimplifier::simplify | ( | ) |
Definition at line 70 of file PolygonSimplifier.cpp.
References vl::Time::elapsed(), vl::Log::error(), vl::ArrayAbstract::getAsVec3(), vl::TriangleIterator::hasNext(), NULL, vl::Log::print(), vl::PT_TRIANGLES, vl::DoubleVertexRemover::removeDoubles(), vl::ArrayAbstract::size(), vl::Time::start(), vl::DrawCall::triangleIterator(), vl::VA_MaxAttribCount, vl::VA_Position, and vl::Log::warning().
void PolygonSimplifier::simplify | ( | const std::vector< fvec3 > & | in_verts, |
const std::vector< int > & | in_tris | ||
) |
Definition at line 144 of file PolygonSimplifier.cpp.
References vl::PolygonSimplifier::Vertex::adjacentVertex(), vl::PolygonSimplifier::Vertex::adjacentVerticesCount(), vl::PolygonSimplifier::Vertex::collapseVertex(), vl::Time::elapsed(), vl::PolygonSimplifier::Vertex::mAlreadyProcessed, vl::PolygonSimplifier::Vertex::mRemoveOrder, vl::Log::print(), vl::PolygonSimplifier::Vertex::removed(), vl::Time::start(), and VL_CHECK.
|
inline |
Definition at line 330 of file PolygonSimplifier.hpp.
|
inline |
Definition at line 331 of file PolygonSimplifier.hpp.
|
inline |
Definition at line 349 of file PolygonSimplifier.hpp.
Definition at line 361 of file PolygonSimplifier.hpp.
Definition at line 362 of file PolygonSimplifier.hpp.
|
protected |
Definition at line 366 of file PolygonSimplifier.hpp.
|
protected |
Definition at line 369 of file PolygonSimplifier.hpp.
|
protected |
Definition at line 367 of file PolygonSimplifier.hpp.
|
protected |
Definition at line 365 of file PolygonSimplifier.hpp.
|
protected |
Definition at line 364 of file PolygonSimplifier.hpp.
|
protected |
Definition at line 363 of file PolygonSimplifier.hpp.
|
protected |
Definition at line 368 of file PolygonSimplifier.hpp.
Visualization Library 2.1.0 Reference Documentation
Updated on Wed Mar 10 2021 16:02:53.
© Copyright Michele Bosi. All rights reserved.