# Quick math question...

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

## Recommended Posts

Here's an easy one, and I'm drawing a blank and can't seem to figure it out... First off, I have a 2d normalized vector. Just for simplicity's sake, let's say it's (0.25, 0.75). What I want to do is turn that (0.75) into (1.00) and turn (0.25) into whatever would allow the first number to be (1.00) but still point in the same direction... Hard to explain, but basically I want to scale the vector to allow the larger (or smaller, if the 'larger' number is negative) number to be 'one' (or 'negative one'). So, if the vector was (0.33, 0.66), I'd want it to end up being (x.x, 1.0). If the original vector was (-0.2, -0.8), I'd want it to end up being (-x.x, -1.0). If the original vector was (-0.6, 0.4), I'd want it to end up being (-1.0, y.y)... I apologize if this doesn't make any sense at all, because I really stink at explaining stuff! But if you sorta muck through what I'm trying to explain, maybe an equasion you know will come to mind. Thanks in advance for the help, I really appreciate it! :)

##### Share on other sites
if your vector is [x,y] , if you scale it by 1/y , you'll get
[x,y]*(1/y) = [x*(1/y) , y*(1/y)] = [x/y,1.0]

##### Share on other sites
Its really easy. You're just scaling both components by the same amount. Given a 2D vector (x, y), if you want y to be 1.0, the scaled vector is:

scaled vector = (x/fabsf(y), y/fabsf(y))              = (x/fabsf(y), 1.0 or -1.0);

If you want the *larger* of x or y to become 1/-1, then do this:

multiplier = 1.0/(max(fabsf(x), fabsf(y)));scaled vector = (x * multiplier, y * multiplier);

##### Share on other sites

these are not normalize vectors as long as I know!!!

and if you want your vector to be (x.x, 1.0), it doesn't have the choice to be (0.0, 1.0)

maybe you should revise your math!!

##### Share on other sites
Quote:
 Original post by cybergthese are not normalize vectors as long as I know!!!

Depends on which norm you're talking about. When talking about the L1-norm, they are normalized. The L1-norm is the sum of the absolute values of all components.
Quote:
 and if you want your vector to be (x.x, 1.0), it doesn't have the choice to be (0.0, 1.0)

Again, that depends on the type of norm used. The Linfinity-norm is the maximum value of all components in the vector, so normalizing the vector with respect to the Linfinity-norm is done as the two previous posters said.

Quote:
 maybe you should revise your math!!

##### Share on other sites
Dang y'all are quick! Thanks for all the info, I'll play around with those ideas and see if I can get it all to work.

As far as increasing my knowledge of vector math and such, what field of math (algebra, geometry, trig, etc) should I study?

Thanks again! :)

##### Share on other sites
Quote:
 Original post by DookieDang y'all are quick! Thanks for all the info, I'll play around with those ideas and see if I can get it all to work.As far as increasing my knowledge of vector math and such, what field of math (algebra, geometry, trig, etc) should I study?Thanks again! :)

i think, all fields. But you have to do algebra and some geometry first and only then do trig...

##### Share on other sites
Quote:
 Original post by cybergand if you want your vector to be (x.x, 1.0), it doesn't have the choice to be (0.0, 1.0)

That's a true statement only if the result vector also needs to be normalized. (under the standard definition of "normalized")

1. 1
2. 2
Rutin
21
3. 3
JoeJ
18
4. 4
5. 5
gaxio
12

• 14
• 40
• 23
• 13
• 13
• ### Forum Statistics

• Total Topics
631724
• Total Posts
3001897
×