From a374e959ee6ffc8fc968b4c253fa3bf9c2b06130 Mon Sep 17 00:00:00 2001 From: alemuntoni Date: Fri, 29 May 2020 13:20:57 +0200 Subject: [PATCH] more implementation and some refactoring --- vcg/complex/algorithms/align_pair.h | 88 ++++++++++++++++++++--------- 1 file changed, 61 insertions(+), 27 deletions(-) diff --git a/vcg/complex/algorithms/align_pair.h b/vcg/complex/algorithms/align_pair.h index 8fbc0d4b..f7803a98 100644 --- a/vcg/complex/algorithms/align_pair.h +++ b/vcg/complex/algorithms/align_pair.h @@ -88,7 +88,7 @@ public: //bool Import(const char *filename) { Matrix44d Tr; Tr.SetIdentity(); return Import(filename,Tr);} //bool Import(const char *filename, Matrix44d &Tr); - inline bool InitVert(const Matrix44d &Tr) { + inline bool initVert(const Matrix44d &Tr) { Matrix44d Idn; Idn.SetIdentity(); if (Tr != Idn) tri::UpdatePosition::Matrix(*this, Tr); @@ -96,7 +96,7 @@ public: tri::UpdateBounding::Box(*this); return true; } - inline bool Init(const Matrix44d &Tr) { + inline bool init(const Matrix44d &Tr) { Matrix44d Idn; Idn.SetIdentity(); tri::Clean::RemoveUnreferencedVertex(*this); if (Tr != Idn) @@ -143,12 +143,12 @@ public: std::vector I; - double LastPcl50() const + double lastPcl50() const { return I.back().pcl50; } - int LastSampleUsed() const { + int lastSampleUsed() const { return I.back().SampleUsed; } @@ -156,11 +156,11 @@ public: int FixVertNum; int FixFaceNum; - int TotTime() { + int totTime() { return I.back().Time-StartTime; } - int IterTime(unsigned int i) const + int iterTime(unsigned int i) const { const int clock_per_ms = std::max(CLOCKS_PER_SEC / 1000,1); assert(i\n"); fprintf(fp, " Mindist 50ile Hi Avg RMS StdDev Time Tested Used Dist Bord Angl \n"); for (unsigned int qi = 0; qi < I.size(); ++qi) @@ -209,14 +209,14 @@ public: I[qi].MinDistAbs, I[qi].pcl50, I[qi].pclhi, I[qi].AVG, I[qi].RMS, I[qi].StdDev, - IterTime(qi), + iterTime(qi), I[qi].SampleTested, I[qi].SampleUsed, I[qi].DistanceDiscarded, I[qi].BorderDiscarded, I[qi].AngleDiscarded); fprintf(fp, "\n"); } // Restituisce true se nelle ultime iterazioni non e' diminuito // l'errore - inline bool Stable(int lastiter) + inline bool stable(int lastiter) { if (I.empty()) return false; @@ -304,7 +304,7 @@ public: double MaxScale; MatchModeEnum MatchMode; SampleModeEnum SampleMode; - void Dump(FILE *fp,double BoxDiag); + //void Dump(FILE *fp,double BoxDiag); }; @@ -334,7 +334,10 @@ public: Stat as; Param ap; ErrorCode status; - bool IsValid() {return status==SUCCESS;} + bool IsValid() + { + return status==SUCCESS; + } double err; float area; // the overlapping area, a percentage as computed in Occupancy Grid. @@ -345,12 +348,11 @@ public: bool operator == (const Result & rr) const {return (err==rr.err);} bool operator != (const Result & rr) const {return (err!=rr.err);} - std::pair ComputeAvgErr() const + std::pair computeAvgErr() const { double sum_before=0; double sum_after=0; - for(unsigned int ii=0;ii - void ConvertMesh(MESH &M1, A2Mesh &M2) + void convertMesh(MESH &M1, A2Mesh &M2) { tri::Append::MeshCopy(M2,M1); } template < class VERTEX > - void ConvertVertex(const std::vector &vert1, std::vector &vert2, Box3d *Clip=0) + void convertVertex(const std::vector &vert1, std::vector &vert2, Box3d *Clip=0) { - vert2.clear(); typename std::vector::const_iterator vi; A2Vertex tv; @@ -400,13 +432,15 @@ public: vert2.push_back(tv); } } - else - for(vi=vert1.begin();vi &vert, int SampleNum, AlignPair::Param::SampleModeEnum SampleMode); @@ -463,7 +497,7 @@ res.as.Dump(stdout); bool ret=Align(UG, UGV, in, res.Tr, res.Pfix, res.Nfix, res.Pmov, res.Nmov, res.H, res.as); - res.err=res.as.LastPcl50(); + res.err=res.as.lastPcl50(); res.status=status; return ret; }