Skip to main content

ReferenceFrame

Trait ReferenceFrame 

Source
pub trait ReferenceFrame:
    Copy
    + Clone
    + Debug {
    // Required method
    fn frame_name() -> &'static str;

    // Provided method
    fn spherical_names() -> Option<(&'static str, &'static str, &'static str)> { ... }
}
Expand description

A trait for defining a reference frame (orientation).

Reference frames define the orientation of coordinate axes. Different frames represent different ways of orienting a coordinate system (e.g., aligned with an equator, an orbital plane, a horizon, etc.).

§Implementing

Implement this trait for zero-sized marker types that represent different frames:

use affn::frames::ReferenceFrame;

#[derive(Debug, Copy, Clone)]
pub struct MyFrame;

impl ReferenceFrame for MyFrame {
    fn frame_name() -> &'static str {
        "MyFrame"
    }
}

Required Methods§

Source

fn frame_name() -> &'static str

Returns the canonical name of this reference frame.

Provided Methods§

Source

fn spherical_names() -> Option<(&'static str, &'static str, &'static str)>

Returns frame-specific names for spherical coordinate components.

When a frame implements SphericalNaming, this returns Some((polar_name, azimuth_name, distance_name)) so that Display impls on [spherical::Direction] and [spherical::Position] can use domain-appropriate axis names (e.g. "dec"/"ra" for ICRS, "alt"/"az" for Horizontal) rather than generic Greek letters.

Returns None for frames that do not implement SphericalNaming.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§