Vector scaling to a specific value

Posted on 2008-11-01
Last Modified: 2012-06-27
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?
Question by:sph2105
  • 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?
LVL 19

Expert Comment

ID: 22860195
If you have a unit vector, then:

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


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


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

So, given V you're components are:



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.

Sorry about that
LVL 19

Accepted Solution

BrianGEFF719 earned 500 total points
ID: 22860337

let's call the magnitude m.

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


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

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

Featured Post

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Vertical and Horizontal Shift 4 74
sumDigits  challenge 7 60
base64 decode encode 12 96
Geomentry-Fundamental concepts-Angles 3 55
Introduction This question got me thinking... ( Why shouldn't we use Globals? This is a simple question without a simple answer.  How do you explain these concepts to a programmer w…
Lithium-ion batteries area cornerstone of today's portable electronic devices, and even though they are relied upon heavily, their chemistry and origin are not of common knowledge. This article is about a device on which every smartphone, laptop, an…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor ( If you're looking for how to monitor bandwidth using netflow or packet s…
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now