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?

Experts Exchange Solution brought to you by

Enjoy your complimentary solution view.

Get every solution instantly with premium.
Start your 7-day free trial.

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.

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)

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.

Sorry about that

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.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Math / Science

From novice to tech pro — start learning today.

Experts Exchange Solution brought to you by

Enjoy your complimentary solution view.

Get every solution instantly with premium.
Start your 7-day free trial.

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?