Permalink
Browse files

added Collatz fractal

  • Loading branch information...
zebastian committed Apr 11, 2016
1 parent 2e7baa0 commit 50097e6added17a3af5faafee21948178f281349
Binary file not shown.
@@ -0,0 +1,136 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>Form</class>
<widget class="QWidget" name="Form">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>535</width>
<height>685</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<property name="spacing">
<number>2</number>
</property>
<property name="leftMargin">
<number>2</number>
</property>
<property name="topMargin">
<number>2</number>
</property>
<property name="rightMargin">
<number>2</number>
</property>
<property name="bottomMargin">
<number>2</number>
</property>
<item>
<widget class="QLabel" name="label">
<property name="text">
<string>No parameters</string>
</property>
</widget>
</item>
<item>
<widget class="MyGroupBox" name="groupCheck_info">
<property name="title">
<string>Info&amp;rmation</string>
</property>
<property name="flat">
<bool>false</bool>
</property>
<property name="checkable">
<bool>true</bool>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
<property name="spacing">
<number>2</number>
</property>
<property name="leftMargin">
<number>2</number>
</property>
<property name="topMargin">
<number>2</number>
</property>
<property name="rightMargin">
<number>2</number>
</property>
<property name="bottomMargin">
<number>2</number>
</property>
<item>
<widget class="QLabel" name="label_code_content">
<property name="text">
<string>&lt;p&gt;CollatzIteration formula&lt;/p&gt;&lt;table&gt;
&lt;tr&gt;&lt;th&gt;Reference&lt;/th&gt;&lt;td&gt;&lt;a href=&quot;https://mathr.co.uk/blog/2016-04-10_collatz_fractal.html&quot;&gt;https://mathr.co.uk/blog/2016-04-10_collatz_fractal.html&lt;br&gt;
&lt;a href=&quot;https://en.wikipedia.org/wiki/Collatz_conjecture#Iterating_on_real_or_complex_numbers&quot;&gt;https://en.wikipedia.org/wiki/Collatz_conjecture#Iterating_on_real_or_complex_numbers&lt;br&gt;
&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;
&lt;h3&gt;Code&lt;/h3&gt;
&lt;!DOCTYPE html&gt;
&lt;html&gt;
&lt;head&gt;
&lt;meta charset=&quot;ISO-8859-1&quot;&gt;
&lt;title&gt;Source file&lt;/title&gt;
&lt;/head&gt;
&lt;body style=&quot;background-color:#202020&quot;&gt;
&lt;pre style=&quot;color:#d0d0d0; background-color:#202020; font-family:'Courier New',monospace;&quot;&gt;&lt;span style=&quot;color:#f09479; font-weight:bold&quot;&gt;void&lt;/span&gt; &lt;span style=&quot;color:#e47eed&quot;&gt;CollatzIteration&lt;/span&gt;&lt;span style=&quot;color:#d0d0d0&quot;&gt;(&lt;/span&gt;CVector3 &lt;span style=&quot;color:#d0d0d0&quot;&gt;&amp;amp;&lt;/span&gt;z&lt;span style=&quot;color:#d0d0d0&quot;&gt;,&lt;/span&gt; sExtendedAux &lt;span style=&quot;color:#d0d0d0&quot;&gt;&amp;amp;&lt;/span&gt;aux&lt;span style=&quot;color:#d0d0d0&quot;&gt;)&lt;/span&gt;
&lt;span style=&quot;color:#d0d0d0&quot;&gt;{&lt;/span&gt;
CVector3 &lt;span style=&quot;color:#e47eed&quot;&gt;xV&lt;/span&gt;&lt;span style=&quot;color:#d0d0d0&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color:#87df71&quot;&gt;1.0&lt;/span&gt;&lt;span style=&quot;color:#d0d0d0&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color:#87df71&quot;&gt;1.0&lt;/span&gt;&lt;span style=&quot;color:#d0d0d0&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color:#87df71&quot;&gt;1.0&lt;/span&gt;&lt;span style=&quot;color:#d0d0d0&quot;&gt;);&lt;/span&gt;
z &lt;span style=&quot;color:#d0d0d0&quot;&gt;=&lt;/span&gt; xV &lt;span style=&quot;color:#d0d0d0&quot;&gt;+&lt;/span&gt; &lt;span style=&quot;color:#87df71&quot;&gt;4.0&lt;/span&gt; &lt;span style=&quot;color:#d0d0d0&quot;&gt;*&lt;/span&gt; z
&lt;span style=&quot;color:#d0d0d0&quot;&gt;-&lt;/span&gt; &lt;span style=&quot;color:#e47eed&quot;&gt;CVector3&lt;/span&gt;&lt;span style=&quot;color:#d0d0d0&quot;&gt;(&lt;/span&gt;xV &lt;span style=&quot;color:#d0d0d0&quot;&gt;+&lt;/span&gt; &lt;span style=&quot;color:#87df71&quot;&gt;2.0&lt;/span&gt; &lt;span style=&quot;color:#d0d0d0&quot;&gt;*&lt;/span&gt; z&lt;span style=&quot;color:#d0d0d0&quot;&gt;)&lt;/span&gt;
&lt;span style=&quot;color:#d0d0d0&quot;&gt;*&lt;/span&gt; z&lt;span style=&quot;color:#d0d0d0&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color:#e47eed&quot;&gt;RotateAroundVectorByAngle&lt;/span&gt;&lt;span style=&quot;color:#d0d0d0&quot;&gt;(&lt;/span&gt;xV&lt;span style=&quot;color:#d0d0d0&quot;&gt;,&lt;/span&gt; M_PI&lt;span style=&quot;color:#d0d0d0&quot;&gt;);&lt;/span&gt;
z &lt;span style=&quot;color:#d0d0d0&quot;&gt;/=&lt;/span&gt; &lt;span style=&quot;color:#87df71&quot;&gt;4.0&lt;/span&gt;&lt;span style=&quot;color:#d0d0d0&quot;&gt;;&lt;/span&gt;
aux&lt;span style=&quot;color:#d0d0d0&quot;&gt;.&lt;/span&gt;DE &lt;span style=&quot;color:#d0d0d0&quot;&gt;=&lt;/span&gt; aux&lt;span style=&quot;color:#d0d0d0&quot;&gt;.&lt;/span&gt;DE &lt;span style=&quot;color:#d0d0d0&quot;&gt;*&lt;/span&gt; &lt;span style=&quot;color:#87df71&quot;&gt;4.0&lt;/span&gt; &lt;span style=&quot;color:#d0d0d0&quot;&gt;+&lt;/span&gt; &lt;span style=&quot;color:#87df71&quot;&gt;1.0&lt;/span&gt;&lt;span style=&quot;color:#d0d0d0&quot;&gt;;&lt;/span&gt;
&lt;span style=&quot;color:#d0d0d0&quot;&gt;}&lt;/span&gt;
&lt;/pre&gt;
&lt;/body&gt;
&lt;/html&gt;
&lt;!--HTML generated by highlight 3.18, http://www.andre-simon.de/--&gt;
</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
<property name="openExternalLinks">
<bool>true</bool>
</property>
<property name="textInteractionFlags">
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse</set>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>MyGroupBox</class>
<extends>QGroupBox</extends>
<header>mygroupbox.h</header>
<container>1</container>
</customwidget>
</customwidgets>
<resources/>
<connections/>
</ui>
@@ -285,8 +285,6 @@ void Compute(const cNineFractals &fractals, const sFractalIn &in, sFractalOut *o
MsltoeToroidalIteration(z, fractal, extendedAux);
break;
}
case generalizedFoldBox:
{
GeneralizedFoldBoxIteration(z, fractal, extendedAux);
@@ -397,13 +395,16 @@ void Compute(const cNineFractals &fractals, const sFractalIn &in, sFractalOut *o
Quaternion3DIteration(z, fractal, extendedAux);
break;
}
case fastImagscaPower2:
{
FastImagscaPower2Iteration(z, fractal);
break;
}
case collatz:
{
CollatzIteration(z, extendedAux);
break;
}
//transforms ------------------------------------------------------------------------------------------
case transfAdditionConstant:
@@ -890,7 +891,7 @@ void Compute(const cNineFractals &fractals, const sFractalIn &in, sFractalOut *o
case msltoesym4Mod:
//case msltoeToroidal:
case quaternion:
case quaternion3D:
case quaternion3D:
case xenodreambuie:
{
if(extendedAux.r_dz > 0)
@@ -921,6 +922,7 @@ void Compute(const cNineFractals &fractals, const sFractalIn &in, sFractalOut *o
}
case kaleidoscopicIFS:
case menger_sponge:
case collatz:
case mengerMod1:
{
if(extendedAux.r_dz > 0)
@@ -973,8 +975,9 @@ void Compute(const cNineFractals &fractals, const sFractalIn &in, sFractalOut *o
case mengerMod1:
case aboxModKali:
case aboxMod1:
case aboxMod1:
case menger_sponge:
case collatz:
case kaleidoscopicIFS:
out->colorIndex = minimumR * 1000.0;
break;
@@ -391,6 +391,21 @@ void SmoothMandelboxIteration(CVector3 &z, const cFractal *fractal, sExtendedAux
aux.DE = aux.DE * fabs(fractal->mandelbox.scale) + 1.0;
}
/**
* CollatzIteration formula
* @reference https://mathr.co.uk/blog/2016-04-10_collatz_fractal.html
* https://en.wikipedia.org/wiki/Collatz_conjecture#Iterating_on_real_or_complex_numbers
*/
void CollatzIteration(CVector3 &z, sExtendedAux &aux)
{
CVector3 xV(1.0, 1.0, 1.0);
z = xV + 4.0 * z
- CVector3(xV + 2.0 * z)
* z.RotateAroundVectorByAngle(xV, M_PI);
z /= 4.0;
aux.DE = aux.DE * 4.0 + 1.0;
}
/**
* Hybrid of Mandelbox and Mandelbulb power 2 with scaling of z axis
*/
@@ -82,6 +82,7 @@ void RiemannSphereMsltoeV1Iteration(CVector3 &z, const cFractal *fractal);
void RiemannBulbMsltoeMod2Iteration(CVector3 &z, const cFractal *fractal);
void SmoothMandelboxIteration(CVector3 &z, const cFractal *fractal, sExtendedAux &aux);
void XenodreambuieIteration(CVector3 &z, const cFractal *fractal, sExtendedAux &aux);
void CollatzIteration(CVector3 &z, sExtendedAux &aux);
void BoxFolding(CVector3 &z, const sFractalFoldings *foldings, sExtendedAux &aux);
void SphericalFolding(CVector3 &z, const sFractalFoldings *foldings, sExtendedAux &aux);
@@ -460,13 +460,21 @@ void DefineFractalList(QList<sFractalDescription> *fractalList)
cpixelEnabledByDefault,
10));
fractalList->append(sFractalDescription("Imaginary scator Power 2",
"imagsca_power_2",
fastImagscaPower2,
deltaDEType,
logarithmicDEFunction,
cpixelEnabledByDefault,
10));
fractalList->append(sFractalDescription("Imaginary scator Power 2",
"imagsca_power_2",
fastImagscaPower2,
deltaDEType,
logarithmicDEFunction,
cpixelEnabledByDefault,
10));
fractalList->append(sFractalDescription("Collatz fractal",
"collatz",
collatz,
analyticDEType,
logarithmicDEFunction,
cpixelDisabledByDefault,
10));
@@ -111,7 +111,7 @@ enum enumFractalFormula
riemannBulbMsltoeMod2 = 85,
msltoeToroidal = 86,
aboxModKaliEiffie = 87,
collatz = 88,
// 152 to 172 reserved for scator
fastImagscaPower2 = 152,

1 comment on commit 50097e6

@zebastian

This comment has been minimized.

Show comment
Hide comment
@zebastian

zebastian Apr 11, 2016

Collaborator

settings to render the icon:

# Mandelbulber settings file
# version 2.07
# only modified parameters
[main_parameters]
ambient_occlusion_enabled true;
camera -6,039491790866783 -6,039491790866783 -6,118444976306676;
camera_distance_to_target 8,660254037844386;
camera_rotation -44,99999999999995 37,26438968275461 0;
camera_top -0,4281488304515826 -0,4281488304515834 0,7958499594558532;
DE_factor 0,0234375;
flight_last_to_render 0;
formula_1 88;
image_height 256;
image_width 256;
target -1,165926009662985 -1,165926009662984 -0,8747141334278372;
Collaborator

zebastian commented on 50097e6 Apr 11, 2016

settings to render the icon:

# Mandelbulber settings file
# version 2.07
# only modified parameters
[main_parameters]
ambient_occlusion_enabled true;
camera -6,039491790866783 -6,039491790866783 -6,118444976306676;
camera_distance_to_target 8,660254037844386;
camera_rotation -44,99999999999995 37,26438968275461 0;
camera_top -0,4281488304515826 -0,4281488304515834 0,7958499594558532;
DE_factor 0,0234375;
flight_last_to_render 0;
formula_1 88;
image_height 256;
image_width 256;
target -1,165926009662985 -1,165926009662984 -0,8747141334278372;
Please sign in to comment.