#### Archived

This topic is now archived and is closed to further replies.

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

## Recommended Posts

hello, How would I normalize a 1d (that''s right, one diemsional) vector so that as distance aproaches 0, scale aproaches 2? In other words, I need to take a distance between two points (1 d) and based on that distance create a scaling factor for the size of an object given the above relation. I haven''t taken algebra in quite some time, as you can tell.... Peace, Thomas

##### Share on other sites
Well, if your vector is truly 1D, then the scaling factor is simply the reciprocal of the magnitude.

EDIT: tho I have to admit, I'm not sure what you mean by "as length approaches 0, scale approaches 2". Why 2?

How appropriate. You fight like a cow.

[edited by - sneftel on May 5, 2003 4:37:25 PM]

##### Share on other sites
A point is at least 2D, having two dimensions: X and Y. It can also be 3D, having X,Y and Z.
So something is wrong with you question I guess...

¬NeWX

##### Share on other sites
what do you mean by reciprocal of the magnitude? And I never said that I want to normalize a point. Just a vector. A vector is just another way of representing a number (or set there of).

Here's the thing:
I'm trying to re-create the "morphing" effect on the mac osx dock. What I want, is that as the distace from the mouse to the icon aproaches zero, I want it to be scalled by a value that aproaches 2. So, I need to normalize my distance, so that I can figure an apropriot scaling factor.

Peace,
Thomas

[edited by - CrackMonkeyT on May 5, 2003 4:47:59 PM]

##### Share on other sites
quote:
Original post by NeWX
A point is at least 2D, having two dimensions: X and Y. It can also be 3D, having X,Y and Z.
Uh? Why not 1D, having just X? Or go wild, 4D, having X,Y,Z and e.g. T.

##### Share on other sites
scale = 2^(1/(K*distance+1))

Play with K.
smaller K(K<1) is gonna give u a smoother transition.
I think.

##### Share on other sites
scale = 2^(1/(K*distance+1))

Play with K.
smaller K(K<1) is gonna give u a smoother transition.
I think.

##### Share on other sites
take the distance from an icon to a point (x,y).
Then the size of the icons are 2-op(dist), where op can be any operation,i.e., sqrt(...). The distance between two icons are 1.

[edited by - kspbergstrom on May 7, 2003 5:06:41 AM]

##### Share on other sites
quote:
Original post by CrackMonkeyT
what do you mean by reciprocal of the magnitude? And I never said that I want to normalize a point. Just a vector. A vector is just another way of representing a number (or set there of).

Not really. A vector is a magnitude and direction. Representing a vector as a ''set of numbers'' isn''t strictly necessary to the concept of a ''vector.''

quote:

Here''s the thing:
I''m trying to re-create the "morphing" effect on the mac osx dock. What I want, is that as the distace from the mouse to the icon aproaches zero, I want it to be scalled by a value that aproaches 2.

So you want a function f(x) such that the limit as x approaches zero is 2? Do you want it to approach from the minus side or the positive side?

Note that you can come up with many other functions that have the same property. The AP has a nice once. I''m still not sure exactly what you''re asking for, so I can''t be more specific, sorry.

quote:

So, I need to normalize my distance, so that I can figure an apropriot scaling factor.

Normalizing a vector means you maintain the direction while converting to a unit magnitude. This doesn''t sound like what you''re trying to do.

##### Share on other sites
quote:

Not really. A vector is a magnitude and direction. Representing a vector as a ''set of numbers'' isn''t strictly necessary to the concept of a ''vector.''

Actually a "vector" is an "n-tuple" or a set of n values, which don''t even have to be real numbers! The concept of "a magnitude and a direction" (polar co-ordinates) is only applicable in R^2, that is vectors that are pairs of real numbers. Even if you go to R^3 (1 extra co-ordinate per vector), you require more information than a single magnitude and direction.

Again, your definition of "normalizing" is only applicable to real inner product spaces as the definition of "direction" only makes sense here... not a big issue really as in game programming you rarely consider otherwise, but I just figured I''d generalize the definition for any interested parties And I agree, "normalizing" isn''t really what you mean here...

To respond more directly to the question though, you''ll need to decide more information about exactly how you want your effect to be before we can decide on the specific equation. You''ve basically given us that "lim(x->0+) [f(x)] = 2" or maybe as far as f(0) = 2.

Now you need to decide things like:
- Where do you want the scaling to begin? What is the minimum scaling factor? 1? At what distance does that occur? Beyond that distance is it just set to 1?
- What "shape" do you want the scaling curve in the valid range (the above maximum distance value, to however close you want to go to 0... if you''re talking pixels, probably 1)? Linear? Quadratic (parabolic)? Reciprocal (hyperbolic)? Higher-order polynomial (arbitrary shape, even based on control points if you like)?

My point is that before that question can be answered, you really need to decide more explicitly what you want. Then we can go about designing "the perfect function" so that you can effectively have f(d) = what you want.

1. 1
2. 2
Rutin
23
3. 3
JoeJ
20
4. 4
5. 5

• 27
• 40
• 23
• 13
• 13
• ### Forum Statistics

• Total Topics
631737
• Total Posts
3001944
×