Patate Lib  0.5
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Pages
Vitelotte::VGMesh< _Scalar, _Dims, _Coeffs > Class Template Reference

Inherits PatateCommon::SurfaceMesh.

Inherited by Vitelotte::DCMesh< _Scalar, _Dims, _Coeffs >.

Detailed Description

template<typename _Scalar, int _Dims = 2, int _Coeffs = 4>
class Vitelotte::VGMesh< _Scalar, _Dims, _Coeffs >

A mesh with data suitable for representing complex color gradients, among other.

For more details about VGMesh, see the [user manual](vitelotte_user_manual_vg_mesh_page).

Classes

struct  Node
 
class  NodeIterator
 
class  NodeProperty
 

Public Types

enum  { DimsAtCompileTime = _Dims, CoeffsAtCompileTime = _Coeffs }
 
enum  HalfedgeAttribute {
  TO_VERTEX_VALUE, FROM_VERTEX_VALUE, EDGE_VALUE, EDGE_GRADIENT,
  HALFEDGE_ATTRIB_COUNT
}
 
enum  VertexAttribute { VERTEX_POSITION, VERTEX_GRADIENT_CONSTRAINT, VERTEX_ATTRIB_COUNT }
 
enum  {
  TO_VERTEX_VALUE_FLAG = PATATE_VG_MESH_HALFEDGE_ATTR_FLAG(TO_VERTEX_VALUE), FROM_VERTEX_VALUE_FLAG = PATATE_VG_MESH_HALFEDGE_ATTR_FLAG(FROM_VERTEX_VALUE), EDGE_VALUE_FLAG = PATATE_VG_MESH_HALFEDGE_ATTR_FLAG(EDGE_VALUE), EDGE_GRADIENT_FLAG = PATATE_VG_MESH_HALFEDGE_ATTR_FLAG(EDGE_GRADIENT),
  VERTEX_GRADIENT_CONSTRAINT_FLAG, LINEAR_FLAGS = TO_VERTEX_VALUE_FLAG | FROM_VERTEX_VALUE_FLAG, QUADRATIC_FLAGS = LINEAR_FLAGS | EDGE_VALUE_FLAG, MORLEY_FLAGS = LINEAR_FLAGS | EDGE_GRADIENT_FLAG,
  FV_FLAGS = QUADRATIC_FLAGS | EDGE_GRADIENT_FLAG | VERTEX_GRADIENT_CONSTRAINT_FLAG
}
 
typedef _Scalar Scalar
 
typedef VGMesh< Scalar,
DimsAtCompileTime,
CoeffsAtCompileTime > 
Self
 
typedef Eigen::Matrix< Scalar,
DimsAtCompileTime, 1 > 
Vector
 
typedef Eigen::Matrix< Scalar,
CoeffsAtCompileTime, 1 > 
Value
 
typedef Eigen::Matrix< Scalar,
CoeffsAtCompileTime,
DimsAtCompileTime > 
Gradient
 
typedef BezierSegment< Vector > CurvedEdge
 
typedef VectorMatrix::ColXpr VectorXpr
 
typedef VectorMatrix::ConstColXpr ConstVectorXpr
 
typedef NodeMatrix::ColXpr ValueXpr
 
typedef NodeMatrix::ConstColXpr ConstValueXpr
 
typedef Value::ConstantReturnType UnconstrainedNodeType
 
- Public Types inherited from PatateCommon::SurfaceMesh
enum  { GC_DONT_RELEASE_INDEX_MAPS = 0x01 }
 

Public Member Functions

template<typename Derived >
PatateCommon::SurfaceMesh::Vertex addVertex (const Eigen::DenseBase< Derived > &pos)
 
template<typename Derived >
VGMesh< _Scalar, _Dim, _Chan >
::Node 
addNode (const Eigen::DenseBase< Derived > &value)
 
Constructor, derstructor, assignement
 VGMesh (unsigned attributes=0)
 Create a VGMesh with attirbutes flags activated.
 
 VGMesh (unsigned nDims, unsigned nCoeffs, unsigned attributes=0)
 
virtual ~VGMesh ()
 
 VGMesh (const Self &other)
 
VGMeshoperator= (const Self &rhs)
 
VGMeshassign (const Self &rhs)
 
