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  * TransfDeLinearCube
10  *
11  */
12 
13 #include "all_fractal_definitions.h"
14 
cFractalTransfDELinearCube()15 cFractalTransfDELinearCube::cFractalTransfDELinearCube() : cAbstractFractal()
16 {
17 	nameInComboBox = "T>DE Linear Cube";
18 	internalName = "transf_de_linear_cube";
19 	internalID = fractal::transfDELinearCube;
20 	DEType = analyticDEType;
21 	DEFunctionType = customDEFunction;
22 	cpixelAddition = cpixelDisabledByDefault;
23 	defaultBailout = 100.0;
24 	DEAnalyticFunction = analyticFunctionCustomDE;
25 	coloringFunction = coloringFunctionDefault;
26 }
27 
FormulaCode(CVector4 & z,const sFractal * fractal,sExtendedAux & aux)28 void cFractalTransfDELinearCube::FormulaCode(
29 	CVector4 &z, const sFractal *fractal, sExtendedAux &aux)
30 {
31 	double R;
32 	if (!fractal->transformCommon.functionEnabledFalse)
33 	{
34 		R = max(max(fabs(z.x), fabs(z.y)), fabs(z.z));
35 	}
36 	else
37 	{
38 		R = z.Length();
39 	}
40 	aux.dist =
41 		(fractal->transformCommon.scale1 * R / aux.DE) - fractal->transformCommon.offset0 / 100.0;
42 
43 	// aux.color
44 	if (fractal->foldColor.auxColorEnabledFalse)
45 	{
46 		aux.color = fractal->foldColor.difs1 * aux.DE / R;
47 	}
48 }
49