fix some gcc warnings
This commit is contained in:
parent
5fa560e9e6
commit
3285c6b1e5
|
@ -218,16 +218,18 @@ public:
|
||||||
// get the adjacent face
|
// get the adjacent face
|
||||||
const FaceType * fp = f.cFFp(edge);
|
const FaceType * fp = f.cFFp(edge);
|
||||||
|
|
||||||
// v0
|
/*
|
||||||
// /|\
|
* v0
|
||||||
// / | \
|
* /|\
|
||||||
// / | \
|
* / | \
|
||||||
// / | \
|
* / | \
|
||||||
// va\ | /vb
|
* / | \
|
||||||
// \ | /
|
* va\ | /vb
|
||||||
// \ | /
|
* \ | /
|
||||||
// \|/
|
* \ | /
|
||||||
// v1
|
* \|/
|
||||||
|
* v1
|
||||||
|
*/
|
||||||
|
|
||||||
ScalarT cotA = 0;
|
ScalarT cotA = 0;
|
||||||
ScalarT cotB = 0;
|
ScalarT cotB = 0;
|
||||||
|
@ -255,16 +257,17 @@ public:
|
||||||
template <typename ScalarT>
|
template <typename ScalarT>
|
||||||
static ScalarT ComputeAngle(const VertexType * a, const VertexType * b, const VertexType * c)
|
static ScalarT ComputeAngle(const VertexType * a, const VertexType * b, const VertexType * c)
|
||||||
{
|
{
|
||||||
// a
|
/* a
|
||||||
// /
|
* /
|
||||||
// /
|
* /
|
||||||
// /
|
* /
|
||||||
// / ___ compute the angle in b
|
* / ___ compute the angle in b
|
||||||
// b \
|
* b \
|
||||||
// \
|
* \
|
||||||
// \
|
* \
|
||||||
// \
|
* \
|
||||||
// c
|
* c
|
||||||
|
*/
|
||||||
assert(a != NULL && b != NULL && c != NULL);
|
assert(a != NULL && b != NULL && c != NULL);
|
||||||
Point3<ScalarT> A,B,C;
|
Point3<ScalarT> A,B,C;
|
||||||
A.Import(a->P());
|
A.Import(a->P());
|
||||||
|
|
|
@ -959,20 +959,22 @@ private:
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
//Choose the best way to collapse a cross based on the (external) cross vertices valence
|
/*
|
||||||
//and resulting face quality
|
*Choose the best way to collapse a cross based on the (external) cross vertices valence
|
||||||
// +0 -1
|
*and resulting face quality
|
||||||
// v1 v1 v1
|
* +0 -1
|
||||||
// /| \ /|\ / \
|
* v1 v1 v1
|
||||||
// / | \ / | \ / \
|
* /| \ /|\ / \
|
||||||
// / | \ / | \ / \
|
* / | \ / | \ / \
|
||||||
// / *p| \ -1/ | \ -1 +0/ \+0
|
* / | \ / | \ / \
|
||||||
// v0-------- v2 ========> v0 | v2 OR v0-------v2
|
* / *p| \ -1/ | \ -1 +0/ \+0
|
||||||
// \ | / \ | / \ /
|
* v0-------- v2 ========> v0 | v2 OR v0-------v2
|
||||||
// \ | / \ | / \ /
|
* \ | / \ | / \ /
|
||||||
// \ | / \ | / \ /
|
* \ | / \ | / \ /
|
||||||
// \ | / \|/ +0 \ / -1
|
* \ | / \ | / \ /
|
||||||
// v3 v3 v3
|
* \ | / \|/ +0 \ / -1
|
||||||
|
* v3 v3 v3
|
||||||
|
*/
|
||||||
static bool chooseBestCrossCollapse(PosType &p, VertexPair& bp, vector<FaceType*> &ff)
|
static bool chooseBestCrossCollapse(PosType &p, VertexPair& bp, vector<FaceType*> &ff)
|
||||||
{
|
{
|
||||||
vector<VertexType*> vv0, vv1, vv2, vv3;
|
vector<VertexType*> vv0, vv1, vv2, vv3;
|
||||||
|
|
|
@ -47,7 +47,7 @@ public:
|
||||||
//Empty vertexref
|
//Empty vertexref
|
||||||
inline typename T::VertexType * & V( const int ) { assert(0); static typename T::VertexType *vp=0; return vp; }
|
inline typename T::VertexType * & V( const int ) { assert(0); static typename T::VertexType *vp=0; return vp; }
|
||||||
inline typename T::VertexType * const & V( const int ) const { assert(0); static typename T::VertexType *vp=0; return vp; }
|
inline typename T::VertexType * const & V( const int ) const { assert(0); static typename T::VertexType *vp=0; return vp; }
|
||||||
inline typename T::VertexType * const cV( const int ) { assert(0); static typename T::VertexType *vp=0; return vp; }
|
inline typename T::VertexType * cV( const int ) { assert(0); static typename T::VertexType *vp=0; return vp; }
|
||||||
inline typename T::CoordType & P( const int ) { assert(0); static typename T::CoordType coord(0, 0, 0); return coord; }
|
inline typename T::CoordType & P( const int ) { assert(0); static typename T::CoordType coord(0, 0, 0); return coord; }
|
||||||
inline const typename T::CoordType & P( const int ) const { assert(0); static typename T::CoordType coord(0, 0, 0); return coord; }
|
inline const typename T::CoordType & P( const int ) const { assert(0); static typename T::CoordType coord(0, 0, 0); return coord; }
|
||||||
inline const typename T::CoordType &cP( const int ) const { assert(0); static typename T::CoordType coord(0, 0, 0); return coord; }
|
inline const typename T::CoordType &cP( const int ) const { assert(0); static typename T::CoordType coord(0, 0, 0); return coord; }
|
||||||
|
@ -177,8 +177,8 @@ public:
|
||||||
typedef typename T::VertexType::CoordType CoordType;
|
typedef typename T::VertexType::CoordType CoordType;
|
||||||
typedef typename T::VertexType::ScalarType ScalarType;
|
typedef typename T::VertexType::ScalarType ScalarType;
|
||||||
|
|
||||||
inline typename T::VertexType * & V( const int j ) { assert(j>=0 && j<4); return v[j]; }
|
inline typename T::VertexType * & V( const int j ) { assert(j>=0 && j<4); return v[j]; }
|
||||||
inline typename T::VertexType * const cV( const int j ) { assert(j>=0 && j<4); return v[j]; }
|
inline typename T::VertexType * cV( const int j ) { assert(j>=0 && j<4); return v[j]; }
|
||||||
|
|
||||||
inline size_t cFtoVi (const int f, const int j) const { assert(f >= 0 && f < 4); assert(j >= 0 && j < 3); return findices[f][j]; }
|
inline size_t cFtoVi (const int f, const int j) const { assert(f >= 0 && f < 4); assert(j >= 0 && j < 3); return findices[f][j]; }
|
||||||
|
|
||||||
|
|
|
@ -232,23 +232,30 @@ namespace vcg{
|
||||||
{
|
{
|
||||||
int ix,iy,iz;
|
int ix,iy,iz;
|
||||||
for (ix=ibbox.min[0]; ix<=ibbox.max[0]; ix++)
|
for (ix=ibbox.min[0]; ix<=ibbox.max[0]; ix++)
|
||||||
|
{
|
||||||
for (iy=ibbox.min[1]; iy<=ibbox.max[1]; iy++)
|
for (iy=ibbox.min[1]; iy<=ibbox.max[1]; iy++)
|
||||||
|
{
|
||||||
for (iz=ibbox.min[2]; iz<=ibbox.max[2]; iz++)
|
for (iz=ibbox.min[2]; iz<=ibbox.max[2]; iz++)
|
||||||
{
|
{
|
||||||
_Si.Grid( ix, iy, iz, first, last );
|
_Si.Grid( ix, iy, iz, first, last );
|
||||||
for(l=first;l!=last;++l)
|
for(l=first;l!=last;++l)
|
||||||
|
{
|
||||||
if (!(**l).IsD())
|
if (!(**l).IsD())
|
||||||
{
|
{
|
||||||
typename SPATIALINDEXING::ObjPtr elem=&(**l);
|
typename SPATIALINDEXING::ObjPtr elem=&(**l);
|
||||||
vcg::Box3<typename SPATIALINDEXING::ScalarType> box_elem;
|
vcg::Box3<typename SPATIALINDEXING::ScalarType> box_elem;
|
||||||
elem->GetBBox(box_elem);
|
elem->GetBBox(box_elem);
|
||||||
if(( ! _marker.IsMarked(elem))&&(box_elem.Collide(_bbox))){
|
if(( ! _marker.IsMarked(elem))&&(box_elem.Collide(_bbox)))
|
||||||
|
{
|
||||||
_objectPtrs.push_back(elem);
|
_objectPtrs.push_back(elem);
|
||||||
_marker.Mark(elem);
|
_marker.Mark(elem);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return (static_cast<unsigned int>(_objectPtrs.size()));
|
}
|
||||||
|
}
|
||||||
|
return (static_cast<unsigned int>(_objectPtrs.size()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -401,7 +401,9 @@ namespace vcg{
|
||||||
{
|
{
|
||||||
int ix,iy,iz;
|
int ix,iy,iz;
|
||||||
for( iz = to_explore.min.Z();iz <= to_explore.max.Z(); ++iz)
|
for( iz = to_explore.min.Z();iz <= to_explore.max.Z(); ++iz)
|
||||||
|
{
|
||||||
for(iy =to_explore.min.Y(); iy <=to_explore.max.Y(); ++iy)
|
for(iy =to_explore.min.Y(); iy <=to_explore.max.Y(); ++iy)
|
||||||
|
{
|
||||||
for(ix =to_explore.min.X(); ix <= to_explore.max.X();++ix)
|
for(ix =to_explore.min.X(); ix <= to_explore.max.X();++ix)
|
||||||
{
|
{
|
||||||
// this test is to avoid to re-process already analyzed cells.
|
// this test is to avoid to re-process already analyzed cells.
|
||||||
|
@ -427,12 +429,13 @@ namespace vcg{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
////sort the elements in Elems and take a iterator to the last one
|
////sort the elements in Elems and take a iterator to the last one
|
||||||
std::sort(Elems.begin(),Elems.end());
|
std::sort(Elems.begin(),Elems.end());
|
||||||
CurrentElem=Elems.rbegin();
|
CurrentElem=Elems.rbegin();
|
||||||
|
|
||||||
return((Elems.size()==0)||(Dist()>radius));
|
return((Elems.size()==0)||(Dist()>radius));
|
||||||
}
|
}
|
||||||
|
|
|
@ -84,66 +84,66 @@ static const char *ErrorMsg(int error)
|
||||||
*/
|
*/
|
||||||
static int Open( MESH_TYPE &m, const char * filename, CallBackPos *cb=0, bool triangulate=false, int lineskip=0)
|
static int Open( MESH_TYPE &m, const char * filename, CallBackPos *cb=0, bool triangulate=false, int lineskip=0)
|
||||||
{
|
{
|
||||||
FILE *fp;
|
FILE *fp;
|
||||||
fp = fopen(filename, "r");
|
fp = fopen(filename, "r");
|
||||||
if(fp == NULL)
|
if(fp == NULL)
|
||||||
{
|
{
|
||||||
qDebug("Failed opening of %s",filename);
|
qDebug("Failed opening of %s",filename);
|
||||||
return E_CANTOPEN;
|
return E_CANTOPEN;
|
||||||
}
|
}
|
||||||
long currentPos = ftell(fp);
|
long currentPos = ftell(fp);
|
||||||
fseek(fp,0L,SEEK_END);
|
fseek(fp,0L,SEEK_END);
|
||||||
long fileLen = ftell(fp);
|
long fileLen = ftell(fp);
|
||||||
fseek(fp,currentPos,SEEK_SET);
|
fseek(fp,currentPos,SEEK_SET);
|
||||||
|
|
||||||
m.Clear();
|
m.Clear();
|
||||||
|
|
||||||
Point3f pp;
|
|
||||||
float q;
|
|
||||||
size_t cnt=0;
|
|
||||||
int ret;
|
|
||||||
char buf[1024];
|
|
||||||
|
|
||||||
// skip the first <lineskip> lines
|
Point3f pp;
|
||||||
for(int i=0;i<lineskip;++i)
|
float q;
|
||||||
fgets(buf,1024,fp);
|
size_t cnt=0;
|
||||||
|
int ret;
|
||||||
|
char buf[1024];
|
||||||
|
|
||||||
/* Read a single triplet of coords from an ASCII file of coords*/
|
// skip the first <lineskip> lines
|
||||||
while(!feof(fp))
|
for(int i=0;i<lineskip;++i)
|
||||||
{
|
fgets(buf,1024,fp);
|
||||||
if(cb && (++cnt)%1000) cb( (ftell(fp)*100)/fileLen, "ASC Mesh Loading");
|
|
||||||
if(feof(fp)) break;
|
/* Read a single triplet of coords from an ASCII file of coords*/
|
||||||
bool fgetOut=fgets(buf,1024,fp);
|
while(!feof(fp))
|
||||||
if( fgetOut == 0 ) continue;
|
{
|
||||||
ret=sscanf(buf, "%f, %f, %f, %f\n", &pp.X(), &pp.Y(), &pp.Z(),&q);
|
if(cb && (++cnt)%1000) cb( (ftell(fp)*100)/fileLen, "ASC Mesh Loading");
|
||||||
if(ret==1) // lets try also non comma separated values
|
if(feof(fp)) break;
|
||||||
ret=sscanf(buf, "%f %f %f %f\n", &pp.X(), &pp.Y(), &pp.Z(),&q);
|
bool fgetOut=fgets(buf,1024,fp);
|
||||||
|
if( fgetOut == 0 ) continue;
|
||||||
|
ret=sscanf(buf, "%f, %f, %f, %f\n", &pp.X(), &pp.Y(), &pp.Z(),&q);
|
||||||
|
if(ret==1) // lets try also non comma separated values
|
||||||
|
ret=sscanf(buf, "%f %f %f %f\n", &pp.X(), &pp.Y(), &pp.Z(),&q);
|
||||||
|
|
||||||
if(ret>=3)
|
if(ret>=3)
|
||||||
{
|
{
|
||||||
VertexIterator vi=Allocator<MESH_TYPE>::AddVertices(m,1);
|
VertexIterator vi=Allocator<MESH_TYPE>::AddVertices(m,1);
|
||||||
(*vi).P().Import(pp);
|
(*vi).P().Import(pp);
|
||||||
if(ret==4) (*vi).Q()=q;
|
if(ret==4) (*vi).Q()=q;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
if(m.vn==0) return E_NO_POINTS;
|
if(m.vn==0) return E_NO_POINTS;
|
||||||
if(!triangulate) return E_NOERROR;
|
if(!triangulate) return E_NOERROR;
|
||||||
// now try to triangulate.
|
// now try to triangulate.
|
||||||
// search for the first jump
|
// search for the first jump
|
||||||
float baseY = m.vert[0].P().Y();
|
float baseY = m.vert[0].P().Y();
|
||||||
int i;
|
unsigned int i;
|
||||||
for(i=1;i<m.vert.size();++i)
|
for(i=1;i<m.vert.size();++i)
|
||||||
{
|
{
|
||||||
if(m.vert[i].P().Y()!= baseY) break;
|
if(m.vert[i].P().Y()!= baseY) break;
|
||||||
}
|
}
|
||||||
cnt=m.vert.size();
|
cnt=m.vert.size();
|
||||||
qDebug("Grid is %i x %i = %i (%i) ",i,cnt/i,i* (cnt/i),cnt);
|
qDebug("Grid is %i x %i = %i (%zu) ",i,cnt/i,i* (cnt/i),cnt);
|
||||||
tri::FaceGrid(m,i,int(cnt/i));
|
tri::FaceGrid(m,i,int(cnt/i));
|
||||||
tri::Clean<MESH_TYPE>::FlipMesh(m);
|
tri::Clean<MESH_TYPE>::FlipMesh(m);
|
||||||
return E_NOERROR;
|
return E_NOERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
}; // end class
|
}; // end class
|
||||||
} // end Namespace tri
|
} // end Namespace tri
|
||||||
|
|
|
@ -166,8 +166,9 @@ public:
|
||||||
char buf[1024];
|
char buf[1024];
|
||||||
if (tex) {
|
if (tex) {
|
||||||
tex->getRelativeFileName().toString(buf); buf[1023] = 0;
|
tex->getRelativeFileName().toString(buf); buf[1023] = 0;
|
||||||
if (std::string(buf) == "")
|
if (std::string(buf) == "") {
|
||||||
tex->getFileName().toString(buf); buf[1023] = 0;
|
tex->getFileName().toString(buf); buf[1023] = 0;
|
||||||
|
}
|
||||||
printf("Texture %s\n", buf);
|
printf("Texture %s\n", buf);
|
||||||
m.textures.push_back(buf);
|
m.textures.push_back(buf);
|
||||||
}
|
}
|
||||||
|
|
|
@ -67,10 +67,12 @@ typedef typename OpenMeshType::EdgeIterator EdgeIterator;
|
||||||
static void readline(FILE *fp, char *line, int max=1000){
|
static void readline(FILE *fp, char *line, int max=1000){
|
||||||
int i=0;
|
int i=0;
|
||||||
char c;
|
char c;
|
||||||
fscanf(fp, "%c", &c);
|
unsigned int rc = 0;
|
||||||
|
rc = fscanf(fp, "%c", &c);
|
||||||
while( (c!=10) && (c!=13) && (i<max-1) ){
|
while( (c!=10) && (c!=13) && (i<max-1) ){
|
||||||
line[i++] = c;
|
if (rc == 1)
|
||||||
fscanf(fp, "%c", &c);
|
line[i++] = c;
|
||||||
|
rc = fscanf(fp, "%c", &c);
|
||||||
}
|
}
|
||||||
line[i] = '\0'; //end of string
|
line[i] = '\0'; //end of string
|
||||||
}
|
}
|
||||||
|
@ -163,14 +165,18 @@ static int Open( OpenMeshType &m, std::vector<Shot<ScalarType> > & shots,
|
||||||
for(uint i = 0; i < num_points;++i,++vi){
|
for(uint i = 0; i < num_points;++i,++vi){
|
||||||
float x,y,z;
|
float x,y,z;
|
||||||
unsigned int r,g,b,i_cam, key_sift,n_corr;
|
unsigned int r,g,b,i_cam, key_sift,n_corr;
|
||||||
fscanf(fp,"%f %f %f ",&x,&y,&z);
|
uint readValues = fscanf(fp,"%f %f %f ",&x,&y,&z);
|
||||||
|
if (readValues < 3) qDebug() << "Point " << i << ": only " << readValues << " coordinates read!";
|
||||||
(*vi).P() = vcg::Point3<typename OpenMeshType::ScalarType>(x,y,z);
|
(*vi).P() = vcg::Point3<typename OpenMeshType::ScalarType>(x,y,z);
|
||||||
fscanf(fp,"%d %d %d ",&r,&g,&b);
|
readValues = fscanf(fp,"%d %d %d ",&r,&g,&b);
|
||||||
|
if (readValues < 3) qDebug() << "Point " << i << ": only " << readValues << " color values read!";
|
||||||
(*vi).C() = vcg::Color4b(r,g,b,255);
|
(*vi).C() = vcg::Color4b(r,g,b,255);
|
||||||
|
|
||||||
fscanf(fp,"%d ",&n_corr);
|
readValues = fscanf(fp,"%d ",&n_corr);
|
||||||
|
if (readValues < 1) qDebug() << "Point " << i << ": no n correspondences read!";
|
||||||
for(uint j = 0; j < n_corr; ++j){
|
for(uint j = 0; j < n_corr; ++j){
|
||||||
fscanf(fp,"%d %d %f %f ",&i_cam,&key_sift,&x,&y);
|
readValues = fscanf(fp,"%d %d %f %f ",&i_cam,&key_sift,&x,&y);
|
||||||
|
if (readValues != 3) qDebug() << "Point " << i << "; Corresp: " << j << ": only " << readValues << " values read!";
|
||||||
Correspondence corr(i_cam,key_sift,x,y);
|
Correspondence corr(i_cam,key_sift,x,y);
|
||||||
ch[i].push_back(corr);
|
ch[i].push_back(corr);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue