Avogadro  1.1.0
Public Member Functions | Protected Attributes
Avogadro::Mesh Class Reference

Encapsulation of a triangular mesh that makes up a surface. More...

#include <avogadro/mesh.h>

Inheritance diagram for Avogadro::Mesh:
Inheritance graph
[legend]

List of all members.

Public Member Functions

 Mesh (QObject *parent=0)
 ~Mesh ()
bool reserve (unsigned int size, bool colors=false)
void setStable (bool stable)
bool stable ()
void setIsoValue (float value)
float isoValue () const
void setOtherMesh (unsigned int other)
unsigned int otherMesh () const
void setCube (unsigned int cube)
unsigned int cube () const
const std::vector
< Eigen::Vector3f > & 
vertices () const
unsigned int numVertices () const
const Eigen::Vector3f * vertex (int n) const
bool setVertices (const std::vector< Eigen::Vector3f > &values)
bool addVertices (const std::vector< Eigen::Vector3f > &values)
const std::vector
< Eigen::Vector3f > & 
normals () const
unsigned int numNormals () const
const Eigen::Vector3f * normal (int n) const
bool setNormals (const std::vector< Eigen::Vector3f > &values)
bool addNormals (const std::vector< Eigen::Vector3f > &values)
const std::vector< Color3f > & colors () const
const Color3fcolor (int n) const
bool setColors (const std::vector< Color3f > &values)
bool addColors (const std::vector< Color3f > &values)
bool valid () const
bool clear ()
Meshoperator= (const Mesh &other)
void setName (QString name)
QString name ()
QReadWriteLocklock () const

Protected Attributes

std::vector< Eigen::Vector3f > m_vertices
std::vector< Eigen::Vector3f > m_normals
std::vector< Color3fm_colors
QString m_name
bool m_stable
float m_isoValue
unsigned int m_other
unsigned int m_cube
QReadWriteLockm_lock

Detailed Description

Encapsulation of a triangular mesh that makes up a surface.

Author:
Marcus D. Hanwell

The Mesh class is a Primitive subclass that provides an Mesh object. All meshes must be owned by a Molecule. It should also be removed by the Molecule that owns it. Meshes encapsulate triangular meshes that can also have colors associated with each vertex.


Constructor & Destructor Documentation

Avogadro::Mesh::Mesh ( QObject parent = 0)

Constructor.

Destructor.


Member Function Documentation

bool Avogadro::Mesh::addColors ( const std::vector< Color3f > &  values)

Add one or more normals, i.e., the vector is expected to be of length 3 x n where n is an integer.

References lock().

bool Avogadro::Mesh::addNormals ( const std::vector< Eigen::Vector3f > &  values)

Add one or more normals, i.e., the vector is expected to be of length 3 x n where n is an integer.

References lock().

bool Avogadro::Mesh::addVertices ( const std::vector< Eigen::Vector3f > &  values)

Add one or more vertices, i.e., the vector is expected to be of length 3 x n where n is an integer.

References lock().

Clear all mesh data.

Returns:
True on success.

References lock().

Referenced by Avogadro::MeshGenerator::run().

const Color3f * Avogadro::Mesh::color ( int  n) const
Returns:
Pointer to the first color of the specified triangle.

References lock().

const vector< Color3f > & Avogadro::Mesh::colors ( ) const
Returns:
Vector containing all of the colors in a one-dimensional array.

References lock().

Referenced by Avogadro::GLPainter::drawColorMesh().

unsigned int Avogadro::Mesh::cube ( ) const [inline]
Returns:
The unique id of the Cube the Mesh was generated from.
float Avogadro::Mesh::isoValue ( ) const [inline]
Returns:
The iso value used to generate the Mesh.
Returns:
The name of the Mesh.
const Vector3f * Avogadro::Mesh::normal ( int  n) const
Returns:
Pointer to the first normal of the specified triangle.

References lock().

const vector< Vector3f > & Avogadro::Mesh::normals ( ) const
Returns:
Vector containing all of the normals in a one-dimensional array.

References lock().

Referenced by Avogadro::GLPainter::drawColorMesh(), and Avogadro::GLPainter::drawMesh().

unsigned int Avogadro::Mesh::numNormals ( ) const [inline]
Returns:
The number of normals.
unsigned int Avogadro::Mesh::numVertices ( ) const [inline]
Returns:
The number of vertices.
Mesh & Avogadro::Mesh::operator= ( const Mesh other)

Overloaded operator.

References lock().

unsigned int Avogadro::Mesh::otherMesh ( ) const [inline]
Returns:
The unique id of the other Mesh if this is part of a pair.
bool Avogadro::Mesh::reserve ( unsigned int  size,
bool  colors = false 
)

Reserve the expected space for the mesh. This causes all member vector storage to call the reserve function with the number specified.

Parameters:
sizeExpected size of the mesh.
colorsShould the colors vector reserve this space too? Defaults to false.
Returns:
True on success.

References lock().

bool Avogadro::Mesh::setColors ( const std::vector< Color3f > &  values)

Clear the colors vector and assign new values.

References lock().

void Avogadro::Mesh::setCube ( unsigned int  cube) [inline]

Set the unique id of the Cube the Mesh was generated from.

void Avogadro::Mesh::setIsoValue ( float  value) [inline]

Set the iso value that was used to generate the Mesh.

void Avogadro::Mesh::setName ( QString  name) [inline]

Set the name of the Mesh.

bool Avogadro::Mesh::setNormals ( const std::vector< Eigen::Vector3f > &  values)

Clear the normals vector and assign new values.

References lock().

Referenced by Avogadro::MeshGenerator::run().

void Avogadro::Mesh::setOtherMesh ( unsigned int  other) [inline]

Set the unique id of the other Mesh if this Mesh is part of a pair.

void Avogadro::Mesh::setStable ( bool  stable)

This function allows long running calculations to mark the mesh as in progress.

Parameters:
stableIndicate that the Mesh is currently being modified.

References lock(), and stable().

Referenced by Avogadro::MeshGenerator::run().

bool Avogadro::Mesh::setVertices ( const std::vector< Eigen::Vector3f > &  values)

Clear the vertices vector and assign new values.

References lock().

Referenced by Avogadro::MeshGenerator::run().

Indicate whether the Mesh is complete or currently being modified. In general using Mesh values from an unstable Mesh is not advisable.

Returns:
True if the Mesh is complete, false if it is being modified.

References lock().

Referenced by setStable().

bool Avogadro::Mesh::valid ( ) const

Sanity checking function - is the mesh sane?

Returns:
True if the Mesh object is sane and composed of the right number of elements.

References lock().

const Vector3f * Avogadro::Mesh::vertex ( int  n) const
Returns:
Pointer to the first vertex of the specified triangle.

References lock().

const vector< Vector3f > & Avogadro::Mesh::vertices ( ) const
Returns:
Vector containing all of the vertices in a one dimensional array.

References lock().

Referenced by Avogadro::GLPainter::drawColorMesh(), and Avogadro::GLPainter::drawMesh().


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