Archived

This topic is now archived and is closed to further replies.

Plotting quadrics

This topic is 5167 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi everybody, I''d like to plot quadrics with OpenGl. Could anybody please give me some hints how to do this? Some pictures of quadrics can be found at http://www.geom.uiuc.edu/docs/reference/CRC-formulas/node61.html Bye Stefan

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Quadrics in opengl are limited. They are mainly housed in the glut library and are of the form sphere, cylinder, torus. The library functions do not cover the full range of quatrics. At least to the best of my knownledge it doesn''t.

To draw real quadrics you could try to build a nurbs surface but I think that would only complicate the process more.

I would try drawing them by hand. I don''t know completely how do do this because in my applications I only approximate drawing quadrics. All of my information is derived from Mike Garland''s papers and source code on his web site.

Here is some information which may be helpful: see Mike Garland''s site for more info
1. represent the quadric in matrix form.
2. retrieve the eigenvectors for the matrix. The Eigenvectors for the matrix tell you the major axis(<-plural however you spell that) for the quadric.
3. you have to figure out how to tell between a sphere a saddle/ cylinder/ whatever else. I think the process of extracting the eigenvectors tells you this information but I do not know what to tell you.

There is also a process of drawing quadrics called shell splatting. My understanding of this is rudimentary but here is how I see it. A sphere represents the basic quadric meaning the axis(plural) are uniform and the eigenvectors / eigenvalues are equal. Shell splatting uses the eigenvectors taken from the quadric matrix and builds a modelview matrix which will distort the sphere. This only works for some object because you have to invert then eigenvector matrix and for some shapes like a cylinder the eigenvector matrix is uninvertable.

This is probably not that helpful I do not fully understand the process myself. There is probably an easier way but check out Mike Garland''s site.

Share this post


Link to post
Share on other sites
Hmm, you would have to do them manually for most of those quadratics.

Just define the resolution, and range you want. For example with a resolution of 1 and a range of +- 20 you would have it 40 units wide and in increments of 1 unit.

What you do is just make a few nested loops that will evaluate each point for a given y. Because of this you will have to solve each equation for y. Also note that because often its y^2 you will have to account for the +- you get when solving for y. That way you will have to do this twice, once for the + once for the -. You will want to store the results in 2 matrices. Also keep in mind you will have to have a error testing as there won’t be a value for every y.

So now you have your 2 3d matrices with 1 y value per x,y cords. New all you have to do is draw the resulting mesh using quads or triangles.

Any flaws with this? I''ve done this with a 2d quadratic grapher but never 3d.

Good luck and feel free to ask questions if you want to try this.

Share this post


Link to post
Share on other sites
stemmel,

if you are still interested in this... I read your post (& the replies thus far) & tried to plot the coolest lookin quadric on that page of yours... the hyperbolic something or other... it looks really good in OpenGL, I have the source code & some pointers if you want to try the other shapes. e-mail me.

luke_miklos@yahoo.com

Share this post


Link to post
Share on other sites