1/**
2 * Mandelbulber v2, a 3D fractal generator  _%}}i*<.        ____                _______
3 * Copyright (C) 2020 Mandelbulber Team   _>]|=||i=i<,     / __ \___  ___ ___  / ___/ /
4 *                                        \><||i|=>>%)    / /_/ / _ \/ -_) _ \/ /__/ /__
5 * This file is part of Mandelbulber.     )<=i=]=|=i<>    \____/ .__/\__/_//_/\___/____/
6 * The project is licensed under GPLv3,   -<>>=|><|||`        /_/
7 * see also COPYING file in this folder.    ~+{i%+++
8 *
9 * Classic Mandelbulb Power 2 fractal
10 * @reference http://www.fractalforums.com/3d-fractal-generation/true-3d-mandlebrot-type-fractal/
11
12 * This file has been autogenerated by tools/populateUiInformation.php
13 * from the file "fractal_mandelbulb_power2.cpp" in the folder formula/definition
14 * D O    N O T    E D I T    T H I S    F I L E !
15 */
16
17REAL4 MandelbulbPower2Iteration(REAL4 z, __constant sFractalCl *fractal, sExtendedAuxCl *aux)
18{
19	Q_UNUSED(fractal);
20
21	aux->DE = aux->DE * 2.0f * aux->r;
22	REAL x2 = z.x * z.x;
23	REAL y2 = z.y * z.y;
24	REAL z2 = z.z * z.z;
25	REAL temp = 1.0f - z2 / (x2 + y2);
26	REAL newx = (x2 - y2) * temp;
27	REAL newy = 2.0f * z.x * z.y * temp;
28	REAL newz = -2.0f * z.z * native_sqrt(x2 + y2);
29	z.x = newx;
30	z.y = newy;
31	z.z = newz;
32	return z;
33}