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 * 3D Version of the 2D Eye Fractal created by biberino, modified mclarekin
10
11 * This file has been autogenerated by tools/populateUiInformation.php
12 * from the file "fractal_mandelbulb_eye.cpp" in the folder formula/definition
13 * D O    N O T    E D I T    T H I S    F I L E !
14 */
15
16REAL4 MandelbulbEyeIteration(REAL4 z, __constant sFractalCl *fractal, sExtendedAuxCl *aux)
17{
18	aux->DE = aux->DE * 2.0f * aux->r;
19
20	// pre abs
21	if (fractal->buffalo.preabsx) z.x = fabs(z.x);
22	if (fractal->buffalo.preabsy) z.y = fabs(z.y);
23	if (fractal->buffalo.preabsz) z.z = fabs(z.z);
24
25	// bulb
26	REAL4 zz = z * z;
27	REAL rr = zz.x + zz.y + zz.z;
28	REAL temp = native_sqrt(zz.x + zz.y);
29	REAL theta1 = atan2(temp, z.z) * fractal->transformCommon.scaleB1;
30	REAL theta2 = atan2(temp, -z.z) * fractal->transformCommon.scaleC1;
31	temp = theta1 + theta2;
32
33	REAL phi1 = atan2(z.y, z.x);
34	REAL phi2 = 0.0f;
35	if (!fractal->transformCommon.functionEnabledFalse)
36		phi2 = atan2(-z.y, z.x);
37	else
38		phi2 = M_PI_F - phi1;
39	phi1 *= fractal->transformCommon.scale1;
40	phi1 += phi2;
41
42	temp = rr * native_sin(theta1 + theta2);
43	z.x = temp * native_cos(phi1);
44	z.y = temp * native_sin(phi1);
45	z.z = rr * native_cos(theta1 + theta2);
46
47	// post abs
48	z.x = fractal->buffalo.absx ? fabs(z.x) : z.x;
49	z.y = fractal->buffalo.absy ? fabs(z.y) : z.y;
50	z.z = fractal->buffalo.absz ? fabs(z.z) : z.z;
51
52	// offset
53	z += fractal->transformCommon.additionConstantA000;
54
55	// analyticDE controls
56	if (fractal->analyticDE.enabledFalse)
57		aux->DE = aux->DE * fractal->analyticDE.scale1 + fractal->analyticDE.offset1;
58	return z;
59}