Advertisement

Unit Vector

Started by March 31, 2016 01:25 AM
1 comment, last by aeroKittens 8 years, 9 months ago

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 :()

can't help being grumpy...

Just need to let some steam out, so my head doesn't explode...

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

You use a unit vector when you are multiplying it in some way with something else, and you purposefully do not want the scale of that vector to influence the result of whatever else is involved. If, say, you're doing a dot product with a velocity, to figure out how quickly something is moving in some specific direction, that direction needs to be a unit vector. Otherwise, some scale will be mixed in with your result.

You didn't really mention what you're doing with this vector, so who knows what it can be? All I can offer is circular reasoning: if you need a unit vector, you better use a unit vector. If you don't need a unit vector, use whatever values you want.

Advertisement


(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:

can't help being grumpy...

Just need to let some steam out, so my head doesn't explode...

This topic is closed to new replies.

Advertisement