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  * 3D Mandelbrot formula invented by David Makin
10  * http://www.fractalgallery.co.uk/ and https://www.facebook.com/david.makin.7
11  * @reference
12  * http://www.fractalforums.com/3d-fractal-generation/true-3d-mandlebrot-type-fractal/msg7235/#msg7235
13  */
14 
15 #include "all_fractal_definitions.h"
16 
cFractalHypercomplex()17 cFractalHypercomplex::cFractalHypercomplex() : cAbstractFractal()
18 {
19 	nameInComboBox = "Hypercomplex";
20 	internalName = "hypercomplex";
21 	internalID = fractal::hypercomplex;
22 	DEType = analyticDEType;
23 	DEFunctionType = logarithmicDEFunction;
24 	cpixelAddition = cpixelEnabledByDefault;
25 	defaultBailout = 10.0;
26 	DEAnalyticFunction = analyticFunctionLogarithmic;
27 	coloringFunction = coloringFunctionDefault;
28 }
29 
FormulaCode(CVector4 & z,const sFractal * fractal,sExtendedAux & aux)30 void cFractalHypercomplex::FormulaCode(CVector4 &z, const sFractal *fractal, sExtendedAux &aux)
31 {
32 	Q_UNUSED(fractal);
33 
34 	aux.DE = aux.DE * 2.0 * aux.r;
35 	double newx = z.x * z.x - z.y * z.y - z.z * z.z - z.w * z.w;
36 	double newy = 2.0 * z.x * z.y - 2.0 * z.w * z.z;
37 	double newz = 2.0 * z.x * z.z - 2.0 * z.y * z.w;
38 	double neww = 2.0 * z.x * z.w - 2.0 * z.y * z.z;
39 	z.x = newx;
40 	z.y = newy;
41 	z.z = newz;
42 	z.w = neww;
43 }
44