pub struct Offset {
pub sky: (Angle, Angle),
pub frame: Option<(Angle, Angle)>,
pub pixels: Option<(f64, f64)>,
}Expand description
The offset of a matched object relative to the frame centre.
Carried on every Match. frame and pixels are only populated for
rectangular Membership (see Constraint::frame,
Constraint::frame_rotated) — circular membership has no frame axes.
§Example
use skymath::{Angle, Equatorial, ParseMode};
use target_match::{rank, Constraint, Field, Optics, SkyObject};
struct Target {
ra: f64,
dec: f64,
}
impl SkyObject for Target {
fn position(&self) -> Equatorial {
Equatorial::j2000(Angle::from_degrees(self.ra), Angle::from_degrees(self.dec)).unwrap()
}
}
let catalog = [Target { ra: 10.6847, dec: 41.2688 }];
let pointing = Equatorial::parse_j2000("00:42:44.3", "+41:16:09", ParseMode::Strict).unwrap();
let field = Field::from_optics(Optics {
focal_mm: 800.0,
pixel_um: (3.76, 3.76),
binning: (1, 1),
pixels: (6248, 4176),
})
.unwrap();
let hits = rank(pointing, &catalog, Constraint::frame(&field));
let offset = hits[0].offset;
assert!(offset.frame.is_some(), "rectangular membership reports a frame-aligned offset");
assert!(offset.pixels.is_some(), "plate scale from `Optics` fills the pixel offset");Fields§
§sky: (Angle, Angle)Sky-tangent offset (East, North) — always present.
frame: Option<(Angle, Angle)>Frame-aligned offset (x, y), present for rectangular membership.
pixels: Option<(f64, f64)>Frame-aligned offset in pixels (x, y), present when a plate scale is known.
Trait Implementations§
impl Copy for Offset
Source§impl<'de> Deserialize<'de> for Offset
impl<'de> Deserialize<'de> for Offset
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl StructuralPartialEq for Offset
Auto Trait Implementations§
impl Freeze for Offset
impl RefUnwindSafe for Offset
impl Send for Offset
impl Sync for Offset
impl Unpin for Offset
impl UnsafeUnpin for Offset
impl UnwindSafe for Offset
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more