Attributes
unsigned getAttributes () const
 Return active attribute flags ored together.
 
void setAttributes (unsigned attributes)
 Set the active attributes to attributes. More...
 
bool hasAttribute (HalfedgeAttribute attr) const
 
bool hasToVertexValue () const
 
bool hasFromVertexValue () const
 
bool hasEdgeValue () const
 
bool hasEdgeGradient () const
 
bool hasVertexGradientConstraint () const
 
Node toVertexValueNode (Halfedge h) const
 
NodetoVertexValueNode (Halfedge h)
 
Node fromVertexValueNode (Halfedge h) const
 
NodefromVertexValueNode (Halfedge h)
 
Node edgeValueNode (Halfedge h) const
 
NodeedgeValueNode (Halfedge h)
 
Node edgeGradientNode (Halfedge h) const
 
NodeedgeGradientNode (Halfedge h)
 
HalfedgeAttribute oppositeAttribute (HalfedgeAttribute attr) const
 
Node halfedgeNode (Halfedge h, HalfedgeAttribute attr) const
 
NodehalfedgeNode (Halfedge h, HalfedgeAttribute attr)
 
Node halfedgeOppositeNode (Halfedge h, HalfedgeAttribute attr) const
 
NodehalfedgeOppositeNode (Halfedge h, HalfedgeAttribute attr)
 
Point gradient constraints
bool isGradientConstraint (Vertex v) const
 
Gradient & gradientConstraint (Vertex v)
 
const Gradient & gradientConstraint (Vertex v) const
 
void setGradientConstraint (Vertex v, const Gradient &grad)
 
void removeGradientConstraint (Vertex v)
 
int nVertexGradientConstraints () const
 
unsigned nVertexGradientConstraints (Halfedge h) const
 
unsigned nVertexGradientConstraints (Face f) const
 
High-level nodes manipulation
void setVertexNodes (Node node, Halfedge from, Halfedge to)
 Set nodes of all the halfedges inbetween halfedges from and to (in counter-clockwise direction) to node. More...
 
void setSingularity (Node fromNode, Node toNode, Halfedge from, Halfedge to)
 Similar to VGMesh::setVertexNode, but for singularities. More...
 
void simplifyConstraints ()
 Simplify constraints when possible. More...
 
void simplifyVertexArcConstraints (Halfedge from, Halfedge to)
 
void simplifyEdgeConstraints (Edge e)
 
void simplifyOppositeNodes (Node &n0, Node &n1, bool b0=false, bool b1=false) const
 Replace n0 and n1 by a single node on an invalid node if possible. More...
 
void finalize ()
 
void finalizeVertexArc (Halfedge from, Halfedge to)
 
void finalizeEdge (Edge e)
 
Quadratic patches
bool isSingular (Halfedge h) const
 Return true if the target vertex of h is singular.
 
unsigned nSingulars (Face f) const
 Return the number of singular vertex around f.
 
unsigned nSingularFaces () const
 Return the number of singular faces in the mesh. More...
 
- Public Member Functions inherited from PatateCommon::SurfaceMesh
 SurfaceMesh ()
 default constructor
 
 ~SurfaceMesh ()
 
 SurfaceMesh (const SurfaceMesh &rhs)
 copy constructor: copies rhs to *this. performs a deep copy of all properties.
 
SurfaceMeshoperator= (const SurfaceMesh &rhs)
 assign rhs to *this. performs a deep copy of all properties.
 
SurfaceMeshassign (const SurfaceMesh &rhs)
 assign rhs to *this. does not copy custom properties.
 
Vertex addVertex ()
 add a new vertex
 
Face addFace (const std::vector< Vertex > &vertices)
 
Face addTriangle (Vertex v1, Vertex v2, Vertex v3)
 
Face addQuad (Vertex v1, Vertex v2, Vertex v3, Vertex v4)
 
unsigned int verticesSize () const
 returns number of (deleted and valid) vertices in the mesh
 
unsigned int halfedgesSize () const
 returns number of (deleted and valid)halfedge in the mesh
 
unsigned int edgesSize () const
 returns number of (deleted and valid)edges in the mesh
 
unsigned int facesSize () const
 returns number of (deleted and valid)faces in the mesh
 
unsigned int nVertices () const
 returns number of vertices in the mesh
 
