Skip to content
Snippets Groups Projects
Commit 1ba7c1b5 authored by Vladimír Ulman's avatar Vladimír Ulman
Browse files

Quadric surface now uses eigenvector corresponding to smallest non-negative eigenvalue.

parent 4fcb0ce0
No related branches found
No related tags found
No related merge requests found
......@@ -492,8 +492,12 @@ int ActiveMesh::CalcQuadricSurface_Taubin(const int vertexID,
//w holds eigenvalues in ascending order
//our result c[1]...c[9] is the eigenvector
//corresponding to the smallest eigenvalue, so the first eigenvector
//
//corresponding to the smallest non-negative eigenvalue, so the j-th eigenvector
int j=0;
while (j < 9 && w[j] < 0.f) ++j;
//have we found some non-negative eigenvalue?
if (j == 9) return(-9999);
//also:
//the last missing coefficient c[0] we will determine by submitting
//the given input vertex to the algebraic expresion of the surface
......@@ -501,9 +505,11 @@ int ActiveMesh::CalcQuadricSurface_Taubin(const int vertexID,
coeffs[0]=0.f;
for (int i=0; i < 9; ++i)
{
coeffs[i+1]=M[i];
coeffs[0]-=coeffs[i+1]*V[i+1];
coeffs[i+1]=M[j*9 +i]; //copy eigenvector
coeffs[0]-=coeffs[i+1]*V[i+1]; //determine c[0]
}
std::cout << "w(j)=" << w[j] << ", j=" << j << "\n";
return 0;
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment