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 * MsltoeSym2Mod based on the formula from Mandelbulb3D 10 * @reference http://www.fractalforums.com/theory/choosing-the-squaring-formula-by-location/15/ 11 12 * This file has been autogenerated by tools/populateUiInformation.php 13 * from the file "fractal_msltoe_sym2_mod.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 MsltoeSym2ModIteration(REAL4 z, __constant sFractalCl *fractal, sExtendedAuxCl *aux) 18{ 19 REAL4 c = aux->const_c; 20 21 aux->DE = aux->DE * 2.0f * aux->r; 22 REAL4 temp = z; 23 24 if (fabs(z.y) < fabs(z.z)) // then swap 25 { 26 z.y = temp.z; // making z.y furthest away from axis 27 z.z = temp.y; 28 } 29 if (z.y > z.z) // then change sign of z.x and z.z 30 { 31 z.x = -z.x; 32 } 33 34 REAL4 z2 = z * z; // squares 35 REAL v3 = (z2.x + z2.y + z2.z); // sum of squares 36 // if (v3 < 1e-21f && v3 > -1e-21f) 37 // v3 = (v3 > 0) ? 1e-21f : -1e-21f; 38 REAL zr = 1.0f - z2.z / v3; 39 temp.x = (z2.x - z2.y) * zr; 40 temp.y = 2.0f * z.x * z.y * zr * fractal->transformCommon.scale; // scaling temp.y 41 temp.z = 2.0f * z.z * native_sqrt(z2.x + z2.y); 42 z = temp + fractal->transformCommon.additionConstant000; 43 44 if (fractal->transformCommon.addCpixelEnabledFalse) 45 { 46 REAL4 tempFAB = c; 47 if (fractal->transformCommon.functionEnabledx) tempFAB.x = fabs(tempFAB.x); 48 if (fractal->transformCommon.functionEnabledy) tempFAB.y = fabs(tempFAB.y); 49 if (fractal->transformCommon.functionEnabledz) tempFAB.z = fabs(tempFAB.z); 50 51 tempFAB *= fractal->transformCommon.constantMultiplier000; 52 53 z.x += sign(z.x) * tempFAB.x; 54 z.y += sign(z.y) * tempFAB.y; 55 z.z += sign(z.z) * tempFAB.z; 56 } 57 58 REAL lengthTempZ = -length(z); 59 // if (lengthTempZ > -1e-21f) 60 // 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 return z; 65}