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

Finished rendering of the surface... very likely has some error!

parent 9189cf69
No related branches found
No related tags found
No related merge requests found
...@@ -155,20 +155,47 @@ void ActiveMesh::displayQuadricSurface(void) ...@@ -155,20 +155,47 @@ void ActiveMesh::displayQuadricSurface(void)
glBegin(GL_POINTS); glBegin(GL_POINTS);
glColor3f(0.0f,1.0f,0.0f); glColor3f(0.0f,1.0f,0.0f);
//do the rendering //do the rendering, i.e., take incident triangles
//hmm... figure out some iteration model.. //and sample points from them and project
//perhaps from surrounding points some interpolation //these points on the obtained surface
//FOR CYCLE BEGIN //list of neigs triangle IDs
Vector3F point; std::vector<size_t> neigsT;
//say we have x,y,z -> point ulm::getVertexIncidentTriangles(*this,VertexID,neigsT);
//adapt the point
GetClosestPointOnQuadricSurface(point,surf_coeff);
//display the point
glVertex3f(point.x,point.y,point.z);
//FOR CYCLE BEGIN
//over all triangles
for (unsigned int t=0; t < neigsT.size(); ++t)
{
//determine triangle vertices
const Vector3FC& v1=Pos[ID[3*neigsT[t] +0]];
const Vector3FC& v2=Pos[ID[3*neigsT[t] +1]];
const Vector3FC& v3=Pos[ID[3*neigsT[t] +2]];
//sweep (coarsely!) across current triangle
for (float c=0.1f; c <= 0.9f; c += 0.1f)
for (float b=0.1f; b <= (0.9f-c); b += 0.1f)
{
float a=1.0f -b -c;
Vector3F point=a*v1;
point+=b*v2;
point+=c*v3;
//backup...
Vector3F origPoint(point);
//adapt the point
std::cout << "dist=" <<
GetClosestPointOnQuadricSurface(point,surf_coeff);
//display the point
glVertex3f(point.x,point.y,point.z);
std::cout << "(" << origPoint.x << "," << origPoint.y << "," << origPoint.z
<< ") -> ("
<< point.x << "," << point.y << "," << point.z << ")\n";
}
}
//FOR CYCLE END //FOR CYCLE END
glEnd(); glEnd();
...@@ -347,12 +374,15 @@ void keyboard(unsigned char key, int mx, int my) ...@@ -347,12 +374,15 @@ void keyboard(unsigned char key, int mx, int my)
case 'M': case 'M':
showWholeMesh^=true; showWholeMesh^=true;
glutPostRedisplay();
break; break;
case 'V': case 'V':
showVertexSurface^=true; showVertexSurface^=true;
glutPostRedisplay();
break; break;
case 'Q': case 'Q':
showQuadricSurface^=true; showQuadricSurface^=true;
glutPostRedisplay();
break; break;
case 'i': //inspect a cell case 'i': //inspect a cell
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment