I believe the square magnitude of a 3 component vector is: (xx + yy + z*z). If you multiply a vector by its square magnitude, is there a function that you can perform to obtain the original vector?
Lets take original vector3 A = (Ax, Ay, Az). The final vector3 B = A*(AxAx + AyAy + Az*Az).
Now, is there a function of B that will return A?
Thank you!
I originally found that the dot product of a Vector with itself equals the vectors square magnitude. However, I also read that the inverse of dot product is impossible because of many solutions. Still, with the two qualifiers (1: the dot product is between a vector and itself, 2: the final vector's components are linearly related to the original vector's corresponding components) there may be enough to restrict to one possible solution.
Get squared magnitude of B
. Note that result SMB
is equal to magnitude of A
in the sixth power (or cube of SMA=squareMagnitude(A)
).
B = bx + by + bx =
ax * SMA + ay * SMA + az * SMA
SMB = B.dot.B = ax^2 * SMA^2 + ay^2 * SMA^2 + az^2 * SMA^2 =
SMA^2*(ax^2 + ay^2 + az^2) =
SMA^2 * SMA =
SMA^3
So you can get squareMagnitude(A)
as cube root of SMB
and extract components of A
SMA = SMB^(1/3) = pow(SBB, 1./3)
ax = bx / SMA
ay = by / SMA
az = bz / SMA
P.S. It is interesting - what operations do provide B
value?
Concerning the second question - not very readable in comments, so I've added this:
A/(1+SMA)=B square it
SMA/(1+2*SMA+SMA^2)=SMB
SMA = SMB+2*SMA*SMB+SMA^2*SMB
SMA^2*SMB+SMA*(2*SMB-1)+SMB = 0
D = 4*SMB^2-4*SMB+1-4*SMB^2= 1-4*SMB
D should be positive, so B magnitude should be small
SMA = (1-2*SMB + Sqrt(1-4*SMB)) /(2*SMB)
the second solution with minus is definitely negative, so omit it
and finally with known SMA
A = B * (1 + SMA)