Advertisement

Scale a vector about an arbitrary axis.

Started by April 26, 2003 07:08 PM
1 comment, last by Abob 21 years, 9 months ago
Dose anyone know how to scale a 2D vector about an arbitrary axis? Like the vector (10, 10) scaled about the axes (1, 0) by 2 = (20, 10), only I need to be able to scale it on any axis, not just the x or y. This should be a simple problem, but I can’t figure out how to do it. Thanks for any help.
Arrg!!
I think you can solve your problem by first rotating your vector by an angle A, then scaling, then rotating back by -A. You can find the value of A by doing some trig/geometry; determine how much you''d need to rotate the xy axes to make them equivalent to your other axes. Tell me if you want some more information.
You know what I never noticed before?
Advertisement
Suppose you want to scale vector v on the axis a by a factor k

(a is normalized)

Project v on a :
v = (a*v)*a + (v-(a*v)*a)
Then scale the part colinear to a
newv = k*(a*v)*a + (v-(a*v)*a)
You''re done

This topic is closed to new replies.

Advertisement