Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Professional Discussion / how calculate the normal of a vertex on a volume

Author
Message
delorme
23
Years of Service
User Offline
Joined: 5th Apr 2003
Location:
Posted: 23rd Jun 2003 21:19
Hi

how calculat the normal of a vertex on a volume ( sphere, cube ....)

i find the follow code

xn=(y2-y1)*(z3-z1)-(z2-z1)*(y3-y1)
yn=(z2-z1)*(x3-x1)-(x2-x1)*(z3-z1)
zn=(x2-x1)*(y3-y1)-(y2-y1)*(x3-x1)

But it's work correctly one once on two.


Thank's for your help
Sorry for my english,
IanM
Retired Moderator
23
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 24th Jun 2003 00:03
What you have there is the way to calculate the normal for a plane or face.

The way to calculate the vertex normal is to calculate the face normals for all faces that touch the vertex and add them together.

Here's a couple of links for explanation:
http://www.scs.leeds.ac.uk/cuddles/hyperbks/Rendering/Background/vector_manip.html
http://nate.scuzzy.net/docs/normals

Login to post a reply

Server time is: 2026-07-17 22:12:56
Your offset time is: 2026-07-17 22:12:56