AvogadroLibs 1.97.0
Public Member Functions | List of all members
Mesh Class Reference

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

#include <avogadro/core/mesh.h>

Public Member Functions

 Mesh ()
 
 Mesh (const Mesh &other)
 
 ~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 Core::Array< Vector3f > & vertices () const
 
unsigned int numVertices () const
 
const Vector3f * vertex (int n) const
 
bool setVertices (const Core::Array< Vector3f > &values)
 
bool addVertices (const Core::Array< Vector3f > &values)
 
const Core::Array< Vector3f > & normals () const
 
unsigned int numNormals () const
 
const Vector3f * normal (int n) const
 
bool setNormals (const Core::Array< Vector3f > &values)
 
bool addNormals (const Core::Array< Vector3f > &values)
 
const Core::Array< Color3f > & colors () const
 
const Color3fcolor (int n) const
 
bool setColors (const Core::Array< Color3f > &values)
 
bool addColors (const Core::Array< Color3f > &values)
 
bool valid () const
 
bool clear ()
 
Meshoperator= (const Mesh &other)
 
void setName (const std::string &name_)
 
std::string name () const
 
Mutexlock () const
 
void smooth (int iterationCount=6)
 

Detailed Description

Author
Marcus D. Hanwell

The Mesh class is a data container that provides a Mesh object. All meshes should 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

◆ Mesh() [1/2]

Mesh ( )

Constructor.

◆ Mesh() [2/2]

Mesh ( const Mesh other)

Copy constructor

◆ ~Mesh()

~Mesh ( )

Destructor.

Member Function Documentation

◆ reserve()

bool reserve ( unsigned int  size,
bool  colors = false 
)

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

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

◆ setStable()

void 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.

◆ stable()

bool stable ( )

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.

◆ setIsoValue()

void setIsoValue ( float  value)

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

◆ isoValue()

float isoValue ( ) const
Returns
The iso value used to generate the Mesh.

◆ setOtherMesh()

void setOtherMesh ( unsigned int  other)

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

◆ otherMesh()

unsigned int otherMesh ( ) const
Returns
The unique id of the other Mesh if this is part of a pair.

◆ setCube()

void setCube ( unsigned int  cube_)

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

◆ cube()

unsigned int cube ( ) const
Returns
The unique id of the Cube the Mesh was generated from.

◆ vertices()

const Core::Array< Vector3f > & vertices ( ) const
Returns
Array containing all of the vertices in a one dimensional array.

◆ numVertices()

unsigned int numVertices ( ) const
Returns
The number of vertices.

◆ vertex()

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

◆ setVertices()

bool setVertices ( const Core::Array< Vector3f > &  values)

Clear the vertices vector and assign new values.

◆ addVertices()

bool addVertices ( const Core::Array< Vector3f > &  values)

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

◆ normals()

const Core::Array< Vector3f > & normals ( ) const
Returns
Array containing all of the normals in a one-dimensional array.

◆ numNormals()

unsigned int numNormals ( ) const
Returns
The number of normals.

◆ normal()

const Vector3f * normal ( int  n) const
Returns
Pointer to the first normal of the specified triangle.

◆ setNormals()

bool setNormals ( const Core::Array< Vector3f > &  values)

Clear the normals array and assign new values.

◆ addNormals()

bool addNormals ( const Core::Array< Vector3f > &  values)

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

◆ colors()

const Core::Array< Color3f > & colors ( ) const
Returns
Array containing all of the colors in a one-dimensional array.

◆ color()

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

◆ setColors()

bool setColors ( const Core::Array< Color3f > &  values)

Clear the colors array and assign new values.

◆ addColors()

bool addColors ( const Core::Array< Color3f > &  values)

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

◆ valid()

bool 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.

◆ clear()

bool clear ( )

Clear all mesh data.

Returns
True on success.

◆ operator=()

Mesh & operator= ( const Mesh other)

Overloaded operator.

◆ setName()

void setName ( const std::string &  name_)

Set the name of the Mesh.

◆ name()

std::string name ( ) const
Returns
The name of the Mesh.

◆ lock()

Mutex * lock ( ) const

Provides locking.

◆ smooth()

void smooth ( int  iterationCount = 6)

Applies Laplacian smoothing.

Parameters
iterationCountnumber of smoothing passes to make.

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