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 * MsltoeJuliaBulb Eiffie. Refer post by Eiffie Reply #69 on: January 27, 2015 10 * @reference http://www.fractalforums.com/theory/choosing-the-squaring-formula-by-location/60/ 11 12 * This file has been autogenerated by tools/populateUiInformation.php 13 * from the file "fractal_msltoe_sym3_mod5.cpp" in the folder formula/definition 14 * D O N O T E D I T T H I S F I L E ! 15 */ 16 17REAL4 MsltoeSym3Mod5Iteration(REAL4 z, __constant sFractalCl *fractal, sExtendedAuxCl *aux) 18{ 19 REAL4 c = aux->const_c; 20 aux->DE = aux->DE * 2.0f * aux->r; 21 22 REAL psi = fractal->transformCommon.int8Y; 23 if (fractal->transformCommon.functionEnabledBFalse 24 && aux->i >= fractal->transformCommon.startIterationsB 25 && aux->i < fractal->transformCommon.stopIterationsB) 26 { 27 psi += fractal->transformCommon.int1; 28 } 29 psi = M_PI_F / psi; 30 psi = fabs(fmod(atan2(z.z, z.y) + M_PI_F + psi, 2.0f * psi) - psi); 31 REAL len = native_sqrt(z.y * z.y + z.z * z.z); 32 z.y = native_cos(psi) * len; 33 z.z = native_sin(psi) * len; 34 35 REAL4 z2 = z * z; 36 REAL rr = z2.x + z2.y + z2.z; 37 REAL m = 1.0f - z2.z / rr; 38 REAL4 temp; 39 temp.x = (z2.x - z2.y) * m * fractal->transformCommon.scaleB1; 40 temp.y = 2.0f * z.x * z.y * m * fractal->transformCommon.scale; // scaling y; 41 temp.z = 2.0f * z.z * native_sqrt(z2.x + z2.y); 42 temp.w = z.w; 43 z = temp + fractal->transformCommon.additionConstantNeg100; 44 45 if (fractal->transformCommon.addCpixelEnabledFalse 46 && aux->i >= fractal->transformCommon.startIterationsC 47 && aux->i < fractal->transformCommon.stopIterationsC) 48 { 49 REAL4 tempFAB = c; 50 if (fractal->transformCommon.functionEnabledx) tempFAB.x = fabs(tempFAB.x); 51 if (fractal->transformCommon.functionEnabledy) tempFAB.y = fabs(tempFAB.y); 52 if (fractal->transformCommon.functionEnabledz) tempFAB.z = fabs(tempFAB.z); 53 54 tempFAB *= fractal->transformCommon.constantMultiplier000; 55 z.x += sign(z.x) * tempFAB.x; 56 z.y += sign(z.y) * tempFAB.y; 57 z.z += sign(z.z) * tempFAB.z; 58 } 59 REAL lengthTempZ = -length(z); 60 // if (lengthTempZ > -1e-21f) lengthTempZ = -1e-21f; // z is neg.) 61 z *= 1.0f + fractal->transformCommon.offset / lengthTempZ; 62 z *= fractal->transformCommon.scale1; 63 aux->DE *= fabs(fractal->transformCommon.scale1); 64 65 if (fractal->transformCommon.functionEnabledFalse // quaternion fold 66 && aux->i >= fractal->transformCommon.startIterationsA 67 && aux->i < fractal->transformCommon.stopIterationsA) 68 { 69 aux->r = length(z); 70 aux->DE = aux->DE * 2.0f * aux->r; 71 z = (REAL4){z.x * z.x - z.y * z.y - z.z * z.z, z.x * z.y, z.x * z.z, z.w}; 72 if (!fractal->transformCommon.functionEnabledTFalse) 73 { 74 z *= (REAL4){1.0f, 2.0f, 2.0f, 1.0f}; 75 } 76 else 77 { 78 REAL4 temp = z; 79 REAL tempL = length(temp); 80 z *= (REAL4){1.0f, 2.0f, 2.0f, 1.0f}; 81 // if (tempL < 1e-21f) 82 // tempL = 1e-21f; 83 REAL avgScale = length(z) / tempL; 84 aux->DE *= avgScale; 85 } 86 z.z -= aux->const_c.z * fractal->transformCommon.scaleF1; 87 z.z -= fractal->transformCommon.offset0; 88 } 89 if (fractal->analyticDE.enabledFalse) 90 aux->DE = aux->DE * fractal->analyticDE.scale1 + fractal->analyticDE.offset0; 91 return z; 92}