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 * Box Tiling 4d 10 */ 11 12 #include "all_fractal_definitions.h" 13 cFractalTransfBoxTiling4d()14cFractalTransfBoxTiling4d::cFractalTransfBoxTiling4d() : cAbstractFractal() 15 { 16 nameInComboBox = "T>Box Tiling 4D"; 17 internalName = "transf_box_tiling4d"; 18 internalID = fractal::transfBoxTiling4d; 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 cFractalTransfBoxTiling4d::FormulaCode(CVector4 &z, const sFractal *fractal, sExtendedAux &aux) 28 { 29 CVector4 size = fractal->transformCommon.offset2222; 30 CVector4 oldZ = z; 31 32 if (!fractal->transformCommon.functionEnabledFalse) 33 { 34 if (fractal->transformCommon.functionEnabledx && size.x != 0.0) 35 { 36 z.x -= round(z.x / size.x) * size.x; 37 } 38 if (fractal->transformCommon.functionEnabledyFalse && size.y != 0.0) 39 { 40 z.y -= round(z.y / size.y) * size.y; 41 } 42 if (fractal->transformCommon.functionEnabledzFalse && size.z != 0.0) 43 { 44 z.z -= round(z.z / size.z) * size.z; 45 } 46 if (fractal->transformCommon.functionEnabledwFalse && size.w != 0.0) 47 { 48 z.w -= round(z.w / size.w) * size.w; 49 } 50 } 51 else 52 { 53 CVector4 repeatPos = fractal->transformCommon.offsetA1111; 54 CVector4 repeatNeg = fractal->transformCommon.offsetB1111; 55 56 if (fractal->transformCommon.functionEnabledx && z.x < (repeatPos.x + 0.5) * size.x 57 && z.x > (repeatNeg.x + 0.5) * -size.x && size.x != 0.0) 58 { 59 z.x -= round(z.x / size.x) * size.x; 60 } 61 if (fractal->transformCommon.functionEnabledyFalse && z.y < (repeatPos.y + 0.5) * size.y 62 && z.y > (repeatNeg.y + 0.5) * -size.y && size.y != 0.0) 63 { 64 z.y -= round(z.y / size.y) * size.y; 65 } 66 if (fractal->transformCommon.functionEnabledzFalse && z.z < (repeatPos.z + 0.5) * size.z 67 && z.z > (repeatNeg.z + 0.5) * -size.z && size.z != 0.0) 68 { 69 z.z -= round(z.z / size.z) * size.z; 70 } 71 if (fractal->transformCommon.functionEnabledwFalse && z.w < (repeatPos.w + 0.5) * size.w 72 && z.w > (repeatNeg.w + 0.5) * -size.w && size.w != 0.0) 73 { 74 z.w -= round(z.w / size.w) * size.w; 75 } 76 } 77 78 if (fractal->transformCommon.functionEnabledBxFalse) 79 { 80 z.x = z.x * fractal->transformCommon.scale1 / (fabs(oldZ.x) + 1.0); 81 z.y = z.y * fractal->transformCommon.scale1 / (fabs(oldZ.y) + 1.0); 82 z.z = z.z * fractal->transformCommon.scale1 / (fabs(oldZ.z) + 1.0); 83 z.w = z.w * fractal->transformCommon.scale1 / (fabs(oldZ.w) + 1.0); 84 } 85 86 if (fractal->analyticDE.enabled) 87 { 88 if (!fractal->analyticDE.enabledFalse) 89 aux.DE = aux.DE * fractal->analyticDE.scale1 + fractal->analyticDE.offset0; 90 else 91 { 92 aux.DE = aux.DE * z.Length() * fractal->analyticDE.scale1 + fractal->analyticDE.offset0; 93 } 94 } 95 } 96