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 * scale vary V2.12.- based on DarkBeam's maths
10 * @reference
11 * http://www.fractalforums.com/mandelbulb-3d/custom-formulas-and-transforms-release-t17106/
12
13 * This file has been autogenerated by tools/populateUiInformation.php
14 * from the file "fractal_transf_scale_vary_v212.cpp" in the folder formula/definition
15 * D O    N O T    E D I T    T H I S    F I L E !
16 */
17
18REAL4 TransfScaleVaryV212Iteration(REAL4 z, __constant sFractalCl *fractal, sExtendedAuxCl *aux)
19{
20	if (aux->i >= fractal->transformCommon.startIterations
21			&& aux->i < fractal->transformCommon.stopIterations)
22	{
23		if (fractal->transformCommon.functionEnabledBxFalse)
24		{
25			aux->actualScaleA = fabs(aux->actualScaleA);
26		}
27		aux->actualScaleA =
28			fractal->transformCommon.scaleMain2 + fractal->transformCommon.scaleVary0 * aux->actualScaleA;
29		REAL temp = aux->actualScaleA;
30		if (fractal->transformCommon.functionEnabledByFalse) // limits
31		{
32			if (aux->actualScaleA < fractal->transformCommon.offset0)
33				temp = fractal->transformCommon.offset0;
34			if (aux->actualScaleA > fractal->transformCommon.offset4)
35				temp = fractal->transformCommon.offset4;
36		}
37
38		z *= temp;
39		aux->DE = aux->DE * fabs(temp) + 1.0f;
40	}
41
42	else if (aux->i < fractal->transformCommon.startIterations)
43	{
44		z *= fractal->transformCommon.scaleMain2;
45		aux->DE = aux->DE * fabs(fractal->transformCommon.scaleMain2 + 1.0f);
46	}
47	else
48	{
49		if (fractal->transformCommon.functionEnabledBzFalse)
50		{
51			aux->actualScaleA = fractal->transformCommon.scaleMain2;
52		}
53		z *= aux->actualScaleA;
54		aux->DE = aux->DE * fabs(aux->actualScaleA + 1.0f);
55	}
56	return z;
57}