Advertisement Jump to content
Sign in to follow this  

Unit Vector

This topic is 1021 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

With this overly-simplified 2d example  of x, y(4,3)

Using the unit vector maths formula x/|distance|, y/|distance| the unit vector is v(0.8, 0.6)

this can further be reduced to v(0.4, 0.3)

For the sake of working pixels (bitmaps) where one can move 1 pixel in x for every fraction in y (or vice versa), I calculated the direction with another method which yielded v(1, 0.75)


Since this particular result using the popular formula is still reducible, should it still be regarded as the true unit vector ? If reducibility doesn't remove it from being accurately used as the unit vector then why not V(1 , 075)?


I ask because i'm currently working with bitmaps and the directions with pixels in the form of ratio 1 pixel : 0.xx pixel is very advantageous (and convenient) but i'm wondering if I would have less accurate result as a result (Oops :()

Share this post

Link to post
Share on other sites

(0.8, 0.6) is a unit vector, because its length is 1. That's easy enough to verify.

(0.4, 0.3) is clearly half as long as the previous vector, so it is not a unit vector. Unit vectors are not fractions. You do not "reduce" them. You "normalize" a vector to get a unit vector. If you normalize (0.4, 0.3), you end up with (0.8, 0.6) again.

Great answer. thanks

I had found v(1, 0.75) convenient, but like you said it wouldn't scale accurately, with my experience i should have known these stuff but my brain seems to be getting very lazy these days. I think i'm working too long hours :wub:

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using, you agree to our community Guidelines, Terms of Use, and Privacy Policy. is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!