Vector scaling to a specific value

Suppose I have a 3D normal vector (x,y,z), and I am given a brightness value V. How can I find the scaling factor such that x^2 + y^2 + z^2 = V^2?
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Commented:
If you know x, y, and z (which it sounds like you do) then "V" is the magnitude of the vector:

V = sqrt[x^2 + y^2 + z^2]

But you've already said that you have a "3D normal vector," which means the magnitude is 1 (and so is V then), so this question doesn't really make sense. Can you please clarify?
0
Commented:
If you have a unit vector, then:

x^2 + y^2 + z^2 = 1

and:

v^2(x^2 + y^2 + z^2) = V^2

So:

V^2 * x^2 + V^2 * y^2 + V^2 * z^2 = V^2

So, given V you're components are:

(Vx,Vy,Vz)

0
Author Commented:
Sorry. Let me clarify.

x,y and z are indeed known,
V is some value that I have precalculated from some other function.

I need to scale x,y and z such that its magnitude (i.e. sqrt(x^2 + y^2 + z^2)) is equal to V.

Another way to look at is, I need x^2 + y^2 + z^2 = V^2.

The magnitude of vector (x,y,z) is not necessarily equal to V. I need to scale x,y and z it so that it IS always equal to V.

0
Commented:
Then:

let's call the magnitude m.

m = sqrt[x^2 + y^2 + z^2]

Then:

You want: Vx/m, Vy/m, Vz/m

Turn the vector into a unit vector then scale by V.
0

Experts Exchange Solution brought to you by