Avogadro
1.1.0
|
Encapsulation of a triangular mesh that makes up a surface. More...
#include <avogadro/mesh.h>
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 Color3f * | color (int n) const |
bool | setColors (const std::vector< Color3f > &values) |
bool | addColors (const std::vector< Color3f > &values) |
bool | valid () const |
bool | clear () |
Mesh & | operator= (const Mesh &other) |
void | setName (QString name) |
QString | name () |
QReadWriteLock * | lock () const |
Protected Attributes | |
std::vector< Eigen::Vector3f > | m_vertices |
std::vector< Eigen::Vector3f > | m_normals |
std::vector< Color3f > | m_colors |
QString | m_name |
bool | m_stable |
float | m_isoValue |
unsigned int | m_other |
unsigned int | m_cube |
QReadWriteLock * | m_lock |
Encapsulation of a triangular mesh that makes up a surface.
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.
Avogadro::Mesh::Mesh | ( | QObject * | parent = 0 | ) |
Constructor.
Destructor.
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().
bool Avogadro::Mesh::clear | ( | ) |
Clear all mesh data.
References lock().
Referenced by Avogadro::MeshGenerator::run().
const Color3f * Avogadro::Mesh::color | ( | int | n | ) | const |
References lock().
const vector< Color3f > & Avogadro::Mesh::colors | ( | ) | const |
References lock().
Referenced by Avogadro::GLPainter::drawColorMesh().
unsigned int Avogadro::Mesh::cube | ( | ) | const [inline] |
float Avogadro::Mesh::isoValue | ( | ) | const [inline] |
QReadWriteLock * Avogadro::Mesh::lock | ( | ) | const |
Provides locking.
Referenced by addColors(), addNormals(), addVertices(), clear(), color(), colors(), normal(), normals(), operator=(), reserve(), setColors(), setNormals(), setStable(), setVertices(), stable(), valid(), vertex(), and vertices().
QString Avogadro::Mesh::name | ( | ) | [inline] |
const Vector3f * Avogadro::Mesh::normal | ( | int | n | ) | const |
References lock().
const vector< Vector3f > & Avogadro::Mesh::normals | ( | ) | const |
References lock().
Referenced by Avogadro::GLPainter::drawColorMesh(), and Avogadro::GLPainter::drawMesh().
unsigned int Avogadro::Mesh::numNormals | ( | ) | const [inline] |
unsigned int Avogadro::Mesh::numVertices | ( | ) | const [inline] |
unsigned int Avogadro::Mesh::otherMesh | ( | ) | const [inline] |
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.
size | Expected size of the mesh. |
colors | Should the colors vector reserve this space too? Defaults to false. |
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] |
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] |
void Avogadro::Mesh::setStable | ( | bool | stable | ) |
This function allows long running calculations to mark the mesh as in progress.
stable | Indicate 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().
bool Avogadro::Mesh::stable | ( | ) |
bool Avogadro::Mesh::valid | ( | ) | const |
const Vector3f * Avogadro::Mesh::vertex | ( | int | n | ) | const |
References lock().
const vector< Vector3f > & Avogadro::Mesh::vertices | ( | ) | const |
References lock().
Referenced by Avogadro::GLPainter::drawColorMesh(), and Avogadro::GLPainter::drawMesh().