1/**
2 * Mandelbulber v2, a 3D fractal generator  _%}}i*<.        ____                _______
3 * Copyright (C) 2021 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 * Inverse spherical coords. Fast conversion without parameters.
10 * Formula by Luca GN 2011, from M3D, from Wikipedia;
11 * @reference
12 * http://www.fractalforums.com/mandelbulb-3d/custom-formulas-and-transforms-release-t17106/
13
14 * This file has been autogenerated by tools/populateUiInformation.php
15 * from the file "fractal_transf_spherical_coord_invs.cpp" in the folder formula/definition
16 * D O    N O T    E D I T    T H I S    F I L E !
17 */
18
19REAL4 TransfSphericalCoordInvsIteration(
20	REAL4 z, __constant sFractalCl *fractal, sExtendedAuxCl *aux)
21{
22	Q_UNUSED(aux);
23
24	REAL4 t = z;
25	if (fractal->transformCommon.functionEnabled)
26	{
27		t.x = z.x * native_sin(z.y) * native_cos(z.z);
28		t.y = z.x * native_sin(z.y) * native_sin(z.z);
29		t.z = z.x * native_cos(z.y);
30	}
31
32	if (fractal->transformCommon.functionEnabledAFalse)
33	{
34		t.x = z.z * native_sin(z.x) * native_sin(z.y);
35		t.z = z.z * native_sin(z.x) * native_cos(z.y);
36		t.y = z.z * native_cos(z.x);
37	}
38
39	if (fractal->transformCommon.functionEnabledBFalse)
40	{
41		t.y = z.y * native_sin(z.x) * native_cos(z.z);
42		t.x = z.y * native_sin(z.x) * native_sin(z.z);
43		t.z = z.y * native_cos(z.x);
44	}
45
46	z = t + fractal->transformCommon.offset000;
47	return z;
48}