unsigned int nHalfedges () const
 returns number of halfedge in the mesh
 
unsigned int nEdges () const
 returns number of edges in the mesh
 
unsigned int nFaces () const
 returns number of faces in the mesh
 
unsigned int empty () const
 returns true iff the mesh is empty, i.e., has no vertices
 
void clear ()
 clear mesh: remove all vertices, edges, faces
 
void freeMemory ()
 remove unused memory from vectors
 
void reserve (unsigned int nvertices, unsigned int nedges, unsigned int nfaces)
 reserve memory (mainly used in file readers)
 
void garbageCollection (unsigned flags=0)
 remove deleted vertices/edges/faces
 
void releaseGCIndexMaps ()
 
Vertex gcMap (Vertex v)
 
Halfedge gcMap (Halfedge h)
 
Face gcMap (Face f)
 
bool isDeleted (Vertex v) const
 
bool isDeleted (Halfedge h) const
 
bool isDeleted (Edge e) const
 
bool isDeleted (Face f) const
 
bool isValid (Vertex v) const
 return whether vertex v is valid, i.e. the index is stores it within the array bounds.
 
bool isValid (Halfedge h) const
 return whether halfedge h is valid, i.e. the index is stores it within the array bounds.
 
bool isValid (Edge e) const
 return whether edge e is valid, i.e. the index is stores it within the array bounds.
 
bool isValid (Face f) const
 return whether face f is valid, i.e. the index is stores it within the array bounds.
 
Halfedge halfedge (Vertex v) const
 
void setHalfedge (Vertex v, Halfedge h)
 set the outgoing halfedge of vertex v to h
 
bool isBoundary (Vertex v) const
 returns whether v is a boundary vertex
 
bool isIsolated (Vertex v) const
 returns whether v is isolated, i.e., not incident to any face
 
bool isManifold (Vertex v) const
 returns whether v is a manifold vertex (not incident to several patches)
 
Vertex toVertex (Halfedge h) const
 returns the vertex the halfedge h points to
 
Vertex fromVertex (Halfedge h) const
 returns the vertex the halfedge h emanates from
 
void setVertex (Halfedge h, Vertex v)
 sets the vertex the halfedge h points to to v
 
Face face (Halfedge h) const
 returns the face incident to halfedge h
 
void setFace (Halfedge h, Face f)
 sets the incident face to halfedge h to f
 
Halfedge nextHalfedge (Halfedge h) const
 returns the next halfedge within the incident face
 
void setNextHalfedge (Halfedge h, Halfedge nh)
 sets the next halfedge of h within the face to nh
 
Halfedge prevHalfedge (Halfedge h) const
 returns the previous halfedge within the incident face
 
Halfedge oppositeHalfedge (Halfedge h) const
 returns the opposite halfedge of h
 
Halfedge ccwRotatedHalfedge (Halfedge h) const
 
Halfedge cwRotatedHalfedge (Halfedge h) const
 
Edge edge (Halfedge h) const
 return the edge that contains halfedge h as one of its two halfedges.
 
bool isBoundary (Halfedge h) const
 returns whether h is a boundary halfege, i.e., if its face does not exist.
 
Halfedge halfedge (Edge e, unsigned int i) const
 returns the i'th halfedge of edge e. i has to be 0 or 1.
 
Vertex vertex (Edge e, unsigned int i) const
 returns the i'th vertex of edge e. i has to be 0 or 1.
 
Face face (Edge e, unsigned int i) const
 returns the face incident to the i'th halfedge of edge e. i has to be 0 or 1.
 
bool isBoundary (Edge e) const
 
Halfedge halfedge (Face f) const
 returns a halfedge of face f
 
void setHalfedge (Face f, Halfedge h)
 sets the halfedge of face f to h
 
bool isBoundary (Face f) const
 returns whether f is a boundary face, i.e., it one of its edges is a boundary edge.
 
template<class T >
VertexProperty< T > addVertexProperty (const std::string &name, const T t=T())
 
template<class T >
HalfedgeProperty< T > addHalfedgeProperty (const std::string &name, const T t=T())
 
template<class T >
EdgeProperty< T > addEdgeProperty (const std::string &name, const T t=T())
 
template<class T >
FaceProperty< T > addFaceProperty (const std::string &name, const T t=T())
 
