archondas

01-14-2005, 08:26 PM

I need to be able to draw polynomial surfaces but I have

not found a way to do it with OpenGL. The problem is as

follows:

Given the polynomial: f(x,y) = sum(a_ij*x^i*y^j) i,j = 1,2,...,n

example: f(x,y) = 2.0*x^2 + y^2 +3*x*y + x + 2.0*y + 1.0

I want to be able to draw the 3D surface over a triangular domain:

example: I have the 2D triangle T2=(x1,y1, x2,y2, x3,y3).

If I say something like:

glBegin(GL_TRIANGLES)

glVertex3f(x1,y1,f(x1,y1));

glVertex3f(x2,y2,f(x2,y2));

glVertex3f(x3,y3,f(x3,y3));

glEnd();

I will see the the 3D triangle T3 whose vertices are

(xi,yi,f(xi,yi)) i=1,2,3 and all the points in the

2D triangle T2 have z coordinate such that it

lies inside the plane of the the triangle T3.

What I want to change is that each point P2(xp,zp) inside the

triangle T2 is mapped to a point P3(xp,yp,zp) where zp is given

by: zp = f(xp,yp).

How can I achieve that with OpenGL?

Thanks in advance!

not found a way to do it with OpenGL. The problem is as

follows:

Given the polynomial: f(x,y) = sum(a_ij*x^i*y^j) i,j = 1,2,...,n

example: f(x,y) = 2.0*x^2 + y^2 +3*x*y + x + 2.0*y + 1.0

I want to be able to draw the 3D surface over a triangular domain:

example: I have the 2D triangle T2=(x1,y1, x2,y2, x3,y3).

If I say something like:

glBegin(GL_TRIANGLES)

glVertex3f(x1,y1,f(x1,y1));

glVertex3f(x2,y2,f(x2,y2));

glVertex3f(x3,y3,f(x3,y3));

glEnd();

I will see the the 3D triangle T3 whose vertices are

(xi,yi,f(xi,yi)) i=1,2,3 and all the points in the

2D triangle T2 have z coordinate such that it

lies inside the plane of the the triangle T3.

What I want to change is that each point P2(xp,zp) inside the

triangle T2 is mapped to a point P3(xp,yp,zp) where zp is given

by: zp = f(xp,yp).

How can I achieve that with OpenGL?

Thanks in advance!