Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Interface 2, Advanced iOS
Mockup & Code Gen
($9.99)

Make your own iPhone apps
and run them live!
(free)

Pic Frame Dynamo: Photo Editing
($0.99)

Abiliator
($1.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum

View Single Post
Old 06-20-2009, 12:44 AM   #43 (permalink)
gravity
New Member
 
Join Date: Jun 2009
Posts: 21
gravity is on a distinguished road
Default

Quote:
Originally Posted by mauriceatron View Post
Hi gravity,

Perhaps, don't really remember what I was trying to achieve there as that diagram is a bit pointless except that it shows that the normal is perpendicular to a primitive's face. Also, that's a surface normal.

Nah, that section isn't my best work (not that I have any particularly good work). I'll re-write that bit.

Oh, and to answer your question, the normal is the dot product of two of the polygon's edges. That's what gives you the direction, not the right hand rule.

Simon
Well, I thought it was done quite well- all of your tutorials are succinct, but clear, which makes it easy to tackle one subject at a time. Especially when you bring in screenshots for when you pass differ GL_* parameters in as arguments.

The dot product actually does not return a vector, rather a scalar (which is just a number without a direction). Rather the cross product would return a direction, and using the cross product on any two sides of the polygon in order (going in a loop) will follow the right hand rule.

If somebody is reading this and doesn't know what the right hand rule is, here is a quick definition. If you were to curl your four fingers in the direction that the vertices are loaded, the normal would be in the direction of your upright thumb. It's easier to show visually, here is a quick youtube video showing this, it's the magnetic field induced by an electric current, but don't let that confuse you, just imagine the red circles as the shapes being drawn and the arrows represent the vertices, and they are pointing in the direction that they are created in your array. The blue arrow coming out orthogonal (perpendicular in 3d) from your surface is the normal.

You load the vertices in anti-clockwise direction if you were looking down upon the surface of the polygon, which defines the normal as going outwards. The right-hand rule gives you the normal, which is also the axis that glRotate() calls will rotate around (in the same anti-clockwise direction). As well, when you drop a texture onto it, it faces normal side up (or so I've been led to believe).

Last edited by gravity; 06-20-2009 at 12:59 AM.
gravity is offline   Reply With Quote
 

» Advertisements
» Online Users: 429
16 members and 413 guests
baja_yu, buggen, evilmatt10, givensur, Mnashmi, networ, pabloruiz55, pochuang, QuantumDoja, Sami Gh, scubadivingfool, Speed, teebee74, TheStalker, thestojkovic, za1407
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,636
Threads: 94,101
Posts: 402,819
Top Poster: BrianSlick (7,990)
Welcome to our newest member, samdanielblr
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 10:40 AM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.