template<class T >
VertexProperty< T > getVertexProperty (const std::string &name) const
 
template<class T >
HalfedgeProperty< T > getHalfedgeProperty (const std::string &name) const
 
template<class T >
EdgeProperty< T > getEdgeProperty (const std::string &name) const
 
template<class T >
FaceProperty< T > getFaceProperty (const std::string &name) const
 
template<class T >
VertexProperty< T > vertexProperty (const std::string &name, const T t=T())
 
template<class T >
HalfedgeProperty< T > halfedgeProperty (const std::string &name, const T t=T())
 
template<class T >
EdgeProperty< T > edgeProperty (const std::string &name, const T t=T())
 
template<class T >
FaceProperty< T > faceProperty (const std::string &name, const T t=T())
 
template<class T >
void removeVertexProperty (VertexProperty< T > &p)
 remove the vertex property p
 
template<class T >
void removeHalfedgeProperty (HalfedgeProperty< T > &p)
 remove the halfedge property p
 
template<class T >
void removeEdgeProperty (EdgeProperty< T > &p)
 remove the edge property p
 
template<class T >
void removeFaceProperty (FaceProperty< T > &p)
 remove the face property p
 
const std::type_info & getVertexPropertyType (const std::string &name)
 
const std::type_info & getHalfedgePropertyType (const std::string &name)
 
const std::type_info & getEdgePropertyType (const std::string &name)
 
const std::type_info & getFacePropertyType (const std::string &name)
 
std::vector< std::string > vertexProperties () const
 returns the names of all vertex properties
 
std::vector< std::string > halfedgeProperties () const
 returns the names of all halfedge properties
 
std::vector< std::string > edgeProperties () const
 returns the names of all edge properties
 
std::vector< std::string > faceProperties () const
 returns the names of all face properties
 
void propertyStats () const
 prints the names of all properties
 
VertexIterator verticesBegin () const
 returns start iterator for vertices
 
VertexIterator verticesEnd () const
 returns end iterator for vertices
 
VertexContainer vertices () const
 returns vertex container for C++11 range-based for-loops
 
HalfedgeIterator halfedgesBegin () const
 returns start iterator for halfedges
 
HalfedgeIterator halfedgesEnd () const
 returns end iterator for halfedges
 
HalfedgeContainer halfedges () const
 returns halfedge container for C++11 range-based for-loops
 
EdgeIterator edgesBegin () const
 returns start iterator for edges
 
EdgeIterator edgesEnd () const
 returns end iterator for edges
 
EdgeContainer edges () const
 returns edge container for C++11 range-based for-loops
 
FaceIterator facesBegin () const
 returns start iterator for faces
 
FaceIterator facesEnd () const
 returns end iterator for faces
 
FaceContainer faces () const
 returns face container for C++11 range-based for-loops
 
VertexAroundVertexCirculator vertices (Vertex v) const
 returns circulator for vertices around vertex v
 
HalfedgeAroundVertexCirculator halfedges (Vertex v) const
 returns circulator for outgoing halfedges around vertex v
 
FaceAroundVertexCirculator faces (Vertex v) const
 returns circulator for faces around vertex v
 
VertexAroundFaceCirculator vertices (Face f) const
 returns circulator for vertices of face f
 
HalfedgeAroundFaceCirculator halfedges (Face f) const
 returns circulator for halfedges of face f
 
bool isTriangleMesh () const
 
bool isQuadMesh () const
 
void triangulate ()
 
void triangulate (Face f)
 
bool isCollapseOk (Halfedge h)
 
void collapse (Halfedge h)
 
void split (Face f, Vertex v)
 
void split (Edge e, Vertex v)
 
Halfedge insertVertex (Edge e, Vertex v)
 
Halfedge insertVertex (Halfedge h, Vertex v)
 
Halfedge insertEdge (Halfedge h0, Halfedge h1)
 
bool isFlipOk (Edge e) const
 
void flip (Edge e)
 
unsigned int valence (Vertex v) const
 
unsigned int valence (Face f) const
 returns the valence of face f (its number of vertices)
 
Halfedge findHalfedge (Vertex start, Vertex end) const
 find the halfedge from start to end
 
Edge findEdge (Vertex a, Vertex b) const
 find the edge (a,b)
 
