Normals

Started by
1 comment, last by RonnyK 22 years, 5 months ago
What is a normalized vector, why are they used? When the direction for the normal is entered, should the position be relative to the 0, 0, 0 co-ordinate, or does it work in some completly different way? And umm.... do I have to know anything else to get those normals working?
Advertisement
Vectors are a direction, not a coordinate - so they are always relative to 0,0,0. Normalised vectors are a vector divided by its length - ie. the normalised vector has a length of 1. Use pythagoras to do this. For example, if you have a 2d vector vy,vx to get the length you have to do this: l = sqrt((vy*vy)+(vx*vx)). To normalise the vector, you just do: vx/=l; vy/=l;

Hope this helps!
code snippet.

    D3DXVECTOR3 normal;  D3DXVECTOR3 polyvecs[3];  // to normalise  D3DXVECTOR3 vec1,vec2;   vec1 = polyvecs[1] - polyvecs[0];   vec2 = polyvecs[2] - polyvecs[0];   // cant remember the actual function,   // its just a simple cross product.   D3DCrossProduct(normal,vec1,vec2);   // normalise in the sense to remove anomolies.   Normalise(normal);  




{ Stating the obvious never helped any situation !! }

This topic is closed to new replies.

Advertisement