From 1380ee7712b3a941148465f505fd4b18d35fc029 Mon Sep 17 00:00:00 2001 From: cignoni Date: Fri, 10 Dec 2004 01:03:15 +0000 Subject: [PATCH] added an inline and removed loggng --- vcg/complex/local_optimization.h | 15 ++++----------- vcg/math/quadric.h | 23 +++++++++++++++++++++++ 2 files changed, 27 insertions(+), 11 deletions(-) diff --git a/vcg/complex/local_optimization.h b/vcg/complex/local_optimization.h index 047c7474..e37d0c09 100644 --- a/vcg/complex/local_optimization.h +++ b/vcg/complex/local_optimization.h @@ -22,6 +22,9 @@ ****************************************************************************/ /**************************************************************************** $Log: not supported by cvs2svn $ + Revision 1.11 2004/12/03 21:14:39 ponchio + Fixed memory leak... + Revision 1.10 2004/11/23 10:37:17 cignoni Added a member with a cached copy of the floating Priority() value inside the HeapElem to optimize operator< in heap updating operator @@ -210,7 +213,7 @@ public: /// STL heap has the largest element as the first one. /// usually we mean priority as an error so we should invert the comparison - const bool operator <(const HeapElem & h) const + inline const bool operator <(const HeapElem & h) const { return (pri < h.pri); //return (locModPtr->Priority() < h.locModPtr->Priority()); @@ -238,9 +241,6 @@ public: { start=clock(); nPerfmormedOps =0; -#ifdef __SAVE__LOG__ - FILE * fo=fopen("log.txt","w"); -#endif // __SAVE__LOG__ while( !GoalReached() && !h.empty()) { std::pop_heap(h.begin(),h.end()); @@ -253,10 +253,6 @@ public: // check if it is feasible if (locMod->IsFeasible()) { -#ifdef __SAVE__LOG__ - fprintf(fo,"%s",locMod->Info(m)); -#endif // __SAVE__LOG__ - nPerfmormedOps++; locMod->Execute(m); locMod->UpdateHeap(h); @@ -265,9 +261,6 @@ public: //else printf("popped out unfeasible\n"); delete locMod; } -#ifdef __SAVE__LOG__ - fclose(fo); -#endif // __SAVE__LOG__ return !(h.empty()); } diff --git a/vcg/math/quadric.h b/vcg/math/quadric.h index b9977a21..7cc56a8d 100644 --- a/vcg/math/quadric.h +++ b/vcg/math/quadric.h @@ -24,6 +24,9 @@ History $Log: not supported by cvs2svn $ +Revision 1.3 2004/10/25 16:23:51 ponchio +typedef ScalarType ScalarType; was a problem on g++ + Revision 1.2 2004/10/25 16:15:59 ganovelli template changed @@ -224,6 +227,26 @@ bool Minimum(Point3 &x) return Gauss33(&(x[0]),C); } + +bool Minimum(Point3 &x) const +{ + ScalarType c0=-b[0]/2; + ScalarType c1=-b[1]/2; + ScalarType c2=-b[2]/2; + + ScalarType t125 = a[4]*a[1]; + ScalarType t124 = a[4]*a[4]-a[3]*a[5]; + ScalarType t123 = -a[1]*a[5]+a[4]*a[2]; + ScalarType t122 = a[2]*a[3]-t125; + ScalarType t121 = -a[2]*a[1]+a[0]*a[4]; + ScalarType t120 = a[2]*a[2]; + ScalarType t119 = a[1]*a[1]; + ScalarType t117 = 1.0/(-a[3]*t120+2*a[2]*t125-t119*a[5]-t124*a[0]); + x[0] = -(t124*c0+t122*c2-t123*c1)*t117; + x[1] = (t123*c0-t121*c2+(-t120+a[0]*a[5])*c1)*t117; + x[2] = -(t122*c0+(t119-a[0]*a[3])*c2+t121*c1)*t117; + return true; +} // determina il punto di errore minimo vincolato nel segmento (a,b) bool Minimum(Point3 &x,Point3 &pa,Point3 &pb){ ScalarType t1,t2, t4, t5, t8, t9,