void deleteVertex (Vertex v)
 deletes the vertex v from the mesh
 
void deleteEdge (Edge e)
 deletes the edge e from the mesh
 
void deleteFace (Face f)
 deletes the face f from the mesh
 

Protected Types

typedef Eigen::Matrix< Scalar,
DimsAtCompileTime,
Eigen::Dynamic > 
VectorMatrix
 
typedef Eigen::Matrix< Scalar,
CoeffsAtCompileTime,
Eigen::Dynamic > 
NodeMatrix
 
typedef std::pair< Vertex,
Gradient > 
VertexGradientPair
 
typedef std::map< Vertex,
Gradient, std::less< Vertex >
, Eigen::aligned_allocator
< VertexGradientPair > > 
VertexGradientMap
 
typedef std::pair< Edge,
CurvedEdge
EdgeCurvePair
 
typedef std::map< Edge,
CurvedEdge, std::less< Edge >
, Eigen::aligned_allocator
< EdgeCurvePair > > 
CurvedEdgesMap
 
- Protected Types inherited from PatateCommon::SurfaceMesh
typedef std::pair< Halfedge,
Halfedge
NextCacheEntry
 
typedef std::vector
< NextCacheEntry > 
NextCache
 

Protected Member Functions

Removed topological operations
void triangulate ()
 
void triangulate (Face)
 
bool isCollapseOk (Halfedge)
 
void collapse (Halfedge)
 
void split (Face, Vertex)
 
void split (Edge, Vertex)
 
Halfedge insertVertex (Edge, Vertex)
 
Halfedge insertVertex (Halfedge, Vertex)
 
Halfedge insertEdge (Halfedge, Halfedge)
 
bool isFlipOk (Edge) const
 
void flip (Edge)
 
Helper methods
void copyVGMeshMembers (const Self &rhs)
 
void findConstrainedEdgesSimplify (Vertex vx, std::vector< Halfedge > &consEdges)
 
void resizePositionsMatrix (unsigned rows, unsigned cols)
 
void resizeNodesMatrix (unsigned rows, unsigned cols)
 
- Protected Member Functions inherited from PatateCommon::SurfaceMesh
Vertex newVertex ()
 allocate a new vertex, resize vertex properties accordingly.
 
Halfedge newEdge (Vertex start, Vertex end)
 allocate a new edge, resize edge and halfedge properties accordingly.
 
Face newFace ()
 allocate a new face, resize face properties accordingly.
 
void adjustOutgoingHalfedge (Vertex v)
 
void removeEdge (Halfedge h)
 Helper for halfedge collapse.
 
void removeLoop (Halfedge h)
 Helper for halfedge collapse.
 
bool garbage () const
 are there deleted vertices, edges or faces?
 

Protected Attributes

unsigned m_attributes
 
ColorSpace m_colorSpace
 
PatateCommon::PropertyContainer m_nprops
 
VectorMatrix m_positions
 
VertexGradientMap m_vertexGradientConstraints
 
CurvedEdgesMap m_curvedEdges
 
HalfedgeProperty< Nodem_halfedgeAttributes [HALFEDGE_ATTRIB_COUNT]
 
unsigned m_deletedNodes
 
NodeMatrix m_nodes
 
NodeProperty< bool > m_ndeleted
 
std::vector< Nodem_gcNodeMap
 
- Protected Attributes inherited from PatateCommon::SurfaceMesh
PropertyContainer m_vprops
 
PropertyContainer m_hprops
 
PropertyContainer m_eprops
 
PropertyContainer m_fprops
 
VertexProperty
< VertexConnectivity
m_vconn
 
HalfedgeProperty
< HalfedgeConnectivity
m_hconn
 
FaceProperty< FaceConnectivitym_fconn
 
VertexProperty< bool > m_vdeleted
 
EdgeProperty< bool > m_edeleted
 
FaceProperty< bool > m_fdeleted
 
unsigned int m_deletedVertices
 
unsigned int m_deletedEdges
 
unsigned int m_deleteFaces
 
bool m_garbage
 
std::vector< Vertexm_gcVertexMap
 
std::vector< Halfedgem_gcHalfedgeMap
 
std::vector< Facem_gcFaceMap
 
