Advertisement

normals?.?

Started by March 18, 2000 03:46 PM
0 comments, last by ECKILLER 24 years, 11 months ago
Can someone give me a way to find the normal for each primitive using my class structure. My fragmented structure: Object: holds an array of verts and an array of primitives that make up object. Primitive: holds indices that make up this primitive. VERTEX: x, y, z coordinates I''ve been coding for quite awhile today and i just can''t think how to get this w/ my class structure. I''d like to have a method in my Primitive class that calculates the normal for that particular primitive, it it possible to do so with just indices and no verts? Ideas and suggestionns please!!?? Thanks ECKILLER
ECKILLER
To calculate the normal you need the vertices. But you could precalculate them and store them in your structure.

To compute the normal for a triangle you need to do this:

Normal = Normalize(CrossProduct(V1 - V0, V2 - V0));

Where V0, V1, and V2 is the vertices for the triangle. Remember that the crossproduct is not commutative, i.e. CrossProduct(A,B) does not equal CrossProduct(B,A).

This topic is closed to new replies.

Advertisement