From 7d785e7b3a5b32591c7227a7683fee64a5ce856d Mon Sep 17 00:00:00 2001 From: Walt Semrau Date: Wed, 11 Sep 2024 15:32:36 -0700 Subject: [PATCH] fixed type error in coords.rs and handled fov_size properly --- src/fov.rs | 4 ++-- src/types/coords.rs | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/fov.rs b/src/fov.rs index dc90a13..8483e37 100644 --- a/src/fov.rs +++ b/src/fov.rs @@ -15,7 +15,7 @@ pub fn get_fov( ra: 180.0_f64.to_radians(), dec: 0.0_f64.to_radians(), }; - let fov_size = fov_w.max(fov_h)/ (4.0 * PI); + let fov_size = fov_w.max(fov_h); let ra_dif = center.ra - view_init_center.ra; let dec_dif = center.dec - view_init_center.dec; // Calculate FOV bounds in cartesian coords @@ -107,7 +107,7 @@ pub fn get_fov( z: transformed[(2, 0)], } .to_equatorial() - .to_grid(fov_size); + .to_grid(fov_size/(4.0*PI)); let next_coord = EquatorialCoords { ra: grid_coord.ra + 1.0, dec: grid_coord.dec, diff --git a/src/types/coords.rs b/src/types/coords.rs index 1bcb6ed..620e81c 100644 --- a/src/types/coords.rs +++ b/src/types/coords.rs @@ -68,7 +68,7 @@ impl EquatorialCoords { } pub fn to_grid(&self, fov_size: f64) -> EquatorialCoords { - let clamped_size = fov_size.clamp(0.02, 1); + let clamped_size = fov_size.clamp(0.02, 1.0); EquatorialCoords { ra: (self.ra / (2.0 * PI) * (1.0 - (2.0 * self.dec.abs() / PI)).powf(0.5) / clamped_size).round(), dec: (self.dec / (2.0 * PI) / clamped_size).round(),