Include header cleaning and reordering.
This commit is contained in:
parent
d4eb599a66
commit
84c80a1972
|
@ -1,46 +1,64 @@
|
|||
/****************************************************************************
|
||||
* VCGLib o o *
|
||||
* Visual and Computer Graphics Library o o *
|
||||
* _ O _ *
|
||||
* Copyright(C) 2004-2012 \/)\/ *
|
||||
* Visual Computing Lab /\/| *
|
||||
* ISTI - Italian National Research Council | *
|
||||
* \ *
|
||||
* All rights reserved. *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 2 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt) *
|
||||
* for more details. *
|
||||
* *
|
||||
****************************************************************************/
|
||||
#ifndef VCG_TRI_ATTRIBUTE_SEAM_H
|
||||
#define VCG_TRI_ATTRIBUTE_SEAM_H
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include <vcg/complex/allocate.h>
|
||||
|
||||
/*
|
||||
|
||||
// sample extract functor
|
||||
void v_extract(const src_mesh_t & wm, const src_face_t & f, int k, const dst_mesh_t & vm, dst_vertex_t & v)
|
||||
{
|
||||
(void)wm;
|
||||
(void)vm;
|
||||
(void)wm;
|
||||
(void)vm;
|
||||
|
||||
v.P() = f.cP (k);
|
||||
v.N() = f.cWN(k);
|
||||
v.C() = f.cWC(k);
|
||||
v.T() = f.cWT(k);
|
||||
v.P() = f.cP (k);
|
||||
v.N() = f.cWN(k);
|
||||
v.C() = f.cWC(k);
|
||||
v.T() = f.cWT(k);
|
||||
}
|
||||
|
||||
// sample compare functor
|
||||
bool v_compare(const dst_mesh_t & vm, const dst_vertex_t & u, const dst_vertex_t & v)
|
||||
{
|
||||
(void)vm;
|
||||
(void)vm;
|
||||
|
||||
return
|
||||
(
|
||||
(u.cN() == v.cN())
|
||||
&& (u.cC() == v.cC())
|
||||
&& (u.cT() == v.cT())
|
||||
);
|
||||
return
|
||||
(
|
||||
(u.cN() == v.cN())
|
||||
&& (u.cC() == v.cC())
|
||||
&& (u.cT() == v.cT())
|
||||
);
|
||||
}
|
||||
|
||||
// sample copy functor
|
||||
void v_copy(const dst_mesh_t & vm, const dst_vertex_t & u, dst_vertex_t & v)
|
||||
{
|
||||
(void)vm;
|
||||
(void)vm;
|
||||
|
||||
v.P() = u.cP();
|
||||
v.N() = u.cN();
|
||||
v.C() = u.cC();
|
||||
v.T() = u.cT();
|
||||
v.P() = u.cP();
|
||||
v.N() = u.cN();
|
||||
v.C() = u.cC();
|
||||
v.T() = u.cT();
|
||||
}
|
||||
|
||||
// create seams
|
||||
|
@ -56,310 +74,310 @@ namespace tri
|
|||
|
||||
class AttributeSeam
|
||||
{
|
||||
public:
|
||||
|
||||
typedef AttributeSeam ThisType;
|
||||
|
||||
enum ASMask
|
||||
{
|
||||
POSITION_PER_VERTEX = (1 << 0),
|
||||
|
||||
NORMAL_PER_VERTEX = (1 << 1),
|
||||
NORMAL_PER_WEDGE = (1 << 2),
|
||||
NORMAL_PER_FACE = (1 << 3),
|
||||
|
||||
COLOR_PER_VERTEX = (1 << 4),
|
||||
COLOR_PER_WEDGE = (1 << 5),
|
||||
COLOR_PER_FACE = (1 << 6),
|
||||
|
||||
TEXCOORD_PER_VERTEX = (1 << 7),
|
||||
TEXCOORD_PER_WEDGE = (1 << 8)
|
||||
};
|
||||
|
||||
template <typename src_trimesh_t, typename dst_trimesh_t>
|
||||
struct ASExtract
|
||||
{
|
||||
const unsigned int mask;
|
||||
|
||||
ASExtract(unsigned int vmask = 0) : mask(vmask)
|
||||
{
|
||||
;
|
||||
}
|
||||
|
||||
void operator () (const src_trimesh_t & sm, const typename src_trimesh_t::FaceType & f, int k, const dst_trimesh_t & dm, typename dst_trimesh_t::VertexType & v) const
|
||||
{
|
||||
(void)sm;
|
||||
(void)dm;
|
||||
|
||||
const unsigned int m = this->mask;
|
||||
const typename src_trimesh_t::VertexType & u = *(f.cV(k));
|
||||
|
||||
if ((m & AttributeSeam::POSITION_PER_VERTEX) != 0) v.P() = f.cP (k);
|
||||
|
||||
if ((m & AttributeSeam::NORMAL_PER_VERTEX) != 0) v.N() = u.cN ( );
|
||||
if ((m & AttributeSeam::NORMAL_PER_WEDGE) != 0) v.N() = f.cWN(k);
|
||||
if ((m & AttributeSeam::NORMAL_PER_FACE) != 0) v.N() = f.cN ( );
|
||||
|
||||
if ((m & AttributeSeam::COLOR_PER_VERTEX) != 0) v.C() = u.cC ( );
|
||||
if ((m & AttributeSeam::COLOR_PER_WEDGE) != 0) v.C() = f.cWC(k);
|
||||
if ((m & AttributeSeam::COLOR_PER_FACE) != 0) v.C() = f.cC ( );
|
||||
|
||||
if ((m & AttributeSeam::TEXCOORD_PER_VERTEX) != 0) v.T() = u.cT ( );
|
||||
if ((m & AttributeSeam::TEXCOORD_PER_WEDGE) != 0) v.T() = f.cWT(k);
|
||||
}
|
||||
};
|
||||
|
||||
template <typename dst_trimesh_t>
|
||||
struct ASCompare
|
||||
{
|
||||
const unsigned int mask;
|
||||
|
||||
ASCompare(unsigned int vmask = 0) : mask(vmask)
|
||||
{
|
||||
;
|
||||
}
|
||||
|
||||
bool operator () (const dst_trimesh_t & sm, const typename dst_trimesh_t::VertexType & u, const typename dst_trimesh_t::VertexType & v) const
|
||||
{
|
||||
(void)sm;
|
||||
|
||||
const unsigned int m = this->mask;
|
||||
|
||||
/*
|
||||
if ((m & (AttributeSeam::POSITION_PER_VERTEX)) != 0)
|
||||
{
|
||||
if (u.cP() != v.cP()) return false;
|
||||
}
|
||||
*/
|
||||
|
||||
if ((m & (AttributeSeam::NORMAL_PER_VERTEX | AttributeSeam::NORMAL_PER_WEDGE | AttributeSeam::NORMAL_PER_FACE)) != 0)
|
||||
{
|
||||
if (u.cN() != v.cN()) return false;
|
||||
}
|
||||
|
||||
if ((m & (AttributeSeam::COLOR_PER_VERTEX | AttributeSeam::COLOR_PER_WEDGE | AttributeSeam::COLOR_PER_FACE)) != 0)
|
||||
{
|
||||
if (u.cC() != v.cC()) return false;
|
||||
}
|
||||
|
||||
if ((m & (AttributeSeam::TEXCOORD_PER_VERTEX | AttributeSeam::TEXCOORD_PER_WEDGE)) != 0)
|
||||
{
|
||||
if (u.cT() != v.cT()) return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
// in-place version
|
||||
template <typename src_trimesh_t, typename extract_wedge_attribs_t, typename compare_vertex_attribs_t>
|
||||
static inline bool SplitVertex(src_trimesh_t & src, extract_wedge_attribs_t v_extract, compare_vertex_attribs_t & v_compare)
|
||||
{
|
||||
typedef typename src_trimesh_t::VertexType src_vertex_t;
|
||||
typedef typename src_trimesh_t::VertexIterator src_vertex_i;
|
||||
typedef typename src_trimesh_t::FaceType src_face_t;
|
||||
typedef typename src_trimesh_t::FaceIterator src_face_i;
|
||||
typedef typename src_trimesh_t::VertContainer src_vertex_container_t;
|
||||
|
||||
typedef vcg::tri::Allocator<src_trimesh_t> src_mesh_allocator_t;
|
||||
typedef typename src_mesh_allocator_t :: template PointerUpdater<typename src_trimesh_t::VertexPointer> src_pointer_updater_t;
|
||||
|
||||
if ((src.vn <= 0) || (src.fn <= 0))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
src_pointer_updater_t pt_upd;
|
||||
src_vertex_i vi = src_mesh_allocator_t::AddVertices(src, 1, pt_upd);
|
||||
src_vertex_t * vtx = &(*vi);
|
||||
src_vertex_t * vtxbase = &(src.vert[0]);
|
||||
|
||||
const size_t vertex_count = src.vert.size();
|
||||
const size_t vertex_pool_size = vertex_count;
|
||||
|
||||
std::vector<int> vloc;
|
||||
vloc.reserve(vertex_pool_size);
|
||||
vloc.resize(vertex_count, -2);
|
||||
|
||||
int vcount = int(src.vert.size());
|
||||
int idx = 0;
|
||||
|
||||
for (src_face_i it=src.face.begin(); it!=src.face.end(); ++it)
|
||||
{
|
||||
src_face_t & f = (*it);
|
||||
if (f.IsD()) continue;
|
||||
|
||||
for (int k=0; k<3; ++k)
|
||||
{
|
||||
idx = (f.cV(k) - vtxbase);
|
||||
v_extract(src, f, k, src, *vtx);
|
||||
|
||||
if (vloc[idx] == -2)
|
||||
{
|
||||
vloc[idx] = -1;
|
||||
src.vert[idx].ImportData(*vtx);
|
||||
}
|
||||
else
|
||||
{
|
||||
int vidx = idx;
|
||||
do
|
||||
{
|
||||
if (v_compare(src, src.vert[vidx], *vtx)) break;
|
||||
vidx = vloc[vidx];
|
||||
} while (vidx >= 0);
|
||||
|
||||
if (vidx < 0)
|
||||
{
|
||||
vloc.push_back(vloc[idx]);
|
||||
vloc[idx] = vcount;
|
||||
|
||||
vi = src_mesh_allocator_t::AddVertices(src, 1, pt_upd);
|
||||
pt_upd.Update(vtx);
|
||||
pt_upd.Update(vtxbase);
|
||||
|
||||
(*vi).ImportData(*vtx);
|
||||
|
||||
idx = vcount;
|
||||
vcount++;
|
||||
}
|
||||
else
|
||||
{
|
||||
idx = vidx;
|
||||
}
|
||||
}
|
||||
|
||||
f.V(k) = &(src.vert[idx]);
|
||||
}
|
||||
}
|
||||
|
||||
src_mesh_allocator_t::DeleteVertex(src, *vtx);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// out-of-place version
|
||||
template <typename src_trimesh_t, typename dst_trimesh_t, typename extract_wedge_attribs_t, typename compare_vertex_attribs_t, typename copy_vertex_t>
|
||||
static inline bool SplitVertex(const src_trimesh_t & src, dst_trimesh_t & dst, extract_wedge_attribs_t & v_extract, compare_vertex_attribs_t & v_compare, copy_vertex_t & v_copy)
|
||||
{
|
||||
typedef typename src_trimesh_t::VertexType src_vertex_t;
|
||||
typedef typename src_trimesh_t::FaceType src_face_t;
|
||||
typedef typename src_trimesh_t::ConstFaceIterator src_face_ci;
|
||||
|
||||
typedef typename dst_trimesh_t::VertContainer dst_vertex_container_t;
|
||||
typedef typename dst_trimesh_t::VertexType dst_vertex_t;
|
||||
typedef typename dst_trimesh_t::VertexIterator dst_vertex_i;
|
||||
typedef typename dst_trimesh_t::FaceType dst_face_t;
|
||||
typedef typename dst_trimesh_t::FaceIterator dst_face_i;
|
||||
|
||||
typedef vcg::tri::Allocator<dst_trimesh_t> dst_mesh_allocator_t;
|
||||
|
||||
/* GCC gets in troubles and need some hints ("template") to parse the following line */
|
||||
typedef typename dst_mesh_allocator_t :: template PointerUpdater<typename dst_trimesh_t::VertexPointer> dst_pointer_updater_t;
|
||||
|
||||
if (reinterpret_cast<const void *>(&src) == reinterpret_cast<const void *>(&dst))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
dst.Clear();
|
||||
|
||||
if ((src.vn <= 0) || (src.fn <= 0))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
const size_t vertex_count = src.vert.size();
|
||||
const size_t vertex_pool_size = vertex_count;
|
||||
|
||||
const src_vertex_t * vtxbase = &(src.vert[0]);
|
||||
|
||||
std::vector<int> vloc;
|
||||
vloc.reserve(vertex_pool_size);
|
||||
vloc.resize(vertex_count, -2);
|
||||
|
||||
dst_vertex_i vv;
|
||||
dst_pointer_updater_t pt_upd;
|
||||
pt_upd.preventUpdateFlag = true;
|
||||
dst_mesh_allocator_t::AddVertices(dst, 1 + int(vertex_count), pt_upd);
|
||||
dst_vertex_t * vtx = &(dst.vert[0]);
|
||||
|
||||
dst_face_i fbase = dst_mesh_allocator_t::AddFaces(dst, src.fn);
|
||||
dst_face_i fi = fbase;
|
||||
|
||||
int vcount = int(dst.vert.size());
|
||||
int idx = 0;
|
||||
|
||||
for (src_face_ci it=src.face.begin(); it!=src.face.end(); ++it)
|
||||
{
|
||||
const src_face_t & wf = (*it);
|
||||
if (wf.IsD()) continue;
|
||||
|
||||
dst_face_t & vf = (*fi);
|
||||
|
||||
for (int k=0; k<3; ++k)
|
||||
{
|
||||
idx = (wf.cV(k) - vtxbase);
|
||||
|
||||
v_extract(src, wf, k, dst, *vtx);
|
||||
|
||||
if (vloc[idx] == -2)
|
||||
{
|
||||
vloc[idx] = -1;
|
||||
v_copy(dst, *vtx, dst.vert[idx]);
|
||||
}
|
||||
else
|
||||
{
|
||||
int vidx = idx;
|
||||
do
|
||||
{
|
||||
if (v_compare(dst, dst.vert[vidx], *vtx)) break;
|
||||
vidx = vloc[vidx];
|
||||
} while (vidx >= 0);
|
||||
|
||||
if (vidx < 0)
|
||||
{
|
||||
vloc.push_back(vloc[idx]);
|
||||
vloc[idx] = vcount;
|
||||
|
||||
vv = dst_mesh_allocator_t::AddVertices(dst, 1, pt_upd);
|
||||
pt_upd.Update(vtx);
|
||||
v_copy(dst, *vtx, *vv);
|
||||
|
||||
idx = vcount;
|
||||
vcount++;
|
||||
}
|
||||
else
|
||||
{
|
||||
idx = vidx;
|
||||
}
|
||||
}
|
||||
|
||||
vf.V(k) = reinterpret_cast<dst_vertex_t *>(idx);
|
||||
}
|
||||
|
||||
fi++;
|
||||
}
|
||||
|
||||
{
|
||||
std::vector<int> tmp;
|
||||
vloc.swap(tmp);
|
||||
}
|
||||
|
||||
dst_vertex_t * vstart = &(dst.vert[0]);
|
||||
|
||||
for (dst_face_i it=fbase; it!=dst.face.end(); ++it)
|
||||
{
|
||||
dst_face_t & vf = (*it);
|
||||
public:
|
||||
|
||||
typedef AttributeSeam ThisType;
|
||||
|
||||
enum ASMask
|
||||
{
|
||||
POSITION_PER_VERTEX = (1 << 0),
|
||||
|
||||
NORMAL_PER_VERTEX = (1 << 1),
|
||||
NORMAL_PER_WEDGE = (1 << 2),
|
||||
NORMAL_PER_FACE = (1 << 3),
|
||||
|
||||
COLOR_PER_VERTEX = (1 << 4),
|
||||
COLOR_PER_WEDGE = (1 << 5),
|
||||
COLOR_PER_FACE = (1 << 6),
|
||||
|
||||
TEXCOORD_PER_VERTEX = (1 << 7),
|
||||
TEXCOORD_PER_WEDGE = (1 << 8)
|
||||
};
|
||||
|
||||
template <typename src_trimesh_t, typename dst_trimesh_t>
|
||||
struct ASExtract
|
||||
{
|
||||
const unsigned int mask;
|
||||
|
||||
ASExtract(unsigned int vmask = 0) : mask(vmask)
|
||||
{
|
||||
;
|
||||
}
|
||||
|
||||
void operator () (const src_trimesh_t & sm, const typename src_trimesh_t::FaceType & f, int k, const dst_trimesh_t & dm, typename dst_trimesh_t::VertexType & v) const
|
||||
{
|
||||
(void)sm;
|
||||
(void)dm;
|
||||
|
||||
const unsigned int m = this->mask;
|
||||
const typename src_trimesh_t::VertexType & u = *(f.cV(k));
|
||||
|
||||
if ((m & AttributeSeam::POSITION_PER_VERTEX) != 0) v.P() = f.cP (k);
|
||||
|
||||
if ((m & AttributeSeam::NORMAL_PER_VERTEX) != 0) v.N() = u.cN ( );
|
||||
if ((m & AttributeSeam::NORMAL_PER_WEDGE) != 0) v.N() = f.cWN(k);
|
||||
if ((m & AttributeSeam::NORMAL_PER_FACE) != 0) v.N() = f.cN ( );
|
||||
|
||||
if ((m & AttributeSeam::COLOR_PER_VERTEX) != 0) v.C() = u.cC ( );
|
||||
if ((m & AttributeSeam::COLOR_PER_WEDGE) != 0) v.C() = f.cWC(k);
|
||||
if ((m & AttributeSeam::COLOR_PER_FACE) != 0) v.C() = f.cC ( );
|
||||
|
||||
if ((m & AttributeSeam::TEXCOORD_PER_VERTEX) != 0) v.T() = u.cT ( );
|
||||
if ((m & AttributeSeam::TEXCOORD_PER_WEDGE) != 0) v.T() = f.cWT(k);
|
||||
}
|
||||
};
|
||||
|
||||
template <typename dst_trimesh_t>
|
||||
struct ASCompare
|
||||
{
|
||||
const unsigned int mask;
|
||||
|
||||
ASCompare(unsigned int vmask = 0) : mask(vmask)
|
||||
{
|
||||
;
|
||||
}
|
||||
|
||||
bool operator () (const dst_trimesh_t & sm, const typename dst_trimesh_t::VertexType & u, const typename dst_trimesh_t::VertexType & v) const
|
||||
{
|
||||
(void)sm;
|
||||
|
||||
const unsigned int m = this->mask;
|
||||
|
||||
/*
|
||||
if ((m & (AttributeSeam::POSITION_PER_VERTEX)) != 0)
|
||||
{
|
||||
if (u.cP() != v.cP()) return false;
|
||||
}
|
||||
*/
|
||||
|
||||
if ((m & (AttributeSeam::NORMAL_PER_VERTEX | AttributeSeam::NORMAL_PER_WEDGE | AttributeSeam::NORMAL_PER_FACE)) != 0)
|
||||
{
|
||||
if (u.cN() != v.cN()) return false;
|
||||
}
|
||||
|
||||
if ((m & (AttributeSeam::COLOR_PER_VERTEX | AttributeSeam::COLOR_PER_WEDGE | AttributeSeam::COLOR_PER_FACE)) != 0)
|
||||
{
|
||||
if (u.cC() != v.cC()) return false;
|
||||
}
|
||||
|
||||
if ((m & (AttributeSeam::TEXCOORD_PER_VERTEX | AttributeSeam::TEXCOORD_PER_WEDGE)) != 0)
|
||||
{
|
||||
if (u.cT() != v.cT()) return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
// in-place version
|
||||
template <typename src_trimesh_t, typename extract_wedge_attribs_t, typename compare_vertex_attribs_t>
|
||||
static inline bool SplitVertex(src_trimesh_t & src, extract_wedge_attribs_t v_extract, compare_vertex_attribs_t & v_compare)
|
||||
{
|
||||
typedef typename src_trimesh_t::VertexType src_vertex_t;
|
||||
typedef typename src_trimesh_t::VertexIterator src_vertex_i;
|
||||
typedef typename src_trimesh_t::FaceType src_face_t;
|
||||
typedef typename src_trimesh_t::FaceIterator src_face_i;
|
||||
typedef typename src_trimesh_t::VertContainer src_vertex_container_t;
|
||||
|
||||
typedef vcg::tri::Allocator<src_trimesh_t> src_mesh_allocator_t;
|
||||
typedef typename src_mesh_allocator_t :: template PointerUpdater<typename src_trimesh_t::VertexPointer> src_pointer_updater_t;
|
||||
|
||||
if ((src.vn <= 0) || (src.fn <= 0))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
src_pointer_updater_t pt_upd;
|
||||
src_vertex_i vi = src_mesh_allocator_t::AddVertices(src, 1, pt_upd);
|
||||
src_vertex_t * vtx = &(*vi);
|
||||
src_vertex_t * vtxbase = &(src.vert[0]);
|
||||
|
||||
const size_t vertex_count = src.vert.size();
|
||||
const size_t vertex_pool_size = vertex_count;
|
||||
|
||||
std::vector<int> vloc;
|
||||
vloc.reserve(vertex_pool_size);
|
||||
vloc.resize(vertex_count, -2);
|
||||
|
||||
int vcount = int(src.vert.size());
|
||||
int idx = 0;
|
||||
|
||||
for (src_face_i it=src.face.begin(); it!=src.face.end(); ++it)
|
||||
{
|
||||
src_face_t & f = (*it);
|
||||
if (f.IsD()) continue;
|
||||
|
||||
for (int k=0; k<3; ++k)
|
||||
{
|
||||
idx = (f.cV(k) - vtxbase);
|
||||
v_extract(src, f, k, src, *vtx);
|
||||
|
||||
if (vloc[idx] == -2)
|
||||
{
|
||||
vloc[idx] = -1;
|
||||
src.vert[idx].ImportData(*vtx);
|
||||
}
|
||||
else
|
||||
{
|
||||
int vidx = idx;
|
||||
do
|
||||
{
|
||||
if (v_compare(src, src.vert[vidx], *vtx)) break;
|
||||
vidx = vloc[vidx];
|
||||
} while (vidx >= 0);
|
||||
|
||||
if (vidx < 0)
|
||||
{
|
||||
vloc.push_back(vloc[idx]);
|
||||
vloc[idx] = vcount;
|
||||
|
||||
vi = src_mesh_allocator_t::AddVertices(src, 1, pt_upd);
|
||||
pt_upd.Update(vtx);
|
||||
pt_upd.Update(vtxbase);
|
||||
|
||||
(*vi).ImportData(*vtx);
|
||||
|
||||
idx = vcount;
|
||||
vcount++;
|
||||
}
|
||||
else
|
||||
{
|
||||
idx = vidx;
|
||||
}
|
||||
}
|
||||
|
||||
f.V(k) = &(src.vert[idx]);
|
||||
}
|
||||
}
|
||||
|
||||
src_mesh_allocator_t::DeleteVertex(src, *vtx);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// out-of-place version
|
||||
template <typename src_trimesh_t, typename dst_trimesh_t, typename extract_wedge_attribs_t, typename compare_vertex_attribs_t, typename copy_vertex_t>
|
||||
static inline bool SplitVertex(const src_trimesh_t & src, dst_trimesh_t & dst, extract_wedge_attribs_t & v_extract, compare_vertex_attribs_t & v_compare, copy_vertex_t & v_copy)
|
||||
{
|
||||
typedef typename src_trimesh_t::VertexType src_vertex_t;
|
||||
typedef typename src_trimesh_t::FaceType src_face_t;
|
||||
typedef typename src_trimesh_t::ConstFaceIterator src_face_ci;
|
||||
|
||||
typedef typename dst_trimesh_t::VertContainer dst_vertex_container_t;
|
||||
typedef typename dst_trimesh_t::VertexType dst_vertex_t;
|
||||
typedef typename dst_trimesh_t::VertexIterator dst_vertex_i;
|
||||
typedef typename dst_trimesh_t::FaceType dst_face_t;
|
||||
typedef typename dst_trimesh_t::FaceIterator dst_face_i;
|
||||
|
||||
typedef vcg::tri::Allocator<dst_trimesh_t> dst_mesh_allocator_t;
|
||||
|
||||
/* GCC gets in troubles and need some hints ("template") to parse the following line */
|
||||
typedef typename dst_mesh_allocator_t :: template PointerUpdater<typename dst_trimesh_t::VertexPointer> dst_pointer_updater_t;
|
||||
|
||||
if (reinterpret_cast<const void *>(&src) == reinterpret_cast<const void *>(&dst))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
dst.Clear();
|
||||
|
||||
if ((src.vn <= 0) || (src.fn <= 0))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
const size_t vertex_count = src.vert.size();
|
||||
const size_t vertex_pool_size = vertex_count;
|
||||
|
||||
const src_vertex_t * vtxbase = &(src.vert[0]);
|
||||
|
||||
std::vector<int> vloc;
|
||||
vloc.reserve(vertex_pool_size);
|
||||
vloc.resize(vertex_count, -2);
|
||||
|
||||
dst_vertex_i vv;
|
||||
dst_pointer_updater_t pt_upd;
|
||||
pt_upd.preventUpdateFlag = true;
|
||||
dst_mesh_allocator_t::AddVertices(dst, 1 + int(vertex_count), pt_upd);
|
||||
dst_vertex_t * vtx = &(dst.vert[0]);
|
||||
|
||||
dst_face_i fbase = dst_mesh_allocator_t::AddFaces(dst, src.fn);
|
||||
dst_face_i fi = fbase;
|
||||
|
||||
int vcount = int(dst.vert.size());
|
||||
int idx = 0;
|
||||
|
||||
for (src_face_ci it=src.face.begin(); it!=src.face.end(); ++it)
|
||||
{
|
||||
const src_face_t & wf = (*it);
|
||||
if (wf.IsD()) continue;
|
||||
|
||||
dst_face_t & vf = (*fi);
|
||||
|
||||
for (int k=0; k<3; ++k)
|
||||
{
|
||||
idx = (wf.cV(k) - vtxbase);
|
||||
|
||||
v_extract(src, wf, k, dst, *vtx);
|
||||
|
||||
if (vloc[idx] == -2)
|
||||
{
|
||||
vloc[idx] = -1;
|
||||
v_copy(dst, *vtx, dst.vert[idx]);
|
||||
}
|
||||
else
|
||||
{
|
||||
int vidx = idx;
|
||||
do
|
||||
{
|
||||
if (v_compare(dst, dst.vert[vidx], *vtx)) break;
|
||||
vidx = vloc[vidx];
|
||||
} while (vidx >= 0);
|
||||
|
||||
if (vidx < 0)
|
||||
{
|
||||
vloc.push_back(vloc[idx]);
|
||||
vloc[idx] = vcount;
|
||||
|
||||
vv = dst_mesh_allocator_t::AddVertices(dst, 1, pt_upd);
|
||||
pt_upd.Update(vtx);
|
||||
v_copy(dst, *vtx, *vv);
|
||||
|
||||
idx = vcount;
|
||||
vcount++;
|
||||
}
|
||||
else
|
||||
{
|
||||
idx = vidx;
|
||||
}
|
||||
}
|
||||
|
||||
vf.V(k) = reinterpret_cast<dst_vertex_t *>(idx);
|
||||
}
|
||||
|
||||
fi++;
|
||||
}
|
||||
|
||||
{
|
||||
std::vector<int> tmp;
|
||||
vloc.swap(tmp);
|
||||
}
|
||||
|
||||
dst_vertex_t * vstart = &(dst.vert[0]);
|
||||
|
||||
for (dst_face_i it=fbase; it!=dst.face.end(); ++it)
|
||||
{
|
||||
dst_face_t & vf = (*it);
|
||||
|
||||
vf.V(0) = vstart + reinterpret_cast<const int>(vf.V(0));
|
||||
vf.V(1) = vstart + reinterpret_cast<const int>(vf.V(1));
|
||||
vf.V(2) = vstart + reinterpret_cast<const int>(vf.V(2));
|
||||
}
|
||||
|
||||
dst_mesh_allocator_t::DeleteVertex(dst, *vtx);
|
||||
|
||||
return true;
|
||||
}
|
||||
vf.V(0) = vstart + reinterpret_cast<const int>(vf.V(0));
|
||||
vf.V(1) = vstart + reinterpret_cast<const int>(vf.V(1));
|
||||
vf.V(2) = vstart + reinterpret_cast<const int>(vf.V(2));
|
||||
}
|
||||
|
||||
dst_mesh_allocator_t::DeleteVertex(dst, *vtx);
|
||||
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
} // end namespace tri
|
||||
|
|
|
@ -1,30 +1,29 @@
|
|||
#include <vcg/complex/algorithms/bitquad_support.h>
|
||||
#include <vcg/complex/allocate.h>
|
||||
|
||||
/** BIT-QUAD creation support:
|
||||
a collection of methods that,
|
||||
starting from a triangular mesh, will create your quad-pure or quad-domainant mesh.
|
||||
|
||||
|
||||
They all require:
|
||||
- per face Q, and FF connectivity, 2-manyfold meshes,
|
||||
- per face Q, and FF connectivity, 2-manyfold meshes,
|
||||
- and tri- or quad- meshes (no penta, etc) (if in need, use MakeBitTriOnly)
|
||||
|
||||
|
||||
[ list of available methods: ]
|
||||
|
||||
void MakePureByRefine(Mesh &m)
|
||||
|
||||
void MakePureByRefine(Mesh &m)
|
||||
- adds a vertex for each tri or quad present
|
||||
- thus, miminal complexity increase is the mesh is quad-dominant already
|
||||
- old non-border edges are made faux
|
||||
- never fails
|
||||
|
||||
void MakePureByCatmullClark(MeshType &m)
|
||||
- adds a vertex in each (non-faux) edge.
|
||||
void MakePureByCatmullClark(MeshType &m)
|
||||
- adds a vertex in each (non-faux) edge.
|
||||
- twice complexity increase w.r.t. "ByRefine" method.
|
||||
- preserves edges: old edges are still edges
|
||||
- preserves edges: old edges are still edges
|
||||
- never fails
|
||||
|
||||
bool MakePureByFlip(MeshType &m [, int maxdist] )
|
||||
|
||||
bool MakePureByFlip(MeshType &m [, int maxdist] )
|
||||
- does not increase # vertices, just flips edges
|
||||
- call in a loop until it returns true (temporary hack)
|
||||
- fails if number of triangle is odd (only happens in open meshes)
|
||||
|
@ -65,9 +64,9 @@ namespace vcg{namespace tri{
|
|||
template <class _MeshType,
|
||||
class Interpolator = GeometricInterpolator<typename _MeshType::VertexType> >
|
||||
class BitQuadCreation{
|
||||
|
||||
|
||||
public:
|
||||
|
||||
|
||||
typedef _MeshType MeshType;
|
||||
typedef typename MeshType::ScalarType ScalarType;
|
||||
typedef typename MeshType::CoordType CoordType;
|
||||
|
@ -84,37 +83,37 @@ typedef BitQuad<MeshType> BQ; // static class to make basic quad operations
|
|||
// given a triangle, merge it with its best neightboord to form a quad
|
||||
template <bool override>
|
||||
static void selectBestDiag(FaceType *fi){
|
||||
|
||||
|
||||
if (!override) {
|
||||
if (fi->IsAnyF()) return;
|
||||
}
|
||||
|
||||
|
||||
// select which edge to make faux (if any)...
|
||||
int whichEdge = -1;
|
||||
ScalarType bestScore = fi->Q();
|
||||
|
||||
ScalarType bestScore = fi->Q();
|
||||
|
||||
whichEdge=-1;
|
||||
|
||||
for (int k=0; k<3; k++){
|
||||
|
||||
|
||||
// todo: check creases? (continue if edge k is a crease)
|
||||
|
||||
|
||||
if (!override) {
|
||||
if (fi->FFp(k)->IsAnyF()) continue;
|
||||
if (fi->FFp(k)->IsAnyF()) continue;
|
||||
}
|
||||
if (fi->FFp(k)==fi) continue; // never make a border faux
|
||||
|
||||
|
||||
ScalarType score = BQ::quadQuality( &*fi, k );
|
||||
if (override) {
|
||||
// don't override anyway iff other face has a better match
|
||||
if (score < fi->FFp(k)->Q()) continue;
|
||||
if (score < fi->FFp(k)->Q()) continue;
|
||||
}
|
||||
if (score>bestScore) {
|
||||
if (score>bestScore) {
|
||||
bestScore = score;
|
||||
whichEdge = k;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ...and make it faux
|
||||
if (whichEdge>=0) {
|
||||
//if (override && fi->FFp(whichEdge)->IsAnyF()) {
|
||||
|
@ -122,8 +121,8 @@ static void selectBestDiag(FaceType *fi){
|
|||
// fi->Q() = fi->FFp(whichEdge)->Q() = ( bestScore + fi->FFp(whichEdge)->Q() ) /2;
|
||||
//} else {
|
||||
//}
|
||||
|
||||
if (override) {
|
||||
|
||||
if (override) {
|
||||
// clear any faux edge of the other face
|
||||
for (int k=0; k<3; k++)
|
||||
if (fi->FFp(whichEdge)->IsF(k)) {
|
||||
|
@ -131,7 +130,7 @@ static void selectBestDiag(FaceType *fi){
|
|||
fi->FFp(whichEdge)->FFp(k)->ClearF( fi->FFp(whichEdge)->FFi(k) );
|
||||
fi->FFp(whichEdge)->FFp(k)->Q()=0.0; // other face's ex-buddy is now single and sad :(
|
||||
}
|
||||
|
||||
|
||||
// clear all faux edges of this face...
|
||||
for (int k=0; k<3; k++)
|
||||
if (fi->IsF(k)) {
|
||||
|
@ -143,11 +142,11 @@ static void selectBestDiag(FaceType *fi){
|
|||
// set (new?) quad
|
||||
fi->SetF(whichEdge);
|
||||
fi->FFp(whichEdge)->SetF( fi->FFi(whichEdge) );
|
||||
fi->Q() = fi->FFp(whichEdge)->Q() = bestScore;
|
||||
fi->Q() = fi->FFp(whichEdge)->Q() = bestScore;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -156,11 +155,11 @@ static void selectBestDiag(FaceType *fi){
|
|||
// a pass though all triangles to merge triangle pairs into quads
|
||||
template <bool override> // override previous decisions?
|
||||
static void MakeDominantPass(MeshType &m){
|
||||
|
||||
|
||||
for (FaceIterator fi = m.face.begin(); fi!=m.face.end(); fi++) if (!fi->IsD()) {
|
||||
selectBestDiag<override>(&(*fi));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
/**
|
||||
* This function split a face along the specified border edge it does not compute any property of the new vertex. It only do the topological work.
|
||||
|
@ -265,9 +264,9 @@ static bool MakeTriEvenBySplit(MeshType& m){
|
|||
|
||||
// make tri count even by delete...
|
||||
static bool MakeTriEvenByDelete(MeshType& m)
|
||||
{
|
||||
{
|
||||
if (m.fn%2==0) return false; // it's already Even
|
||||
|
||||
|
||||
for (FaceIterator fi = m.face.begin(); fi!=m.face.end(); fi++) {
|
||||
for (int k=0; k<3; k++) {
|
||||
if (face::IsBorder(*fi,k) ) {
|
||||
|
@ -304,7 +303,7 @@ static int SplitNonFlatQuads(MeshType &m, ScalarType deg=0){
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
/**
|
||||
Given a mesh, makes it bit trianglular (makes all edges NOT faux)
|
||||
*/
|
||||
static void MakeBitTriOnly(MeshType &m){
|
||||
|
@ -331,7 +330,7 @@ static bool IsBitTriQuadConventional(const MeshType &m){
|
|||
if (fi->IsAnyF())
|
||||
if ( (fi->Flags() & FaceType::FAUX012 ) != FaceType::FAUX2 ) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -347,11 +346,11 @@ static bool IsTriOnly(const MeshType &m){
|
|||
/* returns true if mesh is a pure quad-mesh. */
|
||||
static bool IsQuadOnly(const MeshType &m){
|
||||
for (ConstFaceIterator fi = m.face.begin(); fi!=m.face.end(); fi++) if (!fi->IsD()) {
|
||||
int count = 0;
|
||||
if (fi->IsF(0)) count++;
|
||||
if (fi->IsF(1)) count++;
|
||||
if (fi->IsF(2)) count++;
|
||||
if (count!=1) return false;
|
||||
int count = 0;
|
||||
if (fi->IsF(0)) count++;
|
||||
if (fi->IsF(1)) count++;
|
||||
if (fi->IsF(2)) count++;
|
||||
if (count!=1) return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -359,11 +358,11 @@ static bool IsQuadOnly(const MeshType &m){
|
|||
/* returns true if mesh has only tris and quads (no penta etc) */
|
||||
static bool IsTriQuadOnly(const MeshType &m){
|
||||
for (ConstFaceIterator fi = m.face.begin(); fi!=m.face.end(); fi++) if (!fi->IsD()) {
|
||||
int count = 0;
|
||||
if (fi->IsF(0)) count++;
|
||||
if (fi->IsF(1)) count++;
|
||||
if (fi->IsF(2)) count++;
|
||||
if (count>1) return false;
|
||||
int count = 0;
|
||||
if (fi->IsF(0)) count++;
|
||||
if (fi->IsF(1)) count++;
|
||||
if (fi->IsF(2)) count++;
|
||||
if (count>1) return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -384,20 +383,20 @@ static void CopyTopology(FaceType *fnew, FaceType * fold)
|
|||
requires that the mesh is made only of quads and tris.
|
||||
*/
|
||||
static void MakePureByRefine(MeshType &m){
|
||||
|
||||
|
||||
// todo: update VF connectivity if present
|
||||
|
||||
|
||||
|
||||
int ev = 0; // EXTRA vertices (times 2)
|
||||
int ef = 0; // EXTRA faces
|
||||
|
||||
int ef = 0; // EXTRA faces
|
||||
|
||||
// first pass: count triangles to be added
|
||||
for (FaceIterator fi = m.face.begin(); fi!=m.face.end(); fi++) if (!fi->IsD()) {
|
||||
int k=0;
|
||||
if (face::IsBorder(*fi,0)) k++;
|
||||
if (face::IsBorder(*fi,1)) k++;
|
||||
if (face::IsBorder(*fi,2)) k++;
|
||||
if (!fi->IsAnyF()) {
|
||||
if (!fi->IsAnyF()) {
|
||||
// it's a triangle
|
||||
if (k==0) // add a vertex in the center of the face, splitting it in 3
|
||||
{ ev+=2; ef+=2; }
|
||||
|
@ -410,17 +409,17 @@ static void MakePureByRefine(MeshType &m){
|
|||
}
|
||||
else {
|
||||
// assuming is a quad (not a penta, etc), i.e. only one faux
|
||||
// add a vertex in the center of the faux edge, splitting the face in 2
|
||||
// add a vertex in the center of the faux edge, splitting the face in 2
|
||||
ev+=1; ef+=1;
|
||||
assert(k!=3);
|
||||
}
|
||||
assert(k!=3);
|
||||
}
|
||||
}
|
||||
assert(ev%2==0); // should be even by now
|
||||
assert(ev%2==0); // should be even by now
|
||||
ev/=2; // I was counting each of them twice
|
||||
|
||||
//int originalFaceNum = m.fn;
|
||||
FaceIterator nfi = tri::Allocator<MeshType>::AddFaces(m,ef);
|
||||
VertexIterator nvi = tri::Allocator<MeshType>::AddVertices(m,ev);
|
||||
FaceIterator nfi = tri::Allocator<MeshType>::AddFaces(m,ef);
|
||||
VertexIterator nvi = tri::Allocator<MeshType>::AddVertices(m,ev);
|
||||
|
||||
tri::UpdateFlags<MeshType>::FaceClearV(m);
|
||||
|
||||
|
@ -429,10 +428,10 @@ static void MakePureByRefine(MeshType &m){
|
|||
for (FaceIterator fi = m.face.begin(), fend = nfi; fi!=fend; fi++) if (!fi->IsD() && !fi->IsV() ) {
|
||||
|
||||
fi->SetV();
|
||||
|
||||
if (!fi->IsAnyF()) {
|
||||
|
||||
if (!fi->IsAnyF()) {
|
||||
// it's a triangle
|
||||
|
||||
|
||||
int k=0; // number of borders
|
||||
if (face::IsBorder(*fi,0)) k++;
|
||||
if (face::IsBorder(*fi,1)) k++;
|
||||
|
@ -443,31 +442,31 @@ static void MakePureByRefine(MeshType &m){
|
|||
assert(nvi!=m.vert.end());
|
||||
VertexType *nv = &*nvi; nvi++;
|
||||
//*nv = *fi->V0( 0 ); // lazy: copy everything from the old vertex
|
||||
nv->ImportData(*(fi->V0( 0 ))); // lazy: copy everything from the old vertex
|
||||
nv->ImportData(*(fi->V0( 0 ))); // lazy: copy everything from the old vertex
|
||||
|
||||
nv->P() = ( fi->V(0)->P() + fi->V(1)->P() + fi->V(2)->P() ) /3.0;
|
||||
FaceType *fa = &*fi;
|
||||
FaceType *fb = &*nfi; nfi++;
|
||||
FaceType *fc = &*nfi; nfi++;
|
||||
|
||||
fb->ImportData(*fa); CopyTopology(fb,fa);
|
||||
fc->ImportData(*fa); CopyTopology(fc,fa);
|
||||
fb->ImportData(*fa); CopyTopology(fb,fa);
|
||||
fc->ImportData(*fa); CopyTopology(fc,fa);
|
||||
|
||||
fa->V(0) = nv;
|
||||
fb->V(1) = nv;
|
||||
fc->V(2) = nv;
|
||||
|
||||
fb->FFp(2)=fa->FFp(2); fb->FFi(2)=fa->FFi(2);
|
||||
fc->FFp(0)=fa->FFp(0); fc->FFi(0)=fa->FFi(0);
|
||||
fc->FFp(0)=fa->FFp(0); fc->FFi(0)=fa->FFi(0);
|
||||
|
||||
assert( fa->FFp(1)->FFp(fa->FFi(1)) == fa );
|
||||
/* */fb->FFp(2)->FFp(fb->FFi(2)) = fb;
|
||||
/* */fc->FFp(0)->FFp(fc->FFi(0)) = fc;
|
||||
|
||||
|
||||
fa->FFp(0) = fc; fa->FFp(2) = fb; fa->FFi(0) = fa->FFi(2) = 1;
|
||||
fb->FFp(1) = fa; fb->FFp(0) = fc; fb->FFi(0) = fb->FFi(1) = 2;
|
||||
fc->FFp(1) = fa; fc->FFp(2) = fb; fc->FFi(1) = fc->FFi(2) = 0;
|
||||
|
||||
|
||||
if (fb->FFp(2)==fa) fb->FFp(2)=fb; // recover border status
|
||||
if (fc->FFp(0)==fa) fc->FFp(0)=fc;
|
||||
|
||||
|
@ -477,7 +476,7 @@ static void MakePureByRefine(MeshType &m){
|
|||
fa->SetF(1);
|
||||
fb->SetF(2);
|
||||
fc->SetF(0);
|
||||
|
||||
|
||||
fa->SetV();fb->SetV();fc->SetV();
|
||||
}
|
||||
if (k==1) { // make a border face faux, anf other two as well
|
||||
|
@ -487,18 +486,18 @@ static void MakePureByRefine(MeshType &m){
|
|||
nsplit++;
|
||||
}
|
||||
if (k==2) // do nothing, just mark the non border edge as faux
|
||||
{
|
||||
{
|
||||
fi->ClearAllF();
|
||||
for (int w=0; w<3; w++) if (fi->FFp(w) != &*fi) fi->SetF(w);
|
||||
}
|
||||
if (k==3) // disconnected single triangle (all borders): use catmull-clark (tree vertices, split it in 6
|
||||
{
|
||||
{
|
||||
fi->ClearAllF();
|
||||
fi->SetF(2);
|
||||
fi->SetF(2);
|
||||
nsplit++;
|
||||
}
|
||||
}
|
||||
else {
|
||||
else {
|
||||
// assuming is a part of quad (not a penta, etc), i.e. only one faux
|
||||
FaceType *fa = &*fi;
|
||||
int ea2 = BQ::FauxIndex(fa); // index of the only faux edge
|
||||
|
@ -507,7 +506,7 @@ static void MakePureByRefine(MeshType &m){
|
|||
assert(fb->FFp(eb2)==fa) ;
|
||||
assert(fa->IsF(ea2));
|
||||
//assert(fb->IsF(eb2)); // reciprocal faux edge
|
||||
|
||||
|
||||
int ea0 = (ea2+1) %3;
|
||||
int ea1 = (ea2+2) %3;
|
||||
int eb0 = (eb2+1) %3;
|
||||
|
@ -517,7 +516,7 @@ static void MakePureByRefine(MeshType &m){
|
|||
assert(nvi!=m.vert.end());
|
||||
VertexType *nv = &*nvi; nvi++;
|
||||
// *nv = * fa->V0( ea2 );
|
||||
nv->ImportData(*(fa->V0( ea2 ) )); // lazy: copy everything from the old vertex
|
||||
nv->ImportData(*(fa->V0( ea2 ) )); // lazy: copy everything from the old vertex
|
||||
//nv->P() = ( fa->V(ea2)->P() + fa->V(ea0)->P() ) /2.0;
|
||||
Interpolator::Apply(*(fa->V(ea2)),*(fa->V(ea0)),0.5,*nv);
|
||||
// split faces: add 2 faces (one per side)
|
||||
|
@ -526,33 +525,33 @@ static void MakePureByRefine(MeshType &m){
|
|||
assert(nfi!=m.face.end());
|
||||
FaceType *fd = &*nfi; nfi++;
|
||||
|
||||
fc->ImportData(*fa ); CopyTopology(fc,fa); // lazy: copy everything from the old vertex
|
||||
fd->ImportData(*fb ); CopyTopology(fd,fb);// lazy: copy everything from the old vertex
|
||||
fc->ImportData(*fa ); CopyTopology(fc,fa); // lazy: copy everything from the old vertex
|
||||
fd->ImportData(*fb ); CopyTopology(fd,fb);// lazy: copy everything from the old vertex
|
||||
|
||||
fa->V(ea2) = fc->V(ea0) =
|
||||
fa->V(ea2) = fc->V(ea0) =
|
||||
fb->V(eb2) = fd->V(eb0) = nv ;
|
||||
|
||||
|
||||
fa->FFp(ea1)->FFp( fa->FFi(ea1) ) = fc;
|
||||
fb->FFp(eb1)->FFp( fb->FFi(eb1) ) = fd;
|
||||
|
||||
fa->FFp(ea1) = fc ; fa->FFp(ea2) = fd;
|
||||
fa->FFi(ea1) = ea0; fa->FFi(ea2) = eb2;
|
||||
fb->FFp(eb1) = fd ; fb->FFp(eb2) = fc;
|
||||
fb->FFi(eb1) = eb0; fb->FFi(eb2) = ea2;
|
||||
fc->FFp(ea0) = fa ; fc->FFp(ea2) = fb;
|
||||
fc->FFi(ea0) = ea1; fc->FFi(ea2) = eb2;
|
||||
fd->FFp(eb0) = fb ; fd->FFp(eb2) = fa;
|
||||
|
||||
fa->FFp(ea1) = fc ; fa->FFp(ea2) = fd;
|
||||
fa->FFi(ea1) = ea0; fa->FFi(ea2) = eb2;
|
||||
fb->FFp(eb1) = fd ; fb->FFp(eb2) = fc;
|
||||
fb->FFi(eb1) = eb0; fb->FFi(eb2) = ea2;
|
||||
fc->FFp(ea0) = fa ; fc->FFp(ea2) = fb;
|
||||
fc->FFi(ea0) = ea1; fc->FFi(ea2) = eb2;
|
||||
fd->FFp(eb0) = fb ; fd->FFp(eb2) = fa;
|
||||
fd->FFi(eb0) = eb1; fd->FFi(eb2) = ea2;
|
||||
|
||||
|
||||
// detect boundaries
|
||||
bool ba = fa->FFp(ea0)==fa;
|
||||
bool bc = fc->FFp(ea1)==fa;
|
||||
bool bb = fb->FFp(eb0)==fb;
|
||||
bool bd = fd->FFp(eb1)==fb;
|
||||
|
||||
|
||||
if (bc) fc->FFp(ea1)=fc; // repristinate boundary status
|
||||
if (bd) fd->FFp(eb1)=fd; // of new faces
|
||||
|
||||
|
||||
fa->SetV();
|
||||
fb->SetV();
|
||||
fc->SetV();
|
||||
|
@ -562,103 +561,103 @@ static void MakePureByRefine(MeshType &m){
|
|||
fb->ClearAllF();
|
||||
fc->ClearAllF();
|
||||
fd->ClearAllF();
|
||||
|
||||
|
||||
fa->SetF( ea0 );
|
||||
fb->SetF( eb0 );
|
||||
fc->SetF( ea1 );
|
||||
fd->SetF( eb1 );
|
||||
|
||||
|
||||
// fix faux mesh boundary... if two any consecutive, merge it in a quad
|
||||
if (ba&&bc) {
|
||||
fa->ClearAllF(); fa->SetF(ea1);
|
||||
fa->ClearAllF(); fa->SetF(ea1);
|
||||
fc->ClearAllF(); fc->SetF(ea0);
|
||||
ba = bc = false;
|
||||
ba = bc = false;
|
||||
}
|
||||
if (bc&&bb) {
|
||||
fc->ClearAllF(); fc->SetF(ea2);
|
||||
fc->ClearAllF(); fc->SetF(ea2);
|
||||
fb->ClearAllF(); fb->SetF(eb2);
|
||||
bc = bb = false;
|
||||
bc = bb = false;
|
||||
}
|
||||
if (bb&&bd) {
|
||||
fb->ClearAllF(); fb->SetF(eb1);
|
||||
fb->ClearAllF(); fb->SetF(eb1);
|
||||
fd->ClearAllF(); fd->SetF(eb0);
|
||||
bb = bd = false;
|
||||
bb = bd = false;
|
||||
}
|
||||
if (bd&&ba) {
|
||||
fd->ClearAllF(); fd->SetF(eb2);
|
||||
fd->ClearAllF(); fd->SetF(eb2);
|
||||
fa->ClearAllF(); fa->SetF(ea2);
|
||||
bd = ba = false;
|
||||
bd = ba = false;
|
||||
}
|
||||
// remaninig boudaries will be fixed by splitting in the last pass
|
||||
// remaninig boudaries will be fixed by splitting in the last pass
|
||||
if (ba) nsplit++;
|
||||
if (bb) nsplit++;
|
||||
if (bc) nsplit++;
|
||||
if (bd) nsplit++;
|
||||
}
|
||||
}
|
||||
}
|
||||
assert(nfi==m.face.end());
|
||||
assert(nvi==m.vert.end());
|
||||
|
||||
|
||||
// now and there are no tris left, but there can be faces with ONE edge border & faux ()
|
||||
|
||||
|
||||
// last pass: add vertex on faux border faces... (if any)
|
||||
if (nsplit>0) {
|
||||
if (nsplit>0) {
|
||||
FaceIterator nfi = tri::Allocator<MeshType>::AddFaces(m,nsplit);
|
||||
VertexIterator nvi = tri::Allocator<MeshType>::AddVertices(m,nsplit);
|
||||
VertexIterator nvi = tri::Allocator<MeshType>::AddVertices(m,nsplit);
|
||||
for (FaceIterator fi = m.face.begin(), fend = nfi; fi!=fend; fi++) if (!fi->IsD()) {
|
||||
FaceType* fa = &*fi;
|
||||
int ea2 = -1; // border and faux face (if any)
|
||||
if (fa->FFp(0)==fa && fa->IsF(0) ) ea2=0;
|
||||
if (fa->FFp(1)==fa && fa->IsF(1) ) ea2=1;
|
||||
if (fa->FFp(2)==fa && fa->IsF(2) ) ea2=2;
|
||||
|
||||
|
||||
if (ea2 != -1) { // ea2 edge is naughty (border AND faux)
|
||||
|
||||
int ea0 = (ea2+1) %3;
|
||||
int ea1 = (ea2+2) %3;
|
||||
|
||||
int ea1 = (ea2+2) %3;
|
||||
|
||||
// create new vert in center of faux edge
|
||||
VertexType *nv = &*nvi; nvi++;
|
||||
//*nv = * fa->V0( ea2 );
|
||||
nv->ImportData(*(fa->V0( ea2 ) )); // lazy: copy everything from the old vertex
|
||||
nv->ImportData(*(fa->V0( ea2 ) )); // lazy: copy everything from the old vertex
|
||||
nv->P() = ( fa->V(ea2)->P() + fa->V(ea0)->P() ) /2.0;
|
||||
Interpolator::Apply(*(fa->V(ea2)),*(fa->V(ea0)),0.5,*nv);
|
||||
// split face: add 1 face
|
||||
FaceType *fc = &*nfi; nfi++;
|
||||
|
||||
fc->ImportData(*fa);CopyTopology(fc,fa); // lazy: copy everything from the old vertex
|
||||
fc->ImportData(*fa);CopyTopology(fc,fa); // lazy: copy everything from the old vertex
|
||||
|
||||
fa->V(ea2) = fc->V(ea0) = nv ;
|
||||
|
||||
|
||||
fc->FFp(ea2) = fc;
|
||||
|
||||
|
||||
fa->FFp(ea1)->FFp( fa->FFi(ea1) ) = fc;
|
||||
|
||||
fa->FFp(ea1) = fc ;
|
||||
fa->FFi(ea1) = ea0;
|
||||
fc->FFp(ea0) = fa ; fc->FFp(ea2) = fc;
|
||||
fc->FFi(ea0) = ea1;
|
||||
|
||||
|
||||
fa->FFp(ea1) = fc ;
|
||||
fa->FFi(ea1) = ea0;
|
||||
fc->FFp(ea0) = fa ; fc->FFp(ea2) = fc;
|
||||
fc->FFi(ea0) = ea1;
|
||||
|
||||
if (fc->FFp(ea1)==fa) fc->FFp(ea1)=fc; // recover border status
|
||||
|
||||
|
||||
assert(fa->IsF(ea0) == fa->IsF(ea1) );
|
||||
bool b = fa->IsF(ea1);
|
||||
|
||||
|
||||
fa->ClearAllF();
|
||||
fc->ClearAllF();
|
||||
|
||||
|
||||
if (b) {
|
||||
fa->SetF( ea0 );
|
||||
fc->SetF( ea1 );
|
||||
fc->SetF( ea1 );
|
||||
} else {
|
||||
fa->SetF( ea1 );
|
||||
fc->SetF( ea0 );
|
||||
fc->SetF( ea0 );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
@ -676,13 +675,13 @@ static void MakePureByCatmullClark(MeshType &m){
|
|||
// Stops at maxDist or at the distance when a triangle is found
|
||||
static FaceType * MarkEdgeDistance(MeshType &m, FaceType *startF, int maxDist){
|
||||
assert(tri::HasPerFaceQuality(m));
|
||||
|
||||
|
||||
for (FaceIterator fi = m.face.begin(); fi!=m.face.end(); fi++) if (!fi->IsD()) {
|
||||
fi->Q()=maxDist;
|
||||
}
|
||||
|
||||
FaceType * firstTriangleFound = NULL;
|
||||
|
||||
|
||||
startF->Q() = 0;
|
||||
std::vector<FaceType*> stack;
|
||||
int stackPos=0;
|
||||
|
@ -707,65 +706,65 @@ static FaceType * MarkEdgeDistance(MeshType &m, FaceType *startF, int maxDist){
|
|||
|
||||
/*
|
||||
given a tri-quad mesh,
|
||||
uses edge rotates to make a tri move toward another tri and to merges them into a quad.
|
||||
uses edge rotates to make a tri move toward another tri and to merges them into a quad.
|
||||
|
||||
Retunrs number of surviving triangles (0, or 1), or -1 if not done yet.
|
||||
StepbyStep: makes just one step!
|
||||
use it in a loop as long as it returns 0 or 1.
|
||||
|
||||
|
||||
maxdist is the maximal edge distance where to look for a companion triangle
|
||||
*/
|
||||
static int MakePureByFlipStepByStep(MeshType &m, int maxdist=10000, int restart=false){
|
||||
|
||||
|
||||
static FaceType *ta, *tb; // faces to be matched into a quad
|
||||
|
||||
|
||||
static int step = 0; // hack
|
||||
|
||||
|
||||
if (restart) { step=0; return false; }
|
||||
if (step==0) {
|
||||
|
||||
|
||||
// find a triangular face ta
|
||||
ta = NULL;
|
||||
for (FaceIterator fi = m.face.begin(); fi!=m.face.end(); fi++) if (!fi->IsD()) {
|
||||
if (!fi->IsAnyF()) { ta=&*fi; break; }
|
||||
}
|
||||
if (!ta) return 0; // success: no triangle left (done?)
|
||||
|
||||
|
||||
|
||||
|
||||
tb = MarkEdgeDistance(m,ta,maxdist);
|
||||
if (!tb) return 1; // fail: no matching triagle found (increase maxdist?)
|
||||
|
||||
|
||||
step=1;
|
||||
|
||||
|
||||
} else {
|
||||
int marriageEdge=-1;
|
||||
bool done = false;
|
||||
while (!done) {
|
||||
|
||||
|
||||
int bestScore = int(tb->Q());
|
||||
int edge = -1;
|
||||
bool mustDoFlip;
|
||||
|
||||
|
||||
// select which edge to use
|
||||
for (int k=0; k<3; k++) {
|
||||
if (tb->FFp(k) == tb) continue; // border
|
||||
|
||||
|
||||
FaceType* tbk = tb->FFp(k);
|
||||
|
||||
|
||||
if (!tbk->IsAnyF()) {done=true; marriageEdge=k; break; } // found my match
|
||||
|
||||
|
||||
int back = tb->FFi(k);
|
||||
int faux = BQ::FauxIndex(tbk);
|
||||
int other = 3-back-faux;
|
||||
|
||||
|
||||
int scoreA = int(tbk->FFp(other)->Q());
|
||||
|
||||
|
||||
FaceType* tbh = tbk->FFp(faux);
|
||||
int fauxh = BQ::FauxIndex(tbh);
|
||||
|
||||
|
||||
int scoreB = int(tbh->FFp( (fauxh+1)%3 )->Q());
|
||||
int scoreC = int(tbh->FFp( (fauxh+2)%3 )->Q());
|
||||
|
||||
|
||||
int scoreABC = std::min( scoreC, std::min( scoreA, scoreB ) );
|
||||
if (scoreABC<bestScore) {
|
||||
bestScore = scoreABC;
|
||||
|
@ -775,43 +774,43 @@ if (step==0) {
|
|||
}
|
||||
|
||||
if (done) break;
|
||||
|
||||
|
||||
// use that edge to proceed
|
||||
if (mustDoFlip) {
|
||||
BQ::FlipDiag( *(tb->FFp(edge)) );
|
||||
}
|
||||
|
||||
|
||||
FaceType* next = tb->FFp(edge)->FFp( BQ::FauxIndex(tb->FFp(edge)) );
|
||||
|
||||
|
||||
// create new edge
|
||||
next->ClearAllF();
|
||||
tb->FFp(edge)->ClearAllF();
|
||||
|
||||
|
||||
// dissolve old edge
|
||||
tb->SetF(edge);
|
||||
tb->FFp(edge)->SetF( tb->FFi(edge) );
|
||||
tb->FFp(edge)->Q() = tb->Q();
|
||||
|
||||
|
||||
tb = next;
|
||||
break;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
if (marriageEdge!=-1) {
|
||||
// consume the marriage (two tris = one quad)
|
||||
assert(!(tb->IsAnyF()));
|
||||
assert(!(tb->FFp(marriageEdge)->IsAnyF()));
|
||||
tb->SetF(marriageEdge);
|
||||
tb->FFp(marriageEdge)->SetF(tb->FFi(marriageEdge));
|
||||
|
||||
|
||||
step=0;
|
||||
}
|
||||
}
|
||||
}
|
||||
return -1; // not done yet
|
||||
}
|
||||
|
||||
/*
|
||||
given a tri-quad mesh,
|
||||
uses edge rotates to make a tri move toward another tri and to merges them into a quad.
|
||||
uses edge rotates to make a tri move toward another tri and to merges them into a quad.
|
||||
- maxdist is the maximal edge distance where to look for a companion triangle
|
||||
- retunrs true if all triangles are merged (always, unless they are odd, or maxdist not enough).
|
||||
*/
|
||||
|
@ -825,18 +824,18 @@ static bool MakePureByFlip(MeshType &m, int maxdist=10000)
|
|||
|
||||
/**
|
||||
given a triangle mesh, makes it quad dominant by merging triangle pairs into quads
|
||||
various euristics:
|
||||
various euristics:
|
||||
level = 0: maximally greedy. Leaves fewest triangles
|
||||
level = 1: smarter: leaves more triangles, but makes better quality quads
|
||||
level = 2: even more so (marginally)
|
||||
*/
|
||||
static void MakeDominant(MeshType &m, int level){
|
||||
|
||||
|
||||
for (FaceIterator fi = m.face.begin(); fi!=m.face.end(); fi++) {
|
||||
fi->ClearAllF();
|
||||
fi->Q() = 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
MakeDominantPass<false> (m);
|
||||
if (level>0) MakeDominantPass<true> (m);
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
#ifndef VCG_BITQUAD_SUPPORT
|
||||
#define VCG_BITQUAD_SUPPORT
|
||||
#include <vector>
|
||||
#include <set>
|
||||
#include <vcg/simplex/face/jumping_pos.h>
|
||||
#include <vcg/simplex/face/topology.h>
|
||||
#include <vcg/space/planar_polygon_tessellation.h>
|
||||
|
@ -811,8 +809,8 @@ static bool CollapseDiag(FaceType &f, ScalarType interpol, MeshType& m, Pos* aff
|
|||
pf = t;
|
||||
} while ((pf!=fb));
|
||||
|
||||
pi = fauxb;
|
||||
pf = fb;
|
||||
pi = fauxb;
|
||||
pf = fb;
|
||||
|
||||
do {
|
||||
pf->V(pi) = va;
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -15,27 +15,27 @@ namespace vcg {
|
|||
* v0, v1 the active edge
|
||||
* v2 internal vertex
|
||||
*/
|
||||
class FrontEdge {
|
||||
public:
|
||||
int v0, v1, v2; //v0, v1 represent the FrontEdge, v2 the other vertex
|
||||
//in the face this FrontEdge belongs to
|
||||
class FrontEdge {
|
||||
public:
|
||||
int v0, v1, v2; //v0, v1 represent the FrontEdge, v2 the other vertex
|
||||
//in the face this FrontEdge belongs to
|
||||
bool active; //keep tracks of wether it is in front or in deads
|
||||
|
||||
|
||||
//the loops in the front are mantained as a double linked list
|
||||
std::list<FrontEdge>::iterator next;
|
||||
std::list<FrontEdge>::iterator next;
|
||||
std::list<FrontEdge>::iterator previous;
|
||||
|
||||
|
||||
FrontEdge() {}
|
||||
FrontEdge(int _v0, int _v1, int _v2):
|
||||
v0(_v0), v1(_v1), v2(_v2), active(true) {
|
||||
assert(v0 != v1 && v1 != v2 && v0 != v2);
|
||||
}
|
||||
|
||||
|
||||
bool operator==(const FrontEdge& f) const
|
||||
{
|
||||
return ((v0 == f.v0) && (v1 == f.v1) && (v2 == f.v2) );
|
||||
}
|
||||
};
|
||||
{
|
||||
return ((v0 == f.v0) && (v1 == f.v1) && (v2 == f.v2) );
|
||||
}
|
||||
};
|
||||
|
||||
template <class MESH> class AdvancingFront {
|
||||
public:
|
||||
|
@ -45,58 +45,58 @@ template <class MESH> class AdvancingFront {
|
|||
typedef typename MESH::FaceIterator FaceIterator;
|
||||
typedef typename MESH::ScalarType ScalarType;
|
||||
typedef typename MESH::VertexType::CoordType Point3x;
|
||||
|
||||
|
||||
//class FrontEdgeLists
|
||||
//{
|
||||
|
||||
//};
|
||||
|
||||
|
||||
|
||||
// protected:
|
||||
std::list<FrontEdge> front;
|
||||
std::list<FrontEdge> front;
|
||||
std::list<FrontEdge> deads;
|
||||
std::vector<int> nb; //number of fronts a vertex is into,
|
||||
//this is used for the Visited and Border flags
|
||||
//but adding topology may not be needed anymore
|
||||
|
||||
public:
|
||||
|
||||
|
||||
MESH &mesh; //this structure will be filled by the algorithm
|
||||
|
||||
|
||||
AdvancingFront(MESH &_mesh): mesh(_mesh) {
|
||||
|
||||
|
||||
UpdateFlags<MESH>::FaceBorderFromNone(mesh);
|
||||
UpdateFlags<MESH>::VertexBorderFromFace(mesh);
|
||||
|
||||
UpdateFlags<MESH>::FaceBorderFromNone(mesh);
|
||||
UpdateFlags<MESH>::VertexBorderFromFace(mesh);
|
||||
|
||||
nb.clear();
|
||||
nb.resize(mesh.vert.size(), 0);
|
||||
|
||||
|
||||
CreateLoops();
|
||||
}
|
||||
virtual ~AdvancingFront() {}
|
||||
|
||||
|
||||
void BuildMesh(CallBackPos call = NULL, int interval = 512)
|
||||
{
|
||||
float finalfacesext = mesh.vert.size() * 2.0f;
|
||||
if(call) call(0, "Advancing front");
|
||||
while(1) {
|
||||
|
||||
if(call) call(0, "Advancing front");
|
||||
while(1) {
|
||||
|
||||
for(int i = 0; i < interval; i++) {
|
||||
if(!front.size() && !SeedFace()) return;
|
||||
AddFace();
|
||||
if(call)
|
||||
{
|
||||
float rap = float(mesh.face.size()) / finalfacesext;
|
||||
int perc = (int) (100.0f * rap);
|
||||
(*call)(perc,"Adding Faces");
|
||||
}
|
||||
if(call)
|
||||
{
|
||||
float rap = float(mesh.face.size()) / finalfacesext;
|
||||
int perc = (int) (100.0f * rap);
|
||||
(*call)(perc,"Adding Faces");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
protected:
|
||||
//Implement these functions in your subclass
|
||||
//Implement these functions in your subclass
|
||||
enum ListID {FRONT,DEADS};
|
||||
typedef std::pair< ListID,std::list<FrontEdge>::iterator > ResultIterator;
|
||||
virtual bool Seed(int &v0, int &v1, int &v2) = 0;
|
||||
|
@ -109,20 +109,20 @@ protected:
|
|||
{
|
||||
for(size_t i = 0; i < mesh.face.size(); i++)
|
||||
{
|
||||
FaceType &f = mesh.face[i];
|
||||
FaceType &f = mesh.face[i];
|
||||
if(f.IsD()) continue;
|
||||
|
||||
|
||||
for(int k = 0; k < 3; k++) {
|
||||
if(f.IsB(k)) {
|
||||
addNewEdge(FrontEdge(tri::Index(mesh,f.V0(k)),tri::Index(mesh,f.V1(k)),tri::Index(mesh,f.V2(k))) );
|
||||
nb[tri::Index(mesh,f.V0(k))]++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
for(std::list<FrontEdge>::iterator s = front.begin(); s != front.end(); s++) {
|
||||
(*s).previous = front.end();
|
||||
(*s).next = front.end();
|
||||
(*s).next = front.end();
|
||||
}
|
||||
//now create loops:
|
||||
for(std::list<FrontEdge>::iterator s = front.begin(); s != front.end(); s++) {
|
||||
|
@ -131,90 +131,90 @@ protected:
|
|||
if((*s).v1 != (*j).v0) continue;
|
||||
if((*j).previous != front.end()) continue;
|
||||
(*s).next = j;
|
||||
(*j).previous = s;
|
||||
(*j).previous = s;
|
||||
break;
|
||||
}
|
||||
}
|
||||
for(std::list<FrontEdge>::iterator s = front.begin(); s != front.end(); s++) {
|
||||
for(std::list<FrontEdge>::iterator s = front.begin(); s != front.end(); s++) {
|
||||
assert((*s).next != front.end());
|
||||
assert((*s).previous != front.end());
|
||||
assert((*s).previous != front.end());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
bool SeedFace() {
|
||||
int v[3];
|
||||
bool success = Seed(v[0], v[1], v[2]);
|
||||
if(!success) return false;
|
||||
|
||||
|
||||
nb.resize(mesh.vert.size(), 0);
|
||||
|
||||
//create the border of the first face
|
||||
|
||||
//create the border of the first face
|
||||
std::list<FrontEdge>::iterator e = front.end();
|
||||
std::list<FrontEdge>::iterator last = e;
|
||||
std::list<FrontEdge>::iterator first;
|
||||
|
||||
|
||||
for(int i = 0; i < 3; i++) {
|
||||
int v0 = v[i];
|
||||
int v1 = v[((i+1)%3)];
|
||||
int v2 = v[((i+2)%3)];
|
||||
|
||||
|
||||
mesh.vert[v0].SetB();
|
||||
nb[v[i]]++;
|
||||
|
||||
|
||||
e = front.insert(front.begin(), FrontEdge(v0, v1, v2));
|
||||
if(i != 0) {
|
||||
(*last).next = e;
|
||||
(*last).next = e;
|
||||
(*e).previous = last;
|
||||
} else
|
||||
first = e;
|
||||
|
||||
|
||||
last = e;
|
||||
}
|
||||
}
|
||||
//connect last and first
|
||||
(*last).next = first;
|
||||
(*first).previous = last;
|
||||
|
||||
|
||||
AddFace(v[0], v[1], v[2]);
|
||||
return true;
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
public:
|
||||
bool AddFace() {
|
||||
if(!front.size()) return false;
|
||||
|
||||
if(!front.size()) return false;
|
||||
|
||||
std::list<FrontEdge>::iterator ei = front.begin();
|
||||
FrontEdge ¤t = *ei;
|
||||
FrontEdge &previous = *current.previous;
|
||||
FrontEdge &next = *current.next;
|
||||
|
||||
FrontEdge &previous = *current.previous;
|
||||
FrontEdge &next = *current.next;
|
||||
|
||||
int v0 = current.v0, v1 = current.v1;
|
||||
assert(nb[v0] < 10 && nb[v1] < 10);
|
||||
|
||||
|
||||
ResultIterator touch;
|
||||
touch.first = FRONT;
|
||||
touch.second = front.end();
|
||||
touch.first = FRONT;
|
||||
touch.second = front.end();
|
||||
int v2 = Place(current, touch);
|
||||
|
||||
if(v2 == -1) {
|
||||
KillEdge(ei);
|
||||
return false;
|
||||
}
|
||||
|
||||
assert(v2 != v0 && v2 != v1);
|
||||
|
||||
if ((touch.first == FRONT) && (touch.second != front.end()) ||
|
||||
(touch.first == DEADS) && (touch.second != deads.end()))
|
||||
|
||||
{
|
||||
//check for orientation and manifoldness
|
||||
|
||||
//touch == current.previous?
|
||||
if(v2 == previous.v0) {
|
||||
assert(v2 != v0 && v2 != v1);
|
||||
|
||||
if ( ( (touch.first == FRONT) && (touch.second != front.end()) ) ||
|
||||
( (touch.first == DEADS) && (touch.second != deads.end()) ) )
|
||||
|
||||
{
|
||||
//check for orientation and manifoldness
|
||||
|
||||
//touch == current.previous?
|
||||
if(v2 == previous.v0) {
|
||||
if(!CheckEdge(v2, v1)) {
|
||||
KillEdge(ei);
|
||||
return false;
|
||||
}
|
||||
/*touching previous FrontEdge (we reuse previous)
|
||||
}
|
||||
/*touching previous FrontEdge (we reuse previous)
|
||||
next
|
||||
------->v2 -----> v1------>
|
||||
\ /
|
||||
|
@ -222,9 +222,9 @@ public:
|
|||
previous \ / current
|
||||
\ /
|
||||
v0 */
|
||||
|
||||
|
||||
Detach(v0);
|
||||
|
||||
|
||||
std::list<FrontEdge>::iterator up = addNewEdge(FrontEdge(v2, v1, v0));
|
||||
MoveFront(up);
|
||||
(*up).previous = previous.previous;
|
||||
|
@ -235,21 +235,21 @@ public:
|
|||
Erase(ei);
|
||||
Glue(up);
|
||||
|
||||
//touch == (*current.next).next
|
||||
} else if(v2 == next.v1) {
|
||||
//touch == (*current.next).next
|
||||
} else if(v2 == next.v1) {
|
||||
if(!CheckEdge(v0, v2)) {
|
||||
KillEdge(ei);
|
||||
return false;
|
||||
}
|
||||
/*touching next FrontEdge (we reuse next)
|
||||
}
|
||||
/*touching next FrontEdge (we reuse next)
|
||||
previous
|
||||
------->v0 -----> v2------>
|
||||
\ /
|
||||
\ /
|
||||
\ / next
|
||||
\ /
|
||||
v1 */
|
||||
|
||||
v1 */
|
||||
|
||||
Detach(v1);
|
||||
std::list<FrontEdge>::iterator up = addNewEdge(FrontEdge(v0, v2, v1));
|
||||
MoveFront(up);
|
||||
|
@ -264,10 +264,10 @@ public:
|
|||
if(!CheckEdge(v0, v2) || !CheckEdge(v2, v1)) {
|
||||
KillEdge(ei);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
//touching some loop: split (or merge it is local does not matter.
|
||||
//like this
|
||||
/*
|
||||
//like this
|
||||
/*
|
||||
left right
|
||||
<--------v2-<------
|
||||
/|\
|
||||
|
@ -276,44 +276,44 @@ public:
|
|||
/ \
|
||||
/ V
|
||||
----v0 - - - > v1---------
|
||||
current */
|
||||
current */
|
||||
std::list<FrontEdge>::iterator left = touch.second;
|
||||
std::list<FrontEdge>::iterator right = (*touch.second).previous;
|
||||
|
||||
std::list<FrontEdge>::iterator right = (*touch.second).previous;
|
||||
|
||||
//this would be a really bad join
|
||||
if(v1 == (*right).v0 || v0 == (*left).v1) {
|
||||
KillEdge(ei);
|
||||
return false;
|
||||
}
|
||||
|
||||
nb[v2]++;
|
||||
|
||||
|
||||
nb[v2]++;
|
||||
|
||||
std::list<FrontEdge>::iterator down = addNewEdge(FrontEdge(v2, v1, v0));
|
||||
std::list<FrontEdge>::iterator up = addNewEdge(FrontEdge(v0, v2, v1));
|
||||
|
||||
|
||||
(*right).next = down;
|
||||
(*down).previous = right;
|
||||
|
||||
|
||||
(*down).next = current.next;
|
||||
next.previous = down;
|
||||
|
||||
next.previous = down;
|
||||
|
||||
(*left).previous = up;
|
||||
(*up).next = left;
|
||||
|
||||
|
||||
(*up).previous = current.previous;
|
||||
previous.next = up;
|
||||
Erase(ei);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
else if ((touch.first == FRONT) && (touch.second == front.end()) ||
|
||||
(touch.first == DEADS) && (touch.second == deads.end()))
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
else if (((touch.first == FRONT) && (touch.second == front.end())) ||
|
||||
((touch.first == DEADS) && (touch.second == deads.end())) )
|
||||
{
|
||||
// assert(CheckEdge(v0, v2));
|
||||
// assert(CheckEdge(v2, v1));
|
||||
/* adding a new vertex
|
||||
|
||||
|
||||
v2
|
||||
/|\
|
||||
/ \
|
||||
|
@ -322,12 +322,12 @@ public:
|
|||
/ V
|
||||
----v0 - - - > v1--------- */
|
||||
assert(!mesh.vert[v2].IsB()); //fatal error! a new point is already a border?
|
||||
nb[v2]++;
|
||||
nb[v2]++;
|
||||
mesh.vert[v2].SetB();
|
||||
|
||||
std::list<FrontEdge>::iterator down = addNewEdge(FrontEdge(v2, v1, v0));
|
||||
std::list<FrontEdge>::iterator up = addNewEdge(FrontEdge(v0, v2, v1));
|
||||
|
||||
|
||||
(*down).previous = up;
|
||||
(*up).next = down;
|
||||
(*down).next = current.next;
|
||||
|
@ -339,11 +339,11 @@ public:
|
|||
|
||||
AddFace(v0, v2, v1);
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
protected:
|
||||
void AddFace(int v0, int v1, int v2) {
|
||||
assert(v0 < (int)mesh.vert.size() && v1 < (int)mesh.vert.size() && v2 < (int)mesh.vert.size());
|
||||
assert(v0 < (int)mesh.vert.size() && v1 < (int)mesh.vert.size() && v2 < (int)mesh.vert.size());
|
||||
FaceIterator fi = vcg::tri::Allocator<MESH>::AddFaces(mesh,1);
|
||||
fi->ClearFlags();
|
||||
fi->V(0) = &mesh.vert[v0];
|
||||
|
@ -361,17 +361,17 @@ protected:
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void AddVertex(VertexType &vertex) {
|
||||
VertexType *oldstart = NULL;
|
||||
if(mesh.vert.size()) oldstart = &*mesh.vert.begin();
|
||||
mesh.vert.push_back(vertex);
|
||||
mesh.vn++;
|
||||
VertexType *newstart = &*mesh.vert.begin();
|
||||
if(oldstart && oldstart != newstart) {
|
||||
if(oldstart && oldstart != newstart) {
|
||||
for(int i = 0; i < mesh.face.size(); i++) {
|
||||
FaceType &face = mesh.face[i];
|
||||
for(int k = 0; k < 3; k++)
|
||||
for(int k = 0; k < 3; k++)
|
||||
face.V(k) = newstart + (face.V(k) - oldstart);
|
||||
}
|
||||
}
|
||||
|
@ -386,7 +386,7 @@ protected:
|
|||
bool CheckEdge(int v0, int v1) {
|
||||
int tot = 0;
|
||||
VertexType *vv0 = &(mesh.vert[v0]);
|
||||
VertexType *vv1 = &(mesh.vert[v1]);
|
||||
VertexType *vv1 = &(mesh.vert[v1]);
|
||||
if(tri::HasVFAdjacency(mesh))
|
||||
{
|
||||
face::VFIterator<FaceType> vfi(vv0);
|
||||
|
@ -401,11 +401,11 @@ protected:
|
|||
}
|
||||
return true;
|
||||
}
|
||||
for(int i = 0; i < (int)mesh.face.size(); i++) {
|
||||
for(int i = 0; i < (int)mesh.face.size(); i++) {
|
||||
FaceType &f = mesh.face[i];
|
||||
for(int k = 0; k < 3; k++) {
|
||||
if(vv0 == f.V0(k) && vv1 == f.V1(k)) //orientation non constistent
|
||||
return false;
|
||||
return false;
|
||||
else if(vv1 == f.V0(k) && vv0 == f.V1(k)) ++tot;
|
||||
}
|
||||
if(tot >= 2) { //non manifold
|
||||
|
@ -413,71 +413,71 @@ protected:
|
|||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
//front management:
|
||||
|
||||
//Add a new FrontEdge to the back of the queue
|
||||
std::list<FrontEdge>::iterator addNewEdge(FrontEdge e) {
|
||||
return front.insert(front.end(), e);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//move an Edge among the dead ones
|
||||
void KillEdge(std::list<FrontEdge>::iterator e)
|
||||
void KillEdge(std::list<FrontEdge>::iterator e)
|
||||
{
|
||||
if (e->active)
|
||||
{
|
||||
(*e).active = false;
|
||||
//std::list<FrontEdge>::iterator res = std::find(front.begin(),front.end(),e);
|
||||
FrontEdge tmp = *e;
|
||||
deads.splice(deads.end(), front, e);
|
||||
std::list<FrontEdge>::iterator newe = std::find(deads.begin(),deads.end(),tmp);
|
||||
tmp.previous->next = newe;
|
||||
tmp.next->previous = newe;
|
||||
}
|
||||
{
|
||||
(*e).active = false;
|
||||
//std::list<FrontEdge>::iterator res = std::find(front.begin(),front.end(),e);
|
||||
FrontEdge tmp = *e;
|
||||
deads.splice(deads.end(), front, e);
|
||||
std::list<FrontEdge>::iterator newe = std::find(deads.begin(),deads.end(),tmp);
|
||||
tmp.previous->next = newe;
|
||||
tmp.next->previous = newe;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Erase(std::list<FrontEdge>::iterator e) {
|
||||
if((*e).active) front.erase(e);
|
||||
else deads.erase(e);
|
||||
}
|
||||
|
||||
|
||||
//move an FrontEdge to the back of the queue
|
||||
void MoveBack(std::list<FrontEdge>::iterator e) {
|
||||
front.splice(front.end(), front, e);
|
||||
front.splice(front.end(), front, e);
|
||||
}
|
||||
|
||||
|
||||
void MoveFront(std::list<FrontEdge>::iterator e) {
|
||||
front.splice(front.begin(), front, e);
|
||||
}
|
||||
|
||||
|
||||
//check if e can be sewed with one of oits neighbours
|
||||
bool Glue(std::list<FrontEdge>::iterator e) {
|
||||
return Glue((*e).previous, e) || Glue(e, (*e).next);
|
||||
}
|
||||
|
||||
|
||||
//Glue toghether a and b (where a.next = b
|
||||
bool Glue(std::list<FrontEdge>::iterator a, std::list<FrontEdge>::iterator b) {
|
||||
if((*a).v0 != (*b).v1) return false;
|
||||
|
||||
if((*a).v0 != (*b).v1) return false;
|
||||
|
||||
std::list<FrontEdge>::iterator previous = (*a).previous;
|
||||
std::list<FrontEdge>::iterator next = (*b).next;
|
||||
(*previous).next = next;
|
||||
(*next).previous = previous;
|
||||
Detach((*a).v1);
|
||||
Detach((*a).v0);
|
||||
Detach((*a).v0);
|
||||
Erase(a);
|
||||
Erase(b);
|
||||
Erase(b);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void Detach(int v) {
|
||||
assert(nb[v] > 0);
|
||||
if(--nb[v] == 0) {
|
||||
mesh.vert[v].ClearB();
|
||||
mesh.vert[v].ClearB();
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
template <class MESH> class AdvancingTest: public AdvancingFront<MESH> {
|
||||
public:
|
||||
typedef typename MESH::VertexType VertexType;
|
||||
|
@ -487,10 +487,10 @@ template <class MESH> class AdvancingTest: public AdvancingFront<MESH> {
|
|||
|
||||
typedef typename MESH::ScalarType ScalarType;
|
||||
typedef typename MESH::VertexType::CoordType Point3x;
|
||||
|
||||
|
||||
AdvancingTest(MESH &_mesh): AdvancingFront<MESH>(_mesh) {}
|
||||
|
||||
bool Seed(int &v0, int &v1, int &v2) {
|
||||
bool Seed(int &v0, int &v1, int &v2) {
|
||||
VertexType v[3];
|
||||
v[0].P() = Point3x(0, 0, 0);
|
||||
v[1].P() = Point3x(1, 0, 0);
|
||||
|
@ -507,7 +507,7 @@ template <class MESH> class AdvancingTest: public AdvancingFront<MESH> {
|
|||
AddVertex(v[2]);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
int Place(FrontEdge &e, typename AdvancingFront<MESH>::ResultIterator &touch)
|
||||
{
|
||||
Point3f p[3];
|
||||
|
@ -517,31 +517,31 @@ template <class MESH> class AdvancingTest: public AdvancingFront<MESH> {
|
|||
Point3f point = p[0] + p[1] - p[2];
|
||||
|
||||
int vn = this->mesh.vert.size();
|
||||
for(int i = 0; i < this->mesh.vert.size(); i++)
|
||||
{
|
||||
if((this->mesh.vert[i].P() - point).Norm() < 0.1)
|
||||
{
|
||||
vn = i;
|
||||
//find the border
|
||||
assert(this->mesh.vert[i].IsB());
|
||||
for(std::list<FrontEdge>::iterator k = this->front.begin(); k != this->front.end(); k++)
|
||||
if((*k).v0 == i)
|
||||
{
|
||||
for(int i = 0; i < this->mesh.vert.size(); i++)
|
||||
{
|
||||
if((this->mesh.vert[i].P() - point).Norm() < 0.1)
|
||||
{
|
||||
vn = i;
|
||||
//find the border
|
||||
assert(this->mesh.vert[i].IsB());
|
||||
for(std::list<FrontEdge>::iterator k = this->front.begin(); k != this->front.end(); k++)
|
||||
if((*k).v0 == i)
|
||||
{
|
||||
touch.first = AdvancingFront<MESH>::FRONT;
|
||||
touch.second = k;
|
||||
}
|
||||
touch.second = k;
|
||||
}
|
||||
|
||||
for(std::list<FrontEdge>::iterator k = this->deads.begin(); k != this->deads.end(); k++)
|
||||
if((*k).v0 == i)
|
||||
if((*k).v0 == i)
|
||||
{
|
||||
for(std::list<FrontEdge>::iterator k = this->deads.begin(); k != this->deads.end(); k++)
|
||||
if((*k).v0 == i)
|
||||
if((*k).v0 == i)
|
||||
{
|
||||
touch.first = AdvancingFront<MESH>::FRONT;
|
||||
touch.second = k;
|
||||
}
|
||||
break;
|
||||
touch.second = k;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(vn == this->mesh.vert.size()) {
|
||||
if(vn == this->mesh.vert.size()) {
|
||||
VertexType v;
|
||||
v.P() = point;
|
||||
v.ClearFlags();
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -8,7 +8,7 @@
|
|||
* \ *
|
||||
* All rights reserved. *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 2 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
|
@ -24,10 +24,6 @@
|
|||
#ifndef __VCGLIB_APPEND
|
||||
#define __VCGLIB_APPEND
|
||||
|
||||
#include <vcg/complex/algorithms/update/flag.h>
|
||||
#include <vcg/complex/algorithms/update/selection.h>
|
||||
#include <set>
|
||||
|
||||
namespace vcg {
|
||||
namespace tri {
|
||||
/** \ingroup trimesh */
|
||||
|
@ -68,7 +64,7 @@ public:
|
|||
typedef typename ConstMeshRight::FacePointer FacePointerRight;
|
||||
|
||||
struct Remap{
|
||||
std::vector<int> vert,face,edge, hedge;
|
||||
std::vector<int> vert,face,edge, hedge;
|
||||
};
|
||||
|
||||
static void ImportVertexAdj(MeshLeft &ml, ConstMeshRight &mr, VertexLeft &vl, VertexRight &vr, Remap &remap ){
|
||||
|
@ -175,7 +171,7 @@ public:
|
|||
}
|
||||
|
||||
// Append Right Mesh to the Left Mesh
|
||||
// Append::Mesh(ml, mr) is equivalent to ml += mr.
|
||||
// Append::Mesh(ml, mr) is equivalent to ml += mr.
|
||||
// Note MeshRigth could be costant...
|
||||
/*! \brief %Append the second mesh to the first one.
|
||||
|
||||
|
@ -316,60 +312,60 @@ static void Mesh(MeshLeft& ml, ConstMeshRight& mr, const bool selected = false,
|
|||
ImportHEdgeAdj(ml,mr,ml.hedge[remap.hedge[Index(mr,*hi)]],*hi,remap,selected);
|
||||
}
|
||||
|
||||
// phase 3.
|
||||
// take care of other per mesh data: textures, attributes
|
||||
// phase 3.
|
||||
// take care of other per mesh data: textures, attributes
|
||||
|
||||
// At the end concatenate the vector with texture names.
|
||||
ml.textures.insert(ml.textures.end(),mr.textures.begin(),mr.textures.end());
|
||||
// At the end concatenate the vector with texture names.
|
||||
ml.textures.insert(ml.textures.end(),mr.textures.begin(),mr.textures.end());
|
||||
|
||||
// Attributes. Copy only those attributes that are present in both meshes
|
||||
// Two attributes in different meshes are considered the same if 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
|
||||
// Attributes. Copy only those attributes that are present in both meshes
|
||||
// Two attributes in different meshes are considered the same if 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
|
||||
|
||||
unsigned int id_r;
|
||||
typename std::set< PointerToAttribute >::iterator al, ar;
|
||||
unsigned int id_r;
|
||||
typename std::set< PointerToAttribute >::iterator al, ar;
|
||||
|
||||
// per vertex attributes
|
||||
for(al = ml.vert_attr.begin(); al != ml.vert_attr.end(); ++al)
|
||||
if(!(*al)._name.empty()){
|
||||
ar = mr.vert_attr.find(*al);
|
||||
if(ar!= mr.vert_attr.end()){
|
||||
id_r = 0;
|
||||
for(vi=mr.vert.begin();vi!=mr.vert.end();++vi,++id_r)
|
||||
if( !(*vi).IsD() && (!selected || (*vi).IsS()))
|
||||
memcpy((*al)._handle->At(remap.vert[Index(mr,*vi)]),(*ar)._handle->At(id_r),
|
||||
(*al)._handle->SizeOf());
|
||||
}
|
||||
}
|
||||
// per vertex attributes
|
||||
for(al = ml.vert_attr.begin(); al != ml.vert_attr.end(); ++al)
|
||||
if(!(*al)._name.empty()){
|
||||
ar = mr.vert_attr.find(*al);
|
||||
if(ar!= mr.vert_attr.end()){
|
||||
id_r = 0;
|
||||
for(vi=mr.vert.begin();vi!=mr.vert.end();++vi,++id_r)
|
||||
if( !(*vi).IsD() && (!selected || (*vi).IsS()))
|
||||
memcpy((*al)._handle->At(remap.vert[Index(mr,*vi)]),(*ar)._handle->At(id_r),
|
||||
(*al)._handle->SizeOf());
|
||||
}
|
||||
}
|
||||
|
||||
// per edge attributes
|
||||
for(al = ml.edge_attr.begin(); al != ml.edge_attr.end(); ++al)
|
||||
if(!(*al)._name.empty()){
|
||||
ar = mr.edge_attr.find(*al);
|
||||
if(ar!= mr.edge_attr.end()){
|
||||
id_r = 0;
|
||||
for(ei=mr.edge.begin();ei!=mr.edge.end();++ei,++id_r)
|
||||
if( !(*ei).IsD() && (!selected || (*ei).IsS()))
|
||||
// per edge attributes
|
||||
for(al = ml.edge_attr.begin(); al != ml.edge_attr.end(); ++al)
|
||||
if(!(*al)._name.empty()){
|
||||
ar = mr.edge_attr.find(*al);
|
||||
if(ar!= mr.edge_attr.end()){
|
||||
id_r = 0;
|
||||
for(ei=mr.edge.begin();ei!=mr.edge.end();++ei,++id_r)
|
||||
if( !(*ei).IsD() && (!selected || (*ei).IsS()))
|
||||
memcpy((*al)._handle->At(remap.edge[Index(mr,*ei)]),(*ar)._handle->At(id_r),
|
||||
(*al)._handle->SizeOf());
|
||||
}
|
||||
}
|
||||
(*al)._handle->SizeOf());
|
||||
}
|
||||
}
|
||||
|
||||
// per face attributes
|
||||
for(al = ml.face_attr.begin(); al != ml.face_attr.end(); ++al)
|
||||
if(!(*al)._name.empty()){
|
||||
ar = mr.face_attr.find(*al);
|
||||
if(ar!= mr.face_attr.end()){
|
||||
id_r = 0;
|
||||
for(fi=mr.face.begin();fi!=mr.face.end();++fi,++id_r)
|
||||
if( !(*fi).IsD() && (!selected || (*fi).IsS()))
|
||||
// per face attributes
|
||||
for(al = ml.face_attr.begin(); al != ml.face_attr.end(); ++al)
|
||||
if(!(*al)._name.empty()){
|
||||
ar = mr.face_attr.find(*al);
|
||||
if(ar!= mr.face_attr.end()){
|
||||
id_r = 0;
|
||||
for(fi=mr.face.begin();fi!=mr.face.end();++fi,++id_r)
|
||||
if( !(*fi).IsD() && (!selected || (*fi).IsS()))
|
||||
memcpy((*al)._handle->At(remap.face[Index(mr,*fi)]),(*ar)._handle->At(id_r),
|
||||
(*al)._handle->SizeOf());
|
||||
}
|
||||
}
|
||||
(*al)._handle->SizeOf());
|
||||
}
|
||||
}
|
||||
|
||||
// per mesh attributes
|
||||
// if both ml and mr have an attribute with the same name, no action is done
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
* \ *
|
||||
* All rights reserved. *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 2 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
|
@ -21,21 +21,30 @@
|
|||
* *
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef __VCG_MESH
|
||||
#ifndef __VCG_MESH_H
|
||||
#define __VCG_MESH_H
|
||||
#define __VCG_MESH
|
||||
|
||||
#include <assert.h>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <set>
|
||||
#include <exception>
|
||||
|
||||
#include <stack>
|
||||
#include <algorithm>
|
||||
#include <map>
|
||||
#include <iostream>
|
||||
#include <stdexcept>
|
||||
#include <limits>
|
||||
#include <set>
|
||||
#include <vcg/complex/exception.h>
|
||||
#include <vcg/container/simple_temporary_data.h>
|
||||
#include <vcg/complex/used_types.h>
|
||||
#include <vcg/complex/base.h>
|
||||
#include <vcg/complex/allocate.h>
|
||||
#include <vcg/complex/algorithms/update/flag.h>
|
||||
#include <vcg/complex/algorithms/update/selection.h>
|
||||
#include <vcg/complex/append.h>
|
||||
|
||||
#undef __VCG_MESH
|
||||
#endif
|
||||
|
||||
|
|
Loading…
Reference in New Issue