mirror of
https://github.com/sigmasternchen/queermandelbrot
synced 2025-03-15 07:58:53 +00:00
feat: Center mandelbrot set
This commit is contained in:
parent
5d77366394
commit
33d976d2ae
1 changed files with 24 additions and 10 deletions
|
@ -113,17 +113,31 @@ fn redraw(ctx: Context2D, canvas_width: Int, canvas_height: Int) {
|
|||
<. int.to_float(canvas_width) /. int.to_float(canvas_height)
|
||||
|
||||
let #(sizing_factor, x_offset, y_offset) = case pad_horizontal {
|
||||
True -> #(
|
||||
int.to_float(canvas_height) /. { max_y -. min_y },
|
||||
min_x,
|
||||
True -> {
|
||||
let scaling = int.to_float(canvas_height) /. { max_y -. min_y }
|
||||
#(
|
||||
scaling,
|
||||
min_x
|
||||
-. {
|
||||
int.to_float(canvas_width) /. scaling -. { max_x -. min_x }
|
||||
}
|
||||
/. 2.0,
|
||||
min_y,
|
||||
)
|
||||
False -> #(
|
||||
int.to_float(canvas_width) /. { max_x -. min_x },
|
||||
}
|
||||
False -> {
|
||||
let scaling = int.to_float(canvas_width) /. { max_x -. min_x }
|
||||
#(
|
||||
scaling,
|
||||
min_x,
|
||||
min_y,
|
||||
min_y
|
||||
-. {
|
||||
int.to_float(canvas_height) /. scaling -. { max_y -. min_y }
|
||||
}
|
||||
/. 2.0,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
let location =
|
||||
Complex(
|
||||
|
|
Loading…
Reference in a new issue