fix import matrix precision in aln parser

This commit is contained in:
alemuntoni 2021-04-20 10:25:54 +02:00
parent 0a17efe9a8
commit 0882d62582
1 changed files with 95 additions and 97 deletions

View File

@ -2,7 +2,7 @@
* MeshLab o o * * MeshLab o o *
* An extendible mesh processor o o * * An extendible mesh processor o o *
* _ O _ * * _ O _ *
* Copyright(C) 2005, 2009 \/)\/ * * Copyright(C) 2005, 2021 \/)\/ *
* Visual Computing Lab /\/| * * Visual Computing Lab /\/| *
* ISTI - Italian National Research Council | * * ISTI - Italian National Research Council | *
* \ * * \ *
@ -30,13 +30,10 @@
struct RangeMap struct RangeMap
{ {
RangeMap() RangeMap() : quality(1.0f) {}
{
quality = 1.0f;
}
std::string filename; std::string filename;
Matrix44m transformation; vcg::Matrix44d transformation;
float quality; float quality;
}; };
@ -106,10 +103,10 @@ public:
rm.quality = (float) atof(occurrence+2); rm.quality = (float) atof(occurrence+2);
assert(rm.quality>0); assert(rm.quality>0);
fscanf(stream,"%f %f %f %f \n",&(rm.transformation[0][0]),&(rm.transformation[0][1]),&(rm.transformation[0][2]),&(rm.transformation[0][3])); fscanf(stream,"%lf %lf %lf %lf \n",&(rm.transformation[0][0]),&(rm.transformation[0][1]),&(rm.transformation[0][2]),&(rm.transformation[0][3]));
fscanf(stream,"%f %f %f %f \n",&(rm.transformation[1][0]),&(rm.transformation[1][1]),&(rm.transformation[1][2]),&(rm.transformation[1][3])); fscanf(stream,"%lf %lf %lf %lf \n",&(rm.transformation[1][0]),&(rm.transformation[1][1]),&(rm.transformation[1][2]),&(rm.transformation[1][3]));
fscanf(stream,"%f %f %f %f \n",&(rm.transformation[2][0]),&(rm.transformation[2][1]),&(rm.transformation[2][2]),&(rm.transformation[2][3])); fscanf(stream,"%lf %lf %lf %lf \n",&(rm.transformation[2][0]),&(rm.transformation[2][1]),&(rm.transformation[2][2]),&(rm.transformation[2][3]));
fscanf(stream,"%f %f %f %f \n",&(rm.transformation[3][0]),&(rm.transformation[3][1]),&(rm.transformation[3][2]),&(rm.transformation[3][3])); fscanf(stream,"%lf %lf %lf %lf \n",&(rm.transformation[3][0]),&(rm.transformation[3][1]),&(rm.transformation[3][2]),&(rm.transformation[3][3]));
rangemaps.push_back(rm); rangemaps.push_back(rm);
} }
@ -117,15 +114,16 @@ public:
return NoError; return NoError;
} // end of ParseALN } // end of ParseALN
static bool SaveALN(const char *alnfile, std::vector<std::string> &names) static bool SaveALN(const char *alnfile, std::vector<std::string> &names)
{ {
std::vector<vcg::Matrix44f> Tr(names.size()); std::vector<vcg::Matrix44f> Tr(names.size());
for(int i=0; i < static_cast<int>(Tr.size()); ++i) Tr[i].SetIdentity(); for(int i=0; i < static_cast<int>(Tr.size()); ++i) Tr[i].SetIdentity();
return SaveALN(alnfile,names, Tr); return SaveALN(alnfile,names, Tr);
} }
template <class matrixfloat>
static bool SaveALN(const char *alnfile, std::vector<std::string> &names, std::vector<vcg::Matrix44<matrixfloat> > &Tr) template <class matrixfloat>
{ static bool SaveALN(const char *alnfile, std::vector<std::string> &names, std::vector<vcg::Matrix44<matrixfloat> > &Tr)
{
// printf("Saving aln file %s\n",alnfile); // printf("Saving aln file %s\n",alnfile);
FILE *fp=fopen(alnfile,"w"); FILE *fp=fopen(alnfile,"w");
if(!fp) if(!fp)
@ -149,7 +147,7 @@ static bool SaveALN(const char *alnfile, std::vector<std::string> &names, std::v
fclose(fp); fclose(fp);
return true; return true;
} }
}; };