Skip to content

Commit 6b45392

Browse files
committed
minor changes and new testing image
1 parent 9f3cdbb commit 6b45392

File tree

4 files changed

+11
-7
lines changed

4 files changed

+11
-7
lines changed

output.png

7.17 MB
Loading

src/bin/main.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,15 +53,15 @@ fn main() {
5353
println!("Zoom: {}", zoom);
5454

5555
let mut renderer = FractalRenderer::new(
56-
1000,
57-
1000,
56+
2000,
57+
2000,
5858
zoom,
5959
iterations.parse::<usize>().unwrap(),
6060
center_re,
6161
center_im,
6262
0.001,
6363
false,
64-
16
64+
32
6565
);
6666

6767
let time = Instant::now();

src/renderer.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ impl FractalRenderer {
120120
println!("{:<14}{:>6} ms", "Iteration", time.elapsed().as_millis());
121121

122122
let time = Instant::now();
123-
Colouring::Iteration.run(&pixel_data, &mut self.image, self.maximum_iteration, delta_pixel);
123+
Colouring::Iteration.run(&pixel_data, &mut self.image, self.maximum_iteration, delta_pixel, &reference);
124124
println!("{:<14}{:>6} ms", "Coloring", time.elapsed().as_millis());
125125

126126
// Remove all non-glitched points from the remaining points
@@ -157,7 +157,7 @@ impl FractalRenderer {
157157

158158
Perturbation::iterate(&mut pixel_data, &r, r.current_iteration);
159159

160-
Colouring::Iteration.run(&pixel_data, &mut self.image, self.maximum_iteration, delta_pixel);
160+
Colouring::Iteration.run(&pixel_data, &mut self.image, self.maximum_iteration, delta_pixel, &r);
161161

162162
// Remove all non-glitched points from the remaining points
163163
pixel_data.retain(|packet| {

src/util/colouring.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
use crate::util::image::Image;
22
use crate::util::PixelData;
3+
use crate::math::Reference;
34

45
pub enum Colouring {
56
Iteration,
@@ -9,7 +10,7 @@ pub enum Colouring {
910
}
1011

1112
impl Colouring {
12-
pub fn run(&self, pixel_data: &Vec<PixelData>, image: &mut Image, maximum_iteration: usize, _delta_pixel: f64) {
13+
pub fn run(&self, pixel_data: &Vec<PixelData>, image: &mut Image, maximum_iteration: usize, _delta_pixel: f64, reference: &Reference) {
1314
// Palette is temporarily here
1415
let mut colours = Vec::new();
1516

@@ -65,8 +66,11 @@ impl Colouring {
6566
} else if pixel.iteration >= maximum_iteration {
6667
(0, 0, 0)
6768
} else {
69+
let z_norm = (reference.data[pixel.iteration - reference.start_iteration].z_fixed + pixel.delta_current.to_float()).norm();
70+
let smooth = 1.0 - (z_norm.ln()).log2();
71+
6872
// 0.1656
69-
let hue = (250.0f64 * pixel.iteration as f64) as usize % 8192;
73+
let hue = (7.0f64 * (pixel.iteration as f64 + smooth) + 8192.0) as usize % 8192;
7074

7175
let colour = colours[hue];
7276

0 commit comments

Comments
 (0)