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)
glBegin(GL_POINTS);
glColor3f(0.0f,1.0f,0.0f);
//do the rendering
//hmm... figure out some iteration model..
//perhaps from surrounding points some interpolation
//do the rendering, i.e., take incident triangles
//and sample points from them and project
//these points on the obtained surface
//FOR CYCLE BEGIN
Vector3F point;
//say we have x,y,z -> point
//adapt the point
GetClosestPointOnQuadricSurface(point,surf_coeff);
//display the point
glVertex3f(point.x,point.y,point.z);
//list of neigs triangle IDs
std::vector<size_t> neigsT;
ulm::getVertexIncidentTriangles(*this,VertexID,neigsT);
//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
glEnd();
......@@ -347,12 +374,15 @@ void keyboard(unsigned char key, int mx, int my)
case 'M':
showWholeMesh^=true;
glutPostRedisplay();
break;
case 'V':
showVertexSurface^=true;
glutPostRedisplay();
break;
case 'Q':
showQuadricSurface^=true;
glutPostRedisplay();
break;
case 'i': //inspect a cell
......
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