public PolarVector EuclidVectorToPolar(EuclidVector ev) { double x = ev.X, y = ev.Y, z = ev.Z; double r = Math.Sqrt(x * x + y * y + z * z); double phi = x != 0 ? Math.Atan(y / x) : 0.0; double theta = r != 0 ? Math.Acos(z / r) : 0.0; return(new PolarVector { R = r, Phi = phi, Theta = theta }); }
public void IterateVector(ref EuclidVector ev, EuclidVector cv) { var pv = EuclidVectorToPolar(ev); double n = Power.Value; double rn = Math.Pow(pv.R, n); double phi = pv.Phi; double theta = pv.Theta; ev.X = rn * Math.Sin(n * theta) * Math.Sin(n * phi) + cv.X; ev.Y = rn * Math.Sin(n * theta) * Math.Cos(n * phi) + cv.Y; ev.Z = rn * Math.Cos(n * theta) + cv.Z; }