calculating normals of quads

i know how to calculate normals for triangles, but how can I do this for quads? Any one an idea?

Diapolo

Exactly the same way.
Just use the first 3 points to calulate the normal from, and you’re all set.

John

Only if the four vertices of the quad lie on the same plane you can use any 3 of the 4 points.

How can I calculate them, if they are not on one plane?

if the quad is not a plane, but it should be a single surface the same, then it is better known as a “patch”: something like curved surfaces.
for a patch, there’s not a unique normal.

but if the quad has to be considered not to be curved, you have to split it in two triangles:

A B
±-----+
|\ |
| \ |
| \ |
| \ |
| \ |
| |
±-----+
C D

then, you’ll have two planar surfaces, hence two normals for that quad.

first, calculate the normal for triangle ADB, then for triangle ACD.

Dolo//\ightY

[This message has been edited by dmy (edited 03-24-2000).]

One other question, is it better to use triangles instead of quads? Any difference in speed (which one is better to handle by the graphic chip)?

Diapolo

I think it’s better to send triangles to OpenGL, because I think all poly’s get converted to triangles anyway before they are sent to the card. (Someone correct me if I’m wrong). Also, with triangles you a) never have to worry about non-coplanar polys, which don’t render correctly, and b) avoid some weird OpenGL clipping/lighting artifacts that sometimes happen when you use quads.

Also, you can use triangle strips and fans, which are fast