Skip to content

Commit

Permalink
fixed type error in coords.rs and handled fov_size properly
Browse files Browse the repository at this point in the history
  • Loading branch information
LLO918 committed Sep 11, 2024
1 parent 4c646a2 commit 7d785e7
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/fov.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion src/types/coords.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand Down

0 comments on commit 7d785e7

Please sign in to comment.