Public Group

# 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.

## 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 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.

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:

• ### What is your GameDev Story?

In 2019 we are celebrating 20 years of GameDev.net! Share your GameDev Story with us.

• 15
• 14
• 46
• 22
• 27
• ### Forum Statistics

• Total Topics
634045
• Total Posts
3015218
×