bugfixes and PR template

This commit is contained in:
alemuntoni 2020-04-17 16:44:23 +02:00
parent e9ea05be02
commit f7871eed2d
13 changed files with 54 additions and 40 deletions

14
.github/pull_request_template.md vendored Normal file
View File

@ -0,0 +1,14 @@
## Thank you for sending a Pull Request to the VCGLib!
VCGLib is fully owned by CNR, and all the VCGLib contributors that do not work at the VCLab of CNR must first sign the contributor license agreement that you can find at the following link: https://github.com/cnr-isti-vclab/vcglib/blob/devel/docs/ContributorLicenseAgreement.pdf
If you will sign the CLA, then we will be able to merge your pull request after reviewing it.
Please send the signed document to muntoni.alessandro@gmail.com and paolo.cignoni@isti.cnr.it .
If you will not sign the CLA, we will review and then apply your changes as soon as possible.
Before opening the PR, please leave the follwing form with a check for your particluar case:
##### Check with `[x]` what is your case:
- [ ] I already signed and sent via email the CLA;
- [ ] I wil sign and send the CLA via email as soon as possible;
- [ ] I don't want to sign the CLA.

View File

@ -364,6 +364,7 @@ public:
protected:
void AddFace(int v0, int v1, int v2) {
FaceIterator fi = vcg::tri::Allocator<MESH>::AddFace(mesh,v0,v1,v2);
if (FaceType::HasNormal())
fi->N() = TriangleNormal(*fi).Normalize();
if(tri::HasVFAdjacency(mesh))
{

View File

@ -100,7 +100,7 @@ struct RegularLoopWeight {
.69908
};
return (k<=12)?(1.0-bkPolar[k-3])/k:LoopWeight<SCALAR_TYPE>().beta(k);
return (k<=12 && k>=3)?(1.0-bkPolar[k-3])/k:LoopWeight<SCALAR_TYPE>().beta(k);
}
inline SCALAR_TYPE incidentRegular(int k) {
@ -120,7 +120,7 @@ struct RegularLoopWeight {
.44579
};
return (k<=12)?bkPolar[k-3]:LoopWeight<SCALAR_TYPE>().incidentIrregular(k);
return (k<=12 && k>=3)?bkPolar[k-3]:LoopWeight<SCALAR_TYPE>().incidentIrregular(k);
}
inline SCALAR_TYPE opposite(int k) {
static SCALAR_TYPE bkPolar[] = {
@ -136,7 +136,7 @@ struct RegularLoopWeight {
.19828
};
return (k<=12)?bkPolar[k-3]:LoopWeight<SCALAR_TYPE>().opposite(k);
return (k<=12 && k >= 3)?bkPolar[k-3]:LoopWeight<SCALAR_TYPE>().opposite(k);
}
};
@ -156,7 +156,7 @@ struct ContinuityLoopWeight {
.70014
};
return (k<=12)?(1.0-bkPolar[k-3])/k:LoopWeight<SCALAR_TYPE>().beta(k);
return (k<=12 && k>= 3)?(1.0-bkPolar[k-3])/k:LoopWeight<SCALAR_TYPE>().beta(k);
}
inline SCALAR_TYPE incidentRegular(int k) {
@ -176,7 +176,7 @@ struct ContinuityLoopWeight {
.2452
};
return (k<=12)?bkPolar[k-3]:LoopWeight<SCALAR_TYPE>().incidentIrregular(k);
return (k<=12 && k>=3)?bkPolar[k-3]:LoopWeight<SCALAR_TYPE>().incidentIrregular(k);
}
inline SCALAR_TYPE opposite(int k) {
static SCALAR_TYPE bkPolar[] = {
@ -192,7 +192,7 @@ struct ContinuityLoopWeight {
.29934
};
return (k<=12)?bkPolar[k-3]:LoopWeight<SCALAR_TYPE>().opposite(k);
return (k<=12 && k >= 3)?bkPolar[k-3]:LoopWeight<SCALAR_TYPE>().opposite(k);
}
};

View File

@ -211,7 +211,7 @@ static void FillUniqueEdgeVector(MeshType &m, std::vector<PEdge> &edgeVec, bool
edgeVec[ i ].isBorder = true;
for (size_t i=1; i<edgeVec.size(); i++) {
if (edgeVec[i]==edgeVec[i-1])
edgeVec[i-1].isBorder = edgeVec[i-1].isBorder = false;
edgeVec[i].isBorder = edgeVec[i-1].isBorder = false;
}
}

View File

