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 * benesiT1 3D
10 * @reference
11 * http://www.fractalforums.com/new-theories-and-research/
12 * do-m3d-formula-have-to-be-distance-estimation-formulas/
13 */
14
15 #include "all_fractal_definitions.h"
16
cFractalTransfBenesiT1()17 cFractalTransfBenesiT1::cFractalTransfBenesiT1() : cAbstractFractal()
18 {
19 nameInComboBox = "T>Benesi T1";
20 internalName = "transf_benesi_t1";
21 internalID = fractal::transfBenesiT1;
22 DEType = analyticDEType;
23 DEFunctionType = withoutDEFunction;
24 cpixelAddition = cpixelDisabledByDefault;
25 defaultBailout = 100.0;
26 DEAnalyticFunction = analyticFunctionNone;
27 coloringFunction = coloringFunctionDefault;
28 }
29
FormulaCode(CVector4 & z,const sFractal * fractal,sExtendedAux & aux)30 void cFractalTransfBenesiT1::FormulaCode(CVector4 &z, const sFractal *fractal, sExtendedAux &aux)
31 {
32 double tempXZ = z.x * SQRT_2_3 - z.z * SQRT_1_3;
33 z = CVector4(
34 (tempXZ - z.y) * SQRT_1_2, (tempXZ + z.y) * SQRT_1_2, z.x * SQRT_1_3 + z.z * SQRT_2_3, z.w);
35
36 CVector4 temp = z;
37 double tempL = temp.Length();
38 z = fabs(z) * fractal->transformCommon.scale3D222;
39 // if (tempL < 1e-21) tempL = 1e-21;
40 double avgScale = z.Length() / tempL;
41 aux.DE = aux.DE * avgScale + 1.0;
42
43 if (fractal->transformCommon.rotationEnabled)
44 {
45 z = fractal->transformCommon.rotationMatrix.RotateVector(z);
46 }
47
48 tempXZ = (z.y + z.x) * SQRT_1_2;
49
50 z = CVector4(z.z * SQRT_1_3 + tempXZ * SQRT_2_3, (z.y - z.x) * SQRT_1_2,
51 z.z * SQRT_2_3 - tempXZ * SQRT_1_3, z.w);
52 z = z - fractal->transformCommon.offset200;
53 }
54