PDA

View Full Version : need help with my maths

Bra'Tac
05-22-2001, 12:21 AM
I want to know if a face is visible.

I have the normal at the faces (at the begining) and I only translate along Oz (in global coordinates) or rotate around Ox and Oy (in local coordinates).

I must calcute (view vector).(face normal) but how can I obtain the face normal ?

Gavin
05-22-2001, 12:34 AM
If you know the vertex's of the face...
(v1 - v2) . (v3-v2)

i.e. the dotproduct of two of the faces (polygons) edges (vectors).

gav

kistompika
05-22-2001, 01:49 AM
You can transform your face normals too to global coordinates.

Only the affine part of your transformation matrix should be applied to the normal(upper left 3*3 part of a 4*4 matrix).

If you do not use matrices, you should apply only rotation to your normal, around the origin of the global coordinate system.

kistompika
05-22-2001, 01:54 AM

I don't want to criticise him http://www.opengl.org/discussion_boards/ubb/smile.gif,
but his method is just not correct.
A dot product returns a scalar not a vector.
You can obtain the normal by calculating

(v1-v2)x(v3-v2)

(cross product), but transforming is more efficient(generally).

Gavin
05-22-2001, 01:57 AM
haha, sorry, and I was only doing it yesterday.......
Just been doing angles between vectors and that threw me off....