|
-
Sep 5th, 2002, 11:36 PM
#1
Thread Starter
Lively Member
DirectX8 - normalised vectors
Hi just a quick check on my understanding of something if thats cool guys - normalised vectors,
(0,1,0) - up
(0,-1,0) - down
(-1,0,0) - left
(1,0,0) - right
(0,0,1) - into the screen
(0,0,-1)-towards me
Correct?
I take it u can use decimals but they have to add up to 1 right?
Cheers
Dan
-
Sep 6th, 2002, 03:23 AM
#2
PowerPoster
Depending on the 'VUp' vector setting for your world.. this might be true.
-
Sep 6th, 2002, 06:10 AM
#3
Frenzied Member
Not add to one, the length of the vector must be one. For instance, (0.5, 0, 0.5) is NOT normalized. Now, the length of a vector is:
Code:
sqr(x^2 + y ^ 2 + z^2)
To normalize the vector, simpy divide each component by the vector's length.
You can also use the D3DX functions for this stuff.
Z.
-
Sep 6th, 2002, 06:34 AM
#4
Thread Starter
Lively Member
does d3dxvec3normalize do the job 4 u if u pass it (0.5,0,0.5) for instance?
PS I assummed the world up vector was the default (0,1,0) earlier
Cheers
Dan
-
Sep 6th, 2002, 06:36 AM
#5
Yes.
The D3DX* functions also have the advantage that they'll use cpu optimizations (e.g. MMX), whereas code you write might not (depending on compiler and settings).
All the buzzt
 CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.
-
Sep 6th, 2002, 08:07 AM
#6
Frenzied Member
Righto, CornedBee =).
Any vector where one direction is 1, and the others are 0, is normalized.
Z.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|