Trying to solve int / size_t issues. Added a error guard to avoid inclusion of append.

This commit is contained in:
Paolo Cignoni 2014-07-07 10:09:25 +00:00
parent 30a9c6c2fb
commit 65336cfe7b
2 changed files with 13 additions and 12 deletions

View File

@ -20,14 +20,12 @@
* for more details. *
* *
****************************************************************************/
#ifndef __VCG_MESH
#error "This file should not be included alone. It is automatically included by complex.h"
#endif
#ifndef __VCGLIB_TRIALLOCATOR
#define __VCGLIB_TRIALLOCATOR
#include<climits>
#ifndef __VCG_MESH
#error "This file should not be included alone. It is automatically included by complex.h"
#endif
namespace vcg {
namespace tri {

View File

@ -20,10 +20,13 @@
* for more details. *
* *
****************************************************************************/
#ifndef __VCGLIB_APPEND
#define __VCGLIB_APPEND
#ifndef __VCG_MESH
#error "This file should not be included alone. It is automatically included by complex.h"
#endif
namespace vcg {
namespace tri {
/** \ingroup trimesh */
@ -64,7 +67,7 @@ public:
typedef typename ConstMeshRight::FacePointer FacePointerRight;
struct Remap{
std::vector<size_t> vert,face,edge, hedge;
std::vector<int> vert,face,edge, hedge;
};
static void ImportVertexAdj(MeshLeft &ml, ConstMeshRight &mr, VertexLeft &vl, VertexRight &vr, Remap &remap ){
@ -119,7 +122,7 @@ public:
if(HasFEAdjacency(ml) && HasFEAdjacency(mr)){
assert(fl.VN() == fr.VN());
for( int vi = 0; vi < fl.VN(); ++vi ){
size_t idx = remap.edge[Index(mr,fr.cFEp(vi))];
int idx = remap.edge[Index(mr,fr.cFEp(vi))];
if(idx>=0)
fl.FEp(vi) = &ml.edge[idx];
}
@ -129,7 +132,7 @@ public:
if(HasFFAdjacency(ml) && HasFFAdjacency(mr)){
assert(fl.VN() == fr.VN());
for( int vi = 0; vi < fl.VN(); ++vi ){
size_t idx = remap.face[Index(mr,fr.cFFp(vi))];
int idx = remap.face[Index(mr,fr.cFFp(vi))];
if(idx>=0){
fl.FFp(vi) = &ml.face[idx];
fl.FFi(vi) = fr.cFFi(vi);
@ -219,9 +222,9 @@ static void Mesh(MeshLeft& ml, ConstMeshRight& mr, const bool selected = false,
remap.vert.resize(mr.vert.size(),-1);
VertexIteratorLeft vp;
size_t svn = UpdateSelection<ConstMeshRight>::VertexCount(mr);
if(selected)
if(selected)
vp=Allocator<MeshLeft>::AddVertices(ml,int(svn));
else
else
vp=Allocator<MeshLeft>::AddVertices(ml,mr.vn);
for(VertexIteratorRight vi=mr.vert.begin(); vi!=mr.vert.end(); ++vi)
@ -232,7 +235,7 @@ static void Mesh(MeshLeft& ml, ConstMeshRight& mr, const bool selected = false,
remap.vert[ind]=int(Index(ml,*vp));
++vp;
}
}
}
// edge
remap.edge.resize(mr.edge.size(),-1);
EdgeIteratorLeft ep;