std::vector< Vertexm_addFaceVertices
 
std::vector< Halfedgem_addFaceHalfedges
 
std::vector< bool > m_addFaceIsNew
 
std::vector< bool > m_addFaceNeedsAdjust
 
NextCache m_addFaceNextCache
 

Static Protected Attributes

static const char * _halfedgeAttrName [HALFEDGE_ATTRIB_COUNT]
 

Mesh and general

unsigned nDims () const
 
unsigned nCoeffs () const
 
void setNDims (unsigned nDims)
 
void setNCoeffs (unsigned nCoeffs)
 Set the number of coefficients to nCoeffs. More...
 
void reserve (unsigned nvertices, unsigned nedges, unsigned nfaces, unsigned nnodes)
 
void clear ()
 
void garbageCollection (unsigned flags=0)
 
void releaseGCIndexMaps ()
 
Node gcMap (Node n) const
 
template<typename Derived >
Vertex addVertex (const Eigen::DenseBase< Derived > &pos)
 
ConstVectorXpr position (Vertex v) const
 
VectorXpr position (Vertex v)
 
bool isValid (Node n) const
 
ColorSpace colorSpace () const
 
void setColorSpace (ColorSpace colorSpace)
 
bool isCurved (Edge e) const
 
bool isCurved (Halfedge h) const
 
const CurvedEdgeedgeCurve (Edge e) const
 
CurvedEdge edgeCurve (Halfedge h) const
 
void setEdgeCurve (Edge e, const CurvedEdge &curve)
 
void setEdgeCurve (Halfedge h, const CurvedEdge &curve)
 
bool halfedgeOrientation (Halfedge h) const
 Return a boolean such that opposite halfedges give a different result. More...
 
template<class T >
NodeProperty< T > addNodeProperty (const std::string &name, const T t=T())
 
template<class T >
NodeProperty< T > getNodeProperty (const std::string &name) const
 
template<class T >
NodeProperty< T > nodeProperty (const std::string &name, const T t=T())
 
template<class T >
void removeNodeProperty (NodeProperty< T > &p)
 
const std::type_info & getNodePropertyType (const std::string &name)
 
std::vector< std::string > nodeProperties () const
 
unsigned positionsCapacity () const
 

Low-level nodes manipulation

unsigned nodesSize () const
 
unsigned nNodes () const
 Return the number of nodes.
 
bool isDeleted (Node n) const
 
void deleteUnusedNodes ()
 Mark unused node as deleted, but does not free memory. More...
 
NodeIterator nodesBegin () const
 
NodeIterator nodesEnd () const
 
Node addNode ()
 Add and return a node with value value or an unknown node if no parameter is provided.
 
template<typename Derived >
Node addNode (const Eigen::DenseBase< Derived > &value)
 
ConstValueXpr value (Node node) const
 Read only access to the value of node.
 
ValueXpr value (Node node)
 Read-write access to the value of node.
 
UnconstrainedNodeType unconstrainedValue () const
 
bool isConstraint (Node node) const
 Return true iff node is a constraint.
 
bool hasUnknowns () const
 Return true if the mesh has unknown nodes. More...
 
unsigned nUnknowns () const
 
unsigned nodesCapacity () const
 

Member Function Documentation

template<typename _Scalar , int _Dim, int _Chan>
void Vitelotte::VGMesh< _Scalar, _Dim, _Chan >::deleteUnusedNodes ( )

Mark unused node as deleted, but does not free memory.

See Also
garbageCollection()
template<typename _Scalar , int _Dim, int _Chan>
void Vitelotte::VGMesh< _Scalar, _Dim, _Chan >::finalize ( )

/brief Finalize a mesh with invalid node so that it can be send to a Solver.

Warning
This method does not support non-local unknown node, ie. unknown node used on different primitive of the mesh to achieve special effects like color "teleportation". Using it in such case may lead to unexpected results.
template<typename _Scalar , int _Dims = 2, int _Coeffs = 4>
bool Vitelotte::VGMesh< _Scalar, _Dims, _Coeffs >::halfedgeOrientation ( Halfedge  h) const
inline

Return a boolean such that opposite halfedges give a different result.

In practice, return fromVertex(h).idx() > toVertex(h).idx(). This make the method easily predictable.

