transforms appear to work correctly
This commit is contained in:
10
src/lib.rs
10
src/lib.rs
@@ -24,7 +24,7 @@ pub struct Args {
|
||||
pub transform: Vec<String>
|
||||
}
|
||||
|
||||
pub type Float = f32;
|
||||
pub type Float = f64;
|
||||
pub type Point = Complex<Float>;
|
||||
use num::complex::Complex;
|
||||
pub type Transform = [(Point, Point); 3];
|
||||
@@ -56,7 +56,7 @@ pub struct Config {
|
||||
|
||||
|
||||
impl Config {
|
||||
fn render_point(&self, (base, delta): (Point, Point)) -> f32 {
|
||||
fn render_point(&self, (base, delta): (Point, Point)) -> Float {
|
||||
const ESCAPE: Float = 2.;
|
||||
const ESCAPE2: Float = ESCAPE * ESCAPE;
|
||||
|
||||
@@ -71,7 +71,7 @@ impl Config {
|
||||
|(iter, val)|
|
||||
iter as Float + 1. - val.norm().ln().ln() / ESCAPE.ln()
|
||||
);
|
||||
result as f32
|
||||
result as Float
|
||||
}
|
||||
|
||||
pub fn render_image(&self) -> ImageBuffer<Rgb<u8>, Vec<u8>> {
|
||||
@@ -86,8 +86,8 @@ impl Config {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn map_palette(val: f32) -> image::Rgb<u8> {
|
||||
let magnitude = f32::clamp(val * 255., 0., 255.) as u8;
|
||||
pub fn map_palette(val: Float) -> image::Rgb<u8> {
|
||||
let magnitude = Float::clamp(val * 255., 0., 255.) as u8;
|
||||
image::Rgb([magnitude, magnitude, magnitude])
|
||||
}
|
||||
pub fn main() -> anyhow::Result<()> {
|
||||
|
||||
Reference in New Issue
Block a user