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 * Adds c constant to z vector 10 */ 11 12 #include "all_fractal_definitions.h" 13 cFractalTransfAddConstantMod1()14cFractalTransfAddConstantMod1::cFractalTransfAddConstantMod1() : cAbstractFractal() 15 { 16 nameInComboBox = "T>Add Constant Mod1"; 17 internalName = "transf_add_constant_mod1"; 18 internalID = fractal::transfAddConstantMod1; 19 DEType = analyticDEType; 20 DEFunctionType = withoutDEFunction; 21 cpixelAddition = cpixelDisabledByDefault; 22 defaultBailout = 100.0; 23 DEAnalyticFunction = analyticFunctionNone; 24 coloringFunction = coloringFunctionDefault; 25 } 26 FormulaCode(CVector4 & z,const sFractal * fractal,sExtendedAux & aux)27void cFractalTransfAddConstantMod1::FormulaCode( 28 CVector4 &z, const sFractal *fractal, sExtendedAux &aux) 29 { 30 Q_UNUSED(aux); 31 // std offset 32 z += fractal->transformCommon.additionConstantA000; 33 // polynomial 34 if (fractal->transformCommon.functionEnabledBx 35 && aux.i >= fractal->transformCommon.startIterationsX 36 && aux.i < fractal->transformCommon.stopIterationsX) 37 { 38 CVector4 temp = fractal->transformCommon.additionConstant000; 39 CVector4 temp2 = temp * temp; 40 CVector4 z2 = z * z * fractal->transformCommon.scaleA1; 41 z.x -= ((temp.x * temp2.x) / (z2.x + temp2.x) - 2.0 * temp.x) * fractal->transformCommon.scale1; 42 z.y -= ((temp.y * temp2.y) / (z2.y + temp2.y) - 2.0 * temp.y) * fractal->transformCommon.scale1; 43 z.z -= ((temp.z * temp2.z) / (z2.z + temp2.z) - 2.0 * temp.z) * fractal->transformCommon.scale1; 44 } 45 46 else if (fractal->transformCommon.functionEnabledByFalse 47 && aux.i >= fractal->transformCommon.startIterationsX 48 && aux.i < fractal->transformCommon.stopIterationsX) 49 { 50 CVector4 temp = fractal->transformCommon.additionConstant000; 51 CVector4 temp2 = temp * temp; 52 CVector4 z2 = z * z * fractal->transformCommon.scaleA1; 53 54 z.x -= ((temp2.x) / (z2.x + temp2.x) - 2.0 * temp.x) 55 * fractal->transformCommon.scale1; // * sign(z.x); 56 z.y -= ((temp2.y) / (z2.y + temp2.y) - 2.0 * temp.y) 57 * fractal->transformCommon.scale1; // * sign(z.y); 58 z.z -= ((temp2.z) / (z2.z + temp2.z) - 2.0 * temp.z) 59 * fractal->transformCommon.scale1; // * sign(z.z); 60 } 61 } 62