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 * TransfDIFSEllipsoidIteration fragmentarium code, mdifs by knighty (jan 2012)
10 * and http://www.iquilezles.org/www/articles/distfunctions/distfunctions.htm
11 */
12
13 #include "all_fractal_definitions.h"
14
cFractalTransfDIFSEllipsoid()15 cFractalTransfDIFSEllipsoid::cFractalTransfDIFSEllipsoid() : cAbstractFractal()
16 {
17 nameInComboBox = "T>DIFS Ellipsoid";
18 internalName = "transf_difs_ellipsoid";
19 internalID = fractal::transfDIFSEllipsoid;
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 cFractalTransfDIFSEllipsoid::FormulaCode(
29 CVector4 &z, const sFractal *fractal, sExtendedAux &aux)
30 {
31 CVector4 zc = z;
32 CVector4 rads4 = fractal->transformCommon.additionConstant111;
33 CVector3 rads3 = CVector3(rads4.x, rads4.y, rads4.z);
34
35 CVector3 rV = CVector3(zc.x, zc.y, zc.z);
36 rV /= rads3;
37
38 CVector3 rrV = rV;
39 rrV /= rads3;
40
41 double rd = rV.Length();
42 double rrd = rrV.Length();
43 double ellD = rd * (rd - 1.0) / rrd;
44 aux.dist = min(aux.dist, ellD / (aux.DE + 1.0));
45 }
46