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 * MsltoeJuliaBulb Eiffie. Refer post by Eiffie Reply #69 on: January 27, 2015
10 * @reference http://www.fractalforums.com/theory/choosing-the-squaring-formula-by-location/60/
11 */
12
13 #include "all_fractal_definitions.h"
14
cFractalEiffieMsltoe()15 cFractalEiffieMsltoe::cFractalEiffieMsltoe() : cAbstractFractal()
16 {
17 nameInComboBox = "Msltoe - Julia Bulb Eiffie";
18 internalName = "eiffie_msltoe";
19 internalID = fractal::eiffieMsltoe;
20 DEType = analyticDEType;
21 DEFunctionType = logarithmicDEFunction;
22 cpixelAddition = cpixelEnabledByDefault;
23 defaultBailout = 10.0;
24 DEAnalyticFunction = analyticFunctionLogarithmic;
25 coloringFunction = coloringFunctionDefault;
26 }
27
FormulaCode(CVector4 & z,const sFractal * fractal,sExtendedAux & aux)28 void cFractalEiffieMsltoe::FormulaCode(CVector4 &z, const sFractal *fractal, sExtendedAux &aux)
29 {
30 CVector4 c = aux.const_c;
31 double psi = fabs(fmod(atan2(z.z, z.y) + M_PI + M_PI_8, M_PI_4) - M_PI_8);
32 double lengthYZ = sqrt(z.y * z.y + z.z * z.z);
33
34 z.y = cos(psi) * lengthYZ;
35 z.z = sin(psi) * lengthYZ;
36 aux.DE = aux.DE * 2.0 * aux.r;
37
38 CVector4 z2 = z * z;
39 double rr = z2.x + z2.y + z2.z;
40 double m = 1.0 - z2.z / rr;
41 CVector4 temp;
42 temp.x = (z2.x - z2.y) * m;
43 temp.y = 2.0 * z.x * z.y * m * fractal->transformCommon.scale; // scaling y;
44 temp.z = 2.0 * z.z * sqrt(z2.x + z2.y);
45 temp.w = z.w;
46 z = temp + fractal->transformCommon.additionConstant000;
47
48 if (fractal->transformCommon.addCpixelEnabledFalse)
49 {
50 CVector4 tempFAB = c;
51 if (fractal->transformCommon.functionEnabledx) tempFAB.x = fabs(tempFAB.x);
52 if (fractal->transformCommon.functionEnabledy) tempFAB.y = fabs(tempFAB.y);
53 if (fractal->transformCommon.functionEnabledz) tempFAB.z = fabs(tempFAB.z);
54
55 tempFAB *= fractal->transformCommon.constantMultiplier000;
56 z.x += sign(z.x) * tempFAB.x;
57 z.y += sign(z.y) * tempFAB.y;
58 z.z += sign(z.z) * tempFAB.z;
59 }
60 double lengthTempZ = -z.Length();
61 // if (lengthTempZ > -1e-21) lengthTempZ = -1e-21; // z is neg.)
62 z *= 1.0 + fractal->transformCommon.offset / lengthTempZ;
63 z *= fractal->transformCommon.scale1;
64 /*aux.DE = aux.DE * fabs(fractal->transformCommon.scale1) + 1.0;
65 // aux.DE *= fabs(fractal->transformCommon.scale1);
66
67 if (fractal->analyticDE.enabledFalse)
68 { // analytic DE adjustment
69 aux.DE *= fabs(fractal->transformCommon.scale1) * fractal->analyticDE.scale1;
70 }
71 else
72 {
73 aux.DE *= fabs(fractal->transformCommon.scale1);
74 }*/
75 if (!fractal->analyticDE.enabledFalse)
76 aux.DE = aux.DE * fabs(fractal->transformCommon.scale1) + 1.0;
77 else
78 aux.DE = aux.DE * fabs(fractal->transformCommon.scale1) * fractal->analyticDE.scale1
79 + fractal->analyticDE.offset1;
80 }
81