1 /**
2  * Mandelbulber v2, a 3D fractal generator  _%}}i*<.         ______
3  * Copyright (C) 2019 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  * Aexion's Quadray Sets from FractalForums
10  * @reference http://www.fractalforums.com/the-3d-mandelbulb/quadray-sets/msg31458/#msg31458
11  */
12 
13 #include "all_fractal_definitions.h"
14 
cFractalAexion()15 cFractalAexion::cFractalAexion() : cAbstractFractal()
16 {
17 	nameInComboBox = "Aexion";
18 	internalName = "aexion";
19 	internalID = fractal::aexion;
20 	DEType = analyticDEType;
21 	DEFunctionType = logarithmicDEFunction;
22 	cpixelAddition = cpixelAlreadyHas;
23 	defaultBailout = 10000.0;
24 	DEAnalyticFunction = analyticFunctionLogarithmic;
25 	coloringFunction = coloringFunctionDefault;
26 }
27 
FormulaCode(CVector4 & z,const sFractal * fractal,sExtendedAux & aux)28 void cFractalAexion::FormulaCode(CVector4 &z, const sFractal *fractal, sExtendedAux &aux)
29 {
30 	CVector4 temp = z;
31 	double t;
32 	if (aux.i == 0)
33 	{
34 		t = fractal->aexion.cadd;
35 		CVector4 cadd = CVector4(t, t, t, t);
36 		temp.x = z.x + z.y + z.z;
37 		temp.y = -z.x - z.y + z.z;
38 		temp.z = -z.x + z.y - z.z;
39 		temp.w = z.x - z.y - z.z;
40 		z = fabs(temp) + cadd;
41 		aux.const_c = z;
42 	}
43 	t = 2.0 * z.w * z.z;
44 	temp.x = z.x * z.x - z.y * z.y;
45 	temp.y = t - temp.x;
46 	temp.x += t;
47 	t = 2.0 * z.x * z.y;
48 	temp.z = z.z * z.z - z.w * z.w;
49 	temp.w = t - temp.z;
50 	temp.z += t;
51 	z = temp + aux.const_c;
52 
53 	if (fractal->analyticDE.enabled)
54 	{
55 		double de1 = 1.1 * aux.r;
56 		de1 = de1 + (z.Length() / aux.r - de1) * fractal->analyticDE.scale1;
57 		aux.DE = de1 * 2.0 * aux.DE + fractal->analyticDE.offset1;
58 	}
59 }
60