$darkmode
VCG Library
Classes | Public Types | Static Public Member Functions | List of all members
vcg::tri::Append< MeshLeft, ConstMeshRight > Class Template Reference

Class to safely duplicate and append (portion of) meshes. More...

#include <append.h>

Classes

struct  Remap
 

Public Types

typedef MeshLeft::ScalarType ScalarLeft
 
typedef MeshLeft::CoordType CoordLeft
 
typedef MeshLeft::VertexType VertexLeft
 
typedef MeshLeft::EdgeType EdgeLeft
 
typedef MeshLeft::FaceType FaceLeft
 
typedef MeshLeft::HEdgeType HEdgeLeft
 
typedef MeshLeft::TetraType TetraLeft
 
typedef MeshLeft::VertexPointer VertexPointerLeft
 
typedef MeshLeft::VertexIterator VertexIteratorLeft
 
typedef MeshLeft::EdgeIterator EdgeIteratorLeft
 
typedef MeshLeft::HEdgeIterator HEdgeIteratorLeft
 
typedef MeshLeft::FaceIterator FaceIteratorLeft
 
typedef MeshLeft::TetraIterator TetraIteratorLeft
 
typedef ConstMeshRight::ScalarType ScalarRight
 
typedef ConstMeshRight::CoordType CoordRight
 
typedef ConstMeshRight::VertexType VertexRight
 
typedef ConstMeshRight::EdgeType EdgeRight
 
typedef ConstMeshRight::HEdgeType HEdgeRight
 
typedef ConstMeshRight::FaceType FaceRight
 
typedef ConstMeshRight::TetraType TetraRight
 
typedef ConstMeshRight::TetraPointer TetraPointerRight
 
typedef ConstMeshRight::TetraIterator TetraIteratorRight
 
typedef ConstMeshRight::VertexPointer VertexPointerRight
 
typedef ConstMeshRight::VertexIterator VertexIteratorRight
 
typedef ConstMeshRight::EdgeIterator EdgeIteratorRight
 
typedef ConstMeshRight::HEdgeIterator HEdgeIteratorRight
 
typedef ConstMeshRight::FaceIterator FaceIteratorRight
 
typedef ConstMeshRight::FacePointer FacePointerRight
 

Static Public Member Functions

static void ImportVertexAdj (MeshLeft &ml, const ConstMeshRight &mr, VertexLeft &vl, const VertexRight &vr, Remap &remap)
 
static void ImportEdgeAdj (MeshLeft &ml, const ConstMeshRight &mr, EdgeLeft &el, const EdgeRight &er, Remap &remap)
 
static void ImportFaceAdj (MeshLeft &ml, const ConstMeshRight &mr, FaceLeft &fl, const FaceRight &fr, Remap &remap)
 
static void ImportHEdgeAdj (MeshLeft &ml, const ConstMeshRight &mr, HEdgeLeft &hl, const HEdgeRight &hr, Remap &remap, bool)
 
static void ImportTetraAdj (MeshLeft &ml, const ConstMeshRight &mr, TetraLeft &tl, const TetraRight &tr, Remap &remap)
 
static void Mesh (MeshLeft &ml, ConstMeshRight &mr, const bool selected=false, const bool adjFlag=false)
 Append the second mesh to the first one. More...
 
static void MeshAppendConst (MeshLeft &ml, const ConstMeshRight &mr, const bool selected=false, const bool adjFlag=false)
 MeshAppendConst. More...
 
static void MeshCopy (MeshLeft &ml, ConstMeshRight &mr, bool selected=false, const bool adjFlag=false)
 Copy the second mesh over the first one. The first mesh is destroyed. If requested only the selected elements are copied.
 
static void MeshCopyConst (MeshLeft &ml, const ConstMeshRight &mr, bool selected=false, const bool adjFlag=false)
 
static void Selected (MeshLeft &ml, ConstMeshRight &mr)
 Append only the selected elements of second mesh to the first one. More...
 

Detailed Description

template<class MeshLeft, class ConstMeshRight>
class vcg::tri::Append< MeshLeft, ConstMeshRight >

Class to safely duplicate and append (portion of) meshes.

Adding elements to a mesh, like faces and vertices can involve the reallocation of the vectors of the involved elements. This class provide the only safe methods to add elements of a mesh to another one.

See also
Allocating and Deleting mesh elements

Member Function Documentation

◆ Mesh()

template<class MeshLeft , class ConstMeshRight >
static void vcg::tri::Append< MeshLeft, ConstMeshRight >::Mesh ( MeshLeft &  ml,
ConstMeshRight &  mr,
const bool  selected = false,
const bool  adjFlag = false 
)
inlinestatic

Append the second mesh to the first one.

The first mesh is not destroyed and no attempt of avoid duplication of already present elements is done. If requested only the selected elements are appended to the first one. The second mesh is not changed at all (it could be constant) with the exception of the selection (see below note).

Note
If the the selection of the vertexes is not consistent with the face selection the append could build faces referencing non existent vertices so it is mandatory that the selection of the vertices reflects the loose selection from edges and faces (e.g. if a face is selected then all its vertices must be selected).
Attributes. This function will copy only those attributes that are present in both meshes. Two attributes in different meshes are considered the same iff they have the same name and the same type. This may be deceiving because they could in fact have different semantic, but this is up to the developer. If the left mesh has attributes that are not in the right mesh, their values for the elements of the right mesh will be uninitialized

◆ MeshAppendConst()

template<class MeshLeft , class ConstMeshRight >
static void vcg::tri::Append< MeshLeft, ConstMeshRight >::MeshAppendConst ( MeshLeft &  ml,
const ConstMeshRight &  mr,
const bool  selected = false,
const bool  adjFlag = false 
)
inlinestatic

MeshAppendConst.

Parameters
ml
mrThis is function is similar with the Mesh function, but does not never update selections. In some cases, after the append, selection of vertices may be inconsistent with face selection, as explained above. To avoid this, before using this function, call the following functions:
static size_t VertexFromEdgeLoose(MeshType &m, bool preserveSelection=false)
Select all the vertices that are touched by at least a single selected edge.
Definition: selection.h:399
static size_t VertexFromFaceLoose(MeshType &m, bool preserveSelection=false)
Select all the vertices that are touched by at least a single selected faces.
Definition: selection.h:386

or, use the Mesh function that takes a non-const Right Mesh argument.

◆ Selected()

template<class MeshLeft , class ConstMeshRight >
static void vcg::tri::Append< MeshLeft, ConstMeshRight >::Selected ( MeshLeft &  ml,
ConstMeshRight &  mr 
)
inlinestatic

Append only the selected elements of second mesh to the first one.

It is just a wrap of the main Append::Mesh()


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