diff --git a/Source/Fractorium/Fractorium.h b/Source/Fractorium/Fractorium.h
index 5cc3856..c47c743 100644
--- a/Source/Fractorium/Fractorium.h
+++ b/Source/Fractorium/Fractorium.h
@@ -233,6 +233,7 @@ public slots:
void OnScaleDownButtonClicked(bool checked);
void OnScaleUpButtonClicked(bool checked);
void OnResetAffineButtonClicked(bool checked);
+ void OnRandomAffineButtonClicked(bool checked);
void OnAffineGroupBoxToggled(bool on);
void OnAffineDrawAllCurrentRadioButtonToggled(bool checked);
diff --git a/Source/Fractorium/Fractorium.ui b/Source/Fractorium/Fractorium.ui
index 70f4cf3..610b9ce 100644
--- a/Source/Fractorium/Fractorium.ui
+++ b/Source/Fractorium/Fractorium.ui
@@ -3513,8 +3513,8 @@
0
0
- 118
- 618
+ 263
+ 700
@@ -3547,13 +3547,13 @@
100
- 270
+ 297
16777215
- 270
+ 297
@@ -3752,6 +3752,32 @@
+ -
+
+
+
+ 0
+ 24
+
+
+
+
+ 16777215
+ 24
+
+
+
+ Move xform x units right
+
+
+
+
+
+
+ :/Fractorium/Icons/arrow_right.png:/Fractorium/Icons/arrow_right.png
+
+
+
-
@@ -3778,8 +3804,8 @@
- -
-
+
-
+
0
@@ -3793,14 +3819,14 @@
- Move xform x units right
+ Move xform x units up
- :/Fractorium/Icons/arrow_right.png:/Fractorium/Icons/arrow_right.png
+ :/Fractorium/Icons/arrow_up.png:/Fractorium/Icons/arrow_up.png
@@ -3857,8 +3883,8 @@
- -
-
+
-
+
0
@@ -3872,19 +3898,19 @@
- Move xform x units up
+ Scale xform x percent up
- :/Fractorium/Icons/arrow_up.png:/Fractorium/Icons/arrow_up.png
+ :/Fractorium/Icons/arrow_out.png:/Fractorium/Icons/arrow_out.png
- -
-
+
-
+
0
@@ -3898,19 +3924,51 @@
- Move xform x units down
+ Scale xform x percent down
- :/Fractorium/Icons/arrow_down.png:/Fractorium/Icons/arrow_down.png
+ :/Fractorium/Icons/arrow_in.png:/Fractorium/Icons/arrow_in.png
- -
-
+
-
+
+
+
+ 0
+ 0
+
+
+
+
+ 0
+ 24
+
+
+
+
+ 16777215
+ 24
+
+
+
+ Flip xform horizontally
+
+
+
+
+
+
+ :/Fractorium/Icons/shape_flip_horizontal.png:/Fractorium/Icons/shape_flip_horizontal.png
+
+
+
+ -
+
0
@@ -3920,30 +3978,31 @@
75
- 23
+ 24
16777215
- 23
+ 24
-
- true
+
+ Reset xform to the identity matrix
-
- true
+
+ Reset
-
-
-
- 1
-
-
- -
-
+
-
+
+
+
+ 0
+ 0
+
+
0
@@ -3957,14 +4016,66 @@
- Move xform x units left
+ Flip xform vertically
- :/Fractorium/Icons/arrow_left.png:/Fractorium/Icons/arrow_left.png
+ :/Fractorium/Icons/shape_flip_vertical.png:/Fractorium/Icons/shape_flip_vertical.png
+
+
+
+ -
+
+
+
+ 0
+ 24
+
+
+
+
+ 16777215
+ 24
+
+
+
+ Rotate xform x degrees clockwise
+
+
+
+
+
+
+ :/Fractorium/Icons/arrow_rotate_clockwise.png:/Fractorium/Icons/arrow_rotate_clockwise.png
+
+
+
+ -
+
+
+
+ 0
+ 24
+
+
+
+
+ 16777215
+ 24
+
+
+
+ Rotate xform x degrees counter clockwise
+
+
+
+
+
+
+ :/Fractorium/Icons/arrow_rotate_anticlockwise.png:/Fractorium/Icons/arrow_rotate_anticlockwise.png
@@ -4042,8 +4153,8 @@
- -
-
+
-
+
0
@@ -4057,77 +4168,19 @@
- Rotate xform x degrees counter clockwise
+ Move xform x units left
- :/Fractorium/Icons/arrow_rotate_anticlockwise.png:/Fractorium/Icons/arrow_rotate_anticlockwise.png
+ :/Fractorium/Icons/arrow_left.png:/Fractorium/Icons/arrow_left.png
- -
-
-
-
- 0
- 24
-
-
-
-
- 16777215
- 24
-
-
-
- Rotate xform x degrees clockwise
-
-
-
-
-
-
- :/Fractorium/Icons/arrow_rotate_clockwise.png:/Fractorium/Icons/arrow_rotate_clockwise.png
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
-
- 0
- 24
-
-
-
-
- 16777215
- 24
-
-
-
- Flip xform vertically
-
-
-
-
-
-
- :/Fractorium/Icons/shape_flip_vertical.png:/Fractorium/Icons/shape_flip_vertical.png
-
-
-
- -
-
+
-
+
0
@@ -4137,6 +4190,33 @@
75
+ 23
+
+
+
+
+ 16777215
+ 23
+
+
+
+ true
+
+
+ true
+
+
-
+
+ 1
+
+
+
+
+ -
+
+
+
+ 0
24
@@ -4147,15 +4227,19 @@
- Reset xform to the identity matrix
+ Move xform x units down
- Reset
+
+
+
+
+ :/Fractorium/Icons/arrow_down.png:/Fractorium/Icons/arrow_down.png
- -
-
+
-
+
0
@@ -4174,67 +4258,8 @@
24
-
- Flip xform horizontally
-
-
-
-
-
- :/Fractorium/Icons/shape_flip_horizontal.png:/Fractorium/Icons/shape_flip_horizontal.png
-
-
-
- -
-
-
-
- 0
- 24
-
-
-
-
- 16777215
- 24
-
-
-
- Scale xform x percent down
-
-
-
-
-
-
- :/Fractorium/Icons/arrow_in.png:/Fractorium/Icons/arrow_in.png
-
-
-
- -
-
-
-
- 0
- 24
-
-
-
-
- 16777215
- 24
-
-
-
- Scale xform x percent up
-
-
-
-
-
-
- :/Fractorium/Icons/arrow_out.png:/Fractorium/Icons/arrow_out.png
+ Random
@@ -4307,13 +4332,13 @@
100
- 270
+ 297
16777215
- 270
+ 297
@@ -4489,8 +4514,8 @@
3
- -
-
+
-
+
true
@@ -4507,19 +4532,19 @@
- Rotate xform 90 degrees counter clockwise
+ Rotate xform x degrees clockwise
- :/Fractorium/Icons/arrow_turn_left.png:/Fractorium/Icons/arrow_turn_left.png
+ :/Fractorium/Icons/arrow_rotate_clockwise.png:/Fractorium/Icons/arrow_rotate_clockwise.png
- -
-
+
-
+
true
@@ -4536,19 +4561,19 @@
- Rotate xform 90 degrees clockwise
+ Rotate xform x degrees counter clockwise
- :/Fractorium/Icons/arrow_turn_right.png:/Fractorium/Icons/arrow_turn_right.png
+ :/Fractorium/Icons/arrow_rotate_anticlockwise.png:/Fractorium/Icons/arrow_rotate_anticlockwise.png
- -
-
+
-
+
true
@@ -4565,75 +4590,19 @@
- Move xform x units right
+ Flip xform horizontally
- :/Fractorium/Icons/arrow_right.png:/Fractorium/Icons/arrow_right.png
+ :/Fractorium/Icons/shape_flip_horizontal.png:/Fractorium/Icons/shape_flip_horizontal.png
- -
-
-
- true
-
-
-
- 0
- 0
-
-
-
-
- 75
- 23
-
-
-
-
- 16777215
- 23
-
-
-
- true
-
-
- true
-
-
-
-
- 110
-
-
- -
-
- 125
-
-
- -
-
- 150
-
-
- -
-
- 175
-
-
- -
-
- 200
-
-
-
-
- -
-
+
-
+
true
@@ -4650,108 +4619,14 @@
- Move xform x units up
+ Flip xform vertically
- :/Fractorium/Icons/arrow_up.png:/Fractorium/Icons/arrow_up.png
-
-
-
- -
-
-
- true
-
-
-
- 0
- 24
-
-
-
-
- 16777215
- 24
-
-
-
- Move xform x units down
-
-
-
-
-
-
- :/Fractorium/Icons/arrow_down.png:/Fractorium/Icons/arrow_down.png
-
-
-
- -
-
-
- true
-
-
-
- 0
- 0
-
-
-
-
- 75
- 23
-
-
-
-
- 16777215
- 23
-
-
-
- true
-
-
- true
-
-
-
-
- 1
-
-
-
-
- -
-
-
- true
-
-
-
- 0
- 24
-
-
-
-
- 16777215
- 24
-
-
-
- Move xform x units left
-
-
-
-
-
-
- :/Fractorium/Icons/arrow_left.png:/Fractorium/Icons/arrow_left.png
+ :/Fractorium/Icons/shape_flip_vertical.png:/Fractorium/Icons/shape_flip_vertical.png
@@ -4832,122 +4707,6 @@
- -
-
-
- true
-
-
-
- 0
- 24
-
-
-
-
- 16777215
- 24
-
-
-
- Rotate xform x degrees counter clockwise
-
-
-
-
-
-
- :/Fractorium/Icons/arrow_rotate_anticlockwise.png:/Fractorium/Icons/arrow_rotate_anticlockwise.png
-
-
-
- -
-
-
- true
-
-
-
- 0
- 24
-
-
-
-
- 16777215
- 24
-
-
-
- Rotate xform x degrees clockwise
-
-
-
-
-
-
- :/Fractorium/Icons/arrow_rotate_clockwise.png:/Fractorium/Icons/arrow_rotate_clockwise.png
-
-
-
- -
-
-
- true
-
-
-
- 0
- 24
-
-
-
-
- 16777215
- 24
-
-
-
- Flip xform horizontally
-
-
-
-
-
-
- :/Fractorium/Icons/shape_flip_horizontal.png:/Fractorium/Icons/shape_flip_horizontal.png
-
-
-
- -
-
-
- true
-
-
-
- 0
- 24
-
-
-
-
- 16777215
- 24
-
-
-
- Flip xform vertically
-
-
-
-
-
-
- :/Fractorium/Icons/shape_flip_vertical.png:/Fractorium/Icons/shape_flip_vertical.png
-
-
-
-
@@ -5037,6 +4796,297 @@
+ -
+
+
+ true
+
+
+
+ 0
+ 24
+
+
+
+
+ 16777215
+ 24
+
+
+
+ Move xform x units left
+
+
+
+
+
+
+ :/Fractorium/Icons/arrow_left.png:/Fractorium/Icons/arrow_left.png
+
+
+
+ -
+
+
+ true
+
+
+
+ 0
+ 0
+
+
+
+
+ 75
+ 23
+
+
+
+
+ 16777215
+ 23
+
+
+
+ true
+
+
+ true
+
+
-
+
+ 1
+
+
+
+
+ -
+
+
+ true
+
+
+
+ 0
+ 24
+
+
+
+
+ 16777215
+ 24
+
+
+
+ Move xform x units right
+
+
+
+
+
+
+ :/Fractorium/Icons/arrow_right.png:/Fractorium/Icons/arrow_right.png
+
+
+
+ -
+
+
+ true
+
+
+
+ 0
+ 24
+
+
+
+
+ 16777215
+ 24
+
+
+
+ Rotate xform 90 degrees clockwise
+
+
+
+
+
+
+ :/Fractorium/Icons/arrow_turn_right.png:/Fractorium/Icons/arrow_turn_right.png
+
+
+
+ -
+
+
+ true
+
+
+
+ 0
+ 24
+
+
+
+
+ 16777215
+ 24
+
+
+
+ Move xform x units up
+
+
+
+
+
+
+ :/Fractorium/Icons/arrow_up.png:/Fractorium/Icons/arrow_up.png
+
+
+
+ -
+
+
+ true
+
+
+
+ 0
+ 24
+
+
+
+
+ 16777215
+ 24
+
+
+
+ Rotate xform 90 degrees counter clockwise
+
+
+
+
+
+
+ :/Fractorium/Icons/arrow_turn_left.png:/Fractorium/Icons/arrow_turn_left.png
+
+
+
+ -
+
+
+ true
+
+
+
+ 0
+ 0
+
+
+
+
+ 75
+ 23
+
+
+
+
+ 16777215
+ 23
+
+
+
+ true
+
+
+ true
+
+
-
+
+ 110
+
+
+ -
+
+ 125
+
+
+ -
+
+ 150
+
+
+ -
+
+ 175
+
+
+ -
+
+ 200
+
+
+
+
+ -
+
+
+ true
+
+
+
+ 0
+ 24
+
+
+
+
+ 16777215
+ 24
+
+
+
+ Move xform x units down
+
+
+
+
+
+
+ :/Fractorium/Icons/arrow_down.png:/Fractorium/Icons/arrow_down.png
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+
+ 0
+ 24
+
+
+
+
+ 16777215
+ 24
+
+
+
+ Random
+
+
+
-
@@ -5531,8 +5581,8 @@
0
0
- 133
- 52
+ 259
+ 652
diff --git a/Source/Fractorium/FractoriumEmberController.h b/Source/Fractorium/FractoriumEmberController.h
index 312f668..d12cf16 100644
--- a/Source/Fractorium/FractoriumEmberController.h
+++ b/Source/Fractorium/FractoriumEmberController.h
@@ -178,6 +178,7 @@ public:
virtual void MoveXforms(double x, double y, bool pre) { }
virtual void ScaleXforms(double scale, bool pre) { }
virtual void ResetXformsAffine(bool pre) { }
+ virtual void RandomXformsAffine(bool pre) { }
virtual void FillBothAffines() { }
double LockedScale() { return m_LockedScale; }
void LockedScale(double scale) { m_LockedScale = scale; }
@@ -424,6 +425,7 @@ public:
virtual void MoveXforms(double x, double y, bool pre) override;
virtual void ScaleXforms(double scale, bool pre) override;
virtual void ResetXformsAffine(bool pre) override;
+ virtual void RandomXformsAffine(bool pre) override;
virtual void FillBothAffines() override;
virtual void LockAffineScaleCheckBoxStateChanged(int state) override;
void FillAffineWithXform(Xform* xform, bool pre);
diff --git a/Source/Fractorium/FractoriumXformsAffine.cpp b/Source/Fractorium/FractoriumXformsAffine.cpp
index 94e8fe6..dcb253d 100644
--- a/Source/Fractorium/FractoriumXformsAffine.cpp
+++ b/Source/Fractorium/FractoriumXformsAffine.cpp
@@ -75,6 +75,7 @@ void Fractorium::InitXformsAffineUI()
connect(ui.PreScaleDownButton, SIGNAL(clicked(bool)), this, SLOT(OnScaleDownButtonClicked(bool)), Qt::QueuedConnection);
connect(ui.PreScaleUpButton, SIGNAL(clicked(bool)), this, SLOT(OnScaleUpButtonClicked(bool)), Qt::QueuedConnection);
connect(ui.PreResetButton, SIGNAL(clicked(bool)), this, SLOT(OnResetAffineButtonClicked(bool)), Qt::QueuedConnection);
+ connect(ui.PreRandomButton, SIGNAL(clicked(bool)), this, SLOT(OnRandomAffineButtonClicked(bool)), Qt::QueuedConnection);
connect(ui.PostFlipHorizontalButton, SIGNAL(clicked(bool)), this, SLOT(OnFlipHorizontalButtonClicked(bool)), Qt::QueuedConnection);
connect(ui.PostFlipVerticalButton, SIGNAL(clicked(bool)), this, SLOT(OnFlipVerticalButtonClicked(bool)), Qt::QueuedConnection);
connect(ui.PostRotate90CcButton, SIGNAL(clicked(bool)), this, SLOT(OnRotate90CcButtonClicked(bool)), Qt::QueuedConnection);
@@ -88,6 +89,7 @@ void Fractorium::InitXformsAffineUI()
connect(ui.PostScaleDownButton, SIGNAL(clicked(bool)), this, SLOT(OnScaleDownButtonClicked(bool)), Qt::QueuedConnection);
connect(ui.PostScaleUpButton, SIGNAL(clicked(bool)), this, SLOT(OnScaleUpButtonClicked(bool)), Qt::QueuedConnection);
connect(ui.PostResetButton, SIGNAL(clicked(bool)), this, SLOT(OnResetAffineButtonClicked(bool)), Qt::QueuedConnection);
+ connect(ui.PostRandomButton, SIGNAL(clicked(bool)), this, SLOT(OnRandomAffineButtonClicked(bool)), Qt::QueuedConnection);
connect(ui.PreAffineGroupBox, SIGNAL(toggled(bool)), this, SLOT(OnAffineGroupBoxToggled(bool)), Qt::QueuedConnection);
connect(ui.PostAffineGroupBox, SIGNAL(toggled(bool)), this, SLOT(OnAffineGroupBoxToggled(bool)), Qt::QueuedConnection);
connect(ui.ShowPreAffineAllRadio, SIGNAL(toggled(bool)), this, SLOT(OnAffineDrawAllCurrentRadioButtonToggled(bool)), Qt::QueuedConnection);
@@ -569,12 +571,30 @@ void FractoriumEmberController::ResetXformsAffine(bool pre)
FillAffineWithXform(CurrentXform(), pre);
}
+void Fractorium::OnResetAffineButtonClicked(bool checked) { m_Controller->ResetXformsAffine(sender() == ui.PreResetButton); }
+
///
-/// Reset pre/post affine to the identity matrix.
-/// Called when reset pre/post affine buttons are clicked.
+/// Randomize all values in selected pre/post affines to a range of -1 to 1.
+/// Called when random pre/post affine buttons are clicked.
/// Resets the rendering process.
///
-void Fractorium::OnResetAffineButtonClicked(bool checked) { m_Controller->ResetXformsAffine(sender() == ui.PreResetButton); }
+template
+void FractoriumEmberController::RandomXformsAffine(bool pre)
+{
+ UpdateXform([&](Xform* xform)
+ {
+ auto affine = pre ? &xform->m_Affine : &xform->m_Post;
+ xform->m_Affine.A(m_Rand.Frand11());
+ xform->m_Affine.B(m_Rand.Frand11());
+ xform->m_Affine.C(m_Rand.Frand11());
+ xform->m_Affine.D(m_Rand.Frand11());
+ xform->m_Affine.E(m_Rand.Frand11());
+ xform->m_Affine.F(m_Rand.Frand11());
+ }, eXformUpdate::UPDATE_SELECTED);
+ FillAffineWithXform(CurrentXform(), pre);
+}
+
+void Fractorium::OnRandomAffineButtonClicked(bool checked) { m_Controller->RandomXformsAffine(sender() == ui.PreRandomButton); }
///
/// Fill the GUI with the pre and post affine xform values.