@ -1330,7 +1330,7 @@ public:
m.tetra[pos].ImportData(m.tetra[i]);
//import vertex refs
for (int j = 0; j < 4; ++j)
m.tetra[pos].V(j) = m.tetra[i].cV(j);
m.tetra[pos].V(j) = m.tetra[i].V(j);
//import VT adj
if (HasVTAdjacency(m))
for (int j = 0; j < 4; ++j)
@ -1675,7 +1675,7 @@ public:
typename std::set<PointerToAttribute > ::iterator i;
for( i = m.edge_attr.begin(); i != m.edge_attr.end(); ++i)
if( (*i)._handle == h._handle ){
delete ((SimpleTempData<FaceContainer,ATTR_TYPE>*)(*i)._handle);
delete ((SimpleTempData<EdgeContainer,ATTR_TYPE>*)(*i)._handle);
m.edge_attr.erase(i);
return;}
}

View File

@ -368,8 +368,7 @@ void ExternalProduct(const Point3<S> &a, const Point3<S> &b)
ScalarType Norm()
{
ScalarType SQsum=0;
for(int i=0;i<3;++i)
for(int j=0;j<3;++j)
for(int i=0;i<9;++i)
SQsum += a[i]*a[i];
return (math::Sqrt(SQsum));
}

View File

@ -47,7 +47,7 @@ public:
//Empty vertexref
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 * cV( const int ) { assert(0); static typename T::VertexType *vp=0; return vp; }
inline const 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 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; }
@ -178,7 +178,7 @@ public:
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 * cV( const int j ) { assert(j>=0 && j<4); return v[j]; }
inline const 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]; }

View File

@ -26,6 +26,7 @@
#include <stdarg.h> // For va_start, etc.
#include <memory> // For std::unique_ptr
#include <iostream>
namespace vcg {
/*! \brief This function allow lenghty algorithms to report progress and status.

View File

@ -96,7 +96,7 @@ namespace io {
"The importer assumes that the OpenMeshType uses a 3D point for the vertex position",
"There isn't any scene in Collada file",
"The input file is not compatible with COLLADA 1.41 standard format",
"Collada file is trying to referece an attribute that is not in the file",
"Collada file is trying to reference an attribute that is not in the file",
"This version of Collada Importer support only triangular and polygonal mesh file"
};
@ -108,7 +108,7 @@ namespace io {
// For example
// <instance_geometry url="#shape0-lib">
// means that you have to search in the <library_geometries> for a node <geometry> with id = "shape0-lib"
// you have to call this function to get ther right refernece name
// you have to call this function to get the right reference name
inline static void referenceToANodeAttribute(const QDomNode n,const QString& attr,QString& url_st)
{
@ -182,7 +182,7 @@ namespace io {
res = nd.simplified().split(" ",QString::SkipEmptyParts);
if(res.empty())
{
qDebug("Warning valueStringList returned and emtpy list. nothing inside element with tag '%s'", qPrintable(tag));
qDebug("Warning valueStringList returned and empty list. nothing inside element with tag '%s'", qPrintable(tag));
return;
}
if (res.last() == "")
@ -348,7 +348,7 @@ namespace io {
/* Very important procedure
it has the task to finde the name of the image node corresponding to a given material id,
it has the task to find the name of the image node corresponding to a given material id,
it assuemes that the material name that is passed have already been bound with the current bindings
*/

View File

@ -141,7 +141,7 @@ public:
off_error_msg.resize(3);
off_error_msg[0] = "No errors";
off_error_msg[1] = "Can't open file";
off_error_msg[1] = "Output Stream error";
off_error_msg[2] = "Output Stream error";
}
if (error>2 || error<0) return "Unknown error";

View File

@ -637,7 +637,7 @@ namespace io {
QDomElement instGeomNode= geomNodeList.at(ch).toElement();
if(instGeomNode.parentNode()==node) // process only direct child
{
QDEBUG("** instance_geometry with url %s (intial mesh size %i %i T = %i)",qPrintable(instGeomNode.attribute("url")),m.vn,m.fn,m.textures.size());
QDEBUG("** instance_geometry with url %s (initial mesh size %i %i T = %i)",qPrintable(instGeomNode.attribute("url")),m.vn,m.fn,m.textures.size());
//assert(m.textures.size()>0 == HasPerWedgeTexCoord(m));
QString geomNode_url;
referenceToANodeAttribute(instGeomNode,"url",geomNode_url);
@ -711,7 +711,7 @@ namespace io {
}
// Retrieve the transformation matrix that is defined in the childs of a node.
// Retrieve the transformation matrix that is defined in the children of a node.
// used during the recursive descent.
static Matrix44f getTransfMatrixFromNode(const QDomElement parentNode)
{

View File

@ -81,7 +81,7 @@ static bool ReadHeader(FILE *fp,unsigned int &num_cams, unsigned int &num_points
if(0!=strcmp("# Bundle file v0.3", line)) return false;
readline(fp, line);
if(line[0]=='\0') return false;
sscanf(line, "%d %d", &num_cams, &num_points);
if (sscanf(line, "%d %d", &num_cams, &num_points) != 2) return false;
return true;
}
@ -108,13 +108,12 @@ static int Open( OpenMeshType &m, std::vector<Shot<ScalarType> > & shots,
float R[16]={0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,1};
vcg::Point3f t;
readline(fp, line); if(line[0]=='\0') return false; sscanf(line, "%f %f %f", &f, &k1, &k2);
readline(fp, line); if(line[0]=='\0') return false; if (sscanf(line, "%f %f %f", &f, &k1, &k2) != 3) return false;
readline(fp, line); if(line[0]=='\0') return false; sscanf(line, "%f %f %f", &(R[0]), &(R[1]), &(R[2])); R[3] = 0;
readline(fp, line); if(line[0]=='\0') return false; sscanf(line, "%f %f %f", &(R[4]), &(R[5]), &(R[6])); R[7] = 0;
readline(fp, line); if(line[0]=='\0') return false; sscanf(line, "%f %f %f", &(R[8]), &(R[9]), &(R[10])); R[11] = 0;
readline(fp, line); if(line[0]=='\0') return false; sscanf(line, "%f %f %f", &(t[0]), &(t[1]), &(t[2]));
readline(fp, line); if(line[0]=='\0') return false; if (sscanf(line, "%f %f %f", &(R[0]), &(R[1]), &(R[2])) != 3) return false; R[3] = 0;
readline(fp, line); if(line[0]=='\0') return false; if (sscanf(line, "%f %f %f", &(R[4]), &(R[5]), &(R[6])) != 3) return false; R[7] = 0;
readline(fp, line); if(line[0]=='\0') return false; if (sscanf(line, "%f %f %f", &(R[8]), &(R[9]), &(R[10])) != 3) return false; R[11] = 0;
readline(fp, line); if(line[0]=='\0') return false; if (sscanf(line, "%f %f %f", &(t[0]), &(t[1]), &(t[2])) != 3) return false;
Matrix44x mat = Matrix44x::Construct(Matrix44f(R));
@ -152,14 +151,14 @@ static int Open( OpenMeshType &m, std::vector<Shot<ScalarType> > & shots,
for(uint i = 0; i < num_points;++i,++vi){
double x,y,z;
unsigned int r,g,b,i_cam, key_sift,n_corr;
fscanf(fp,"%lf %lf %lf ",&x,&y,&z);
if (fscanf(fp,"%lf %lf %lf ",&x,&y,&z) != 3) return false;
(*vi).P() = vcg::Point3<typename OpenMeshType::ScalarType>(x,y,z);
fscanf(fp,"%d %d %d ",&r,&g,&b);
if (fscanf(fp,"%d %d %d ",&r,&g,&b) != 3) return false;
(*vi).C() = vcg::Color4b(r,g,b,255);
fscanf(fp,"%d ",&n_corr);
if (fscanf(fp,"%d ",&n_corr) != 1) return false;
for(uint j = 0; j < n_corr; ++j){
fscanf(fp,"%d %d %lf %lf ",&i_cam,&key_sift,&x,&y);
if (fscanf(fp,"%d %d %lf %lf ",&i_cam,&key_sift,&x,&y) != 4) return false;
Correspondence corr(i_cam,key_sift,x,y);
ch[i].push_back(corr);
}
@ -181,7 +180,7 @@ static bool ReadImagesFilenames(const char * filename,std::vector<std::string>
while(!feof(fp)){
readline(fp, line, 1000);
if(line[0] == '\0') continue; //ignore empty lines (in theory, might happen only at end of file)
sscanf(line, "%s", name);
if (sscanf(line, "%s", name) != 1) return false;
std::string n(name);
image_filenames.push_back(n);
}

View File

@ -970,7 +970,7 @@ public:
bufstr = c.substr(num_cols.length()+1);
RangeGridCols = atoi(bufstr.c_str());
}
if( num_rows == c.substr(0,num_cols.length()) )
if( num_rows == c.substr(0,num_rows.length()) )
{
bufstr = c.substr(num_rows.length()+1);
RangeGridRows = atoi(bufstr.c_str());