Results 1 to 6 of 6

Thread: DirectX8 - normalised vectors

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Jul 2002
    Posts
    118

    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

  2. #2
    PowerPoster Fox's Avatar
    Join Date
    Jan 2000
    Location
    *afk*
    Posts
    2,088
    Depending on the 'VUp' vector setting for your world.. this might be true.

  3. #3
    Frenzied Member Zaei's Avatar
    Join Date
    Jul 2002
    Location
    My own little world...
    Posts
    1,710
    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.

  4. #4

    Thread Starter
    Lively Member
    Join Date
    Jul 2002
    Posts
    118
    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

  5. #5
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594
    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.

  6. #6
    Frenzied Member Zaei's Avatar
    Join Date
    Jul 2002
    Location
    My own little world...
    Posts
    1,710
    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
  •  



Click Here to Expand Forum to Full Width