Dot Product
The dot product (or scalar product) of two vectors is calculated like this:
if
v1 = (x1, y1, z1) and
v2 = (x2, y2, z2) then
v1.v2 = x1*x2 + y1*y2 + z1*z2
One useful thing you can do with it is determine the angle between two vectors. For this you use the following identity:
cos A = (v1.v2) / (|v1| * |v2|)
The angle between two vectors can be used for things like calculating how certain light sources affect the different polygons in your scene, or determining which polygons are facing ''away'' from the camera and thus don''t need to be drawn.
There''s probably all sorts of stuff that it is used with that I''m missing, but I haven''t done much 3D programming, I just know a lot of the math.
-Ironblayde
Aeon Software
Down with Tiberia!
"All your women are belong to me." - Nekrophidius
if
v1 = (x1, y1, z1) and
v2 = (x2, y2, z2) then
v1.v2 = x1*x2 + y1*y2 + z1*z2
One useful thing you can do with it is determine the angle between two vectors. For this you use the following identity:
cos A = (v1.v2) / (|v1| * |v2|)
The angle between two vectors can be used for things like calculating how certain light sources affect the different polygons in your scene, or determining which polygons are facing ''away'' from the camera and thus don''t need to be drawn.
There''s probably all sorts of stuff that it is used with that I''m missing, but I haven''t done much 3D programming, I just know a lot of the math.
-Ironblayde
Aeon Software
Down with Tiberia!
"All your women are belong to me." - Nekrophidius
"Your superior intellect is no match for our puny weapons!"
Thanks For the Post
Anyway what does the pipe(|) sign mean?
Do you know where the formula of cross product come from? why is it:
out[x] = v1[y] * v2[z] - v1[z]* v2[y];
out[y] = v1[z] * v2[x] - v1[x]* v2[z];
out[z] = v1[x] * v2[y] - v1[y]* v2[x];
Sorry if this is basic maths questions but i am a newbie to 3D maths and only studying GCSE in the UK.
Thanks Alot
Steve
Anyway what does the pipe(|) sign mean?
Do you know where the formula of cross product come from? why is it:
out[x] = v1[y] * v2[z] - v1[z]* v2[y];
out[y] = v1[z] * v2[x] - v1[x]* v2[z];
out[z] = v1[x] * v2[y] - v1[y]* v2[x];
Sorry if this is basic maths questions but i am a newbie to 3D maths and only studying GCSE in the UK.
Thanks Alot
Steve
April 04, 2001 03:02 PM
The pipe signs around the vector mean the length of that vector.
So, if your vector is like this:
VECTOR vec = < 0, 0, 5 >
then |vec| = 5, because the length of the vector is exactly five.
So, if your vector is like this:
VECTOR vec = < 0, 0, 5 >
then |vec| = 5, because the length of the vector is exactly five.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement