PDA

View Full Version : calculating normals of quads



Diapolo
03-22-2000, 11:26 AM
i know how to calculate normals for triangles, but how can I do this for quads? Any one an idea?

Diapolo

Sjonny
03-22-2000, 12:21 PM
Exactly the same way.
Just use the first 3 points to calulate the normal from, and you're all set.

John

Swan
03-24-2000, 04:45 AM
Only if the four vertices of the quad lie on the same plane you can use any 3 of the 4 points.

Diapolo
03-24-2000, 06:49 AM
How can I calculate them, if they are not on one plane?

dmy
03-24-2000, 07:00 AM
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).]

Diapolo
03-24-2000, 09:49 AM
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

jyk
03-24-2000, 08:33 PM
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 http://www.opengl.org/discussion_boards/ubb/smile.gif