Solved

# Vector scaling to a specific value

Posted on 2008-11-01
703 Views
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?
0
Question by:sph2105
[X]
###### Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

• Help others & share knowledge
• Earn cash & points
• Learn & ask questions
• 3

LVL 19

Expert Comment

ID: 22860173
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

LVL 19

Expert Comment

ID: 22860195
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 Comment

ID: 22860302
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

LVL 19

Accepted Solution

BrianGEFF719 earned 500 total points
ID: 22860337
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

## Featured Post

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

### Suggested Solutions

Title # Comments Views Activity
Probability 2 81
Vertical and Horizontal Shift 4 147
Expected time for an event 13 63