template<typename _Scalar , int _Dim, int _Chan>
bool Vitelotte::VGMesh< _Scalar, _Dim, _Chan >::hasUnknowns ( ) const
inline

Return true if the mesh has unknown nodes.

Complexity
This function operates in \(O(n)\) with \(n\) the number of nodes.
template<typename _Scalar , int _Dim, int _Chan>
unsigned Vitelotte::VGMesh< _Scalar, _Dim, _Chan >::nSingularFaces ( ) const
inline

Return the number of singular faces in the mesh.

Complexity
This method opperates in \(O(n)\) with \(n\) the number of halfedges.
template<typename _Scalar , int _Dim, int _Chan>
void Vitelotte::VGMesh< _Scalar, _Dim, _Chan >::setAttributes ( unsigned  attributes)

Set the active attributes to attributes.

Attributes that are removed will release corresponding memory and new attributes will be set to their default value. Attibute that stay active won't be modified.

Parameters
attributesAttributes flags ORed together.
template<typename _Scalar , int _Dim, int _Chan>
void Vitelotte::VGMesh< _Scalar, _Dim, _Chan >::setNCoeffs ( unsigned  nCoeffs)

Set the number of coefficients to nCoeffs.

If this mesh has a fixed number of coefficients, nCoeffs must match it.

If this function is used to increase the number of coefficients of a non-empty mesh, be aware that the new coefficients will be uninitialized. In other words, value() will return partially initialized vectors.

template<typename _Scalar , int _Dim, int _Chan>
void Vitelotte::VGMesh< _Scalar, _Dim, _Chan >::setSingularity ( Node  fromNode,
Node  toNode,
Halfedge  from,
Halfedge  to 
)

Similar to VGMesh::setVertexNode, but for singularities.

set nodes for a singularity starting with value fromNode in the direction of halfedge from to value toNode in the direction of halfedge to.

Precondition
The mesh must have the VertexFromValue attribute active.
from and to mush have the same source vertex.
fromNode and toNode mush be constraints.
template<typename _Scalar , int _Dim, int _Chan>
void Vitelotte::VGMesh< _Scalar, _Dim, _Chan >::setVertexNodes ( Node  node,
Halfedge  from,
Halfedge  to 
)

Set nodes of all the halfedges inbetween halfedges from and to (in counter-clockwise direction) to node.

Precondition
from and to mush have the same source vertex.
template<typename _Scalar , int _Dim, int _Chan>
void Vitelotte::VGMesh< _Scalar, _Dim, _Chan >::simplifyConstraints ( )

Simplify constraints when possible.

This method operate in two steps:

  1. Simplify each pair of opposite nodes (see VGMesh::simplifyOppositeNodes()).
  2. Go around each vertex and try to simplfy them.

After processing, the resulting mesh will use less nodes than the original if simplifications where possible, but still produce the same final result after finalization and solving. It may be usefull to make the solver slightly faster or to diminish file size.

One typically wish to call VGMesh::deleteUnusedNodes() and VGMesh::garbageCollection after this function to effectively remove unused nodes.

Note
Currently, this method only work locally. This mean for instance that it won't merge all constraint nodes with the same value if they are not on the same primitive.
Warning
This method does not support non-local unknown node, ie. unknown node used on different primitive of the mesh to achieve special effects like color "teleportation". Using it in such case may lead to unexpected results.
template<typename _Scalar , int _Dim, int _Chan>
void Vitelotte::VGMesh< _Scalar, _Dim, _Chan >::simplifyOppositeNodes ( Node n0,
Node n1,
bool  b0 = false,
bool  b1 = false 
) const

Replace n0 and n1 by a single node on an invalid node if possible.

This is mainly an helper funciton for VGMesh::simplifyConstraints().

Warning
This method does not support non-local unknown node, ie. unknown node used on different primitive of the mesh to achieve special effects like color "teleportation". Using it in such case may lead to unexpected results.

Member Data Documentation

template<typename _Scalar , int _Dims = 2, int _Coeffs = 4>
const char * Vitelotte::VGMesh< _Scalar, _Dim, _Chan >::_halfedgeAttrName
staticprotected
Initial value:
= {
"h:toVertexValueNode",
"h:fromVertexValueNode",
"h:edgeValueNode",
"h:edgeGradientNode"
}